]> git.cryptolib.org Git - arm-crypto-lib.git/blobdiff - Makefile
adding trivium
[arm-crypto-lib.git] / Makefile
index 8ed3e1ade1e4b03fa0ba8f31d6af4d1112c4d15e..b98015985816bb362960a3dd9768fe77d8ceef7f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -70,7 +70,7 @@ define TargetSource_Template
 $(1): $(2)
        @echo "[cc]: $(1) <-- $(2)"
        @mkdir -p $(dir $(1))
-       @$(CC) $(CFLAGS_A) -I./$(strip $(3)) -c -o $(1) $(2)
+       @$(CC) $(CFLAGS_A) $(addprefix -I./,$(3)) $(addprefix -D, $(4)) -c -o $(1) $(2)
 endef
 
 # ----------------------------------------------------------------------------
@@ -92,8 +92,9 @@ $(foreach a, $(ALGORITHMS), \
   $(foreach b, $($(a)_OBJ), \
     $(eval $(call TargetSource_Template, \
       $(BIN_DIR)$(call lc, $(a))/$(b), \
-       $(call find_source_file, $(b), $($(a)_DIR) $($(a)_INCDIR) $(GLOBAL_INCDIR) ),\
-      $($(a)_DIR) \
+      $(call find_source_file, $(b), $($(a)_DIR) $($(a)_INCDIR) $(GLOBAL_INCDIR) ),\
+      $($(a)_DIR) $($(a)_INCDIR) $(GLOBAL_INCDIR), \
+      $($(a)_DEF) \
     )) \
   ) \
 )
@@ -102,8 +103,9 @@ $(foreach a, $(ALGORITHMS), \
   $(foreach b, $($(a)_TEST_BIN), \
     $(eval $(call TargetSource_Template, \
       $(BIN_DIR)$(call lc, $(a))/$(TEST_DIR)$(b), \
-       $(call find_source_file, $(b), $($(a)_DIR) $($(a)_INCDIR) $(GLOBAL_INCDIR) ),\
-      $($(a)_DIR) \
+      $(call find_source_file, $(b), $($(a)_DIR) $($(a)_INCDIR) $(GLOBAL_INCDIR) ),\
+      $($(a)_DIR) $($(a)_INCDIR) $(GLOBAL_INCDIR), \
+      $($(a)_DEF) \
     )) \
   ) \
 )
@@ -134,7 +136,7 @@ all: $(foreach algo, $(ALGORITHMS), $($(algo)_BINOBJ))
 #-------------------------------------------------------------------------------
 
 define TestBin_TEMPLATE
-$(1)_TEST_BIN: $(2)
+$(1)_TESTBIN: $(2)
 endef
 
 $(foreach algo, $(ALGORITHMS), $(eval $(call TestBin_TEMPLATE, \
@@ -144,6 +146,10 @@ $(foreach algo, $(ALGORITHMS), $(eval $(call TestBin_TEMPLATE, \
 
 #-------------------------------------------------------------------------------
 
+%.bin: %.elf
+       @echo "[objcopy]: $@"
+       @$(OBJCOPY) -O binary $< $@
+       
 %.hex: %.elf
        @echo "[objcopy]: $@"
        @$(OBJCOPY) -j .text -j .data -O ihex $< $@
@@ -153,12 +159,12 @@ $(foreach algo, $(ALGORITHMS), $(eval $(call TestBin_TEMPLATE, \
 define Flash_Template
 $(1)_FLASH: $(2)
        @echo "[flash]: $(2)"
-       @$(FLASHCMD)$(call first,$(2))
+       @$(call FLASHCMD, $(call first,$(2)))
 endef
 
 $(foreach algo, $(ALGORITHMS), $(eval $(call Flash_Template, \
     $(algo), \
-    $(BIN_DIR)$(call lc, $(algo))/$(TEST_DIR)main-$(call lc, $(algo))-test.hex \
+    $(BIN_DIR)$(call lc, $(algo))/$(TEST_DIR)main-$(call lc, $(algo))-test.bin \
 )))
 
 #-------------------------------------------------------------------------------
@@ -258,7 +264,7 @@ aux: $(foreach algo, $(AUX), $(algo)_OBJ)
 help: info
 .PHONY: info
 info:
-       @echo "infos on AVR-Crypto-lib:"
+       @echo "infos on ARM-Crypto-lib:"
        @echo "  block ciphers:"
        @echo "    $(BLOCK_CIPHERS)"
        @echo "  stream ciphers:"
@@ -296,7 +302,7 @@ info:
        @echo "  docu               - build doxygen documentation"
        @echo "  clean              - remove a lot of builded files"
        @echo "  depclean           - also remove dependency files"
-       @echo "  *_TEST_BIN         - build test program"
+       @echo "  *_TESTBIN          - build test program"
        @echo "  *_TESTRUN          - run nessie test"
        @echo "  *_OBJ              - build algorithm core"
        @echo "  *_FLASH            - flash test program"