summaryrefslogtreecommitdiff
path: root/xpp/utils/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'xpp/utils/Makefile')
-rw-r--r--xpp/utils/Makefile37
1 files changed, 37 insertions, 0 deletions
diff --git a/xpp/utils/Makefile b/xpp/utils/Makefile
new file mode 100644
index 0000000..021647c
--- /dev/null
+++ b/xpp/utils/Makefile
@@ -0,0 +1,37 @@
+TEST_CPP = 1
+PEDANTIC = -ansi -pedantic
+
+CC = gcc
+RANLIB = ranlib
+
+ifeq (1,${TEST_CPP})
+CXXFLAGS = $(CFLAGS)
+EXTRA_CFLAGS = -x c++
+EXTRA_LIBS = -lstdc++
+LDLIBS += $(EXTRA_LIBS)
+endif
+
+CFLAGS = -g -Wall $(EXTRA_CFLAGS)
+
+TARGETS = libhexfile.a fpga_load test_parse
+
+all: $(TARGETS)
+
+libhexfile.a: hexfile.o
+ $(AR) cru $@ $^
+ $(RANLIB) $@
+
+fpga_load: fpga_load.o libhexfile.a
+ $(CC) -L. -o $@ $@.o $(EXTRA_LIBS) -lhexfile -lusb
+
+hexfile.o: hexfile.c hexfile.h
+ $(CC) $(CFLAGS) $(PEDANTIC) -c $*.c
+
+test_parse.o: test_parse.c hexfile.h
+ $(CC) $(CFLAGS) $(PEDANTIC) -c $*.c
+
+test_parse: test_parse.o libhexfile.a
+ $(CC) -L. -o $@ $@.o $(EXTRA_LIBS) -lhexfile -lusb
+
+clean:
+ $(RM) *.o $(TARGETS)