-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathMakefile
More file actions
53 lines (44 loc) · 2.17 KB
/
Makefile
File metadata and controls
53 lines (44 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# ZXC - High-performance lossless compression
#
# Copyright (c) 2025-2026 Bertrand Lebonnois and contributors.
# SPDX-License-Identifier: BSD-3-Clause
# Top-level convenience Makefile (wraps CMake)
#
# Usage:
# make Build the library + CLI (Release)
# make test Build and run tests
# make format Format source code with clang-format
# make format-check Check formatting (CI mode)
# make doc Generate Doxygen documentation
# make clean Remove build directory
#
# Override build directory: make BUILD=mybuild
# Pass extra CMake flags: make CMAKE_EXTRA="-DZXC_NATIVE_ARCH=OFF"
BUILD ?= build
CMAKE ?= cmake
CMAKE_EXTRA ?=
JOBS ?= $(shell nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 4)
.PHONY: all test format format-check doc clean
# ── Build ────────────────────────────────────────────────────
all:
@$(CMAKE) -S . -B $(BUILD) -DCMAKE_BUILD_TYPE=Release $(CMAKE_EXTRA)
@$(CMAKE) --build $(BUILD) -j$(JOBS)
# ── Test ─────────────────────────────────────────────────────
test:
@$(CMAKE) -S . -B $(BUILD) -DCMAKE_BUILD_TYPE=Debug -DZXC_BUILD_TESTS=ON $(CMAKE_EXTRA)
@$(CMAKE) --build $(BUILD) -j$(JOBS)
@cd $(BUILD) && ctest --output-on-failure
# ── Formatting ───────────────────────────────────────────────
format:
@$(CMAKE) -S . -B $(BUILD)
@$(CMAKE) --build $(BUILD) --target format
format-check:
@$(CMAKE) -S . -B $(BUILD)
@$(CMAKE) --build $(BUILD) --target format-check
# ── Documentation ────────────────────────────────────────────
doc:
@$(CMAKE) -S . -B $(BUILD)
@$(CMAKE) --build $(BUILD) --target doc
# ── Clean ────────────────────────────────────────────────────
clean:
@rm -rf $(BUILD)