-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
103 lines (72 loc) · 3.57 KB
/
Copy pathmakefile
File metadata and controls
103 lines (72 loc) · 3.57 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
##############################################################################
################################ makefile ####################################
##############################################################################
# #
# makefile of the StochasticBlock tests #
# #
# Antonio Frangioni #
# Dipartimento di Informatica #
# Universita' di Pisa #
# #
##############################################################################
# the executables built here
NAMES = StochasticBlock_test test_discrete
# basic directory
DIR = .
# common flags
COMMON_SW = -std=c++20 -ferror-limit=1
# debug switches
SW_DEBUG = -g -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
SW_RELEASE = -O3 $(COMMON_SW) -DNDEBUG -DCLANG_1200_0_32_27_PATCH
# compiler
CC = clang++
# default target- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
default: release
# debug target- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
debug: SW = $(SW_DEBUG)
debug: $(addprefix $(DIR)/,$(NAMES))
# debug_asan target - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
debug_asan: SW = $(SW_DEBUG_ASAN)
debug_asan: $(addprefix $(DIR)/,$(NAMES))
# release target- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
release: SW = $(SW_RELEASE)
release: $(addprefix $(DIR)/,$(NAMES))
# clean target- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
clean::
rm -f $(DIR)/*.o $(DIR)/*~ $(addprefix $(DIR)/,$(NAMES))
# define & include the necessary modules- - - - - - - - - - - - - - - - - - -
# 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 >
# StochasticBlock complete + core SMS++
StcBlkSDR = ..
include $(StcBlkSDR)/makefile-c
# MILPSolver (without core SMS++), only needed by test_discrete
MILPSSDR = ../../MILPSolver
include $(MILPSSDR)/makefile-s
# main module (linking phase) - - - - - - - - - - - - - - - - - - - - - - - -
# StochasticBlock_test needs only StochasticBlock + core
$(DIR)/StochasticBlock_test: $(StcBlkOBJ) $(DIR)/test.o
$(CC) -o $@ $(DIR)/test.o $(StcBlkOBJ) $(StcBlkLIB) $(SW)
# test_discrete additionally needs MILPSolver
$(DIR)/test_discrete: $(StcBlkOBJ) $(MILPSOBJ) $(DIR)/test_discrete.o
$(CC) -o $@ $(DIR)/test_discrete.o $(StcBlkOBJ) $(MILPSOBJ) \
$(StcBlkLIB) $(MILPSLIB) $(SW)
# dependencies: every .o from its .cpp + every recursively included .h- - - -
# include directives
MINC = $(StcBlkINC) $(MILPSINC)
# includes
MH = $(StcBlkH) $(MILPSH)
# compile command
$(DIR)/%.o: $(DIR)/%.cpp $(MH)
$(CC) -c $< -o $@ $(MINC) $(SW)
# distclean target- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
distclean: clean
# phony targets - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
.PHONY: debug debug_asan release clean distclean
############################ End of makefile #################################