summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorAttila Veghelyi <works@veghelyiattila.hu>2025-06-24 22:25:26 +0200
committerAttila Veghelyi <works@veghelyiattila.hu>2025-06-24 22:29:04 +0200
commitb8fae6e2fa3908faa31105fb5a9cd5bb29bb7755 (patch)
treea514928cc001dc5d0ddcacdd8c6bd7fe4d8bd4fc /Makefile
parenta047db1259d3822b554d300ecc48fb2052bfc849 (diff)
downloadOpenProgrammer-b8fae6e2fa3908faa31105fb5a9cd5bb29bb7755.tar.gz
OpenProgrammer-b8fae6e2fa3908faa31105fb5a9cd5bb29bb7755.zip
Add compiler scriptHEADmaster
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile67
1 files changed, 67 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..fd64f01
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,67 @@
+OP_PROGRAM := op
+OPGUI_PROGRAM := opgui
+
+VERSION = 0.12.4
+
+CFLAGS := '-DVERSION="$(VERSION)"'
+CFLAGS += -Os -s #size
+CFLAGSGUI := -DOPGUI `pkg-config --cflags gtk+-3.0`
+
+SOURCES := \
+ common_functions.c \
+ progP12.c \
+ progP16.c \
+ progP18.c \
+ progP24.c \
+ progEEPROM.c \
+ progAVR.c \
+ fileIO.c \
+ deviceRW.c \
+ I2CSPI.c \
+ strings.c
+
+OP_SOURCES := \
+ op.c
+
+OPGUI_SOURCES := \
+ opgui.c \
+ coff.c \
+ icd.c \
+ resources.c
+
+OBJECTS := $(addsuffix .o, $(basename $(SOURCES)))
+
+OP_OBJ := $(OBJECTS) $(OP_SOURCES:.c=.o)
+
+OPGUI_OBJ := $(OBJECTS) $(OPGUI_SOURCES:.c=.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
+ @echo "\tGLIB $@"
+ @glib-compile-resources resources.xml --target=resources.c --generate-source
+
+$(OPGUI_PROGRAM): $(OPGUI_OBJ)
+ @echo "\tLD $@"
+ @$(CC) $^ -o $@ $(LDFLAGS) $(LDFLAGSGTK)
+
+$(OP_PROGRAM): $(OP_OBJ)
+ @echo "\tLD $@"
+ @$(CC) $^ -o $@ $(LDFLAGS)
+
+clean:
+ @echo "\tCLEAN .o"
+ @rm -f *.o
+
+.PHONY: all clean