-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
47 lines (34 loc) · 994 Bytes
/
Makefile
File metadata and controls
47 lines (34 loc) · 994 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
CFLAGS := -Wall -Wno-sign-compare -fdiagnostics-color=always
CXXFLAGS := $(CFLAGS) --std=c++11
LDFLAGS :=
BUILD ?= $(shell [ -f build/last_build_type ] && cat build/last_build_type)
CMAKE_BUILD_TYPE :=
ifeq ($(BUILD),release)
CMAKE_BUILD_TYPE := release
else ifeq ($(BUILD),profile)
CMAKE_BUILD_TYPE := release
CXXFLAGS += -pg
else
CMAKE_BUILD_TYPE := debug
endif
BUILD_DIR := build/$(CMAKE_BUILD_TYPE)
CMAKE_ARGS := -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE)
all: test
install: all
cd $(BUILD_DIR) && $(MAKE) install
uninstall:
[ -d $(BUILD_DIR) ] && cd $(BUILD_DIR) && $(MAKE) uninstall
test: target
cd $(BUILD_DIR) && ctest --verbose
target: .cmake
cd $(BUILD_DIR) && $(MAKE)
.cmake: .build_marker
cd $(BUILD_DIR) \
&& CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" \
cmake ../.. $(CMAKE_ARGS)
.build_marker: $(BUILD_DIR)
echo $(BUILD) > build/last_build_type
$(BUILD_DIR):
[ -d $(BUILD_DIR) ] || mkdir -p $(BUILD_DIR)
clean:
rm -fr build