summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 2abc7483a5dcd39be8bde789b1c14fd8f34ecf53 (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
OP_PROGRAM		:= op
OPGUI_PROGRAM	:= opgui

VERSION = 0.12.1

CFLAGS := '-DVERSION="$(VERSION)"'
CFLAGS += -Os -s #size
CFLAGSGUI := -DOPGUI `pkg-config --cflags gtk+-3.0`

OBJECTS := \
		progP12.o \
		progP16.o \
		progP18.o \
		progP24.o \
		progEEPROM.o \
		progAVR.o \
		fileIO.o \
		deviceRW.o \
		I2CSPI.o \
		strings.o \

OP_OBJ := \
		op.o \

OPGUI_OBJ := \
		opgui.o \
		coff.o \
		icd.o \
		resources.o \

LDFLAGS 	:= -lrt
LDFLAGSGTK 	:= `pkg-config --libs gtk+-3.0`

all: $(OP_PROGRAM) $(OPGUI_PROGRAM)

# https://stackoverflow.com/a/1305879

$(OPGUI_PROGRAM): EXTRA_FLAGS := $(CFLAGSGUI)

%.o: %.c
	@echo "\tCC $@"
	$(CC) $(CFLAGS) $(EXTRA_FLAGS) -c $^ -o $@

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

$(OPGUI_PROGRAM): $(OBJECTS) $(OPGUI_OBJ)
	@echo "\tLD $@"
	$(CC) $^ -o $@ $(LDFLAGS) $(LDFLAGSGTK)
	@rm -f *.o resources.c

$(OP_PROGRAM): $(OBJECTS) $(OP_OBJ)
	@echo "\tLD $@"
	$(CC) $^ -o $@ $(LDFLAGS)
	@rm -f *.o

clean:
	@echo "\tCLEAN .o"
	@rm -f *.o

.PHONY: all clean