Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ __pycache__/
.vscode/
/build/
/out/
compile_commands.json
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ BUILD_TESTS ?= ON # pass BUILD_TESTS=OFF to skip
BUILD_BENCH ?= OFF
BUILD_TOOLS ?= OFF
BUILD_TYPE ?= Debug # Release | RelWithDebInfo ...
COMPILE_COMMANDS ?= ON
JOBS ?= $(shell nproc 2>/dev/null || sysctl -n hw.ncpu)

CMAKE_FLAGS = \
Expand All @@ -15,13 +16,17 @@ CMAKE_FLAGS = \
-DBUILD_TESTING=$(BUILD_TESTS) \
-DBUILD_BENCHMARKS=$(BUILD_BENCH) \
-DBUILD_TOOLS=$(BUILD_TOOLS) \
-DCMAKE_EXPORT_COMPILE_COMMANDS=$(COMPILE_COMMANDS)

.PHONY: build test bench tools \
format clean distclean help

configure:
@mkdir -p "$(BUILD_DIR)"
@cmake -S . -B "$(BUILD_DIR)" $(CMAKE_FLAGS)
ifeq ($(COMPILE_COMMANDS),ON)
@ln -sf "$(BUILD_DIR)/compile_commands.json" compile_commands.json
endif

build: configure
@cmake --build "$(BUILD_DIR)" -- -j$(JOBS)
Expand Down Expand Up @@ -53,6 +58,9 @@ clean:

distclean:
@rm -rf "$(BUILD_DIR)"
ifeq ($(COMPILE_COMMANDS),ON)
@rm -f compile_commands.json
endif

help:
@echo "Targets:"
Expand Down