From e048ac1e57d345b12b4019447ddfddfdd3dc52fc Mon Sep 17 00:00:00 2001 From: bg Date: Thu, 3 Jul 2008 12:14:14 +0000 Subject: [PATCH] modyfied build process --- Makefile | 64 ++++++++---------------- avr-makefile.inc | 6 ++- arcfour.mk => mkfiles/arcfour.mk | 0 camellia.mk => mkfiles/camellia.mk | 0 cast5.mk => mkfiles/cast5.mk | 0 des.mk => mkfiles/des.mk | 0 entropium.mk => mkfiles/entropium.mk | 0 grain.mk => mkfiles/grain.mk | 0 hmac-sha256.mk => mkfiles/hmac-sha256.mk | 0 md5.mk => mkfiles/md5.mk | 0 mkfiles/mickey128.mk | 12 +++++ noekeon.mk => mkfiles/noekeon.mk | 0 present.mk => mkfiles/present.mk | 0 rc5.mk => mkfiles/rc5.mk | 0 rc6.mk => mkfiles/rc6.mk | 0 seed.mk => mkfiles/seed.mk | 0 serpent.mk => mkfiles/serpent.mk | 0 sha1.mk => mkfiles/sha1.mk | 0 sha256.mk => mkfiles/sha256.mk | 0 shabea.mk => mkfiles/shabea.mk | 0 shacal1enc.mk => mkfiles/shacal1enc.mk | 0 shacal2enc.mk => mkfiles/shacal2enc.mk | 0 skipjack.mk => mkfiles/skipjack.mk | 0 tdes.mk => mkfiles/tdes.mk | 0 trivium.mk => mkfiles/trivium.mk | 0 xtea.mk => mkfiles/xtea.mk | 0 26 files changed, 38 insertions(+), 44 deletions(-) rename arcfour.mk => mkfiles/arcfour.mk (100%) rename camellia.mk => mkfiles/camellia.mk (100%) rename cast5.mk => mkfiles/cast5.mk (100%) rename des.mk => mkfiles/des.mk (100%) rename entropium.mk => mkfiles/entropium.mk (100%) rename grain.mk => mkfiles/grain.mk (100%) rename hmac-sha256.mk => mkfiles/hmac-sha256.mk (100%) rename md5.mk => mkfiles/md5.mk (100%) create mode 100644 mkfiles/mickey128.mk rename noekeon.mk => mkfiles/noekeon.mk (100%) rename present.mk => mkfiles/present.mk (100%) rename rc5.mk => mkfiles/rc5.mk (100%) rename rc6.mk => mkfiles/rc6.mk (100%) rename seed.mk => mkfiles/seed.mk (100%) rename serpent.mk => mkfiles/serpent.mk (100%) rename sha1.mk => mkfiles/sha1.mk (100%) rename sha256.mk => mkfiles/sha256.mk (100%) rename shabea.mk => mkfiles/shabea.mk (100%) rename shacal1enc.mk => mkfiles/shacal1enc.mk (100%) rename shacal2enc.mk => mkfiles/shacal2enc.mk (100%) rename skipjack.mk => mkfiles/skipjack.mk (100%) rename tdes.mk => mkfiles/tdes.mk (100%) rename trivium.mk => mkfiles/trivium.mk (100%) rename xtea.mk => mkfiles/xtea.mk (100%) diff --git a/Makefile b/Makefile index c8a52b7..e725133 100644 --- a/Makefile +++ b/Makefile @@ -10,15 +10,19 @@ PRNGS := # we use the gnu make standard library include gmsl include avr-makefile.inc -include *.mk +include mkfiles/*.mk ALGORITHMS = $(BLOCK_CIPHERS) $(STREAM_CIPHERS) $(HASHES) $(PRNGS) $(MACS) ALGORITHMS_OBJ = $(patsubst %,%_OBJ, $(ALGORITHMS)) -ALGORITHMS_OBJ_IMM = $(foreach a, $(ALGORITHMS_OBJ), $($(a))) +define OBJinBINDIR_TEMPLATE +$(1) = $(2) +endef +$(foreach a, $(ALGORITHMS_OBJ), $(eval $(call OBJinBINDIR_TEMPLATE, $(a), $(patsubst %.o,$(BIN_DIR)%.o,$($(a)))))) ALGORITHMS_TEST_BIN = $(patsubst %,%_TEST_BIN, $(ALGORITHMS)) +$(foreach a, $(ALGORITHMS_TEST_BIN), $(eval $(call OBJinBINDIR_TEMPLATE, $(a), $(patsubst %.o,$(BIN_DIR)%.o,$($(a)))))) ALGORITHMS_TEST_BIN_MAIN = $(foreach a, $(ALGORITHMS_TEST_BIN), $(firstword $($(a)))) -ALGORITHMS_TEST_BIN_MAIN_ELF = $(patsubst %.o, %.elf, $(ALGORITHMS_TEST_BIN_MAIN)) -ALGORITHMS_TEST_BIN_MAIN_HEX = $(patsubst %.o, %.hex, $(ALGORITHMS_TEST_BIN_MAIN)) +ALGORITHMS_TEST_BIN_MAIN_ELF = $(patsubst $(BIN_DIR)%.o, $(TESTBIN_DIR)%.elf, $(ALGORITHMS_TEST_BIN_MAIN)) +ALGORITHMS_TEST_BIN_MAIN_HEX = $(patsubst $(BIN_DIR)%.o, $(TESTBIN_DIR)%.hex, $(ALGORITHMS_TEST_BIN_MAIN)) ALGORITHMS_TEST_BIN_IMM = $(foreach a, $(ALGORITHMS_TEST_BIN), $($(a))) ALGORITHMS_NESSIE_TEST = $(patsubst %,%_NESSIE_TEST, $(ALGORITHMS)) @@ -26,7 +30,6 @@ ALGORITHMS_PERFORMANCE_TEST = $(patsubst %,%_PERORMANCE_TEST, $(ALGORITHMS)) ALGORITHMS_LC = $(call lc,$(ALGORITHMS)) -PRG = remove_me #------------------------------------------------------------------------------- @@ -44,7 +47,7 @@ $(2): $(3) $(LIBS) endef -$(foreach algo, $(ALGORITHMS), $(eval $(call BLA_TEMPLATE2, $(algo), $(patsubst %.o,%.elf,$(firstword $($(algo)_TEST_BIN))), $($(algo)_TEST_BIN) ))) +$(foreach algo, $(ALGORITHMS), $(eval $(call BLA_TEMPLATE2, $(algo), $(patsubst $(BIN_DIR)%.o,$(TESTBIN_DIR)%.elf,$(firstword $($(algo)_TEST_BIN))), $(patsubst %.o,%.o,$($(algo)_TEST_BIN)) ))) #------------------------------------------------------------------------------- @@ -61,22 +64,18 @@ info: @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) + +$(BIN_DIR)%.o: %.c + @echo "[gcc]: $@" + @$(CC) $(CFLAGS) -c -o $@ $< + +$(BIN_DIR)%.o: %.S + @echo "[as] : $@" + @$(CC) $(ASFLAGS) -c -o $@ $< %.o: %.c @echo "[gcc]: $@" - @$(CC) $(CFLAGS) -c -o $@ $< + @$(CC) $(CFLAGS) -c -o $@ $< %.o: %.S @echo "[as] : $@" @@ -107,7 +106,6 @@ tests: $(ALGORITHMS_TEST_BIN) \ .PHONY: stats stats: $(SIZESTAT_FILE) -#$(patsubst %, %_size.txt, $(ALGORITHMS_LC)) $(SIZESTAT_FILE): $(patsubst %, %_size.txt, $(ALGORITHMS_LC)) @@ -158,28 +156,20 @@ $(foreach algo, $(ALGORITHMS),$(eval $(call FLASH_TEMPLATE, $(algo), \ .PHONY: clean clean: - rm -rf *.o *.elf *.eps *.png *.pdf *.bak *_size.txt + rm -rf $(BIN_DIR)*.o *.o $(TESTBIN_DIR)*.elf $(TESTBIN_DIR)* *.elf *.eps *.png *.pdf *.bak *_size.txt rm -rf *.lst *.map $(EXTRA_CLEAN_FILES) $(SIZESTAT_FILE) xclean: clean - rm -rf *.d + rm -rf $(DEP_DIR)*.d flash: $(ERASECMD) $(FLASHCMD) - -lst: $(PRG).lst %.lst: %.elf $(OBJDUMP) -h -S $< > $@ # Rules for building the .text rom images -text: hex bin srec - -hex: $(PRG).hex -bin: $(PRG).bin -srec: $(PRG).srec - %.hex: %.elf $(OBJCOPY) -j .text -j .data -O ihex $< $@ @@ -191,11 +181,6 @@ srec: $(PRG).srec # Rules for building the .eeprom rom images -eeprom: ehex ebin esrec - -ehex: $(PRG)_eeprom.hex -ebin: $(PRG)_eeprom.bin -esrec: $(PRG)_eeprom.srec %_eeprom.hex: %.elf $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O ihex $< $@ @@ -213,12 +198,6 @@ esrec: $(PRG)_eeprom.srec FIG2DEV = fig2dev EXTRA_CLEAN_FILES = *.hex *.bin *.srec -dox: eps png pdf - -eps: $(PRG).eps -png: $(PRG).png -pdf: $(PRG).pdf - %.eps: %.fig $(FIG2DEV) -L eps $< $@ @@ -230,7 +209,8 @@ pdf: $(PRG).pdf $(FIG2DEV) -L png $< $@ -DEPS := $(wildcard *.d) +DEPS := $(wildcard $(DEP_DIR)*.d) + ifneq ($(DEPS),) include $(DEPS) endif diff --git a/avr-makefile.inc b/avr-makefile.inc index 0fe9e4f..f0ea6c8 100644 --- a/avr-makefile.inc +++ b/avr-makefile.inc @@ -4,13 +4,15 @@ MCU_TARGET = atmega644 OPTIMIZE = -Os DEFS = -D$(call uc, $(MCU_TARGET)) FLASHCMD = avrdude -p $(MCU_TARGET) -P /dev/ttyUSB0 -c avr911 -U flash:w:# no space at the end - +DEP_DIR = deps/ +BIN_DIR = bin/ +TESTBIN_DIR = test_bin/ #uisp -dprog=bsd -dlpt=/dev/parport1 --upload if=$(PRG).hex ERASECMD = CC = avr-gcc -override CFLAGS = -MMD -pedantic -std=c99 -Wall -Wstrict-prototypes $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS) +override CFLAGS = -MMD -MF$(DEP_DIR)$(patsubst %.c,%.d,$^) -pedantic -std=c99 -Wall -Wstrict-prototypes $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS) override LDFLAGS = -Wl,-Map, override ASFLAGS = -mmcu=$(MCU_TARGET) diff --git a/arcfour.mk b/mkfiles/arcfour.mk similarity index 100% rename from arcfour.mk rename to mkfiles/arcfour.mk diff --git a/camellia.mk b/mkfiles/camellia.mk similarity index 100% rename from camellia.mk rename to mkfiles/camellia.mk diff --git a/cast5.mk b/mkfiles/cast5.mk similarity index 100% rename from cast5.mk rename to mkfiles/cast5.mk diff --git a/des.mk b/mkfiles/des.mk similarity index 100% rename from des.mk rename to mkfiles/des.mk diff --git a/entropium.mk b/mkfiles/entropium.mk similarity index 100% rename from entropium.mk rename to mkfiles/entropium.mk diff --git a/grain.mk b/mkfiles/grain.mk similarity index 100% rename from grain.mk rename to mkfiles/grain.mk diff --git a/hmac-sha256.mk b/mkfiles/hmac-sha256.mk similarity index 100% rename from hmac-sha256.mk rename to mkfiles/hmac-sha256.mk diff --git a/md5.mk b/mkfiles/md5.mk similarity index 100% rename from md5.mk rename to mkfiles/md5.mk diff --git a/mkfiles/mickey128.mk b/mkfiles/mickey128.mk new file mode 100644 index 0000000..3cb7a42 --- /dev/null +++ b/mkfiles/mickey128.mk @@ -0,0 +1,12 @@ +# Makefile for Mickey128 +ALGO_NAME := MICKEY128 + +# comment out the following line for removement of Mickey128 from the build process +STREAM_CIPHERS += $(ALGO_NAME) + +$(ALGO_NAME)_OBJ := mickey128.o +$(ALGO_NAME)_TEST_BIN := main-mickey128-test.o debug.o uart.o serial-tools.o \ + nessie_stream_test.o nessie_common.o mickey128.o cli.o +$(ALGO_NAME)_NESSIE_TEST := "nessie" +$(ALGO_NAME)_PEROFRMANCE_TEST := "performance" + diff --git a/noekeon.mk b/mkfiles/noekeon.mk similarity index 100% rename from noekeon.mk rename to mkfiles/noekeon.mk diff --git a/present.mk b/mkfiles/present.mk similarity index 100% rename from present.mk rename to mkfiles/present.mk diff --git a/rc5.mk b/mkfiles/rc5.mk similarity index 100% rename from rc5.mk rename to mkfiles/rc5.mk diff --git a/rc6.mk b/mkfiles/rc6.mk similarity index 100% rename from rc6.mk rename to mkfiles/rc6.mk diff --git a/seed.mk b/mkfiles/seed.mk similarity index 100% rename from seed.mk rename to mkfiles/seed.mk diff --git a/serpent.mk b/mkfiles/serpent.mk similarity index 100% rename from serpent.mk rename to mkfiles/serpent.mk diff --git a/sha1.mk b/mkfiles/sha1.mk similarity index 100% rename from sha1.mk rename to mkfiles/sha1.mk diff --git a/sha256.mk b/mkfiles/sha256.mk similarity index 100% rename from sha256.mk rename to mkfiles/sha256.mk diff --git a/shabea.mk b/mkfiles/shabea.mk similarity index 100% rename from shabea.mk rename to mkfiles/shabea.mk diff --git a/shacal1enc.mk b/mkfiles/shacal1enc.mk similarity index 100% rename from shacal1enc.mk rename to mkfiles/shacal1enc.mk diff --git a/shacal2enc.mk b/mkfiles/shacal2enc.mk similarity index 100% rename from shacal2enc.mk rename to mkfiles/shacal2enc.mk diff --git a/skipjack.mk b/mkfiles/skipjack.mk similarity index 100% rename from skipjack.mk rename to mkfiles/skipjack.mk diff --git a/tdes.mk b/mkfiles/tdes.mk similarity index 100% rename from tdes.mk rename to mkfiles/tdes.mk diff --git a/trivium.mk b/mkfiles/trivium.mk similarity index 100% rename from trivium.mk rename to mkfiles/trivium.mk diff --git a/xtea.mk b/mkfiles/xtea.mk similarity index 100% rename from xtea.mk rename to mkfiles/xtea.mk -- 2.39.5