From 791f1bf7a6eb2e592b36e5775ebcdd5c1f3e525b Mon Sep 17 00:00:00 2001 From: Stuart Hayhurst Date: Fri, 30 Aug 2024 02:48:08 +0100 Subject: [PATCH] Allow linting in parallel --- Makefile | 7 ++++++- README.md | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 2cd9c73..fef4a77 100644 --- a/Makefile +++ b/Makefile @@ -18,6 +18,7 @@ DEMO_OBJECTS_SOURCE = $(shell ls ./src/demos/**/*.cpp) DEMO_HEADER_SOURCE = $(shell ls ./src/demos/**/*.hpp) ALL_OBJECTS_SOURCE = $(AMMONITE_OBJECTS_SOURCE) $(HELPER_OBJECTS_SOURCE) $(DEMO_OBJECTS_SOURCE) +LINT_OBJECTS = $(subst ./src,$(OBJECT_DIR),$(subst .cpp,.linted,$(ALL_OBJECTS_SOURCE))) OBJECT_DIR = $(BUILD_DIR)/objects AMMONITE_OBJECTS = $(subst ./src,$(OBJECT_DIR),$(subst .cpp,.o,$(AMMONITE_OBJECTS_SOURCE))) @@ -82,6 +83,10 @@ $(BUILD_DIR)/compile_flags.txt: $(ALL_OBJECTS_SOURCE) @for arg in $(CXXFLAGS); do \ echo $$arg >> "$(BUILD_DIR)/compile_flags.txt"; \ done +$(OBJECT_DIR)/%.linted: ./src/%.cpp + clang-tidy -p "$(BUILD_DIR)" $(subst $(OBJECT_DIR),./src,$(subst .linted,.cpp,$(@))) + @mkdir -p "$$(dirname $@)" + @touch "$@" .PHONY: build demo threads debug library headers install uninstall clean lint cache icons $(AMMONITE_HEADER_INSTALL) build: demo threads @@ -117,7 +122,7 @@ uninstall: clean: cache @rm -rfv "$(BUILD_DIR)" lint: $(BUILD_DIR)/compile_flags.txt - clang-tidy -p "$(BUILD_DIR)" $(ALL_OBJECTS_SOURCE) + @$(MAKE) $(LINT_OBJECTS) cache: @rm -rfv "$(CACHE_DIR)" icons: diff --git a/README.md b/README.md index 0520524..8b067f2 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ ## Build system: - ### Targets: - - `build`, `debug`, `library`, `demo` and `threads` support `-j[CORE COUNT]` + - `build`, `debug`, `library`, `demo`, `threads` and `lint` support `-j[CORE COUNT]` - `make build` - Builds the demo and thread demo - `make debug` - Cleans build directory, then runs `make build` in debug mode - `make library` - Builds `build/libammonite.so`