forked from giaf/hpipm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
209 lines (185 loc) · 7.13 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
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
###################################################################################################
# #
# This file is part of HPIPM. #
# #
# HPIPM -- High-Performance Interior Point Method. #
# Copyright (C) 2017-2018 by Gianluca Frison. #
# Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. #
# All rights reserved. #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version #.
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program. If not, see <https://www.gnu.org/licenses/>. #
# #
# The authors designate this particular file as subject to the "Classpath" exception #
# as provided by the authors in the LICENSE file that accompained this code. #
# #
# Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de #
# #
###################################################################################################
include ./Makefile.rule
OBJS =
ifeq ($(TARGET), GENERIC)
# ipm core
# double
OBJS += ipm_core/d_core_qp_ipm_aux.o
# single
OBJS += ipm_core/s_core_qp_ipm_aux.o
endif
ifeq ($(TARGET), AVX)
# ipm core
# double
OBJS += ipm_core/d_core_qp_ipm_aux_avx.o
# single
OBJS += ipm_core/s_core_qp_ipm_aux_avx.o
endif
# cond
OBJS += cond/d_cond_aux.o cond/d_cond.o cond/d_part_cond.o
OBJS += cond/s_cond_aux.o cond/s_cond.o cond/s_part_cond.o
# dense qp
# double
OBJS += dense_qp/d_dense_qp_dim.o
OBJS += dense_qp/d_dense_qp.o
OBJS += dense_qp/d_dense_qp_sol.o
OBJS += dense_qp/d_dense_qp_res.o
OBJS += dense_qp/d_dense_qp_kkt.o
OBJS += dense_qp/d_dense_qp_ipm.o
# single
OBJS += dense_qp/s_dense_qp_dim.o
OBJS += dense_qp/s_dense_qp.o
OBJS += dense_qp/s_dense_qp_sol.o
OBJS += dense_qp/s_dense_qp_res.o
OBJS += dense_qp/s_dense_qp_kkt.o
OBJS += dense_qp/s_dense_qp_ipm.o
#mixed
OBJS += dense_qp/m_dense_qp_dim.o
OBJS += dense_qp/m_dense_qp.o
# ipm core
# double
#OBJS += ipm_core/d_core_qp_ipm_aux.o
OBJS += ipm_core/d_core_qp_ipm.o
# single
#OBJS += ipm_core/s_core_qp_ipm_aux.o
OBJS += ipm_core/s_core_qp_ipm.o
# ocp nlp
#OBJS += ocp_nlp/d_ocp_nlp.o ocp_nlp/d_ocp_nlp_sol.o ocp_nlp/d_ocp_nlp_aux.o ocp_nlp/d_ocp_nlp_hyb.o ocp_nlp/d_ocp_nlp_ipm.o ocp_nlp/d_ocp_nlp_sqp.o
#OBJS +=
# ocp qp
# double
OBJS += ocp_qp/d_ocp_qp_dim.o
OBJS += ocp_qp/d_ocp_qp.o
OBJS += ocp_qp/d_ocp_qp_sol.o
OBJS += ocp_qp/d_ocp_qp_res.o
OBJS += ocp_qp/d_ocp_qp_kkt.o
OBJS += ocp_qp/d_ocp_qp_ipm.o
OBJS += ocp_qp/d_ocp_qp_utils.o
# single
OBJS += ocp_qp/s_ocp_qp_dim.o
OBJS += ocp_qp/s_ocp_qp.o
OBJS += ocp_qp/s_ocp_qp_sol.o
OBJS += ocp_qp/s_ocp_qp_res.o
OBJS += ocp_qp/s_ocp_qp_kkt.o
OBJS += ocp_qp/s_ocp_qp_ipm.o
OBJS += ocp_qp/s_ocp_qp_utils.o
# mixed
#OBJS += ocp_qp/m_ocp_qp.o ocp_qp/m_ocp_qp_kkt.o ocp_qp/m_ocp_qp_ipm.o
# sim core
#OBJS += sim_core/d_rk_int.o sim_core/d_erk_int.o sim_core/d_irk_int.o
#OBJS +=
# tree ocp qp
# common
OBJS += tree_ocp_qp/scenario_tree.o
# double
OBJS += tree_ocp_qp/d_tree_ocp_qp_dim.o
OBJS += tree_ocp_qp/d_tree_ocp_qp.o
OBJS += tree_ocp_qp/d_tree_ocp_qp_sol.o
OBJS += tree_ocp_qp/d_tree_ocp_qp_res.o
OBJS += tree_ocp_qp/d_tree_ocp_qp_kkt.o
OBJS += tree_ocp_qp/d_tree_ocp_qp_ipm.o
# single
OBJS += tree_ocp_qp/s_tree_ocp_qp_dim.o
OBJS += tree_ocp_qp/s_tree_ocp_qp.o
OBJS += tree_ocp_qp/s_tree_ocp_qp_sol.o
OBJS += tree_ocp_qp/s_tree_ocp_qp_res.o
OBJS += tree_ocp_qp/s_tree_ocp_qp_kkt.o
OBJS += tree_ocp_qp/s_tree_ocp_qp_ipm.o
all: clean static_library
static_library: target
( cd cond; $(MAKE) obj TOP=$(TOP) )
( cd dense_qp; $(MAKE) obj TOP=$(TOP) )
( cd ipm_core; $(MAKE) obj TOP=$(TOP) )
( cd ocp_qp; $(MAKE) obj TOP=$(TOP) )
( cd tree_ocp_qp; $(MAKE) obj TOP=$(TOP) )
ar rcs libhpipm.a $(OBJS)
cp libhpipm.a ./lib/
@echo
@echo " libhpipm.a static library build complete."
@echo
shared_library: target
( cd cond; $(MAKE) obj TOP=$(TOP) )
( cd dense_qp; $(MAKE) obj TOP=$(TOP) )
( cd ipm_core; $(MAKE) obj TOP=$(TOP) )
( cd ocp_qp; $(MAKE) obj TOP=$(TOP) )
( cd tree_ocp_qp; $(MAKE) obj TOP=$(TOP) )
gcc -L$(BLASFEO_PATH)/lib -shared -o libhpipm.so $(OBJS) -lblasfeo
cp libhpipm.so ./lib/
@echo
@echo " libhpipm.so shared library build complete."
@echo
target:
touch ./include/hpipm_target.h
ifeq ($(TARGET), GENERIC)
echo "#ifndef TARGET_GENERIC" > ./include/hpipm_target.h
echo "#define TARGET_GENERIC" >> ./include/hpipm_target.h
echo "#endif" >> ./include/hpipm_target.h
endif
install_static:
mkdir -p $(PREFIX)/hpipm
mkdir -p $(PREFIX)/hpipm/lib
cp -f libhpipm.a $(PREFIX)/hpipm/lib/
mkdir -p $(PREFIX)/hpipm/include
cp -f ./include/*.h $(PREFIX)/hpipm/include/
install_shared:
mkdir -p $(PREFIX)/hpipm
mkdir -p $(PREFIX)/hpipm/lib
cp -f libhpipm.so $(PREFIX)/hpipm/lib/
mkdir -p $(PREFIX)/hpipm/include
cp -f ./include/*.h $(PREFIX)/hpipm/include/
test_problem:
cp libhpipm.a ./test_problems/libhpipm.a
make -C test_problems obj TOP=$(TOP)
@echo
@echo " Test problem build complete."
@echo
run_test_problems:
./test_problems/test.out
examples:
cp libhpipm.a ./examples/c/libhpipm.a
( cd examples/c; $(MAKE) obj )
@echo
@echo " Examples build complete."
@echo
run_examples:
./examples/c/example.out
.PHONY: examples
clean:
rm -f libhpipm.a
rm -f libhpipm.so
rm -f ./lib/libhpipm.a
rm -f ./lib/libhpipm.so
make -C cond clean
make -C dense_qp clean
make -C ipm_core clean
make -C ocp_qp clean
make -C tree_ocp_qp clean
make -C test_problems clean
make -C examples/c clean