-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
39 lines (32 loc) · 881 Bytes
/
Makefile
File metadata and controls
39 lines (32 loc) · 881 Bytes
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
# Variables
BUILD_DIR := build
CMAKE := cmake
NINJA := ninja
# Source files to format
FORMAT_SOURCES := $(shell find src include -name '*.cpp' -o -name '*.h')
# Default target
.PHONY: all
all: debug
# Initialize Ninja build directory (generate build files)
.PHONY: init
init:
$(CMAKE) -S . -B $(BUILD_DIR) -G Ninja
# Build Debug (with debug symbols, no optimization)
.PHONY: debug
debug: init
$(CMAKE) -S . -B $(BUILD_DIR) -G Ninja -DCMAKE_BUILD_TYPE=Debug
$(NINJA) -C $(BUILD_DIR)
# Build Release (optimized)
.PHONY: release
release: init
$(CMAKE) -S . -B $(BUILD_DIR) -G Ninja -DCMAKE_BUILD_TYPE=Release
$(NINJA) -C $(BUILD_DIR)
# Clean build directory
.PHONY: clean
clean:
$(NINJA) -C $(BUILD_DIR) -t clean
rm -rf $(BUILD_DIR)/CMakeCache.txt $(BUILD_DIR)/CMakeFiles
# Format source files with clang-format
.PHONY: format
format:
clang-format -i $(FORMAT_SOURCES)