From c5ce41e18c1cf9f2213a37825137aba5a38365a6 Mon Sep 17 00:00:00 2001 From: David Monniaux Date: Tue, 5 Feb 2019 19:05:09 +0100 Subject: simplification des Makefile --- test/monniaux/bitsliced-aes/Makefile | 39 +------------------------------- test/monniaux/bitsliced-tea/Makefile | 32 +------------------------- test/monniaux/crypto-algorithms/Makefile | 25 +------------------- test/monniaux/glibc_qsort/Makefile | 28 +++++------------------ test/monniaux/heapsort/Makefile | 25 +++++--------------- test/monniaux/idea/Makefile | 32 +------------------------- test/monniaux/micro-bunzip/Makefile | 36 +++++++++++++++++------------ test/monniaux/rules.mk | 37 ++++++++++++++++++++++++++++++ 8 files changed, 75 insertions(+), 179 deletions(-) create mode 100644 test/monniaux/rules.mk (limited to 'test/monniaux') diff --git a/test/monniaux/bitsliced-aes/Makefile b/test/monniaux/bitsliced-aes/Makefile index 7020469c..e79c0ab3 100644 --- a/test/monniaux/bitsliced-aes/Makefile +++ b/test/monniaux/bitsliced-aes/Makefile @@ -1,43 +1,6 @@ src = $(wildcard *.c) tests/tests.c - -CCOMP=ccomp -CCOMPFLAGS=-O3 -Wall -CFLAGS= -std=c99 -O3 -Wall -Wextra -Werror=implicit -K1C_CC=k1-mbr-gcc -K1C_CFLAGS = -std=c99 -O3 -Wall -Wextra -Werror=implicit -K1C_CCOMP = ../../../ccomp -K1C_CCOMPFLAGS=-O3 -Wall - -%.host.gcc.o : %.c - $(CC) $(CFLAGS) -c -o $@ $< - -%.host.ccomp.o : %.c - $(CCOMP) $(CCOMPFLAGS) -c -o $@ $< - -%.gcc.k1c.s: %.c - $(K1C_CC) $(K1C_CFLAGS) -S $< -o $@ - -%.gcc.k1c.o: %.gcc.k1c.s - $(K1C_CC) $(K1C_CFLAGS) -c $< -o $@ - -%.ccomp.k1c.s: %.c - $(K1C_CCOMP) $(K1C_CCOMPFLAGS) -S $< -o $@ - -%.ccomp.k1c.o: %.ccomp.k1c.s - $(K1C_CCOMP) $(K1C_CCOMPFLAGS) -c $< -o $@ - -%.gcc.host.o: %.c - $(CC) $(CFLAGS) -c $< -o $@ - -%.ccomp.host.o: %.c - $(CCOMP) $(CCOMPFLAGS) -c $< -o $@ - -%.k1c.out : %.k1c - k1-cluster --cycle-based -- $< |tee $@ - -%.host.out : %.host - ./$< |tee $@ +include ../rules.mk all: test.gcc.k1c.out test.ccomp.k1c.out test.gcc.host.out test.ccomp.host.out diff --git a/test/monniaux/bitsliced-tea/Makefile b/test/monniaux/bitsliced-tea/Makefile index 6f886c64..4751a280 100644 --- a/test/monniaux/bitsliced-tea/Makefile +++ b/test/monniaux/bitsliced-tea/Makefile @@ -1,33 +1,9 @@ -CFLAGS=-Wall -O3 -CCOMP=ccomp -CCOMPFLAGS=-Wall -O3 -K1C_CC=k1-mbr-gcc -K1C_CFLAGS=-Wall -O3 -std=c99 -K1C_CCOMP=../../../ccomp -K1C_CCOMPFLAGS=-Wall -O3 +include ../rules.mk PRODUCTS=bstea.gcc.host.out bstea.ccomp.host.out bstea.gcc.k1c.out bstea.ccomp.k1c.out bstea.ccomp.k1c.s bstea.gcc.k1c.s bstea.gcc.k1c bstea.ccomp.k1c bstea.gcc.host bstea.ccomp.host all: $(PRODUCTS) -%.gcc.k1c.s: %.c - $(K1C_CC) $(K1C_CFLAGS) -S $< -o $@ - -%.gcc.k1c.o: %.gcc.k1c.s - $(K1C_CC) $(K1C_CFLAGS) -c $< -o $@ - -%.ccomp.k1c.s: %.c - $(K1C_CCOMP) $(K1C_CCOMPFLAGS) -S $< -o $@ - -%.ccomp.k1c.o: %.ccomp.k1c.s - $(K1C_CCOMP) $(K1C_CCOMPFLAGS) -c $< -o $@ - -%.gcc.gcc.o: %.c - $(CC) $(CFLAGS) -c $< -o $@ - -%.ccomp.k1c.o: %.c - $(CCOMP) $(CCOMPFLAGS) -c $< -o $@ - bstea.gcc.host: bstea.c bstea_run.c bstea.h ../clock.o $(CC) $(CFLAGS) bstea.c bstea_run.c ../clock.o -o $@ @@ -42,12 +18,6 @@ bstea.gcc.k1c: bstea.gcc.k1c.o bstea_run.gcc.k1c.o ../clock.gcc.k1c.o bstea.ccomp.k1c: bstea.ccomp.k1c.o bstea_run.gcc.k1c.o ../clock.gcc.k1c.o $(K1C_CCOMP) $(K1C_CCOMPFLAGS) $+ -o $@ -%.k1c.out: %.k1c - k1-cluster --cycle-based -- $< | tee $@ - -%.host.out: %.host - ./$< | tee $@ - clean: $(RM) -f *.k1c *.host *.out *.o *.s diff --git a/test/monniaux/crypto-algorithms/Makefile b/test/monniaux/crypto-algorithms/Makefile index 54b22e37..41daba38 100644 --- a/test/monniaux/crypto-algorithms/Makefile +++ b/test/monniaux/crypto-algorithms/Makefile @@ -1,9 +1,4 @@ -CFLAGS=-Wall -O3 -K1C_CC=k1-mbr-gcc -K1C_CFLAGS=-Wall -O3 -K1C_CCOMP=../../../ccomp -K1C_CCOMPFLAGS=-Wall -O3 - +include ../rules.mk all: md2.all md5.all sha1.all sha256.all blowfish.all des.all k1c: md2_test.ccomp.k1c md5_test.ccomp.k1c sha1_test.ccomp.k1c sha256_test.ccomp.k1c blowfish_test.ccomp.k1c des_test.ccomp.k1c @@ -19,21 +14,6 @@ des.all: des_test.ccomp.k1c.out des_test.gcc.k1c.out base64.all: base64_test.ccomp.k1c.out base64_test.gcc.k1c.out aes.all : aes_test.ccomp.k1c.out aes_test.gcc.k1c.out -%.gcc.k1c.s: %.c - $(K1C_CC) $(K1C_CFLAGS) -S $< -o $@ - -%.gcc.k1c.o: %.gcc.k1c.s - $(K1C_CC) $(K1C_CFLAGS) -c $< -o $@ - -%.ccomp.k1c.s: %.c - $(K1C_CCOMP) $(K1C_CCOMPFLAGS) -S $< -o $@ - -%.ccomp.k1c.o: %.ccomp.k1c.s - $(K1C_CCOMP) $(K1C_CCOMPFLAGS) -c $< -o $@ - -%_test.host: %.c %_test.c %.h - $(CC) $(CFLAGS) $*.c $*_test.c -o $@ - %.gcc.k1c.s %.ccomp.k1c.s %_test.gcc.k1c.s: %.h %_test.gcc.k1c: %.gcc.k1c.o %_test.gcc.k1c.o @@ -42,9 +22,6 @@ aes.all : aes_test.ccomp.k1c.out aes_test.gcc.k1c.out %_test.ccomp.k1c: %.ccomp.k1c.o %_test.gcc.k1c.o $(K1C_CCOMP) $(K1C_CCOMPFLAGS) $+ -o $@ -%.k1c.out: %.k1c - k1-cluster --cycle-based -- $< | tee $@ - clean: $(RM) -f *.s *.o *.out *.k1c *.host diff --git a/test/monniaux/glibc_qsort/Makefile b/test/monniaux/glibc_qsort/Makefile index 2ef30ccf..26cee51d 100644 --- a/test/monniaux/glibc_qsort/Makefile +++ b/test/monniaux/glibc_qsort/Makefile @@ -1,27 +1,14 @@ -CFLAGS=-Wall -O3 -K1C_CC=k1-mbr-gcc -K1C_CFLAGS=-Wall -O3 -pedantic -std=c99 -K1C_CCOMP=../../../ccomp -K1C_CCOMPFLAGS=-Wall -O3 +include ../rules.mk -PRODUCTS=glibc_qsort.host glibc_qsort.gcc.k1c.out glibc_qsort.ccomp.k1c.out glibc_qsort.ccomp.k1c.s glibc_qsort.gcc.k1c.s glibc_qsort.gcc.k1c glibc_qsort.ccomp.k1c +PRODUCTS=glibc_qsort.gcc.host.out glibc_qsort.ccomp.host.out glibc_qsort.gcc.k1c.out glibc_qsort.ccomp.k1c.out glibc_qsort.ccomp.k1c.s glibc_qsort.gcc.k1c.s glibc_qsort.gcc.k1c glibc_qsort.ccomp.k1c all: $(PRODUCTS) -%.gcc.k1c.s: %.c - $(K1C_CC) $(K1C_CFLAGS) -S $< -o $@ +glibc_qsort.gcc.host: glibc_qsort.c glibc_qsort_run.gcc.host.o glibc_qsort.h + $(CC) $(CFLAGS) glibc_qsort.c glibc_qsort_run.gcc.host.o -o $@ -%.gcc.k1c.o: %.gcc.k1c.s - $(K1C_CC) $(K1C_CFLAGS) -c $< -o $@ - -%.ccomp.k1c.s: %.c - $(K1C_CCOMP) $(K1C_CCOMPFLAGS) -S $< -o $@ - -%.ccomp.k1c.o: %.ccomp.k1c.s - $(K1C_CCOMP) $(K1C_CCOMPFLAGS) -c $< -o $@ - -glibc_qsort.host: glibc_qsort.c glibc_qsort_run.c glibc_qsort.h - $(CC) $(CFLAGS) glibc_qsort.c glibc_qsort_run.c -o $@ +glibc_qsort.ccomp.host: glibc_qsort.c glibc_qsort_run.gcc.host.o glibc_qsort.h + $(CCOMP) $(CCOMPFLAGS) glibc_qsort.c glibc_qsort_run.gcc.host.o -o $@ glibc_qsort.gcc.k1c.s glibc_qsort.ccomp.k1c.s glibc_qsort_run.gcc.k1c.s: glibc_qsort.h @@ -31,9 +18,6 @@ glibc_qsort.gcc.k1c: glibc_qsort.gcc.k1c.o glibc_qsort_run.gcc.k1c.o glibc_qsort.ccomp.k1c: glibc_qsort.ccomp.k1c.o glibc_qsort_run.gcc.k1c.o $(K1C_CCOMP) $(K1C_CCOMPFLAGS) $+ -o $@ -%.k1c.out: %.k1c - k1-cluster --cycle-based -- $< | tee $@ - clean: $(RM) -f $(PRODUCTS) glibc_qsort.gcc.k1c.o glibc_qsort.ccomp.k1c.o glibc_qsort_run.gcc.k1c.o glibc_qsort_run.gcc.k1c.s diff --git a/test/monniaux/heapsort/Makefile b/test/monniaux/heapsort/Makefile index c3aa07ac..6c72a58d 100644 --- a/test/monniaux/heapsort/Makefile +++ b/test/monniaux/heapsort/Makefile @@ -1,27 +1,14 @@ -CFLAGS=-Wall -O3 -K1C_CC=k1-mbr-gcc -K1C_CFLAGS=-Wall -O3 -std=c99 -K1C_CCOMP=../../../ccomp -K1C_CCOMPFLAGS=-Wall -O3 +include ../rules.mk -PRODUCTS=heapsort.host heapsort.gcc.k1c.out heapsort.ccomp.k1c.out heapsort.ccomp.k1c.s heapsort.gcc.k1c.s heapsort.gcc.k1c heapsort.ccomp.k1c +PRODUCTS=heapsort.gcc.host.out heapsort.ccomp.host.out heapsort.gcc.k1c.out heapsort.ccomp.k1c.out heapsort.ccomp.k1c.s heapsort.gcc.k1c.s heapsort.gcc.k1c heapsort.ccomp.k1c all: $(PRODUCTS) -%.gcc.k1c.s: %.c - $(K1C_CC) $(K1C_CFLAGS) -S $< -o $@ +heapsort.gcc.host: heapsort.c heapsort_run.gcc.host.o heapsort.h + $(CC) $(CFLAGS) heapsort.c heapsort_run.gcc.host.o -o $@ -%.gcc.k1c.o: %.gcc.k1c.s - $(K1C_CC) $(K1C_CFLAGS) -c $< -o $@ - -%.ccomp.k1c.s: %.c - $(K1C_CCOMP) $(K1C_CCOMPFLAGS) -S $< -o $@ - -%.ccomp.k1c.o: %.ccomp.k1c.s - $(K1C_CCOMP) $(K1C_CCOMPFLAGS) -c $< -o $@ - -heapsort.host: heapsort.c heapsort_run.c heapsort.h - $(CC) $(CFLAGS) heapsort.c heapsort_run.c -o $@ +heapsort.ccomp.host: heapsort.c heapsort_run.gcc.host.o heapsort.h + $(CCOMP) $(CCOMPFLAGS) heapsort.c heapsort_run.gcc.host.o -o $@ heapsort.gcc.k1c.s heapsort.ccomp.k1c.s heapsort_run.gcc.k1c.s: heapsort.h diff --git a/test/monniaux/idea/Makefile b/test/monniaux/idea/Makefile index 6e0f2920..75b7ce43 100644 --- a/test/monniaux/idea/Makefile +++ b/test/monniaux/idea/Makefile @@ -1,33 +1,9 @@ -CFLAGS=-Wall -O3 -CCOMP=ccomp # for host -CCOMPFLAGS=-Wall -O3 -K1C_CC=k1-mbr-gcc -K1C_CFLAGS=-Wall -O3 -std=c99 -K1C_CCOMP=../../../ccomp -K1C_CCOMPFLAGS=-Wall -O3 +include ../rules.mk PRODUCTS=idea.gcc.host.out idea.ccomp.host.out idea.gcc.k1c.out idea.ccomp.k1c.out idea.ccomp.k1c.s idea.gcc.k1c.s idea.gcc.k1c idea.ccomp.k1c all: $(PRODUCTS) -%.gcc.k1c.s: %.c - $(K1C_CC) $(K1C_CFLAGS) -S $< -o $@ - -%.gcc.k1c.o: %.gcc.k1c.s - $(K1C_CC) $(K1C_CFLAGS) -c $< -o $@ - -%.ccomp.k1c.s: %.c - $(K1C_CCOMP) $(K1C_CCOMPFLAGS) -S $< -o $@ - -%.ccomp.k1c.o: %.ccomp.k1c.s - $(K1C_CCOMP) $(K1C_CCOMPFLAGS) -c $< -o $@ - -%.gcc.host.o: %.c - $(CC) $(K1C_CFLAGS) -c $< -o $@ - -%.ccomp.host.o: %.c - $(CCOMP) $(CCOMPFLAGS) -c $< -o $@ - idea.gcc.host: idea.c idea.h ../clock.gcc.host.o $(CC) $(CFLAGS) idea.c ../clock.gcc.host.o -o $@ @@ -42,12 +18,6 @@ idea.gcc.k1c: idea.gcc.k1c.o ../clock.gcc.k1c.o idea.ccomp.k1c: idea.ccomp.k1c.o ../clock.gcc.k1c.o $(K1C_CCOMP) $(K1C_CCOMPFLAGS) $+ -o $@ -%.k1c.out: %.k1c - k1-cluster --cycle-based -- $< | tee $@ - -%.host.out: %.host - ./$< | tee $@ - clean: $(RM) -f $(PRODUCTS) idea.gcc.k1c.o idea.ccomp.k1c.o diff --git a/test/monniaux/micro-bunzip/Makefile b/test/monniaux/micro-bunzip/Makefile index 2f06e4c2..58dfed9b 100644 --- a/test/monniaux/micro-bunzip/Makefile +++ b/test/monniaux/micro-bunzip/Makefile @@ -1,19 +1,24 @@ -all: testfile.txt testfile.txt.2ccomp testfile.txt.2gcc testfile.txt.ccomp.out testfile.txt.gcc.out +include ../rules.mk + +all: testfile.txt testfile.txt.2ccomp testfile.txt.2gcc testfile.ccomp.k1c.out testfile.gcc.k1c.out testfile.ccomp.host.out testfile.gcc.host.out cmp testfile.txt testfile.txt.2ccomp cmp testfile.txt testfile.txt.2gcc -../clock.gcc.k1c.o : ../clock.c ../cycles.h - k1-mbr-gcc -c -Wall -O3 $< -o $@ - -micro-bunzip.host: micro-bunzip.c ../clock.c - $(CC) $+ -o $@ +micro-bunzip.ccomp.host: micro-bunzip.c ../clock.gcc.host.o + $(CCOMP) $(CCOMPFLAGS) $+ -o $@ micro-bunzip.ccomp.k1c: micro-bunzip.c ../clock.gcc.k1c.o - ../../../ccomp -Wall -O3 $+ -o $@ + $(K1C_CCOMP) $(K1C_CCOMPFLAGS) $+ -o $@ + +micro-bunzip.gcc.host: micro-bunzip.c ../clock.gcc.host.o + $(CC) $(CFLAGS) $+ -o $@ + +# micro-bunzip.gcc.k1c: micro-bunzip.c ../clock.gcc.k1c.o +# $(K1C_CC) $(K1C_CFLAGS) $+ -o $@ # TODO: -O3 buggy?? micro-bunzip.gcc.k1c: micro-bunzip.c ../clock.gcc.k1c.o - k1-mbr-gcc -Wall -O2 $+ -o $@ + $(K1C_CC) -Wall -O2 $+ -o $@ testfile.txt: micro-bunzip.c cat micro-bunzip.c > $@ @@ -30,14 +35,17 @@ testfile.txt: micro-bunzip.c # sha512sum micro-bunzip.c >> $@ #x cat micro-bunzip.c >> $@ -testfile.txt.2ccomp testfile.txt.ccomp.out: testfile.txt micro-bunzip.ccomp.k1c - bzip2 testfile.txt.2ccomp 2> testfile.txt.ccomp.out +testfile.txt.2ccomp testfile.ccomp.k1c.out: testfile.txt micro-bunzip.ccomp.k1c + bzip2 testfile.txt.2ccomp 2> testfile.ccomp.k1c.out + +testfile.txt.2gcc testfile.gcc.k1c.out: testfile.txt micro-bunzip.gcc.k1c + bzip2 testfile.txt.2gcc 2> testfile.gcc.k1c.out -testfile.txt.2gcc testfile.txt.gcc.out: testfile.txt micro-bunzip.gcc.k1c - bzip2 testfile.txt.2gcc 2> testfile.txt.gcc.out +testfile.txt.2host testfile.gcc.host.out: testfile.txt micro-bunzip.gcc.host + bzip2 testfile.txt.2host 2> testfile.gcc.host.out -testfile.txt.2host: testfile.txt micro-bunzip.host - bzip2 testfile.txt.2host +testfile.ccomp.host.out: testfile.txt micro-bunzip.ccomp.host + bzip2 /dev/null 2> testfile.ccomp.host.out clean: rm -f *.k1c *.out test*txt* diff --git a/test/monniaux/rules.mk b/test/monniaux/rules.mk new file mode 100644 index 00000000..11256bd3 --- /dev/null +++ b/test/monniaux/rules.mk @@ -0,0 +1,37 @@ +CCOMP=ccomp +CCOMPFLAGS=-O3 -Wall +CFLAGS= -std=c99 -O3 -Wall -Wextra -Werror=implicit +K1C_CC=k1-mbr-gcc +K1C_CFLAGS = -std=c99 -O3 -Wall -Wextra -Werror=implicit +K1C_CCOMP = ../../../ccomp +K1C_CCOMPFLAGS=-O3 -Wall + +%.host.gcc.o : %.c + $(CC) $(CFLAGS) -c -o $@ $< + +%.host.ccomp.o : %.c + $(CCOMP) $(CCOMPFLAGS) -c -o $@ $< + +%.gcc.k1c.s: %.c + $(K1C_CC) $(K1C_CFLAGS) -S $< -o $@ + +%.gcc.k1c.o: %.gcc.k1c.s + $(K1C_CC) $(K1C_CFLAGS) -c $< -o $@ + +%.ccomp.k1c.s: %.c + $(K1C_CCOMP) $(K1C_CCOMPFLAGS) -S $< -o $@ + +%.ccomp.k1c.o: %.ccomp.k1c.s + $(K1C_CCOMP) $(K1C_CCOMPFLAGS) -c $< -o $@ + +%.gcc.host.o: %.c + $(CC) $(CFLAGS) -c $< -o $@ + +%.ccomp.host.o: %.c + $(CCOMP) $(CCOMPFLAGS) -c $< -o $@ + +%.k1c.out : %.k1c + k1-cluster --cycle-based -- $< |tee $@ + +%.host.out : %.host + ./$< |tee $@ -- cgit