-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
92 lines (70 loc) · 1.96 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
#
# Project files
#
BUILD_PREFIX = build
SRCS = $(shell find src -type f -name '*.cpp')
OBJS = $(patsubst %.cpp, %.o, $(SRCS))
EXE = xcov.run
CFLAGS = -Wall -Isrc -Ilibs -std=c++17
LDFLAGS = -L/usr/local/lib -lstdc++fs -lsource-highlight -lboost_filesystem
ifeq ($(PREFIX),)
PREFIX := /usr/local
endif
#
# Debug build settings
#
DBG_DIR = $(BUILD_PREFIX)/debug
DBG_EXE = $(DBG_DIR)/$(EXE)
DBG_OBJS = $(addprefix $(DBG_DIR)/, $(OBJS))
DBG_CFLAGS = -g -O0 --coverage
#
# Release build settings
#
REL_DIR = $(BUILD_PREFIX)/release
REL_EXE = $(REL_DIR)/$(EXE)
REL_OBJS = $(addprefix $(REL_DIR)/, $(OBJS))
REL_CFLAGS = -O3 -DDEFAULT_TEMPL_PATH='"$(PREFIX)/share/xcov/themes/default"'
.PHONY: all clean debug release remake install
# Default build
all: release
#
# Debug rules
#
test: debug
@mkdir -p tmp_build
$(DBG_EXE) -v -r tmp_build -o test_html --filenameing hash
run: debug
$(DBG_EXE) $(ARGS)
debug: $(DBG_EXE)
$(DBG_EXE): $(DBG_OBJS)
@mkdir -p "$(@D)"
$(CXX) $(CFLAGS) $(DBG_CFLAGS) -o $@ $^ -m64 $(LDFLAGS)
$(DBG_DIR)/%.o: %.cpp
@mkdir -p "$(@D)"
$(CXX) -c -m64 $(CFLAGS) $(DBG_CFLAGS) -o $@ $^
#
# Release rules
#
release: $(REL_EXE)
$(REL_EXE): $(REL_OBJS)
@mkdir -p "$(@D)"
$(CXX) $(CFLAGS) $(REL_CFLAGS) -o $@ $^ -m64 $(LDFLAGS)
$(REL_DIR)/%.o: %.cpp
@mkdir -p "$(@D)"
$(CXX) -c -m64 $(CFLAGS) $(REL_CFLAGS) -o $@ $^
#
# Other rules
#
install: release
install -d $(PREFIX)/bin/
install -m 755 $(REL_EXE) $(PREFIX)/bin/xcov
install -d $(PREFIX)/etc/xcov/
install -m 644 default.cfg $(PREFIX)/etc/xcov/
install -d $(PREFIX)/share/xcov/themes/default/
install -m 644 xcov_data/themes/default/index.html $(PREFIX)/share/xcov/themes/default/
install -m 644 xcov_data/themes/default/sourcefile.html $(PREFIX)/share/xcov/themes/default/
install -m 644 xcov_data/themes/default/theme.css $(PREFIX)/share/xcov/themes/default/
install -m 644 xcov_data/themes/default/bootstrap.min.css $(PREFIX)/share/xcov/themes/default/
remake: clean all
clean:
rm -rf ./$(BUILD_PREFIX)