-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathMakefile.in
157 lines (114 loc) · 5.63 KB
/
Makefile.in
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
147
148
149
150
151
152
153
154
155
156
157
# core compiling options
CC = @CC@
CXX = @CXX@
FC = @FC@
CXX_STD = -std=c++11
OPT_FLAGS = @TRAME_WARN_FLAGS@ @TRAME_OPT_FLAGS@
ARMA_INCLUDE_PATH = @ARMA_INCLUDE_PATH@
# install location
INSTALL_PATH=@TRAME_INSTALL_PATH@
# source directories
SDIR = @TRAME_BUILD_PATH@
TRAME_DIR = $(SDIR)
TRAME_SRC_DIR = $(SDIR)/src
TRAME_HEADER_DIR = $(SDIR)/include
TRAME_TEST_DIR = $(SDIR)/tests
# shared library name and flags
SHLIB = @TRAME_SHLIB_NAME@
SHLIB_FLAGS = $(CXX_STD) @TRAME_SHLIB_FLAGS@
# linear programming flags
LP_CFLAGS= @LP_INCLUDE_PATH@
LP_LIB_FLAGS= @LP_LIB_PATH@ @LP_LIB_FLAGS@
SOURCES_LP= $(TRAME_SRC_DIR)/lp/generic_lp_c.c
OBJECTS_LP= $(TRAME_SRC_DIR)/lp/generic_lp_c.o
LP_CXXFLAGS= @LP_INCLUDE_PATH@
SOURCES_LPXX= $(TRAME_SRC_DIR)/lp/generic_lp.cpp
OBJECTS_LPXX= $(TRAME_SRC_DIR)/lp/generic_lp.o
# general flags
CFLAGS = $(OPT_FLAGS) $(LP_CFLAGS) -I$(TRAME_HEADER_DIR)
CXXFLAGS = $(CXX_STD) $(OPT_FLAGS) -I$(ARMA_INCLUDE_PATH) $(LP_CXXFLAGS) -I$(TRAME_HEADER_DIR)
FFLAGS = @TRAME_WARN_FLAGS@ @TRAME_FC_OPT_FLAGS@
LIBS= -lgfortran @TRAME_BLAS_LAPACK@
#
TRAME_OPTIM_DIR= $(TRAME_SRC_DIR)/optim
TRAME_ANC_DIR= $(TRAME_SRC_DIR)/ancillary
TRAME_ARUMS_DIR= $(TRAME_SRC_DIR)/arums
TRAME_MMFS_DIR= $(TRAME_SRC_DIR)/mmfs
TRAME_TRANS_DIR= $(TRAME_SRC_DIR)/transfers
# Optim files
SOURCES_TRAME_OPTIM= $(TRAME_OPTIM_DIR)/unconstrained/bfgs.cpp $(TRAME_OPTIM_DIR)/unconstrained/lbfgs.cpp \
$(TRAME_OPTIM_DIR)/zeros/broyden.cpp $(TRAME_OPTIM_DIR)/line_search/more_thuente.cpp \
$(TRAME_OPTIM_DIR)/constrained/sumt.cpp
OBJECTS_TRAME_OPTIM= $(SOURCES_TRAME_OPTIM:.cpp=.o)
# core TraME files
OBJECTS_TRAME_F90= $(TRAME_SRC_DIR)/prob/prob.o $(TRAME_SRC_DIR)/math/quadpack_double.o $(TRAME_SRC_DIR)/prob/trame_F90_aux.o
SOURCES_TRAME_ANC= $(TRAME_ANC_DIR)/inv_pwa.cpp $(TRAME_ANC_DIR)/trame_stats.cpp $(TRAME_ANC_DIR)/zeroin.cpp
OBJECTS_TRAME_ANC= $(SOURCES_TRAME_ANC:.cpp=.o)
SOURCES_TRAME_ARUMS= $(TRAME_ARUMS_DIR)/arums_empirical.cpp $(TRAME_ARUMS_DIR)/arums_evd.cpp $(TRAME_ARUMS_DIR)/arums_none.cpp \
$(TRAME_ARUMS_DIR)/arums_probit.cpp $(TRAME_ARUMS_DIR)/arums_rsc.cpp $(TRAME_ARUMS_DIR)/arums_rusc.cpp
OBJECTS_TRAME_ARUMS= $(SOURCES_TRAME_ARUMS:.cpp=.o)
SOURCES_TRAME_MMFS= $(TRAME_MMFS_DIR)/mmfs_ces.cpp $(TRAME_MMFS_DIR)/mmfs_cd.cpp $(TRAME_MMFS_DIR)/mmfs_min.cpp \
$(TRAME_MMFS_DIR)/mmfs_geo.cpp
OBJECTS_TRAME_MMFS= $(SOURCES_TRAME_MMFS:.cpp=.o)
SOURCES_TRAME_TRANS= $(TRAME_TRANS_DIR)/transfers_etu.cpp $(TRAME_TRANS_DIR)/transfers_ltu.cpp $(TRAME_TRANS_DIR)/transfers_ntu.cpp \
$(TRAME_TRANS_DIR)/transfers_tu.cpp
OBJECTS_TRAME_TRANS= $(SOURCES_TRAME_TRANS:.cpp=.o)
OBJECTS_TRAME= $(OBJECTS_LP) $(OBJECTS_LPXX) $(OBJECTS_TRAME_F90) $(OBJECTS_TRAME_OPTIM) $(OBJECTS_TRAME_ANC) \
$(OBJECTS_TRAME_ARUMS) $(OBJECTS_TRAME_MMFS) $(OBJECTS_TRAME_TRANS)
all: $(TRAME_DIR)/$(SHLIB) $(OBJECTS_TRAME)
# LP files
$(OBJECTS_LP): $(SOURCES_LP)
$(CC) $(CFLAGS) $^ -c -o $@
$(OBJECTS_LPXX): $(SOURCES_LPXX)
$(CXX) $(CXXFLAGS) $^ -c -o $@
# Misc code and Fortran code
$(TRAME_SRC_DIR)/prob/prob.o: $(TRAME_SRC_DIR)/prob/prob.f90
$(FC) $(FFLAGS) $^ -c -o $@
$(TRAME_SRC_DIR)/math/quadpack_double.o: $(TRAME_SRC_DIR)/math/quadpack_double.f90
$(FC) $(FFLAGS) $^ -c -o $@
$(TRAME_SRC_DIR)/prob/trame_F90_aux.o: $(TRAME_SRC_DIR)/prob/trame_F90_aux.f90
$(FC) $(FFLAGS) $^ -c -o $@
$(TRAME_SRC_DIR)/ancillary/%.o: $(TRAME_SRC_DIR)/ancillary/%.cpp
$(CXX) $(CXXFLAGS) $< -c -o $@
# Optim files
$(TRAME_OPTIM_DIR)/constrained/sumt.o: $(TRAME_OPTIM_DIR)/constrained/sumt.cpp
$(CXX) $(CXXFLAGS) -I$(SDIR)/include/optim $^ -c -o $@
$(TRAME_OPTIM_DIR)/line_search/more_thuente.o: $(TRAME_OPTIM_DIR)/line_search/more_thuente.cpp
$(CXX) $(CXXFLAGS) -I$(SDIR)/include/optim $^ -c -o $@
$(TRAME_OPTIM_DIR)/unconstrained/bfgs.o: $(TRAME_OPTIM_DIR)/unconstrained/bfgs.cpp
$(CXX) $(CXXFLAGS) -I$(SDIR)/include/optim $^ -c -o $@
$(TRAME_OPTIM_DIR)/unconstrained/lbfgs.o: $(TRAME_OPTIM_DIR)/unconstrained/lbfgs.cpp
$(CXX) $(CXXFLAGS) -I$(SDIR)/include/optim $^ -c -o $@
$(TRAME_OPTIM_DIR)/zeros/broyden.o: $(TRAME_OPTIM_DIR)/zeros/broyden.cpp
$(CXX) $(CXXFLAGS) -I$(SDIR)/include/optim $^ -c -o $@
# core TraME files
$(TRAME_ARUMS_DIR)/%.o: $(TRAME_ARUMS_DIR)/%.cpp
$(CXX) $(CXXFLAGS) $< -c -o $@
$(TRAME_MMFS_DIR)/%.o: $(TRAME_MMFS_DIR)/%.cpp
$(CXX) $(CXXFLAGS) $< -c -o $@
$(TRAME_TRANS_DIR)/%.o: $(TRAME_TRANS_DIR)/%.cpp
$(CXX) $(CXXFLAGS) $< -c -o $@
# shared library
$(TRAME_DIR)/$(SHLIB): $(OBJECTS_TRAME)
$(CXX) $(SHLIB_FLAGS) -o $@ $^ $(LIBS) $(LP_LIB_FLAGS)
# cleanup and install
.PHONY: clean
clean:
@rm -f *.so $(TRAME_SRC_DIR)/*/*.o $(TRAME_SRC_DIR)/*/*.tmp $(TRAME_SRC_DIR)/*/*.gcov $(TRAME_SRC_DIR)/*/*.gcno \
$(TRAME_SRC_DIR)/*/*.gcda $(TRAME_SRC_DIR)/*/*.dSYM $(TRAME_SRC_DIR)/*/*/*.o $(TRAME_SRC_DIR)/*/*/*.tmp \
$(TRAME_SRC_DIR)/*/*/*.gcov $(TRAME_SRC_DIR)/*/*/*.gcno $(TRAME_SRC_DIR)/*/*/*.gcda $(TRAME_SRC_DIR)/*/*/*.dSYM
.PHONY: vclean
vclean:
@rm -f *.so $(TRAME_SRC_DIR)/*/*.o $(TRAME_SRC_DIR)/*/*.tmp $(TRAME_SRC_DIR)/*/*.gcov $(TRAME_SRC_DIR)/*/*.gcno \
$(TRAME_SRC_DIR)/*/*.gcda $(TRAME_SRC_DIR)/*/*.dSYM $(TRAME_SRC_DIR)/*/*/*.o $(TRAME_SRC_DIR)/*/*/*.tmp \
$(TRAME_SRC_DIR)/*/*/*.gcov $(TRAME_SRC_DIR)/*/*/*.gcno $(TRAME_SRC_DIR)/*/*/*.gcda $(TRAME_SRC_DIR)/*/*/*.dSYM
@rm -rf ./include/armadillo* ./glpk_tmp
.PHONY: install
install: $(SHLIB)
@cp $(TRAME_DIR)/$(SHLIB) $(INSTALL_PATH)/lib/$(SHLIB)
@mkdir -p $(INSTALL_PATH)/include/trame
@cp -r $(TRAME_DIR)/include/* $(INSTALL_PATH)/include/trame
.PHONY: uninstall
uninstall: $(SHLIB)
@rm $(INSTALL_PATH)/lib/$(SHLIB)
@rm -rf $(INSTALL_PATH)/include/trame