aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Stoelp <johannes.stoelp@gmail.com>2024-03-24 23:41:31 +0100
committerJohannes Stoelp <johannes.stoelp@gmail.com>2024-03-24 23:41:31 +0100
commitd483452fc2ccaba5de26303a449fe5bd2ea1dc18 (patch)
tree90a7778e9b4b2011ac9109358729ebecc136b74c
parent5764088e7abb48f78df2e6d7365710073f774e1a (diff)
downloadcpp-utils-d483452fc2ccaba5de26303a449fe5bd2ea1dc18.tar.gz
cpp-utils-d483452fc2ccaba5de26303a449fe5bd2ea1dc18.zip
make: add compiler,std variant tests
-rw-r--r--Makefile35
1 files changed, 26 insertions, 9 deletions
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)))