2019-01-16 12:02:57 +00:00
|
|
|
ALL_SCHEMES=$(filter-out crypto_%.c, $(wildcard crypto_*/*))
|
2019-01-16 12:52:53 +00:00
|
|
|
|
|
|
|
default: help
|
|
|
|
|
|
|
|
.PHONY: require_scheme
|
|
|
|
require_scheme:
|
2019-01-17 16:44:55 +00:00
|
|
|
# assumes a SCHEME variable; e.g. make functest SCHEME=crypto_kem/kyber768
|
2019-01-16 12:52:53 +00:00
|
|
|
ifndef SCHEME
|
|
|
|
$(error The SCHEME variable is not set. Example: SCHEME=crypto_kem/kyber768)
|
|
|
|
endif
|
|
|
|
|
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: tidy
|
2019-01-16 12:52:53 +00:00
|
|
|
tidy:
|
|
|
|
$(MAKE) do-tidy
|
|
|
|
|
|
|
|
do-tidy: require_scheme
|
2019-01-16 07:18:33 +00:00
|
|
|
clang-tidy \
|
2019-01-16 12:52:53 +00:00
|
|
|
-quiet $(.TIDY_FIX) \
|
2019-01-16 07:18:33 +00:00
|
|
|
$(SCHEME)/clean/*.c \
|
|
|
|
common/*.c \
|
|
|
|
-- -iquote "common/" -iquote "$(SCHEME)/clean"
|
|
|
|
|
2019-01-16 12:52:53 +00:00
|
|
|
.PHONY: apply-tidy
|
|
|
|
apply-tidy:
|
|
|
|
$(MAKE) do-tidy .TIDY_FIX=-fix
|
2019-01-16 07:18:33 +00:00
|
|
|
|
2019-01-16 12:52:53 +00:00
|
|
|
# The below should be outlined with ts=8
|
2019-01-16 07:18:33 +00:00
|
|
|
.PHONY: help
|
|
|
|
help:
|
2019-01-16 12:52:53 +00:00
|
|
|
@echo "make clean Clean up the bin/ folder"
|
|
|
|
@echo "make tidy SCHEME=scheme Runs the clang-tidy linter against SCHEME"
|
|
|
|
@echo "make apply-tidy SCHEME=scheme Tries to automatically fix the issues found by clang-tidy in SCHEME"
|
|
|
|
@echo "make tidy-all Runs the clang-tidy linter against all schemes"
|
|
|
|
@echo "make apply-tidy-all Tidy up all schemes"
|
|
|
|
@echo "make help Displays this message"
|
2019-01-16 12:02:35 +00:00
|
|
|
|
2019-01-22 16:22:18 +00:00
|
|
|
|
2019-01-16 12:02:35 +00:00
|
|
|
.PHONY: tidy-all
|
|
|
|
tidy-all:
|
2019-01-16 12:52:53 +00:00
|
|
|
@for scheme in $(ALL_SCHEMES); do \
|
2019-01-16 12:02:57 +00:00
|
|
|
$(MAKE) tidy SCHEME=$$scheme || exit 1 ; \
|
2019-01-16 12:52:53 +00:00
|
|
|
done
|
2019-01-16 12:02:35 +00:00
|
|
|
|
2019-01-16 12:52:53 +00:00
|
|
|
.PHONY: apply-tidy-all
|
2019-01-16 12:02:35 +00:00
|
|
|
apply-tidy-all:
|
2019-01-16 12:52:53 +00:00
|
|
|
@for scheme in $(ALL_SCHEMES); do \
|
|
|
|
$(MAKE) apply-tidy SCHEME=$$scheme; \
|
|
|
|
done
|