-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
48 lines (34 loc) · 927 Bytes
/
Makefile
File metadata and controls
48 lines (34 loc) · 927 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
40
41
42
43
44
45
46
47
48
MAKEFLAGS += --no-print-directory
BUILD_DIR = build
SOURCE_DIRS = source
SOURCE_FILES = $(shell find $(SOURCE_DIRS) -type f -iregex ".*\.\(c\|h\)\(pp\|xx\|\)")
CMAKE_FLAGS =
.PHONY: build
build: prepare-build
$(MAKE) -C $(BUILD_DIR)
.PHONY: build-tests
build-tests: prepare-build
$(MAKE) -C $(BUILD_DIR) tests
.PHONY: prepare-build
prepare-build:
[ -d "$(BUILD_DIR)" ] || mkdir $(BUILD_DIR)
cd $(BUILD_DIR) && cmake $(CMAKE_FLAGS) ..
.PHONY: debug
debug: CMAKE_FLAGS += -DCMAKE_BUILD_TYPE=Debug
debug: build;
.PHONY: run-tests
run-tests:
$(BUILD_DIR)/source/tests
.PHONY: test
test: build-tests run-tests
.PHONY: lint
lint:
@clang-format --version | grep -qE "[1-9][0-9]+\.[0-9]+\.[0-9]+" || \
(echo "Clang 10 or later is required for linting." && exit 1)
clang-format -n --Werror $(SOURCE_FILES)
.PHONY: codeformat
codeformat:
clang-format -i $(SOURCE_FILES)
.PHONY: clean
clean:
rm -fr $(BUILD_DIR)/