Skip to content

Commit

Permalink
Use a pattern rule for various tests in Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
joostrijneveld committed Mar 21, 2019
1 parent d5afb1a commit 6914969
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,28 +71,19 @@ $(DEST)/%.bin: elf/%.elf
mkdir -p $(DEST)
$(OBJCOPY) -Obinary $^ $@

elf/crypto_$(TYPE)_$(SCHEME)_$(IMPLEMENTATION)_testvectors.elf: $(COMMONSOURCES_M4) crypto_$(TYPE)/$(SCHEME)/$(IMPLEMENTATION)/*.c $(OPENCM3FILE) common/stm32f4_wrapper.c
mkdir -p elf
$(CC) -o $@ $(CFLAGS) \
crypto_$(TYPE)/testvectors.c $(COMMONSOURCES_M4) crypto_$(TYPE)/$(SCHEME)/$(IMPLEMENTATION)/*.c common/stm32f4_wrapper.c \
-Icrypto_$(TYPE)/$(SCHEME)/$(IMPLEMENTATION) $(COMMONINCLUDES_M4) $(LDFLAGS)

elf/crypto_$(TYPE)_$(SCHEME)_$(IMPLEMENTATION)_speed.elf: $(COMMONSOURCES_M4) $(RANDOMBYTES_M4) crypto_$(TYPE)/$(SCHEME)/$(IMPLEMENTATION)/*.c $(OPENCM3FILE) common/stm32f4_wrapper.c
# pattern rules, intended to match % to the type of test (i.e. test, speed, stack)
# note that this excludes testvectors, as that is a special case that provides its own randombytes
# TODO use notrandombytes more generically rather than included in testvectors.c
elf/crypto_$(TYPE)_$(SCHEME)_$(IMPLEMENTATION)_%.elf: $(COMMONSOURCES_M4) $(RANDOMBYTES_M4) crypto_$(TYPE)/$(SCHEME)/$(IMPLEMENTATION)/*.c $(OPENCM3FILE) common/stm32f4_wrapper.c
mkdir -p elf
$(CC) -o $@ $(CFLAGS) \
crypto_$(TYPE)/speed.c $(COMMONSOURCES_M4) $(RANDOMBYTES_M4) crypto_$(TYPE)/$(SCHEME)/$(IMPLEMENTATION)/*.c common/stm32f4_wrapper.c \
crypto_$(TYPE)/$*.c $(COMMONSOURCES_M4) $(RANDOMBYTES_M4) crypto_$(TYPE)/$(SCHEME)/$(IMPLEMENTATION)/*.c common/stm32f4_wrapper.c \
-Icrypto_$(TYPE)/$(SCHEME)/$(IMPLEMENTATION) $(COMMONINCLUDES_M4) $(LDFLAGS)

elf/crypto_$(TYPE)_$(SCHEME)_$(IMPLEMENTATION)_stack.elf: $(COMMONSOURCES_M4) $(RANDOMBYTES_M4) crypto_$(TYPE)/$(SCHEME)/$(IMPLEMENTATION)/*.c $(OPENCM3FILE) common/stm32f4_wrapper.c
mkdir -p elf
$(CC) -o $@ $(CFLAGS) \
crypto_$(TYPE)/stack.c $(COMMONSOURCES_M4) $(RANDOMBYTES_M4) crypto_$(TYPE)/$(SCHEME)/$(IMPLEMENTATION)/*.c common/stm32f4_wrapper.c \
-Icrypto_$(TYPE)/$(SCHEME)/$(IMPLEMENTATION) $(COMMONINCLUDES_M4) $(LDFLAGS)

elf/crypto_$(TYPE)_$(SCHEME)_$(IMPLEMENTATION)_test.elf: $(COMMONSOURCES_M4) $(RANDOMBYTES_M4) crypto_$(TYPE)/$(SCHEME)/$(IMPLEMENTATION)/*.c $(OPENCM3FILE) common/stm32f4_wrapper.c
elf/crypto_$(TYPE)_$(SCHEME)_$(IMPLEMENTATION)_testvectors.elf: $(COMMONSOURCES_M4) crypto_$(TYPE)/$(SCHEME)/$(IMPLEMENTATION)/*.c $(OPENCM3FILE) common/stm32f4_wrapper.c
mkdir -p elf
$(CC) -o $@ $(CFLAGS) \
crypto_$(TYPE)/test.c $(COMMONSOURCES_M4) $(RANDOMBYTES_M4) crypto_$(TYPE)/$(SCHEME)/$(IMPLEMENTATION)/*.c common/stm32f4_wrapper.c \
crypto_$(TYPE)/testvectors.c $(COMMONSOURCES_M4) crypto_$(TYPE)/$(SCHEME)/$(IMPLEMENTATION)/*.c common/stm32f4_wrapper.c \
-Icrypto_$(TYPE)/$(SCHEME)/$(IMPLEMENTATION) $(COMMONINCLUDES_M4) $(LDFLAGS)

$(OPENCM3FILE):
Expand Down

0 comments on commit 6914969

Please sign in to comment.