-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
55 lines (45 loc) · 1.51 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
BUILD_DIR := build
SRC_DIR := src
INC_DIR := include
TEST_DIR := test
BENCH_DIR := bench
JOBS ?= 4
.PHONY: all
all: test
.PHONY: init
init:
git submodule init
git submodule update
.PHONY: format
.SILENT: format
format:
./tools/clang-format.sh $(PWD)/$(SRC_DIR)
./tools/clang-format.sh $(PWD)/$(INC_DIR)
./tools/clang-format.sh $(PWD)/$(TEST_DIR)
./tools/clang-format.sh $(PWD)/$(BENCH_DIR)
.PHONY: build
build: init
cmake -S $(PWD) -B $(PWD)/$(BUILD_DIR) -DCHAIVM_ADD_MEM_SANITIZER=OFF -DCHAIVM_ADD_THREAD_SANITIZER=OFF
cmake --build $(PWD)/$(BUILD_DIR) --parallel $(JOBS)
.PHONY: test
test: build
export GTEST_COLOR=1 && ctest --test-dir $(PWD)/$(BUILD_DIR)/test --parallel $(JOBS) --output-on-failure
.PHONY: execute-tests-inside-make
execute-tests-inside-make:
cmake --build $(PWD)/$(BUILD_DIR) --parallel $(JOBS)
export GTEST_COLOR=1 && ctest --test-dir $(PWD)/$(BUILD_DIR)/test --parallel $(JOBS) --output-on-failure
.PHONY: test-extended
test-extended: init
cmake -S $(PWD) -B $(PWD)/$(BUILD_DIR) -DCHAIVM_ADD_MEM_SANITIZER=OFF -DCHAIVM_ADD_THREAD_SANITIZER=ON
$(MAKE) execute-tests-inside-make
cmake -S $(PWD) -B $(PWD)/$(BUILD_DIR) -DCHAIVM_ADD_MEM_SANITIZER=ON -DCHAIVM_ADD_THREAD_SANITIZER=OFF
$(MAKE) execute-tests-inside-make
.PHONY: bench
bench: init
cmake -S $(PWD) -B $(PWD)/$(BUILD_DIR) -DCHAI_BENCH=1 -DCMAKE_BUILD_TYPE=RELEASE
cmake --build $(PWD)/$(BUILD_DIR) --parallel $(JOBS)
cd $(PWD)/$(BUILD_DIR) && make run_bench && cd $(PWD)
.PHONY: clean
.SILENT: clean
clean:
rm -rf $(PWD)/$(BUILD_DIR)