diff options
author | Johannes Stoelp <johannes.stoelp@gmail.com> | 2024-03-24 23:41:31 +0100 |
---|---|---|
committer | Johannes Stoelp <johannes.stoelp@gmail.com> | 2024-03-24 23:41:31 +0100 |
commit | d483452fc2ccaba5de26303a449fe5bd2ea1dc18 (patch) | |
tree | 90a7778e9b4b2011ac9109358729ebecc136b74c | |
parent | 5764088e7abb48f78df2e6d7365710073f774e1a (diff) | |
download | cpp-utils-d483452fc2ccaba5de26303a449fe5bd2ea1dc18.tar.gz cpp-utils-d483452fc2ccaba5de26303a449fe5bd2ea1dc18.zip |
make: add compiler,std variant tests
-rw-r--r-- | Makefile | 35 |
1 files changed, 26 insertions, 9 deletions
@@ -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))) |