-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
37 lines (27 loc) · 670 Bytes
/
Makefile
File metadata and controls
37 lines (27 loc) · 670 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
.PHONY: all build clean compile lint tidy check test
# Directories
BUILD_DIR := build
# Source and header files
SRCS := $(shell find src -name '*.cpp')
HDRS := $(shell find include -name '*.h')
ALL_FILES := $(SRCS) $(HDRS) main.cpp
# Default target
all: build compile test
# Build targets
build: clean
@mkdir -p $(BUILD_DIR)
@cmake -B $(BUILD_DIR) -G Ninja -DCMAKE_CXX_COMPILER=g++
compile: build
@cmake --build $(BUILD_DIR)
clean:
@rm -rf $(BUILD_DIR)
@clear
# Code quality targets
lint:
@clang-format -i $(ALL_FILES)
tidy:
@clang-tidy $(SRCS) -- -Iinclude
check: lint tidy
# Test target
test: build
@ctest --test-dir $(BUILD_DIR) --output-on-failure