-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile_common
More file actions
80 lines (56 loc) · 3.04 KB
/
Copy pathmakefile_common
File metadata and controls
80 lines (56 loc) · 3.04 KB
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
##############################################################################
################################ makefile ####################################
##############################################################################
# #
# parts of makefile that should be common to them all #
# #
# Antonio Frangioni #
# Dipartimento di Informatica #
# Universita' di Pisa #
# #
##############################################################################
# common flags
COMMON_SW = -std=c++20 -ferror-limit=1 -Wno-enum-compare -DCLANG_1200_0_32_27_PATCH
# debug switches
SW_DEBUG = -g3 -glldb -fno-inline $(COMMON_SW)
# debug switches with address sanitizer and extra pedantic warning
SW_DEBUG_ASAN = -g3 -glldb -fno-inline $(COMMON_SW) -fsanitize=undefined -fsanitize=address -fno-omit-frame-pointer -Wpedantic -Wextra -Wno-unused-parameter
# production switches with address sanitizer
SW_RELEASE_ASAN = -O3 $(COMMON_SW) -DNDEBUG -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined
# production switches
SW_RELEASE = -O3 $(COMMON_SW) -DNDEBUG -Wno-deprecated-declarations
# compiler
CC = clang++
# default target- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
default: release
# debug target- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
debug: SW = $(SW_DEBUG)
debug: $(DIR)/$(NAME)
# debug_asan target - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
debug_asan: SW = $(SW_DEBUG_ASAN)
debug_asan: $(DIR)/$(NAME)
# release target- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
release: SW = $(SW_RELEASE)
release: $(DIR)/$(NAME)
# release_asan target - - - - - - - - - - - - - - - - - - - - - - - - - - - -
release_asan: SW = $(SW_RELEASE_ASAN)
release_asan: $(DIR)/$(NAME)
# clean target- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
clean::
rm -f $(DIR)/*.o $(DIR)/*~ $(DIR)/$(NAME)
# distclean target- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
distclean: clean
# phony targets - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
.PHONY: debug debug_asan release release_asan clean distclean
# common_utils stuff- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# every test in tests/ uses ../common_utils.{cpp,h}; centralize the macros
# and the build rule here so each test makefile only needs to append
# $(CMMNUOBJ) / $(CMMNUINC) / $(CMMNUH) to MOBJ / MINC / MH
CMMNUOBJ = ../common_utils.o
CMMNUH = ../common_utils.h
CMMNUINC = -I..
$(CMMNUOBJ): $(CMMNUH) $(SMS++H) ../common_utils.cpp
$(CC) -c ../common_utils.cpp -o $@ $(MINC) $(SW)
clean::
rm -f $(CMMNUOBJ)
############################ End of makefile #################################