summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@airbus.com>2018-11-28 10:48:11 +0100
committerKévin Le Gouguec <kevin.legouguec@airbus.com>2018-11-28 10:48:11 +0100
commit7bbd4e2aeb37430aa17e99e1f9acd2d31c2fc034 (patch)
tree7c5303f9dd091e2feab08a1bba81b208fe3b96a7
parentb69bd933b2f7f54a1b8943cd834ea0777a2e32d7 (diff)
downloadlilliput-ae-implem-7bbd4e2aeb37430aa17e99e1f9acd2d31c2fc034.tar.xz
Ajout d'un Makefile commun à toutes les implémentations de référence
-rw-r--r--crypto_aead/lilliputaei128v1/ref/Makefile35
-rw-r--r--crypto_aead/lilliputaeii128v1/ref/Makefile35
-rw-r--r--src/common.mk46
3 files changed, 48 insertions, 68 deletions
diff --git a/crypto_aead/lilliputaei128v1/ref/Makefile b/crypto_aead/lilliputaei128v1/ref/Makefile
index 75754d4..699a4be 100644
--- a/crypto_aead/lilliputaei128v1/ref/Makefile
+++ b/crypto_aead/lilliputaei128v1/ref/Makefile
@@ -2,31 +2,7 @@ tests = test-tweakey \
test-tbc-encrypt test-tbc-decrypt \
test-ae-roundtrip test-ae-encrypt test-ae-decrypt
-nist_flags = -std=c99 -Wall -Wextra -Wshadow -fsanitize=address,undefined -O2
-CFLAGS += -I. -Isrc $(nist_flags) -Werror
-LDFLAGS += $(nist_flags)
-
-
-.PHONY: clean test $(tests)
-
-
-clean:
- -rm -r results
-
-results:
- mkdir -p $@
-
-results/%.o: %.c
- @mkdir -p $(dir $@)
- gcc -c $< $(CFLAGS) -o $@
-
-results/test-%: results/test/test-%.o
- gcc $^ $(LDFLAGS) -o $@
-
-test: $(tests)
-
-$(tests): %: results/%
- ./results/$@
+include src/common.mk
results/test-ae-decrypt: results/src/lilliput-ae-i.o results/src/cipher.o results/src/tweakey.o results/src/constants.o | results
results/test-ae-encrypt: results/src/lilliput-ae-i.o results/src/cipher.o results/src/tweakey.o results/src/constants.o | results
@@ -42,12 +18,3 @@ results/test-ae-roundtrip.o: src/lilliput-ae.h
results/test-tbc-decrypt.o: src/cipher.h
results/test-tbc-encrypt.o: src/cipher.h
results/test-tweakey.o: src/tweakey.h
-
-results/src/cipher.o: src/cipher.h src/tweakey.h src/constants.h parameters.h
-results/src/constants.o: src/constants.h
-results/src/lilliput-ae-i.o: src/lilliput-ae.h src/cipher.h src/constants.h
-results/src/tweakey.o: src/tweakey.h src/constants.h parameters.h
-
-# TODO: should add order-only prerequisites to remove mkdirs inside recipes
-# TODO: add valgrind, although it does not seem to play well with ASAN
-# TODO: should use gcc -M... to generate .o -> .h dependencies
diff --git a/crypto_aead/lilliputaeii128v1/ref/Makefile b/crypto_aead/lilliputaeii128v1/ref/Makefile
index ab18c62..941a11a 100644
--- a/crypto_aead/lilliputaeii128v1/ref/Makefile
+++ b/crypto_aead/lilliputaeii128v1/ref/Makefile
@@ -1,41 +1,8 @@
tests = test-ae-roundtrip
-nist_flags = -std=c99 -Wall -Wextra -Wshadow -fsanitize=address,undefined -O2
-CFLAGS += -I. -Isrc $(nist_flags) -Werror
-LDFLAGS += $(nist_flags)
-
-
-.PHONY: clean test $(tests)
-
-
-clean:
- -rm -r results
-
-results:
- mkdir -p $@
-
-results/%.o: %.c
- @mkdir -p $(dir $@)
- gcc -c $< $(CFLAGS) -o $@
-
-results/test-%: results/test/test-%.o
- gcc $^ $(LDFLAGS) -o $@
-
-test: $(tests)
-
-$(tests): %: results/%
- ./results/$@
+include src/common.mk
results/test-ae-roundtrip: results/src/lilliput-ae-ii.o results/src/cipher.o results/src/tweakey.o results/src/constants.o | results
results/test-*.o: test/helpers.h parameters.h
results/test-ae-roundtrip.o: src/lilliput-ae.h
-
-results/src/cipher.o: src/cipher.h src/tweakey.h src/constants.h parameters.h
-results/src/constants.o: src/constants.h
-results/src/lilliput-ae-ii.o: src/lilliput-ae.h src/cipher.h src/constants.h
-results/src/tweakey.o: src/tweakey.h src/constants.h parameters.h
-
-# TODO: should add order-only prerequisites to remove mkdirs inside recipes
-# TODO: add valgrind, although it does not seem to play well with ASAN
-# TODO: should use gcc -M... to generate .o -> .h dependencies
diff --git a/src/common.mk b/src/common.mk
new file mode 100644
index 0000000..ec56102
--- /dev/null
+++ b/src/common.mk
@@ -0,0 +1,46 @@
+nist_flags = -std=c99 -Wall -Wextra -Wshadow -fsanitize=address,undefined -O2
+CFLAGS += -I. -Isrc $(nist_flags) -Werror
+LDFLAGS += $(nist_flags)
+
+# use "make VERBOSE=1" to have full commands printed out.
+VERBOSE = 0
+ifeq ($(VERBOSE),1)
+Q =
+else
+Q = @
+endif
+
+
+.PHONY: clean test $(tests)
+
+
+clean:
+ -rm -r results
+
+results:
+ @ mkdir -p $@
+
+results/%.o: %.c
+ @ mkdir -p $(dir $@)
+ @ echo "CC $@"
+ $(Q) gcc -c $< $(CFLAGS) -o $@
+
+results/test-%: results/test/test-%.o
+ @ echo "LD $@"
+ $(Q) gcc $^ $(LDFLAGS) -o $@
+
+test: $(tests)
+
+$(tests): %: results/%
+ @ echo "TEST $@"
+ $(Q) ./results/$@
+
+
+results/src/cipher.o: src/cipher.h src/tweakey.h src/constants.h parameters.h
+results/src/constants.o: src/constants.h
+results/src/lilliput-ae-i.o: src/lilliput-ae.h src/cipher.h src/constants.h
+results/src/tweakey.o: src/tweakey.h src/constants.h parameters.h
+
+# TODO: should add order-only prerequisites to remove mkdirs inside recipes
+# TODO: add valgrind, although it does not seem to play well with ASAN
+# TODO: should use gcc -M... to generate .o -> .h dependencies