aboutsummaryrefslogtreecommitdiff
path: root/projects/libhal-test/Makefile
diff options
context:
space:
mode:
authorPaul Selkirk <paul@psgd.org>2016-04-11 14:44:44 -0400
committerPaul Selkirk <paul@psgd.org>2016-04-11 14:44:44 -0400
commit79b1ba7104dba52dbfacf11a07305702889f440b (patch)
tree75a08fdc6e3af427e953f319b3fdb0f9dcfdf80e /projects/libhal-test/Makefile
parentd5669dac8c7ab2fbf6bd3c7faed7ce050c94ee1a (diff)
Reorganize Makefile and directory structure, because it's messy, and it's about to get messier.
Diffstat (limited to 'projects/libhal-test/Makefile')
-rw-r--r--projects/libhal-test/Makefile33
1 files changed, 33 insertions, 0 deletions
diff --git a/projects/libhal-test/Makefile b/projects/libhal-test/Makefile
new file mode 100644
index 0000000..b0def35
--- /dev/null
+++ b/projects/libhal-test/Makefile
@@ -0,0 +1,33 @@
+TEST = cores test-bus test-trng test-hash test-aes-key-wrap test-pbkdf2 test-ecdsa test-rsa
+#TEST += test-rpc_hash test-rpc_pkey test-rpc_get_version test-rpc_get_random
+TEST += test-rpc_server
+
+CFLAGS += -I $(LIBHAL_DIR)
+LIBC_OBJS = printf.o gettimeofday.o
+LIBS += $(LIBHAL_DIR)/libhal.a $(LIBTFM_DIR)/libtfm.a
+
+all: $(TEST:=.elf)
+
+vpath %.c $(LIBHAL_DIR)/tests $(LIBHAL_DIR)/utils
+
+# .mo extension for files with main() that need to be wrapped as __main()
+%.mo: %.c
+ $(CC) -c $(CFLAGS) -Dmain=__main -o $@ $<
+
+%.elf: %.mo main.o $(BOARD_OBJS) $(LIBC_OBJS) $(LIBS)
+ $(CC) $(CFLAGS) $^ -o $*.elf -T$(LDSCRIPT) -g -Wl,-Map=$*.map
+ $(OBJCOPY) -O ihex $*.elf $*.hex
+ $(OBJCOPY) -O binary $*.elf $*.bin
+ $(OBJDUMP) -St $*.elf >$*.lst
+ $(SIZE) $*.elf
+
+# don't automatically delete objects, to avoid a lot of unnecessary rebuilding
+.SECONDARY: $(BOARD_OBJS) $(LIBC_OBJS)
+
+clean:
+ rm -f *.o *.mo
+ rm -f *.elf
+ rm -f *.hex
+ rm -f *.bin
+ rm -f *.map
+ rm -f *.lst