-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
146 lines (125 loc) · 6.71 KB
/
Copy pathmakefile
File metadata and controls
146 lines (125 loc) · 6.71 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
137
138
139
140
141
142
143
144
145
146
##############################################################################
################################ makefile ####################################
##############################################################################
# #
# makefile of MILPSolver #
# #
# The makefile takes in input the -I directives for all the external #
# libraries needed by MILPSolver, i.e., core SMS++ and those of all the #
# individual *MILPSolver (currently Cplex, Gurobi, SCIP, HiGHS). These are #
# *not* copied into $(MILPSINC): adding those -I directives to the compile #
# commands will have to done by whatever "main" makefile is using this. #
# Analogously, any external library and the corresponding -L< libdirs > #
# will have to be added to the final linking command by whatever "main" #
# makefile is using this. #
# #
# Note that, conversely, $(SMS++INC) is also assumed to include any #
# -I directive corresponding to external libraries needed by SMS++, at #
# least to the extent in which they are needed by the parts of SMS++ #
# used by MILPSolver. #
# #
# Input: $(CC) = compiler command #
# $(SW) = compiler options #
# $(SMS++INC) = the -I$( core SMS++ directory ) #
# $(SMS++OBJ) = the core SMS++ library #
# $(libCPLEXINC) = the -I$( Cplex library ) #
# $(libGUROBIINC) = the -I$( Gurobi library ) #
# $(libSCIPINC) = the -I$( SCIP library ) #
# $(libHiGHSINC) = the -I$( HiGHS library ) #
# $(MILPSSDR) = the directory where the source is #
# #
# Output: $(MILPSOBJ) = the final object(s) / library #
# $(MILPSH) = the .h files to include #
# $(MILPSINC) = the -I$( source directory ) #
# #
# Antonio Frangioni #
# Dipartimento di Informatica #
# Universita' di Pisa #
# #
##############################################################################
# tools: build + run headers generators - - - - - - - - - - - - - - - - - - -
TOOLSSDR := ./$(MILPSSDR)/tools
STAMP := $(TOOLSSDR)/.headers.stamp
.PHONY: tools
tools: $(STAMP)
$(STAMP):
@echo "[MILPSolver] building and running *_pars in $(TOOLSSDR)"
@set -e; \
$(MAKE) -C "$(TOOLSSDR)"; \
cd "$(TOOLSSDR)"; \
for gen in $$(find . -maxdepth 1 -type f -perm -111 -name "*_pars"); do \
base=$${gen#./}; \
case "$$base" in \
cpx_pars) p=CPX ;; \
grb_pars) p=GRB ;; \
scip_pars) p=SCIP ;; \
highs_pars) p=HiGHS ;; \
*) p= ;; \
esac; \
if [ -n "$$p" ] && \
find ../include -maxdepth 1 -name "$${p}*_defs.h" -print -quit | grep -q . && \
find ../include -maxdepth 1 -name "$${p}*_maps.h" -print -quit | grep -q . ; then \
echo " -> $$base (skip: headers already present)"; \
else \
echo " -> $$base"; \
"./$$base"; \
fi; \
done
@echo "[MILPSolver] headers ready"
@touch "$(STAMP)"
# macros to be exported - - - - - - - - - - - - - - - - - - - - - - - - - - -
MILPSOBJ = $(MILPSSDR)/obj/MILPSolver.o \
$(MILPSSDR)/obj/CPXMILPSolver.o \
$(MILPSSDR)/obj/GRBMILPSolver.o \
$(MILPSSDR)/obj/SCIPMILPSolver.o \
$(MILPSSDR)/obj/HiGHSMILPSolver.o
MILPSINC = -I$(MILPSSDR)/include
MILPSH = $(MILPSSDR)/include/MILPSolver.h \
$(MILPSSDR)/include/CPXMILPSolver.h \
$(MILPSSDR)/include/GRBMILPSolver.h \
$(MILPSSDR)/include/SCIPMILPSolver.h \
$(MILPSSDR)/include/HiGHSMILPSolver.h
# clean target- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
clean::
$(MAKE) -C "$(TOOLSSDR)" clean
rm -f $(MILPSOBJ) $(MILPSSDR)/*~
# distclean target- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
distclean: clean
rm -f $(MILPSSDR)/include/CPX*_defs.h $(MILPSSDR)/include/CPX*_maps.h
rm -f $(MILPSSDR)/include/GRB*_defs.h $(MILPSSDR)/include/GRB*_maps.h
rm -f $(MILPSSDR)/include/SCIP*_defs.h $(MILPSSDR)/include/SCIP*_maps.h
rm -f $(MILPSSDR)/include/HiGHS*_defs.h $(MILPSSDR)/include/HiGHS*_maps.h
rm -f $(STAMP)
# phony targets - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
.PHONY: tools clean distclean
# dependencies: every .o from its .cpp + every recursively included .h- - - -
$(MILPSSDR)/obj/MILPSolver.o: | $(STAMP)
$(MILPSSDR)/obj/CPXMILPSolver.o: | $(STAMP)
$(MILPSSDR)/obj/SCIPMILPSolver.o: | $(STAMP)
$(MILPSSDR)/obj/GRBMILPSolver.o: | $(STAMP)
$(MILPSSDR)/obj/HiGHSMILPSolver.o: | $(STAMP)
$(MILPSSDR)/obj/MILPSolver.o: $(MILPSSDR)/src/MILPSolver.cpp \
$(MILPSSDR)/include/MILPSolver.h $(SMS++OBJ)
$(CC) -c $(MILPSSDR)/src/MILPSolver.cpp -o $@ \
-I$(MILPSSDR)/include $(SMS++INC) $(SW)
$(MILPSSDR)/obj/CPXMILPSolver.o: $(MILPSSDR)/src/CPXMILPSolver.cpp \
$(MILPSSDR)/include/CPXMILPSolver.h \
$(MILPSSDR)/include/MILPSolver.h $(SMS++OBJ)
$(CC) -c $(MILPSSDR)/src/CPXMILPSolver.cpp -o $@ \
-I$(MILPSSDR)/include $(SMS++INC) $(libCPLEXINC) $(SW)
$(MILPSSDR)/obj/SCIPMILPSolver.o: $(MILPSSDR)/src/SCIPMILPSolver.cpp \
$(MILPSSDR)/include/SCIPMILPSolver.h \
$(MILPSSDR)/include/MILPSolver.h $(SMS++OBJ)
$(CC) -c $(MILPSSDR)/src/SCIPMILPSolver.cpp -o $@ \
-I$(MILPSSDR)/include $(SMS++INC) $(libSCIPINC) $(SW)
$(MILPSSDR)/obj/GRBMILPSolver.o: $(MILPSSDR)/src/GRBMILPSolver.cpp \
$(MILPSSDR)/include/GRBMILPSolver.h \
$(MILPSSDR)/include/MILPSolver.h $(SMS++OBJ)
$(CC) -c $(MILPSSDR)/src/GRBMILPSolver.cpp -o $@ \
-I$(MILPSSDR)/include $(SMS++INC) $(libGUROBIINC) $(SW)
$(MILPSSDR)/obj/HiGHSMILPSolver.o: $(MILPSSDR)/src/HiGHSMILPSolver.cpp \
$(MILPSSDR)/include/HiGHSMILPSolver.h \
$(MILPSSDR)/include/MILPSolver.h $(SMS++OBJ)
$(CC) -c $(MILPSSDR)/src/HiGHSMILPSolver.cpp -o $@ \
-I$(MILPSSDR)/include $(SMS++INC) $(libHiGHSINC) $(SW)
########################## End of makefile ###################################