# Use "make VERBOSE=1" to have full commands printed out. VERBOSE = 0 ifeq ($(VERBOSE),1) Q = else Q = @ endif # Use "make IMPLEMENTATION=..." to compile against other versions. IMPLEMENTATION = ref test_dir := $(dir $(lastword $(MAKEFILE_LIST))) root_dir = $(test_dir).. results_dir = $(root_dir)/results/$(mode)-$(keylen) src_dir = $(root_dir)/src/$(IMPLEMENTATION) variant_dir = $(root_dir)/src/$(mode)-$(keylen) nist_flags = -std=c99 -Wall -Wextra -Wshadow -fsanitize=address,undefined -O2 CFLAGS += -I$(src_dir) -I$(variant_dir) -I$(test_dir) $(nist_flags) -Werror LDFLAGS += $(nist_flags) include $(src_dir)/implem.mk .PHONY: clean test $(tests) traces $(traces) clean: - rm -r $(results_dir) $(results_dir) $(results_dir)/src $(results_dir)/test: @ mkdir -p $@ test: $(tests) trace: $(traces) $(tests): test-%: $(results_dir)/test-% @ echo "TEST $@" $(Q) $< $(traces): traces-%: $(results_dir)/traces-% @ echo "TRACES $@" $(Q) $< $(results_dir) $*-$(mode)-$(keylen) $(results_dir)/test-%: $(results_dir)/test/test-%.o @ echo "LD $@" $(Q) gcc $^ $(LDFLAGS) -o $@ $(results_dir)/traces-%: $(results_dir)/test/traces-%.o @ echo "LD $@" $(Q) gcc $^ $(LDFLAGS) -o $@ $(results_dir)/test/%.o: %.c $(test_dir)/test-helpers.h | $(results_dir)/test @ echo "CC $@" $(Q) gcc -c $< $(CFLAGS) -o $@ $(results_dir)/src/%.o: $(src_dir)/%.c | $(results_dir)/src @ echo "CC $@" $(Q) gcc -c $< $(CFLAGS) -o $@ # TODO: add valgrind, although it does not seem to play well with ASAN # TODO: use gcc -M... to generate .o -> .h dependencies