-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile_common
More file actions
136 lines (102 loc) · 5.47 KB
/
Copy pathmakefile_common
File metadata and controls
136 lines (102 loc) · 5.47 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
##############################################################################
################################ makefile ####################################
##############################################################################
# #
# parts of makefile that should be common to them all #
# #
# Input: none #
# #
# Output: COMMON_SW = common flags to all compile mode #
# SW_DEBUG , SW_DEBUG_ASAN , SW_RELEASE_ASAN , SW_RELEASE = #
# switches for the four different compile modes #
# CC = c++ compiler command #
# default: , debug: , debug_asan: , release: , release_asan: , #
# clean:: , distclean: , install: , uninstall: = targets #
# #
# $(SMS++SDR) , $(SMS++INC) , $(SMS++OBJ) , $(SMS++H) and #
# $(SMS++INC) coming from having included the SMS++ core #
# #
# $(CMMNUOBJ) = the commun_utils objects #
# $(CMMNUH) = the .h files to include for the commun_utils #
# $(CMMNUINC) = all the -I$( include dirs ) of the commun_utils #
# #
# Antonio Frangioni #
# Dipartimento di Informatica #
# Universita' di Pisa #
# #
##############################################################################
# common flags
COMMON_SW = -std=c++20 -ferror-limit=1 -Wno-deprecated-declarations -Wno-enum-compare -Wno-backslash-newline-escape -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
# 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) ../common_utils.o
# distclean target- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
distclean: clean
# install/uninstall - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# check if the user is in the sudoers file
ifeq ($(shell id -u),0)
prefix = /opt/smspp-project
else
prefix = $(HOME)/smspp-project
endif
bindir = $(prefix)/$(BUILD_MODE)/bin
install: $(DIR)/$(NAME)
install -s -D $(DIR)/$(NAME) $(DESTDIR)$(bindir)/$(NAME)
uninstall:
rm -f $(DESTDIR)$(bindir)/$(NAME)
# phony targets - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
.PHONY: debug debug_asan release release_asan clean distclean
# common_utils stuff- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# define & include the necessary modules- - - - - - - - - - - - - - - - - - -
# if a module is not used in the current configuration, just comment out the
# corresponding include line
# each module outputs some macros to be used here:
# *OBJ is the final object(s) / library
# *LIB is the external libraries + -L< libdirs >
# *H is the list of all include files
# *INC is the -I< include directories >
# define input macros for SMS++ complete makefile, then include it
SMS++SDR = ../../SMS++
include $(SMS++SDR)/lib/makefile-c
# dependencies: every .o from its .cpp + every recursively included .h- - - -
CMMNUOBJ = ../common_utils.o
CMMNUH = ../common_utils.h
CMMNUINC = -I..
$(CMMNUOBJ): $(CMMNUH) $(SMS++H) ../common_utils.cpp
$(CC) -c ../common_utils.cpp -o $@ $(CMMNUINC) \
$(SMS++INC) $(SW)
# ml_utils stuff- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# the model-agnostic machine learning scaffolding, which the tools training a
# model use; it depends on nothing but the standard library
MLUTOBJ = ../ml_utils.o
MLUTH = ../ml_utils.h
MLUTINC = -I..
$(MLUTOBJ): $(MLUTH) ../ml_utils.cpp
$(CC) -c ../ml_utils.cpp -o $@ $(MLUTINC) $(SW)
clean::
rm -f $(MLUTOBJ)
############################ End of makefile #################################