-.PHONY: info
-info:
- @echo "infos on micro-crypt:"
- @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 " LC functions:"
- @echo " $(ALGORITHMS_LC)"
-
-# echo $(ALGORITHMS_TEST_BIN_MAIN)
-# echo $(ALGORITHMS)
-# echo $(firstword $(XTEA_TEST_BIN))
-# echo $(patsubst %.o,%.elf,$(firstword $(XTEA_TEST_BIN)))
-# echo $(ALGORITHMS_OBJ)
-# echo $(ALGORITHMS_OBJ_IMM)
-# echo $(ALGORITHMS_TEST_BIN)
-# echo $(ALGORITHMS_NESSIE_TEST)
-# echo $(ALGORITHMS_PERFORMANCE_TEST)
-
-%.o: %.c
- @echo "[gcc]: $@"
- @$(CC) $(CFLAGS) -c -o $@ $<
-
-%.o: %.S
- @echo "[as] : $@"
- @$(CC) $(ASFLAGS) -c -o $@ $<
+$(foreach a, $(ALGORITHMS), \
+ $(foreach b, $($(a)_OBJ), \
+ $(eval $(call TargetSource_Template, \
+ $(BIN_DIR)$(call lc, $(a))/$(b), \
+ $(filter %.S %.c, $(wildcard $($(a)_DIR)$(notdir $(patsubst %.o,%,$(b))).*)), \
+ $($(a)_DIR) \
+ )) \
+ ) \
+)
+
+$(foreach a, $(ALGORITHMS), \
+ $(foreach b, $($(a)_TEST_BIN), \
+ $(eval $(call TargetSource_Template, \
+ $(BIN_DIR)$(call lc, $(a))/$(TEST_DIR)$(b), \
+ $(if $(call sne,$(strip $(filter %.S %.c, $(wildcard $(TESTSRC_DIR)$(notdir $(patsubst %.o,%,$(b))).*))),), \
+ $(filter %.S %.c, $(wildcard $(TESTSRC_DIR)$(notdir $(patsubst %.o,%,$(b))).*)), \
+ $(filter %.S %.c, $(wildcard ./$(notdir $(patsubst %.o,%,$(b))).*))\
+ ), \
+ $($(a)_DIR) \
+ )) \
+ ) \
+)
+#-------------------------------------------------------------------------------
+
+define MainTestElf_Template
+$(1): $(2) $(3)
+ @echo "[ld]: $(1)"
+ @$(CC) $(CFLAGS_A) $(LDFLAGS)$(patsubst %.elf,%.map,$(1)) -o \
+ $(1) \
+ $(2) $(3) \
+ $(LIBS)
+endef