2019-01-15 15:34:01 +00:00
|
|
|
# This -Wall was supported by the European Commission through the ERC Starting Grant 805031 (EPOQUE)
|
2019-01-16 07:18:33 +00:00
|
|
|
CFLAGS=-Wall -Wextra -Wpedantic -Werror -std=c99 $(EXTRAFLAGS)
|
2019-01-15 15:09:32 +00:00
|
|
|
|
2019-01-16 07:18:33 +00:00
|
|
|
functest: require_scheme $(dir $(SCHEME))test.c $(wildcard $(SCHEME)/clean/*.c) $(wildcard $(SCHEME)/clean/*.h)
|
2019-01-15 15:03:38 +00:00
|
|
|
mkdir -p bin
|
2019-01-16 07:18:33 +00:00
|
|
|
$(CC) $(CFLAGS) \
|
|
|
|
-iquote "./common/" \
|
|
|
|
-iquote "$(SCHEME)/clean/" \
|
|
|
|
-o bin/functest_$(subst /,_,$(SCHEME)) \
|
|
|
|
common/*.c \
|
|
|
|
$(SCHEME)/clean/*.c \
|
2019-01-15 15:22:15 +00:00
|
|
|
$<
|
2019-01-15 15:03:38 +00:00
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
rm -rf bin
|
2019-01-15 15:34:01 +00:00
|
|
|
|
2019-01-16 07:18:33 +00:00
|
|
|
.PHONY: format
|
2019-01-15 15:34:01 +00:00
|
|
|
format:
|
|
|
|
find . -iname *.h -o -iname *.c | xargs clang-format -i -style=file
|
2019-01-16 10:02:32 +00:00
|
|
|
ifneq (,$(shell which dos2unix))
|
|
|
|
# TODO should we make this mandatory?
|
|
|
|
find . -iname *.h -o -iname *.c | xargs dos2unix -q
|
|
|
|
endif
|
2019-01-16 07:18:33 +00:00
|
|
|
|
|
|
|
.PHONY: tidy
|
|
|
|
tidy: require_scheme
|
|
|
|
clang-tidy \
|
|
|
|
$(SCHEME)/clean/*.c \
|
|
|
|
crypto_kem/test.c \
|
|
|
|
common/*.c \
|
|
|
|
$(.TIDY_FIX) \
|
|
|
|
-- -iquote "common/" -iquote "$(SCHEME)/clean"
|
|
|
|
|
|
|
|
.PHONY: fix-tidy
|
|
|
|
apply-tidy: | $(eval .TIDY_FIX = -fix) tidy
|
|
|
|
|
|
|
|
.PHONY: help
|
|
|
|
help:
|
|
|
|
@echo make functest SCHEME=scheme run functional tests for SCHEME
|
|
|
|
@echo make clean clean up the bin/ folder
|
|
|
|
@echo make format Automatically formats all the source code
|
|
|
|
@echo make tidy SCHEME=scheme Runs the clang-tidy linter against SCHEME
|
|
|
|
@echo make fix-tidy SCHEME=scheme Tries to automatically fix the issues found by clang-tidy in SCHEME
|
|
|
|
@echo make help Displays this message
|
|
|
|
|
|
|
|
.PHONY: require_scheme
|
|
|
|
require_scheme:
|
|
|
|
# assumes a SCHEME variable; e.g. make functest_kem SCHEME=crypto_kem/kyber768
|
|
|
|
ifndef SCHEME
|
|
|
|
$(error The SCHEME variable is not set. Example: SCHEME=crypto_kem/kyber768)
|
|
|
|
endif
|