summaryrefslogtreecommitdiffstats
path: root/Makefile_opgui
blob: 9a15ef78e1c754f51dcc01a24fb372ebd4910245 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# equivalent to #define in c code
VERSION = 0.12.1
CC = gcc
PREFIX = /usr/local

CFLAGS =  '-DVERSION="$(VERSION)"' `pkg-config --libs --cflags gtk+-3.0` 
CFLAGS += -DOPGUI
CFLAGS += -Os -s #size
#CFLAGS += -O3 -s #speed
#CFLAGS += -g #debug

OBJECTS = opgui.o \
	deviceRW.o \
	progP12.o \
	progP16.o \
	progP18.o \
	progP24.o \
	progEEPROM.o \
	progAVR.o \
	fileIO.o \
	I2CSPI.o \
	coff.o \
	icd.o \
	strings.o \
	resources.o
#	progP32.o \

# Check if we are running on windows
UNAME := $(shell uname)
ifneq (, $(findstring _NT-, $(UNAME)))
	CFLAGS += -mwindows
else
	CFLAGS += -lrt
endif
	

# Targets
all: opgui

opgui : $(OBJECTS)
	$(CC) -o $@ $(OBJECTS) $(CFLAGS)
	rm $(OBJECTS) resources.c

%.o : %.c
	$(CC) $(CFLAGS) -c $<

resources.c: resources.xml opgui.glade
	glib-compile-resources resources.xml --target=resources.c --generate-source

clean:
	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;
	
package:
	@echo "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)
	@rm -rf opgui-$(VERSION)

.PHONY: all clean install package