From 68ae38729f271d88024dd642057fb33899e8816b Mon Sep 17 00:00:00 2001 From: David Monniaux Date: Tue, 5 Feb 2019 17:54:19 +0100 Subject: regular Makefiles --- test/monniaux/bitsliced-aes/Makefile | 70 ++++++++++++++++++------------ test/monniaux/bitsliced-aes/Makefile.ccomp | 40 ----------------- test/monniaux/bitsliced-aes/main.c | 2 + 3 files changed, 45 insertions(+), 67 deletions(-) delete mode 100644 test/monniaux/bitsliced-aes/Makefile.ccomp (limited to 'test/monniaux/bitsliced-aes') diff --git a/test/monniaux/bitsliced-aes/Makefile b/test/monniaux/bitsliced-aes/Makefile index 65de1e2e..1c32801a 100644 --- a/test/monniaux/bitsliced-aes/Makefile +++ b/test/monniaux/bitsliced-aes/Makefile @@ -1,40 +1,56 @@ -src = $(wildcard *.c) -obj = $(src:.c=.o) +src = $(wildcard *.c) tests/tests.c -CC=k1-mbr-gcc -LDFLAGS = -Wl,--gc-sections -CFLAGS = -O3 -fdata-sections -ffunction-sections # -DUNROLL_TRANSPOSE -name = bitslice +CCOMP=ccomp +CCOMPFLAGS=-O3 -Wall +K1C_CC=k1-mbr-gcc +K1C_CFLAGS = -std=c99 -O3 -Wall -Wextra -Werror=implicit +K1C_CCOMP = ../../../ccomp +K1C_CCOMPFLAGS=-O3 -Wall -%.s : %.c - $(CC) $(CFLAGS) -S -o $@ $< +%.host.gcc.o : %.c + $(CC) $(CFLAGS) -c -o $@ $< -test: _test $(obj) - $(CC) $(LDFLAGS) -o $(name) $(obj) ../clock.o $(LDFLAGS) +%.host.ccomp.o : %.c + $(CCOMP) $(CCOMPFLAGS) -c -o $@ $< -$(name): _testbench $(obj) - $(CC) $(LDFLAGS) -o $@ $(obj) $(LDFLAGS) +%.gcc.k1c.s: %.c + $(K1C_CC) $(K1C_CFLAGS) -S $< -o $@ -footprint: _footprint $(obj) - $(CC) $(LDFLAGS) -o $(name) $(obj) $(LDFLAGS) +%.gcc.k1c.o: %.gcc.k1c.s + $(K1C_CC) $(K1C_CFLAGS) -c $< -o $@ +%.ccomp.k1c.s: %.c + $(K1C_CCOMP) $(K1C_CCOMPFLAGS) -S $< -o $@ -_test: tests/tests.c - $(eval obj+=$@.o) - $(eval CFLAGS+= -DRUN_TESTS=1) - $(CC) -c $(CFLAGS) -o $@.o $^ +%.ccomp.k1c.o: %.ccomp.k1c.s + $(K1C_CCOMP) $(K1C_CCOMPFLAGS) -c $< -o $@ -_footprint: tests/tests.c - $(eval obj+=$@.o) - $(eval CFLAGS+= -DRUN_TESTS=1 -DTEST_FOOTPRINT=1) - $(CC) -c $(CFLAGS) -o $@.o $^ +%.gcc.host.o: %.c + $(CC) $(CFLAGS) -c $< -o $@ -_testbench: testbench/app.c - $(eval obj+=_testbench.o) - $(eval LDFLAGS+= -lcrypto) - $(CC) -c $(CFLAGS) -o $@.o $^ +%.ccomp.host.o: %.c + $(CCOMP) $(CCOMPFLAGS) -c $< -o $@ +%.k1c.out : %.k1c + k1-cluster --cycle-based -- $< |tee $@ + +%.host.out : %.host + ./$< |tee $@ + +all: test.gcc.k1c.out test.ccomp.k1c.out test.gcc.host.out test.ccomp.host.out + +test.gcc.k1c: $(src:.c=.gcc.k1c.o) ../clock.gcc.k1c.o + $(K1C_CC) $(K1C_CFLAGS) -o $@ $+ + +test.ccomp.k1c: $(src:.c=.ccomp.k1c.o) ../clock.gcc.k1c.o + $(K1C_CCOMP) $(K1C_CCOMPFLAGS) -o $@ $+ + +test.gcc.host: $(src:.c=.gcc.host.o) ../clock.gcc.host.o + $(CC) $(CFLAGS) -o $@ $+ + +test.ccomp.host: $(src:.c=.ccomp.host.o) ../clock.gcc.host.o + $(CCOMP) $(CCOMPFLAGS) -o $@ $+ clean: - rm -f $(obj) _test.o _footprint.o _testbench.o $(name) + rm -f *.o *.k1c *.host */*.o *.s */*.s *.out diff --git a/test/monniaux/bitsliced-aes/Makefile.ccomp b/test/monniaux/bitsliced-aes/Makefile.ccomp deleted file mode 100644 index beb0ad39..00000000 --- a/test/monniaux/bitsliced-aes/Makefile.ccomp +++ /dev/null @@ -1,40 +0,0 @@ -src = $(wildcard *.c) -obj = $(src:.c=.o) - -LDFLAGS = -Wl,--gc-sections -CFLAGS = -O3 -D_DEFAULT_SOURCE # -DUNROLL_TRANSPOSE -# CC=ccomp -CC=../../../ccomp -name = bitslice - -%.s : %.c - $(CC) $(CFLAGS) -S -o $@ $< - -test: _test $(obj) - $(CC) $(LDFLAGS) -o $(name) $(obj) ../clock.o $(LDFLAGS) - -$(name): _testbench $(obj) - $(CC) $(LDFLAGS) -o $@ $(obj) $(LDFLAGS) - -footprint: _footprint $(obj) - $(CC) $(LDFLAGS) -o $(name) $(obj) $(LDFLAGS) - - -_test: tests/tests.c - $(eval obj+=$@.o) - $(eval CFLAGS+= -DRUN_TESTS=1) - $(CC) -c $(CFLAGS) -o $@.o $^ - -_footprint: tests/tests.c - $(eval obj+=$@.o) - $(eval CFLAGS+= -DRUN_TESTS=1 -DTEST_FOOTPRINT=1) - $(CC) -c $(CFLAGS) -o $@.o $^ - -_testbench: testbench/app.c - $(eval obj+=_testbench.o) - $(eval LDFLAGS+= -lcrypto) - $(CC) -c $(CFLAGS) -o $@.o $^ - - -clean: - rm -f $(obj) _test.o _footprint.o _testbench.o $(name) diff --git a/test/monniaux/bitsliced-aes/main.c b/test/monniaux/bitsliced-aes/main.c index 96d545ae..83588872 100644 --- a/test/monniaux/bitsliced-aes/main.c +++ b/test/monniaux/bitsliced-aes/main.c @@ -6,6 +6,8 @@ #include "utils.h" #include "../clock.h" +#define RUN_TESTS + #include "testbench/app.h" #ifdef RUN_TESTS #include "tests/tests.h" -- cgit