Skip to content

Commit

Permalink
Allow linting in parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
stuarthayhurst committed Aug 30, 2024
1 parent 145bc40 commit 791f1bf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down

0 comments on commit 791f1bf

Please sign in to comment.