xtc/Makefile

46 lines
1.4 KiB
Makefile
Raw Normal View History

2026-11-06 19:05:14 +01:00
# Convenience shortcuts only; CMakeLists.txt owns the build.
2026-10-26 23:32:04 +01:00
.DEFAULT_GOAL := all
2026-11-06 19:05:14 +01:00
# CMake handles parallel compilation; serialize separate wrapper goals.
.NOTPARALLEL:
2026-10-26 23:32:04 +01:00
2026-11-06 19:05:14 +01:00
CMAKE ?= cmake
CTEST ?= ctest
2026-10-26 22:51:25 +01:00
BUILD_DIR ?= build
2026-11-06 19:05:14 +01:00
BUILD_TYPE ?= Debug
JOBS ?= 4
CMAKE_ARGS ?=
CTEST_ARGS ?=
2026-10-26 22:51:25 +01:00
2026-11-06 19:05:14 +01:00
.PHONY: all build configure test check gui run clean help
all: build
2026-10-26 22:51:25 +01:00
2026-11-06 19:05:14 +01:00
configure:
$(CMAKE) -S . -B "$(BUILD_DIR)" -DCMAKE_BUILD_TYPE="$(BUILD_TYPE)" $(CMAKE_ARGS)
2026-10-26 22:51:25 +01:00
2026-11-06 19:05:14 +01:00
build: configure
$(CMAKE) --build "$(BUILD_DIR)" --config "$(BUILD_TYPE)" --parallel "$(JOBS)"
2026-10-26 23:03:17 +01:00
2026-11-06 19:05:14 +01:00
test: build
$(CTEST) --test-dir "$(BUILD_DIR)" --build-config "$(BUILD_TYPE)" --output-on-failure $(CTEST_ARGS)
2026-10-26 22:51:25 +01:00
2026-11-06 19:05:14 +01:00
check: test
2026-10-26 22:51:25 +01:00
2026-11-06 19:05:14 +01:00
gui: configure
$(CMAKE) --build "$(BUILD_DIR)" --config "$(BUILD_TYPE)" --target xtc --parallel "$(JOBS)"
2026-10-26 22:51:25 +01:00
2026-11-06 19:05:14 +01:00
run: gui
"$(abspath $(BUILD_DIR))/xtc"
2026-10-26 22:51:25 +01:00
2026-11-06 19:05:14 +01:00
# Keep the CMake cache; never recursively delete a caller-supplied path.
2026-10-26 22:51:25 +01:00
clean:
2026-11-06 19:05:14 +01:00
@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=...'