]> git.cryptolib.org Git - avr-crypto-lib.git/blobdiff - Makefile_main.inc
switching uart header file
[avr-crypto-lib.git] / Makefile_main.inc
index 9ace98f9bbb3f410e43b4e1baad428daecb0e1c7..7402b9d91ef90eca41c8086600a8a02e33650d67 100644 (file)
@@ -1,7 +1,7 @@
 # Makefile for the AVR-Crypto-Lib project
 #
 #    This file is part of the AVR-Crypto-Lib.
-#    Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
+#    Copyright (C) 2006-2015 Daniel Otte (bg@nerilex.org)
 #
 #    This program is free software: you can redistribute it and/or modify
 #    it under the terms of the GNU General Public License as published by
@@ -18,6 +18,7 @@
 
 BLOCK_CIPHERS  :=
 STREAM_CIPHERS :=
+AEAD_CIPHERS   :=
 HASHES         :=
 MACS           :=
 PRNGS          :=
@@ -36,9 +37,11 @@ GLOBAL_INCDIR := ./ $(TESTSRC_DIR)
 # inclusion of make stubs
 include $(sort $(wildcard mkfiles/*.mk))
 
+default: info
+
 #-------------------------------------------------------------------------------
-ALGORITHMS = $(BLOCK_CIPHERS) $(STREAM_CIPHERS) $(HASHES) $(PRNGS) $(MACS) \
-                        $(ENCODINGS) $(SIGNATURE) $(PK_CIPHERS) $(AUX)
+ALGORITHMS = $(BLOCK_CIPHERS) $(STREAM_CIPHERS) $(AEAD_CIPHERS) $(HASHES) \
+              $(PRNGS) $(MACS) $(ENCODINGS) $(SIGNATURE) $(PK_CIPHERS) $(AUX)
 ALGORITHMS_OBJ = $(patsubst %,%_OBJ, $(ALGORITHMS))
 ALGORITHMS_TESTBIN = $(patsubst %,%_TESTBIN, $(ALGORITHMS))
 
@@ -62,21 +65,32 @@ $(foreach a, $(ALGORITHMS), $(eval $(call Assert_Template, \
 
 #-------------------------------------------------------------------------------
 
+define GenericTarget_Template
+$(1): $(2)
+endef
 
-
+ifeq ($(V),)
 define TargetSource_Template
 $(1): $(2)
        @mkdir -p  $(dir $(1)) $(DEP_DIR)
        @echo "[cc]: $(1) <-- $(2)"
        @$(CC) $(CFLAGS_A) $(addprefix -I./,$(3)) $(addprefix -D, $(4)) -c -o $(1) $(2)
 endef
+else
+define TargetSource_Template
+$(1): $(2)
+       @mkdir -p  $(dir $(1)) $(DEP_DIR)
+       @echo "[cc]: $(1) <-- $(2)"
+       $(CC) $(CFLAGS_A) $(addprefix -I./,$(3)) $(addprefix -D, $(4)) -c -o $(1) $(2)
+endef
+endif
 
 
 
 define TargetSourceList_Template
 $(1): $(2)
        @mkdir -p $(dir $(1)) $(DEP_DIR)
-       @echo "[cc]: $(1) <-- $(2)"
+       @echo "[lst]: $(1) <-- $(2)"
        @$(CC) $(CFLAGS_A) $(addprefix -I./,$(3)) $(addprefix -D, $(4)) $(LIST_OPT) -c -o /dev/null $(2) > $(1)
 endef
 
@@ -173,7 +187,7 @@ $(1):
        @mkdir -p $(1)
 endef
 
-$(foreach d, DEP_DIR BIN_DIR TESTSRC_DIR TESTLOG_DIR SPEEDLOG_DIR SIZE_DIR LIST_DIR STAT_DIR AUTOASM_DIR, $(eval $(call MakeDir_TEMPLATE, \
+$(foreach d, DEP_DIR BIN_DIR TESTSRC_DIR TESTLOG_DIR SPEEDLOG_DIR SIZE_DIR LIST_DIR STAT_DIR, $(eval $(call MakeDir_TEMPLATE, \
    $($(d)) \
 )))
 
@@ -187,7 +201,7 @@ endef
 
 $(foreach algo, $(ALGORITHMS), $(eval $(call TestBin_TEMPLATE, \
     $(algo), \
-    $(BIN_DIR)$(call lc, $(algo))/$(TEST_DIR)main-$(call lc, $(algo))-test.elf \
+    $(BIN_DIR)$(call lc, $(algo))/$(TEST_DIR)main-$(call lc, $(algo))-test.hex \
 )))
 
 #-------------------------------------------------------------------------------
@@ -206,6 +220,12 @@ $(foreach algo, $(ALGORITHMS), $(eval $(call Listing_TEMPLATE, \
 %.hex: %.elf
        @echo "[objcopy]: $@"
        @$(OBJCOPY) -j .text -j .data -O ihex $< $@
+ifdef HASH_TOOL
+ifneq ($(HASH_TOOL),)
+       @echo -n "[$(HASH_TOOL)]: "
+       @$(HASH_TOOL) $@
+endif
+endif
 
 #-------------------------------------------------------------------------------
 
@@ -238,15 +258,26 @@ hash_speed: $(foreach algo, $(HASHES), $(algo)_SPEED)
 blockcipher_speed: $(foreach algo, $(BLOCK_CIPHERS), $(algo)_SPEED)
 #-------------------------------------------------------------------------------
 
+define Size_Template
+$(1):  $(2)
+       @echo "[size] $(3)"
+       @mkdir -p $(dir $(1))
+       @$(SIZE) $(2) > $(1)
+endef
+
+$(foreach algo, $(ALGORITHMS), $(eval $(call Size_Template, \
+    $(strip $(SIZE_DIR))$(strip $(call lc, $(algo))).size,$($(algo)_BINOBJ),$(algo) \
+)))
 
 define Size_Template
 $(1)_SIZE:  $(2)
        @echo "[size] $(1)"
-       $(SIZE) $(2) > $(strip $(SIZE_DIR))$(strip $(call lc, $(1))).size
+       @mkdir -p $(dir $(strip $(SIZE_DIR))$(strip $(call lc, $(1))).size)
+       @$(SIZE) $(2) > $(strip $(SIZE_DIR))$(strip $(call lc, $(1))).size
 endef
 
-$(foreach algo, $(ALGORITHMS), $(eval $(call Size_Template, \
-    $(strip $(algo)), $($(algo)_BINOBJ) \
+$(foreach algo, $(ALGORITHMS), $(eval $(call GenericTarget_Template, \
+    $(strip $(algo))_SIZE,$(strip $(SIZE_DIR))$(strip $(call lc, $(algo))).size \
 )))
 
 .PHONY: hash_size
@@ -255,6 +286,13 @@ hash_size: $(foreach algo, $(HASHES), $(algo)_SIZE)
 .PHONY: blockcipher_size
 blockcipher_size: $(foreach algo, $(BLOCK_CIPHERS), $(algo)_SIZE)
 
+.PHONY: size
+size: $(foreach algo, $(ALGORITHMS), $(algo)_SIZE)
+
+.PHONY: size_clean
+size_clean:
+       rm -vf $(strip $(SIZE_DIR))*.size
+
 #-------------------------------------------------------------------------------
 
 .PHONY: tests
@@ -333,6 +371,8 @@ info:
        @echo "    $(BLOCK_CIPHERS)"
        @echo "  stream ciphers:"
        @echo "    $(STREAM_CIPHERS)"
+       @echo "  AEAD ciphers:"
+       @echo "    $(AEAD_CIPHERS)"
        @echo "  hash functions:"
        @echo "    $(HASHES)"
        @echo "  MAC functions:"
@@ -352,7 +392,7 @@ info:
        @echo "  cores              - all algorithm cores"
        @echo "  listings           - all algorithm core listings"
        @echo "  tests              - all algorithm test programs"
-       @echo "  stats              - all algorithm size statistics"
+       @echo "  size               - all algorithm size statistics"
        @echo "  blockciphers       - all blockcipher cores"
        @echo "  streamciphers      - all streamcipher cores"
        @echo "  hashes             - all hash cores"