summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorAttila Veghelyi <works@veghelyiattila.hu>2024-01-03 11:28:50 +0100
committerAttila Veghelyi <works@veghelyiattila.hu>2024-01-03 11:28:50 +0100
commit816b38e07651bfd64acdc53523b92791848ce5f0 (patch)
tree021dce34a7c71050894dfce989a45cc9e63c137a /Makefile
parent426aa30973d25b76931a655381620b27356c909c (diff)
downloadOpenProgrammer-816b38e07651bfd64acdc53523b92791848ce5f0.tar.gz
OpenProgrammer-816b38e07651bfd64acdc53523b92791848ce5f0.zip
Add MAkefile
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile61
1 files changed, 61 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..2abc748
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,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