diff options
-rw-r--r-- | Makefile_op | 27 | ||||
-rw-r--r-- | Makefile_opgui | 30 | ||||
-rw-r--r-- | op.c | 7 | ||||
-rw-r--r-- | opgui.c | 5 |
4 files changed, 41 insertions, 28 deletions
diff --git a/Makefile_op b/Makefile_op index 2593383..6d34e67 100644 --- a/Makefile_op +++ b/Makefile_op @@ -16,34 +16,33 @@ OBJECTS = op.o \ I2CSPI.o \ strings.o -UNAME := $(shell uname) -ifneq (, $(findstring _NT-, $(UNAME))) - OPFLAG = -else - OPFLAG = -lrt -endif +LDFLAG = -lrt all: op op : $(OBJECTS) - $(CC) $(CFLAGS) $(OBJECTS) -o op $(OPFLAG) - rm $(OBJECTS) + @echo "\t LD $@" + @$(CC) $(OBJECTS) -o op $(LDFLAG) + @rm $(OBJECTS) %.o : %.c - $(CC) $(CFLAGS) -c $< + @echo "\t CC $@" + @$(CC) $(CFLAGS) -c $< clean: - rm -f op $(OBJECTS) + @echo "\t CLEAN ALL" + @rm -f op $(OBJECTS) prefix := /usr/local install: op - test -d $(prefix) || mkdir $(prefix) - test -d $(prefix)/bin || mkdir $(prefix)/bin - install -m 0755 op $(prefix)/bin; + @echo "\t Installing op" + @test -d $(prefix) || mkdir $(prefix) + @test -d $(prefix)/bin || mkdir $(prefix)/bin + @install -m 0755 op $(prefix)/bin; package: - @echo "Creating op_$(VERSION).tar.gz" + @echo "\t Creating op_$(VERSION).tar.gz" @mkdir op-$(VERSION) @cp *.c *.h gpl-2.0.txt Makefile readme utils/*.c op-$(VERSION) @tar -czf op_$(VERSION).tar.gz op-$(VERSION) diff --git a/Makefile_opgui b/Makefile_opgui index 9a15ef7..7ac6624 100644 --- a/Makefile_opgui +++ b/Makefile_opgui @@ -3,12 +3,14 @@ VERSION = 0.12.1 CC = gcc PREFIX = /usr/local -CFLAGS = '-DVERSION="$(VERSION)"' `pkg-config --libs --cflags gtk+-3.0` +CFLAGS = '-DVERSION="$(VERSION)"' `pkg-config --cflags gtk+-3.0` CFLAGS += -DOPGUI CFLAGS += -Os -s #size #CFLAGS += -O3 -s #speed #CFLAGS += -g #debug +LDLAGS = `pkg-config --libs gtk+-3.0` + OBJECTS = opgui.o \ deviceRW.o \ progP12.o \ @@ -28,9 +30,9 @@ OBJECTS = opgui.o \ # Check if we are running on windows UNAME := $(shell uname) ifneq (, $(findstring _NT-, $(UNAME))) - CFLAGS += -mwindows + LDLAGS += -mwindows else - CFLAGS += -lrt + LDLAGS += -lrt endif @@ -38,27 +40,31 @@ endif all: opgui opgui : $(OBJECTS) - $(CC) -o $@ $(OBJECTS) $(CFLAGS) - rm $(OBJECTS) resources.c + @echo "\t LD $@" + @$(CC) -o $@ $(OBJECTS) $(LDLAGS) + @rm $(OBJECTS) resources.c %.o : %.c - $(CC) $(CFLAGS) -c $< + @echo "\t CC $@" + @$(CC) $(CFLAGS) -c $< resources.c: resources.xml opgui.glade - glib-compile-resources resources.xml --target=resources.c --generate-source + @echo "\t GLIB $@" + @glib-compile-resources resources.xml --target=resources.c --generate-source clean: - rm -f opgui $(OBJECTS) resources.c + @echo "\t CLEAN ALL" + @rm -f opgui $(OBJECTS) resources.c install: all #test -d $(prefix) || mkdir $(prefix) #test -d $(prefix)/bin || mkdir $(prefix)/bin - @echo "Installing opgui" - mkdir -p $(PREFIX)/bin - install -m 0755 opgui $(PREFIX)/bin; + @echo "\t Installing opgui" + @mkdir -p $(PREFIX)/bin + @install -m 0755 opgui $(PREFIX)/bin; package: - @echo "Creating opgui_$(VERSION).tar.gz" + @echo "\t Creating opgui_$(VERSION).tar.gz" @mkdir opgui-$(VERSION) @cp *.c *.h *.png gpl-2.0.txt Makefile readme resources.xml opgui.glade style.css opgui-$(VERSION) @tar -czf opgui_$(VERSION).tar.gz opgui-$(VERSION) @@ -27,9 +27,7 @@ #include "fileIO.h" #include "progAVR.h" - #if !defined _WIN32 && !defined __CYGWIN__ -DWORD GetTickCount(); #include <sys/select.h> int kbhit() { @@ -888,9 +886,14 @@ void msDelay(double delay) /// /// Get system time DWORD GetTickCount(){ + struct timeval tv; + gettimeofday(&tv, NULL); + return tv.tv_sec*1000+tv.tv_usec/1000; +/* struct timeb now; ftime(&now); return now.time*1000+now.millitm; +*/ } #endif @@ -1538,9 +1538,14 @@ void msDelay(double delay) /// /// Get system time DWORD GetTickCount(){ + struct timeval tv; + gettimeofday(&tv, NULL); + return tv.tv_sec*1000+tv.tv_usec/1000; +/* struct timeb now; ftime(&now); return now.time*1000+now.millitm; +*/ } #endif |