-
Notifications
You must be signed in to change notification settings - Fork 80
/
Makefile
93 lines (70 loc) · 2.3 KB
/
Makefile
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
ifeq ($(OS),Windows_NT)
export SHELL=cmd
endif
FIBER_GUARD_PAGES?=
CPP_17?=
WERROR?=
CMAKE_EXTRA_ARGS?=
CMAKE_OVERRIDE_ARGS=
ifneq ($(FIBER_GUARD_PAGES),)
CMAKE_OVERRIDE_ARGS+=-DFTL_FIBER_STACK_GUARD_PAGES=$(FIBER_GUARD_PAGES)
endif
ifneq ($(CPP_17),)
CMAKE_OVERRIDE_ARGS+=-DFTL_CPP_17=$(CPP_17)
endif
ifneq ($(WERROR),)
CMAKE_OVERRIDE_ARGS+=-DFTL_WERROR=$(WERROR)
endif
CMAKE_OVERRIDE_ARGS+=$(CMAKE_EXTRA_ARGS)
ifeq ($(OS),Windows_NT)
CMAKE_PRESET?=Win_x64_Debug
else
CMAKE_PRESET?=Unix_x64_Debug
endif
.PHONY: build
all: generate build clean
#################################
# Building
#################################
generate:
cmake --version
cmake --preset=$(CMAKE_PRESET) .
build: generate
cmake --build --preset=$(CMAKE_PRESET) -j
#################################
# Testing
#################################
test:
ifeq ($(OS),Windows_NT)
cmd /c "cd build\Debug\tests && ftl-test.exe"
cmd /c "cd build\RelWithDebInfo\tests && ftl-test.exe"
else
/bin/sh -c "(cd build/Debug/tests && exec ./ftl-test)"
/bin/sh -c "(cd build/RelWithDebInfo/tests && exec ./ftl-test)"
endif
benchmark:
ifeq ($(OS),Windows_NT)
cmd /c "cd build\Debug\benchmarks && ftl-benchmark.exe"
cmd /c "cd build\RelWithDebInfo\benchmarks && ftl-benchmark.exe"
else
/bin/sh -c "(cd build/Debug/benchmarks && exec ./ftl-benchmark)"
/bin/sh -c "(cd build/RelWithDebInfo/benchmarks && exec ./ftl-benchmark)"
endif
valgrind_run:
/bin/sh -c "(cd build/Valgrind/tests && exec valgrind --leak-check=yes --log-file=memcheck_output.txt ./ftl-test)"
#################################
# Miscellaneous
#################################
clean:
ifeq ($(OS),Windows_NT)
if exist build del /s /q build > nul
if exist build rmdir /s /q build > nul
else
rm -rf build
endif
format:
docker run --rm -v $(CURDIR):/app -w /app quay.io/richiesams/clang-tools-extra:latest /usr/bin/python3 tools/run-clang-format.py -r --clang-format-executable clang-format-15 -i benchmarks examples include source tests
format_check:
docker run --rm -v $(CURDIR):/app -w /app quay.io/richiesams/clang-tools-extra:latest /usr/bin/python3 tools/run-clang-format.py -r --clang-format-executable clang-format-15 benchmarks examples include source tests
lint:
docker run --rm -v $(CURDIR):/app -w /app quay.io/richiesams/clang-tools-extra:latest /usr/bin/python3 tools/run-clang-tidy.py