+ALGORITHMS_TEST_TARGET_ELF = $(patsubst %, $(TESTBIN_DIR)main-%-test.elf, $(ALGORITHMS_LC))
+ALGORITHMS_TEST_TARGET_HEX = $(patsubst %, $(TESTBIN_DIR)main-%-test.hex, $(ALGORITHMS_LC))
+
+
+#-------------------------------------------------------------------------------
+
+all: $(foreach algo, $(ALGORITHMS), $(algo)_OBJ)
+
+#-------------------------------------------------------------------------------
+
+define MAIN_OBJ_TEMPLATE
+$(2): $(3) $(4)
+ @echo "[ld] : $$@"
+# echo $$^
+ @$(CC) $(CFLAGS) $(LDFLAGS)$(patsubst %.elf,%.map,$(2)) -o \
+ $(2) \
+ $(3) $(4) \
+ $(LIBS)
+endef
+
+$(foreach algo, $(ALGORITHMS), $(eval $(call MAIN_OBJ_TEMPLATE, \
+ $(algo), \
+ $(TESTBIN_DIR)main-$(call lc,$(algo))-test.elf, \
+ $(patsubst %.o,%.o,$($(algo)_TEST_BIN)), \
+ $(patsubst %.o,%.o,$($(algo)_OBJ)) )))
+
+
+
+
+#-------------------------------------------------------------------------------
+.PHONY: help
+help: info
+
+info:
+ @echo "infos on AVR-Crypto-lib:"
+ @echo " block ciphers:"
+ @echo " $(BLOCK_CIPHERS)"
+ @echo " stream ciphers:"
+ @echo " $(STREAM_CIPHERS)"
+ @echo " hash functions:"
+ @echo " $(HASHES)"
+ @echo " MAC functions:"
+ @echo " $(MACS)"
+ @echo " PRNG functions:"
+ @echo " $(PRNGS)"
+ @echo " encodings:"
+ @echo " $(ENCODINGS)"
+# @echo " ALGORITHMS_TEST_BIN:"
+# @echo " $(ALGORITHMS_TEST_BIN)"
+# @echo " ALGORITHMS_TEST_TARGET_ELF:"
+# @echo " $(ALGORITHMS_TEST_TARGET_ELF)"
+ @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 " xclean - 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"
+
+#-------------------------------------------------------------------------------
+
+
+$(BIN_DIR)%.o: %.c
+ @echo "[gcc]: $@"
+ @$(CC) $(CFLAGS) -c -o $@ $<
+
+$(BIN_DIR)%.o: %.S
+ @echo "[as] : $@"
+ @$(CC) $(ASFLAGS) -c -o $@ $<
+
+$(TESTBIN_DIR)%.o: $(TESTSRC_DIR)%.c
+ @echo "[gcc]: $@"
+ @$(CC) $(CFLAGS) -c -o $@ $<
+
+$(TESTBIN_DIR)%.o: $(TESTSRC_DIR)%.S
+ @echo "[as] : $@"
+ @$(CC) $(ASFLAGS) -c -o $@ $<
+
+$(TESTBIN_DIR)%.o: %.c
+ @echo "[gcc]: $@"
+ @$(CC) $(CFLAGS) -c -o $@ $<
+
+$(TESTBIN_DIR)%.o: %.S
+ @echo "[as] : $@"
+ @$(CC) $(ASFLAGS) -c -o $@ $<
+
+
+
+%.o: %.c
+ @echo "[gcc]: $@"
+ @$(CC) $(CFLAGS) -c -o $@ $<
+
+%.o: %.S
+ @echo "[as] : $@"
+ @$(CC) $(ASFLAGS) -c -o $@ $<
+
+#-------------------------------------------------------------------------------
+
+define OBJ_TEMPLATE
+$(1)_OBJ: $(2)
+# @echo " ALGO: $(1)"
+# @echo " REQ: $(2)"
+endef
+
+$(foreach algo, $(ALGORITHMS), $(eval $(call OBJ_TEMPLATE, $(algo), $($(algo)_OBJ))))
+
+
+#-------------------------------------------------------------------------------
+
+define TESTBIN_TEMPLATE
+$(1)_TEST_BIN: $(2)
+endef
+
+$(foreach algo, $(ALGORITHMS), $(eval $(call TESTBIN_TEMPLATE, $(algo), $($(algo)_TEST_BIN))))
+
+#-------------------------------------------------------------------------------
+
+$(BLOCK_CIPHERS_OBJ): $(patsubst %,%_OBJ, $(BLOCK_CIPHERS))
+$(STREAM_CIPHERS_OBJ): $(patsubst %,%_OBJ, $(STREAM_CIPHERS))
+$(HASHES_OBJ): $(patsubst %,%_OBJ, $(HASHES))
+$(PRNGS_OBJ): $(patsubst %,%_OBJ, $(PRNGS))
+$(MACS_OBJ): $(patsubst %,%_OBJ, $(MACS))
+$(ENCODINGS_OBJ): $(patsubst %,%_OBJ, $(ENCODINGS))
+
+#-------------------------------------------------------------------------------
+
+define SIZE_TEMPLATE
+$(1)_size.txt: $(2)
+ @echo "[size]: $(1)_size.txt"
+ @$(SIZE) $(2) > $(1)_size.txt
+endef
+
+$(foreach algo, $(ALGORITHMS), $(eval $(call SIZE_TEMPLATE, $(STAT_DIR)$(call lc,$(algo)), $($(algo)_OBJ))))
+
+#-------------------------------------------------------------------------------
+
+define FLASH_TEMPLATE
+$(1)_FLASH: $(2)
+ @echo "[flash]: $(2)"
+ @$(FLASHCMD)$(call first,$(2))
+endef
+
+$(foreach algo, $(ALGORITHMS),$(eval $(call FLASH_TEMPLATE, $(algo), $(TESTBIN_DIR)main-$(call lc,$(algo))-test.hex) ))
+
+#-------------------------------------------------------------------------------