From d483452fc2ccaba5de26303a449fe5bd2ea1dc18 Mon Sep 17 00:00:00 2001 From: Johannes Stoelp Date: Sun, 24 Mar 2024 23:41:31 +0100 Subject: make: add compiler,std variant tests --- Makefile | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index db0e8ab..808c71f 100644 --- a/Makefile +++ b/Makefile @@ -22,11 +22,7 @@ LDFLAGS = $(SANITIZER) # -- RULES --------------------------------------------------------------------- -all: lint build $(BINS) - -bear: - bear intercept -- $(MAKE) build $(BINS) - bear citnames +default: lint build $(BINS) run: $(RUNS) @@ -34,10 +30,6 @@ run/%: build build/% @echo "==> run $*" build/$* -lint: - clang-format --dry-run -Werror $(shell find -name '*.cc' -o -name '*.h') - clang-tidy test/*.cc -- $(CXXFLAGS) - build/%: build/%.o $(CXX) -o $@ $< $(LDFLAGS) @@ -47,9 +39,34 @@ build/%.o: test/%.cc build: mkdir -p build +lint: + clang-format --dry-run -Werror $(shell find -name '*.cc' -o -name '*.h') + clang-tidy test/*.cc -- $(CXXFLAGS) + clean: $(RM) -r build $(RM) compile_commands.json events.json # Since DEPS files contain rules, include at the end. -include $(DEPS) + +# -- SPECIAL RULES ------------------------------------------------------------- + +# Generate compile database using bear(1). +bear: + bear intercept -- $(MAKE) build $(BINS) + bear citnames + +define VARTEST +var-$(1)-$(2): + @echo "==> VARTEST CXX=$(1) STD=$(2)" + $(MAKE) clean build CXX=$(1) STD=$(2) $(BINS) +endef + +STD_LIST := 14 17 20 +CXX_LIST := g++ clang++ + +# Generate targets for {compiler,std} variant build tests. +$(foreach C,$(CXX_LIST),$(foreach S,$(STD_LIST),$(eval $(call VARTEST,$(C),$(S))))) +# Generate umbrella target to run all variant tests. +vartest: $(foreach C,$(CXX_LIST),$(foreach S,$(STD_LIST),var-$(C)-$(S))) -- cgit v1.2.3