-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
114 lines (81 loc) · 3.2 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
################### CHANGE THESE PATHS ####################
SHELL=/bin/sh
BOOST_HOME=/usr/local/boost_1_71_0
CPLEX_HOME=/opt/ibm/ILOG/CPLEX_Studio128
PROJ_HOME=/home/macs/coding/optimization/set-covering-problem
###############################################################################
CC=g++
CFLAGS=-g -Wall# -O2 -fpermissive
LDLIBS=-L$(BOOST_HOME)/stage/lib -lboost_program_options -lm -lpthread -ldl -larmadillo
LDLIBSCPX=-L$(CPLEX_HOME)/cplex/lib/x86-64_linux/static_pic -lcplex $(LDLIBS)
INC=-I$(BOOST_HOME) -I$(PROJ_HOME)/src
INCCPX=-I$(CPLEX_HOME)/cplex/include/ $(INC)
#### COLORS AND FORMATS
BOLD=\e[1m
BOLDEND=\e[21m
COLEND=\e[39m
COLGREEN=\e[32m
COLRED=\e[31m
COLYELLOW=\e[33m
######################## CPXSOL ##############################
cpxsol : balas_dense balas_sparse cpx_callbacks cpx_common cpx_main cpx_solver
$(CC) $(CFLAGS) lib/balas_dense.o lib/balas_sparse.o lib/cpx_callbacks.o lib/cpx_common.o lib/cpx_main.o lib/cpx_solver.o -o $@ $(LDLIBSCPX)
@mv $@ lib
@echo "$(BOLD)[$(COLGREEN)COMPLETE$(COLEND)] Rule cpxsol$(BOLDEND)"
cpx_callbacks : src/cpx_callbacks.cpp
$(CC) $(CFLAGS) -c src/[email protected] $(INCCPX)
@mv [email protected] lib
cpx_common : src/cpx_common.cpp
$(CC) $(CFLAGS) -c src/[email protected] $(INCCPX)
@mv [email protected] lib
cpx_main : src/cpx_main.cpp
$(CC) $(CFLAGS) -c src/[email protected] $(INCCPX)
@mv [email protected] lib
cpx_solver : src/cpx_solver.cpp
$(CC) $(CFLAGS) -c src/[email protected] $(INCCPX)
@mv [email protected] lib
######################## BALAS LIB ###########################
balas_dense : src/balas_dense.cpp
$(CC) $(CFLAGS) -c src/[email protected] $(INC)
@mv [email protected] lib
balas_sparse : src/balas_sparse.cpp
$(CC) $(CFLAGS) -c src/[email protected] $(INC)
@mv [email protected] lib
######################## BALSOL ##############################
balsol : balas_dense balas_sparse balas_common balas_main balas_solver
$(CC) $(CFLAGS) lib/balas_dense.o lib/balas_sparse.o lib/balas_common.o lib/balas_main.o lib/balas_solver.o -o $@ $(LDLIBS)
@mv $@ lib
@echo "$(BOLD)[$(COLGREEN)COMPLETE$(COLEND)] Rule balsol$(BOLDEND)"
balas_common : src/balas_common.cpp
$(CC) $(CFLAGS) -c src/[email protected] $(INC)
@mv [email protected] lib
balas_main : src/balas_main.cpp
$(CC) $(CFLAGS) -c src/[email protected] $(INC)
@mv [email protected] lib
balas_solver : src/balas_solver.cpp
$(CC) $(CFLAGS) -c src/[email protected] $(INC)
@mv [email protected] lib
######################### UNIT TESTS ############################
test_balas_dense : balas_dense
$(CC) $(CFLAGS) -c tests/[email protected] $(INC)
$(CC) $(CFLAGS) [email protected] lib/balas_dense.o $(LDLIBS) -o $@
@mv $@ tests
@echo "$(BOLD)[$(COLGREEN)COMPLETE$(COLEND)] Rule test_balas_dense$(BOLDEND)"
test_balas_sparse : balas_sparse
$(CC) $(CFLAGS) -c tests/[email protected] $(INC)
$(CC) $(CFLAGS) [email protected] lib/balas_sparse.o $(LDLIBS) -o $@
@mv $@ tests
@echo "$(BOLD)[$(COLGREEN)COMPLETE$(COLEND)] Rule test_balas_sparse$(BOLDEND)"
unittests-all: test_balas_dense test_balas_sparse
@cd tests && ./test_balas_dense
@cd tests && ./test_balas_sparse
unittests-balas_dense: test_balas_dense
@cd tests && ./test_balas_dense
unittests-balas_sparse: test_balas_sparse
@cd tests && ./test_balas_sparse
clean:
@rm -f lib/balsol lib/cpxsol lib/*.o
@cd tests && rm test_balas_dense test_balas_sparse
.PHONY: clean