# Convenience shortcuts only; CMakeLists.txt owns the build. .DEFAULT_GOAL := all # CMake handles parallel compilation; serialize separate wrapper goals. .NOTPARALLEL: CMAKE ?= cmake CTEST ?= ctest BUILD_DIR ?= build BUILD_TYPE ?= Debug JOBS ?= 4 CMAKE_ARGS ?= CTEST_ARGS ?= .PHONY: all build configure test check gui run clean help all: build configure: $(CMAKE) -S . -B "$(BUILD_DIR)" -DCMAKE_BUILD_TYPE="$(BUILD_TYPE)" $(CMAKE_ARGS) build: configure $(CMAKE) --build "$(BUILD_DIR)" --config "$(BUILD_TYPE)" --parallel "$(JOBS)" test: build $(CTEST) --test-dir "$(BUILD_DIR)" --build-config "$(BUILD_TYPE)" --output-on-failure $(CTEST_ARGS) check: test gui: configure $(CMAKE) --build "$(BUILD_DIR)" --config "$(BUILD_TYPE)" --target xtc --parallel "$(JOBS)" run: gui "$(abspath $(BUILD_DIR))/xtc" # Keep the CMake cache; never recursively delete a caller-supplied path. clean: @if [ -f "$(BUILD_DIR)/CMakeCache.txt" ]; then \ $(CMAKE) --build "$(BUILD_DIR)" --config "$(BUILD_TYPE)" --target clean; \ fi help: @echo 'make [build] Configure and compile (default)' @echo 'make configure Configure only' @echo 'make test Build, then run CTest (check is an alias)' @echo 'make gui/run Build the FLTK app / build and launch it' @echo 'make clean Clean products, retaining the CMake cache' @echo 'Overrides: BUILD_DIR=build BUILD_TYPE=Debug JOBS=4 CMAKE_ARGS=... CTEST_ARGS=...'