-
Notifications
You must be signed in to change notification settings - Fork 136
/
Makefile.in
89 lines (62 loc) · 2.77 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
# core compiling options
CXX = @CXX@
CXX_STD = @OPTIM_CXX_STD@
OPT_FLAGS = @OPTIM_WARN_FLAGS@ @OPTIM_OPT_FLAGS@
FPN_FLAGS = -DOPTIM_FPN_TYPE=@OPTIM_FPN_TYPE@
OPTIM_MATLIB_FLAGS = @OPTIM_MATLIB_FLAGS@
OPTIM_MATLIB_INCLUDE_PATH = @OPTIM_MATLIB_INCLUDE_PATH@
# install location
INSTALL_PATH=@OPTIM_INSTALL_PATH@
# source directories
SDIR = .
OPTIM_DIR = $(SDIR)
OPTIM_SRC_DIR = $(SDIR)/src
OPTIM_HEADER_DIR = $(SDIR)/include
# shared library name and flags
SHLIB = @OPTIM_SHLIB_NAME@
SHLIB_FLAGS = $(CXX_STD) @OPTIM_SHLIB_FLAGS@
# general flags
CXXFLAGS = $(CXX_STD) $(OPT_FLAGS) $(FPN_FLAGS) $(OPTIM_MATLIB_FLAGS) -I$(OPTIM_MATLIB_INCLUDE_PATH) -I$(OPTIM_HEADER_DIR)
LIBS= @OPTIM_BLAS_LAPACK@
# core Optim files
SOURCES_OPTIM_LS= $(OPTIM_SRC_DIR)/line_search/more_thuente.cpp
OBJECTS_OPTIM_LS= $(SOURCES_OPTIM_LS:.cpp=.o)
SOURCES_OPTIM_UNCONSTR := $(shell find $(OPTIM_SRC_DIR)/unconstrained -name '*.cpp')
OBJECTS_OPTIM_UNCONSTR := $(SOURCES_OPTIM_UNCONSTR:%.cpp=%.o)
SOURCES_OPTIM_CONSTR= $(OPTIM_SRC_DIR)/constrained/sumt.cpp
OBJECTS_OPTIM_CONSTR= $(SOURCES_OPTIM_CONSTR:.cpp=.o)
SOURCES_OPTIM_ZEROS= $(OPTIM_SRC_DIR)/zeros/broyden.cpp $(OPTIM_SRC_DIR)/zeros/broyden_df.cpp
OBJECTS_OPTIM_ZEROS= $(SOURCES_OPTIM_ZEROS:.cpp=.o)
OBJECTS_OPTIM= $(OBJECTS_OPTIM_LS) $(OBJECTS_OPTIM_UNCONSTR) $(OBJECTS_OPTIM_CONSTR) $(OBJECTS_OPTIM_ZEROS)
all: $(OPTIM_DIR)/$(SHLIB) $(OBJECTS_OPTIM)
#
$(OPTIM_SRC_DIR)/misc/%.o: $(OPTIM_SRC_DIR)/misc/%.cpp
$(CXX) $(CXXFLAGS) $< -c -o $@
$(OPTIM_SRC_DIR)/line_search/%.o: $(OPTIM_SRC_DIR)/line_search/%.cpp
$(CXX) $(CXXFLAGS) $< -c -o $@
$(OPTIM_SRC_DIR)/unconstrained/%.o: $(OPTIM_SRC_DIR)/unconstrained/%.cpp
$(CXX) $(CXXFLAGS) $< -c -o $@
$(OPTIM_SRC_DIR)/constrained/%.o: $(OPTIM_SRC_DIR)/constrained/%.cpp
$(CXX) $(CXXFLAGS) $< -c -o $@
$(OPTIM_SRC_DIR)/generic/%.o: $(OPTIM_SRC_DIR)/generic/%.cpp
$(CXX) $(CXXFLAGS) $< -c -o $@
$(OPTIM_SRC_DIR)/zeros/%.o: $(OPTIM_SRC_DIR)/zeros/%.cpp
$(CXX) $(CXXFLAGS) $< -c -o $@
# shared library
$(OPTIM_DIR)/$(SHLIB): $(OBJECTS_OPTIM)
$(CXX) $(SHLIB_FLAGS) -o $@ $^ $(LIBS)
# cleanup and install
.PHONY: clean
clean:
@rm -f *.so ./tests/*/*.test ./tests/*/*.o $(OPTIM_SRC_DIR)/*/*.o ./tests/*/*.tmp $(OPTIM_SRC_DIR)/*/*.tmp \
$(OPTIM_SRC_DIR)/*/*.gcov $(OPTIM_SRC_DIR)/*/*.gcno $(OPTIM_SRC_DIR)/*/*.gcda $(OPTIM_SRC_DIR)/*/*.dSYM \
$(OPTIM_SRC_DIR)/*/*/*.o $(OPTIM_SRC_DIR)/*/*/*.gcov $(OPTIM_SRC_DIR)/*/*/*.gcno $(OPTIM_SRC_DIR)/*/*/*.gcda $(OPTIM_SRC_DIR)/*/*/*.dSYM
.PHONY: vclean
vclean:
@rm -f *.so ./tests/*/*.test ./tests/*/*.o $(OPTIM_SRC_DIR)/*/*.o $(OPTIM_SRC_DIR)/*/*/*.o
@rm -rf ./include/armadillo*
.PHONY: install
install: $(SHLIB)
@cp $(OPTIM_DIR)/$(SHLIB) $(INSTALL_PATH)/lib/$(SHLIB)
@mkdir -p $(INSTALL_PATH)/include/optim
@cp -r $(OPTIM_DIR)/include/* $(INSTALL_PATH)/include/optim