]> git.cryptolib.org Git - avr-crypto-lib.git/blobdiff - Makefile
optimized cubehash a bit
[avr-crypto-lib.git] / Makefile
index 5a9090ca5dad511115b7313ee006989f87ec9a12..ebc4a6e75e7657b4951b3cfa89bf8529d19c2d42 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,21 @@
 # Makefile for the AVR-Crypto-Lib project
-# author: Daniel Otte
+#
+#    This file is part of the AVR-Crypto-Lib.
+#    Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
+#
+#    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
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
 SHELL = sh
 
 BLOCK_CIPHERS  :=
@@ -8,6 +24,8 @@ HASHES         :=
 MACS           :=
 PRNGS          :=
 ENCODINGS      :=
+SIGNATURE      :=
+PK_CIPHERS     :=
 AUX            :=
 
 # we use the gnu make standard library
@@ -20,7 +38,7 @@ include mkfiles/*.mk
 
 #-------------------------------------------------------------------------------
 ALGORITHMS = $(BLOCK_CIPHERS) $(STREAM_CIPHERS) $(HASHES) $(PRNGS) $(MACS) \
-                        $(ENCODINGS) $(AUX)
+                        $(ENCODINGS) $(SIGNATURE) $(PK_CIPHERS) $(AUX)
 ALGORITHMS_OBJ = $(patsubst %,%_OBJ, $(ALGORITHMS))
 ALGORITHMS_TEST_BIN = $(patsubst %,%_TEST_BIN, $(ALGORITHMS))
 
@@ -149,6 +167,41 @@ $(foreach algo, $(ALGORITHMS), $(eval $(call Flash_Template, \
 
 #-------------------------------------------------------------------------------
 
+define Speed_Template
+$(1)_SPEED:  $(1)_FLASH
+       @$(RUBY) $(SPEEDTOOL) -c $(SPEEDCMD) -t $(SPEEDLOG_DIR) -a $(call lc, $(1))
+endef
+
+$(foreach algo, $(ALGORITHMS), $(eval $(call Speed_Template, \
+    $(algo), $(algo) \
+)))
+
+.PHONY: hash_speed
+hash_speed: $(foreach algo, $(HASHES), $(algo)_SPEED)
+
+.PHONY: blockcipher_speed
+blockcipher_speed: $(foreach algo, $(BLOCK_CIPHERS), $(algo)_SPEED)
+#-------------------------------------------------------------------------------
+
+
+define Size_Template
+$(1)_SIZE:  $(2)
+       @echo "[size] $(1)"
+       $(SIZE) $(2) > $(strip $(SIZE_DIR))$(strip $(call lc, $(1))).size
+endef
+
+$(foreach algo, $(ALGORITHMS), $(eval $(call Size_Template, \
+    $(strip $(algo)), $($(algo)_BINOBJ) \
+)))
+
+.PHONY: hash_size
+hash_size: $(foreach algo, $(HASHES), $(algo)_SIZE)
+
+.PHONY: blockcipher_size
+blockcipher_size: $(foreach algo, $(BLOCK_CIPHERS), $(algo)_SIZE)
+
+#-------------------------------------------------------------------------------
+
 .PHONY: tests
 tests: $(foreach a, $(ALGORITHMS), $(a)_TEST_BIN)
 
@@ -220,28 +273,38 @@ info:
        @echo "    $(MACS)"
        @echo "  PRNG functions:"
        @echo "    $(PRNGS)"
+       @echo "  signature functions:"
+       @echo "    $(SIGNATURE)"
+       @echo "  public key ciphers:"
+       @echo "    $(PK_CIPHERS)"
        @echo "  encodings:"
        @echo "    $(ENCODINGS)"
+       @echo "  auxiliary functions:"
+       @echo "    $(AUX)"
        @echo " targets:"
-       @echo "  all           - all algorithm cores"
-       @echo "  cores         - all algorithm cores"
-       @echo "  listings      - all algorithm core listings"
-       @echo "  tests         - all algorithm test programs"
-       @echo "  stats         - all algorithm size statistics"
-       @echo "  blockciphers  - all blockcipher cores"
-       @echo "  streamciphers - all streamcipher cores"
-       @echo "  hashes        - all hash cores"
-       @echo "  macs          - all MAC cores"
-       @echo "  prngs         - all PRNG cores"
-       @echo "  all_testrun   - testrun all algorithms"
-       @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 "  *_TESTRUN     - run nessie test"
-       @echo "  *_OBJ         - build algorithm core"
-       @echo "  *_FLASH       - flash test program"
-       @echo "  *_LIST        - build assembler listing"
+       @echo "  all                - all algorithm cores"
+       @echo "  cores              - all algorithm cores"
+       @echo "  listings           - all algorithm core listings"
+       @echo "  tests              - all algorithm test programs"
+       @echo "  stats              - all algorithm size statistics"
+       @echo "  blockciphers       - all blockcipher cores"
+       @echo "  streamciphers      - all streamcipher cores"
+       @echo "  hashes             - all hash cores"
+       @echo "  macs               - all MAC cores"
+       @echo "  prngs              - all PRNG cores"
+       @echo "  all_testrun        - testrun all algorithms"
+       @echo "  hash_size          - measure size of all hash functions"
+       @echo "  hash_speed         - measure performance of all hash functions"
+       @echo "  blockcipher_size   - measure size of all blockciphers"
+       @echo "  blockcipher_speed  - measure performance of all blockciphers"
+       @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 "  *_TESTRUN          - run nessie test"
+       @echo "  *_OBJ              - build algorithm core"
+       @echo "  *_FLASH            - flash test program"
+       @echo "  *_LIST             - build assembler listing"
 
 
 #-------------------------------------------------------------------------------
@@ -252,7 +315,7 @@ clean:
 
 .PHONY: depclean
 depclean: clean
-       rm $(DEP_DIR)*.d
+       rm -f $(DEP_DIR)*.d
 
 #-------------------------------------------------------------------------------
 # dependency inclusion