diff options
Diffstat (limited to 'Makefile')
-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))) |