aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorGravatar Jason Gross <jgross@mit.edu>2017-09-27 10:05:39 -0400
committerGravatar Jason Gross <jasongross9@gmail.com>2017-10-10 04:43:20 -0400
commit21f2c1bafa10e0375acf0cd7b89930e006770c74 (patch)
tree0c0f37001cb00b53bf5b5184c927491c4608aaaa /Makefile
parent81c858a3898a11b188263f44d4e43d4cd150954a (diff)
More Makefile factoring
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile113
1 files changed, 62 insertions, 51 deletions
diff --git a/Makefile b/Makefile
index a34288db1..d12884149 100644
--- a/Makefile
+++ b/Makefile
@@ -162,81 +162,92 @@ $(DISPLAY_JAVA_VO:.vo=.log) : %JavaDisplay.log : %.vo %JavaDisplay.v src/Compile
$(SHOW)"COQC $*JavaDisplay > $@"
$(HIDE)$(COQC) $(COQDEBUG) $(COQFLAGS) $*JavaDisplay.v | sed s'/\r\n/\n/g' > $@.tmp && mv -f $@.tmp $@
-src/Specific/X25519/C64/test: src/Specific/X25519/C64/compiler.sh src/Specific/X25519/x25519_test.c $(DISPLAY_X25519_C64_VO:Display.vo=.c) $(DISPLAY_X25519_C64_VO:Display.vo=.h) src/Specific/X25519/C64/scalarmult.c
- src/Specific/X25519/C64/compiler.sh -o $@ -I liblow -I src/Specific/X25519/C64/ $(filter %.c %.s,$^)
+TEST_BINARIES := \
+ src/Specific/X25519/C64/test \
+ src/Specific/NISTP256/AMD64/test/feadd_test \
+ src/Specific/NISTP256/AMD64/test/femul_test \
+ src/Specific/NISTP256/AMD64/test/p256_test \
+ src/Specific/NISTP256/AMD64/icc/p256_test
+RUN_TEST_BINARIES := $(addsuffix -run,$(TEST_BINARIES))
+MEASUREMENTS := \
+ src/Specific/X25519/C64/measurements.txt \
+ third_party/openssl-curve25519/measurements.txt \
+ third_party/curve25519-donna-c64/measurements.txt \
+ third_party/openssl-nistz256-amd64/measurements.txt \
+ third_party/openssl-nistz256-adx/measurements.txt \
+ third_party/openssl-nistp256c64/measurements.txt \
+ src/Specific/NISTP256/AMD64/measurements.txt \
+ src/Specific/NISTP256/AMD64/icc/measurements.txt
+MEASURE_BINARIES := $(addsuffix measure,$(dir $(MEASUREMENTS)))
-src/Specific/X25519/C64/measure: src/Specific/X25519/C64/compiler.sh measure.c $(DISPLAY_X25519_C64_VO:Display.vo=.c) $(DISPLAY_X25519_C64_VO:Display.vo=.h) src/Specific/X25519/C64/scalarmult.c
- src/Specific/X25519/C64/compiler.sh -o $@ -I liblow -I src/Specific/X25519/C64/ $(filter %.c %.s,$^) -D UUT=crypto_scalarmult_bench
+src/Specific/X25519/C64/test src/Specific/X25519/C64/measure: $(DISPLAY_X25519_C64_VO:Display.vo=.c) $(DISPLAY_X25519_C64_VO:Display.vo=.h) src/Specific/X25519/C64/scalarmult.c
+src/Specific/X25519/C64/test: src/Specific/X25519/C64/compiler.sh src/Specific/X25519/x25519_test.c
+src/Specific/X25519/C64/test: INCLUDE_FOLDER=src/Specific/X25519/C64
+src/Specific/X25519/C64/measure: UUT=crypto_scalarmult_bench
+src/Specific/X25519/C64/measurements.txt: COUNT=2047
-src/Specific/X25519/C64/measurements.txt : %/measurements.txt : %/measure capture.sh etc/machine.sh etc/cpufreq etc/tscfreq
- ./capture.sh $* 2047
+third_party/openssl-curve25519/measure: third_party/openssl-curve25519/crypto_scalarmult_bench.c third_party/openssl-curve25519/ec_curve25519.c third_party/openssl-curve25519/ec_curve25519.h
+third_party/openssl-curve25519/measure: UUT=crypto_scalarmult_bench
+third_party/openssl-curve25519/measurements.txt: COUNT=2047
-third_party/openssl-curve25519/measure: third_party/openssl-curve25519/compiler.sh measure.c third_party/openssl-curve25519/crypto_scalarmult_bench.c third_party/openssl-curve25519/ec_curve25519.c third_party/openssl-curve25519/ec_curve25519.h
- third_party/openssl-curve25519/compiler.sh -o $@ -I liblow -I third_party/openssl-curve25519 $(filter %.c %.s,$^) -D UUT=crypto_scalarmult_bench
+third_party/curve25519-donna-c64/measure: third_party/curve25519-donna-c64/crypto_scalarmult_bench.c third_party/curve25519-donna-c64/curve25519-donna-c64.c
+third_party/curve25519-donna-c64/measure: UUT=crypto_scalarmult_bench
+third_party/curve25519-donna-c64/measurements.txt: COUNT=2047
-third_party/openssl-curve25519/measurements.txt : %/measurements.txt : %/measure capture.sh etc/machine.sh etc/cpufreq etc/tscfreq
- ./capture.sh $* 2047
+third_party/openssl-nistz256-amd64/measure: third_party/openssl-nistz256-amd64/bench_madd.c third_party/openssl-nistz256-amd64/cpu_intel.c third_party/openssl-nistz256-amd64/ecp_nistz256-x86_64.s third_party/openssl-nistz256-amd64/nistz256.h
+third_party/openssl-nistz256-amd64/measure: UUT=bench_madd
+third_party/openssl-nistz256-amd64/measurements.txt: COUNT=65535
-third_party/curve25519-donna-c64/measure: third_party/curve25519-donna-c64/compiler.sh measure.c third_party/curve25519-donna-c64/crypto_scalarmult_bench.c third_party/curve25519-donna-c64/curve25519-donna-c64.c
- third_party/curve25519-donna-c64/compiler.sh -o $@ -I liblow -I third_party/curve25519-donna-c64 $(filter %.c %.s,$^) -D UUT=crypto_scalarmult_bench
+third_party/openssl-nistz256-adx/measure: third_party/openssl-nistz256-adx/bench_madd.c third_party/openssl-nistz256-adx/cpu_intel.c third_party/openssl-nistz256-adx/ecp_nistz256-x86_64.s third_party/openssl-nistz256-adx/nistz256.h
+third_party/openssl-nistz256-adx/measure: UUT=bench_madd
+third_party/openssl-nistz256-adx/measurements.txt: COUNT=65535
-third_party/curve25519-donna-c64/measurements.txt : %/measurements.txt : %/measure capture.sh etc/machine.sh etc/cpufreq etc/tscfreq
- ./capture.sh $* 2047
+third_party/openssl-nistp256c64/measure: third_party/openssl-nistp256c64/bench_madd.c third_party/openssl-nistp256c64/ecp_nistp256.c third_party/openssl-nistp256c64/ecp_nistp256.h
+third_party/openssl-nistp256c64/measure: UUT=bench_madd
+third_party/openssl-nistp256c64/measurements.txt: COUNT=65535
-third_party/openssl-nistz256-amd64/measure: third_party/openssl-nistz256-amd64/compiler.sh measure.c third_party/openssl-nistz256-amd64/bench_madd.c third_party/openssl-nistz256-amd64/cpu_intel.c third_party/openssl-nistz256-amd64/ecp_nistz256-x86_64.s third_party/openssl-nistz256-amd64/nistz256.h
- third_party/openssl-nistz256-amd64/compiler.sh -o $@ -I liblow -I third_party/openssl-nistz256-amd64 $(filter %.c %.s,$^) -D UUT=bench_madd
+src/Specific/NISTP256/AMD64/measure: src/Specific/NISTP256/AMD64/bench_madd.c src/Specific/NISTP256/AMD64/feadd.h src/Specific/NISTP256/AMD64/feadd.c src/Specific/NISTP256/AMD64/femul.h src/Specific/NISTP256/AMD64/femul.c src/Specific/NISTP256/AMD64/fenz.h src/Specific/NISTP256/AMD64/fenz.c src/Specific/NISTP256/AMD64/feopp.h src/Specific/NISTP256/AMD64/feopp.c src/Specific/NISTP256/AMD64/fesub.h src/Specific/NISTP256/AMD64/fesub.c src/Specific/NISTP256/AMD64/p256_jacobian_add_affine.c liblow/cmovznz.c
+src/Specific/NISTP256/AMD64/measure: UUT=bench_madd
+src/Specific/NISTP256/AMD64/measurements.txt: COUNT=65535
-third_party/openssl-nistz256-amd64/measurements.txt : %/measurements.txt : %/measure capture.sh etc/machine.sh etc/cpufreq etc/tscfreq
- ./capture.sh $* 65535
+src/Specific/NISTP256/AMD64/icc/measure: src/Specific/NISTP256/AMD64/p256.h src/Specific/NISTP256/AMD64/icc/icc17_p256_jacobian_add_affine.s src/Specific/NISTP256/AMD64/bench_madd.c liblow/cmovznz.c
+src/Specific/NISTP256/AMD64/icc/measure: UUT=bench_madd
+src/Specific/NISTP256/AMD64/icc/measurements.txt: COUNT=65535
-third_party/openssl-nistz256-adx/measure: third_party/openssl-nistz256-adx/compiler.sh measure.c third_party/openssl-nistz256-adx/bench_madd.c third_party/openssl-nistz256-adx/cpu_intel.c third_party/openssl-nistz256-adx/ecp_nistz256-x86_64.s third_party/openssl-nistz256-adx/nistz256.h
- third_party/openssl-nistz256-adx/compiler.sh -o $@ -I liblow -I third_party/openssl-nistz256-adx $(filter %.c %.s,$^) -D UUT=bench_madd
-third_party/openssl-nistz256-adx/measurements.txt : %/measurements.txt : %/measure capture.sh etc/machine.sh etc/cpufreq etc/tscfreq
- ./capture.sh $* 65535
+src/Specific/NISTP256/AMD64/test/feadd_test src/Specific/NISTP256/AMD64/test/femul_test src/Specific/NISTP256/AMD64/test/p256_test: src/Specific/NISTP256/AMD64/compiler.sh liblow/cmovznz.c
+src/Specific/NISTP256/AMD64/test/feadd_test src/Specific/NISTP256/AMD64/test/femul_test src/Specific/NISTP256/AMD64/test/p256_test: INCLUDE_FOLDER=src/Specific/NISTP256/AMD64/
-third_party/openssl-nistp256c64/measure: third_party/openssl-nistp256c64/compiler.sh measure.c third_party/openssl-nistp256c64/bench_madd.c third_party/openssl-nistp256c64/ecp_nistp256.c third_party/openssl-nistp256c64/ecp_nistp256.h
- third_party/openssl-nistp256c64/compiler.sh -o $@ -I liblow -I third_party/openssl-nistp256c64 $(filter %.c %.s,$^) -D UUT=bench_madd
+src/Specific/NISTP256/AMD64/test/feadd_test: src/Specific/NISTP256/AMD64/feadd.h src/Specific/NISTP256/AMD64/feadd.c src/Specific/NISTP256/AMD64/test/feadd_test.c
-third_party/openssl-nistp256c64/measurements.txt : %/measurements.txt : %/measure capture.sh etc/machine.sh etc/cpufreq etc/tscfreq
- ./capture.sh $* 65535
+src/Specific/NISTP256/AMD64/test/femul_test: src/Specific/NISTP256/AMD64/femul.h src/Specific/NISTP256/AMD64/femul.c src/Specific/NISTP256/AMD64/test/femul_test.c
-src/Specific/NISTP256/AMD64/test/feadd_test: src/Specific/NISTP256/AMD64/compiler.sh src/Specific/NISTP256/AMD64/feadd.h src/Specific/NISTP256/AMD64/feadd.c liblow/cmovznz.c src/Specific/NISTP256/AMD64/test/feadd_test.c liblow/cmovznz.c
- src/Specific/NISTP256/AMD64/compiler.sh -o $@ -I liblow -I src/Specific/NISTP256/AMD64/ $(filter %.c %.s,$^)
+src/Specific/NISTP256/AMD64/test/p256_test: src/Specific/NISTP256/AMD64/test/p256_test.c src/Specific/NISTP256/AMD64/feadd.c src/Specific/NISTP256/AMD64/feadd.h src/Specific/NISTP256/AMD64/femul.c src/Specific/NISTP256/AMD64/femul.h src/Specific/NISTP256/AMD64/fenz.c src/Specific/NISTP256/AMD64/fenz.h src/Specific/NISTP256/AMD64/fesub.c src/Specific/NISTP256/AMD64/fesub.h src/Specific/NISTP256/AMD64/p256_jacobian_add_affine.c src/Specific/NISTP256/AMD64/p256.h
-src/Specific/NISTP256/AMD64/test/femul_test: src/Specific/NISTP256/AMD64/compiler.sh src/Specific/NISTP256/AMD64/femul.h src/Specific/NISTP256/AMD64/femul.c liblow/cmovznz.c src/Specific/NISTP256/AMD64/test/femul_test.c liblow/cmovznz.c
- src/Specific/NISTP256/AMD64/compiler.sh -o $@ -I liblow -I src/Specific/NISTP256/AMD64/ $(filter %.c %.s,$^)
+src/Specific/NISTP256/AMD64/icc/p256_test: src/Specific/NISTP256/AMD64/icc/compiler.sh src/Specific/NISTP256/AMD64/test/p256_test.c src/Specific/NISTP256/AMD64/icc/icc17_p256_jacobian_add_affine.s src/Specific/NISTP256/AMD64/p256.h
+src/Specific/NISTP256/AMD64/icc/p256_test: INCLUDE_FOLDER=src/Specific/NISTP256/AMD64/
-src/Specific/NISTP256/AMD64/test/p256_test: src/Specific/NISTP256/AMD64/compiler.sh src/Specific/NISTP256/AMD64/test/p256_test.c liblow/cmovznz.c src/Specific/NISTP256/AMD64/feadd.c src/Specific/NISTP256/AMD64/feadd.h src/Specific/NISTP256/AMD64/femul.c src/Specific/NISTP256/AMD64/femul.h src/Specific/NISTP256/AMD64/fenz.c src/Specific/NISTP256/AMD64/fenz.h src/Specific/NISTP256/AMD64/fesub.c src/Specific/NISTP256/AMD64/fesub.h src/Specific/NISTP256/AMD64/p256_jacobian_add_affine.c src/Specific/NISTP256/AMD64/p256.h
- src/Specific/NISTP256/AMD64/compiler.sh -o $@ -I liblow -I src/Specific/NISTP256/AMD64/ $(filter %.c %.s,$^)
+$(TEST_BINARIES):
+ $(filter %/compiler.sh,$^) -o $@ -I liblow -I $(INCLUDE_FOLDER) $(filter %.c %.s,$^)
-src/Specific/NISTP256/AMD64/measure: src/Specific/NISTP256/AMD64/compiler.sh measure.c src/Specific/NISTP256/AMD64/bench_madd.c src/Specific/NISTP256/AMD64/feadd.h src/Specific/NISTP256/AMD64/feadd.c src/Specific/NISTP256/AMD64/femul.h src/Specific/NISTP256/AMD64/femul.c src/Specific/NISTP256/AMD64/fenz.h src/Specific/NISTP256/AMD64/fenz.c src/Specific/NISTP256/AMD64/feopp.h src/Specific/NISTP256/AMD64/feopp.c src/Specific/NISTP256/AMD64/fesub.h src/Specific/NISTP256/AMD64/fesub.c src/Specific/NISTP256/AMD64/p256_jacobian_add_affine.c liblow/cmovznz.c
- src/Specific/NISTP256/AMD64/compiler.sh -o $@ -I liblow -I src/Specific/NISTP256/AMD64/ $(filter %.c %.s,$^) -D UUT=bench_madd
+$(MEASURE_BINARIES) : %/measure : %/compiler.sh measure.c
+ $*/compiler.sh -o $@ -I liblow -I $* $(filter %.c %.s,$^) -D UUT=$(UUT)
-src/Specific/NISTP256/AMD64/measurements.txt : %/measurements.txt : %/measure capture.sh etc/machine.sh etc/cpufreq etc/tscfreq
- ./capture.sh $* 65535
+$(MEASUREMENTS) : %/measurements.txt : %/measure capture.sh etc/machine.sh etc/cpufreq etc/tscfreq
+ ./capture.sh $* $(COUNT)
src/Specific/NISTP256/AMD64/icc/combined.c: liblow/cmovznz.c src/Specific/NISTP256/AMD64/feadd.c src/Specific/NISTP256/AMD64/femul.c src/Specific/NISTP256/AMD64/fenz.c src/Specific/NISTP256/AMD64/fesub.c src/Specific/NISTP256/AMD64/p256_jacobian_add_affine.c extract-function.sh
(cd src/Specific/NISTP256/AMD64 && ( BITWIDTH=64 FIAT_CRYPTO_EXTRACT_FUNCTION_IS_ASM="" ../../../../extract-function.sh "stdint" < /dev/null | grep -v stdint && sed 's:^uint64_t:static inline &:' ../../../../liblow/cmovznz.c && echo fenz.c feadd.c fesub.c femul.c p256_jacobian_add_affine.c | xargs -n1 grep -A99999 void -- ) | sed 's:^void force_inline:static inline void force_inline:' | grep -v liblow > icc/combined.c )
-src/Specific/NISTP256/AMD64/icc/p256_test: src/Specific/NISTP256/AMD64/icc/compiler.sh src/Specific/NISTP256/AMD64/test/p256_test.c src/Specific/NISTP256/AMD64/icc/icc17_p256_jacobian_add_affine.s src/Specific/NISTP256/AMD64/p256.h
- src/Specific/NISTP256/AMD64/icc/compiler.sh -o $@ -I src/Specific/NISTP256/AMD64/ $(filter %.c %.s,$^)
-
-src/Specific/NISTP256/AMD64/icc/measure: src/Specific/NISTP256/AMD64/icc/compiler.sh measure.c src/Specific/NISTP256/AMD64/p256.h src/Specific/NISTP256/AMD64/icc/icc17_p256_jacobian_add_affine.s src/Specific/NISTP256/AMD64/bench_madd.c
- src/Specific/NISTP256/AMD64/icc/compiler.sh -o $@ -I liblow -I src/Specific/NISTP256/AMD64 $(filter %.c %.s,$^) -D UUT=bench_madd
+bench: $(MEASUREMENTS)
+ head -999999 $?
-src/Specific/NISTP256/AMD64/icc/measurements.txt : %/measurements.txt : %/measure capture.sh etc/machine.sh etc/cpufreq etc/tscfreq
- ./capture.sh $* 65535
-bench: src/Specific/X25519/C64/measurements.txt third_party/openssl-curve25519/measurements.txt third_party/curve25519-donna-c64/measurements.txt src/Specific/NISTP256/AMD64/measurements.txt src/Specific/NISTP256/AMD64/icc/measurements.txt third_party/openssl-nistz256-amd64/measurements.txt third_party/openssl-nistz256-adx/measurements.txt third_party/openssl-nistp256c64/measurements.txt
- head -999999 $?
+.PHONY: $(RUN_TEST_BINARIES)
+$(RUN_TEST_BINARIES) : %-run : %
+ $<
-test: src/Specific/X25519/C64/test src/Specific/NISTP256/AMD64/test/feadd_test src/Specific/NISTP256/AMD64/test/femul_test src/Specific/NISTP256/AMD64/test/p256_test src/Specific/NISTP256/AMD64/icc/p256_test
- src/Specific/X25519/C64/test
- src/Specific/NISTP256/AMD64/test/feadd_test
- src/Specific/NISTP256/AMD64/test/femul_test
- src/Specific/NISTP256/AMD64/test/p256_test
- src/Specific/NISTP256/AMD64/icc/p256_test
+test: $(RUN_TEST_BINARIES)
clean::
rm -f Makefile.coq