This repository has been archived by the owner on Aug 21, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
261 lines (216 loc) · 9.15 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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
################################################################################
##
## Building GNU Octave with 64-bit libraries on GNU Linux
##
################################################################################
# specify root directory (default: current directory)
ROOT_DIR ?= ${PWD}
# create necessary file structure
SRC_CACHE ?= $(ROOT_DIR)/source-cache
BUILD_DIR ?= $(ROOT_DIR)/build
INSTALL_DIR ?= $(ROOT_DIR)/install
# specify elevated privileges command to install to INSTALL_DIR
SUDO_INSTALL ?=
LD_LIBRARY_PATH = $(INSTALL_DIR)/lib
IGNORE := $(shell mkdir -p $(SRC_CACHE) $(BUILD_DIR) $(INSTALL_DIR))
.PHONY: clean
.EXPORT_ALL_VARIABLES:
all: octave
clean:
rm -Rf $(BUILD_DIR) $(INSTALL_DIR) $(SRC_CACHE)
################################################################################
#
# OpenBLAS - https://www.openblas.net/
#
# The OpenBLAS library will be build from a specific version, ensuring
# 64 bit indices.
#
################################################################################
OPENBLAS_VER ?= 0.3.9
$(SRC_CACHE)/openblas-$(OPENBLAS_VER).zip:
@echo -e "\n>>> Download OpenBLAS $(OPENBLAS_VER) <<<\n"
cd $(SRC_CACHE) && wget -q \
"https://github.com/xianyi/OpenBLAS/archive/v$(OPENBLAS_VER).zip" \
&& mv v$(OPENBLAS_VER).zip $@
$(INSTALL_DIR)/lib/libopenblas.so: \
$(SRC_CACHE)/openblas-$(OPENBLAS_VER).zip
@echo -e "\n>>> Unzip OpenBLAS $(OPENBLAS_VER) <<<\n"
cd $(BUILD_DIR) && unzip -q $< \
&& mv OpenBLAS-$(OPENBLAS_VER) openblas-$(OPENBLAS_VER)
cd $(BUILD_DIR)/openblas-$(OPENBLAS_VER) \
&& $(MAKE) BINARY=64 INTERFACE64=1 DYNAMIC_ARCH=1 CONSISTENT_FPCSR=1 \
&& $(SUDO_INSTALL) $(MAKE) install PREFIX=$(INSTALL_DIR)
openblas: $(INSTALL_DIR)/lib/libopenblas.so
################################################################################
#
# SuiteSparse - http://www.suitesparse.com
#
# The SuiteSparse library will be build from a specific version, ensuring
# 64 bit indices and using the self compiled OpenBLAS.
#
################################################################################
SUITESPARSE_VER ?= 5.7.2
$(SRC_CACHE)/suitesparse-$(SUITESPARSE_VER).tar.gz:
@echo -e "\n>>> Download SuiteSparse $(SUITESPARSE_VER) <<<\n"
cd $(SRC_CACHE) && wget -q \
"https://github.com/DrTimothyAldenDavis/SuiteSparse/archive/v$(SUITESPARSE_VER).tar.gz" \
&& mv v$(SUITESPARSE_VER).tar.gz $@
$(INSTALL_DIR)/lib/libsuitesparseconfig.so: \
$(SRC_CACHE)/suitesparse-$(SUITESPARSE_VER).tar.gz \
$(INSTALL_DIR)/lib/libopenblas.so
@echo -e "\n>>> Untar SuiteSparse $(SUITESPARSE_VER) <<<\n"
cd $(BUILD_DIR) && tar -xf $< \
&& mv SuiteSparse-$(SUITESPARSE_VER) \
suitesparse-$(SUITESPARSE_VER)
# build and install library
cd $(BUILD_DIR)/suitesparse-$(SUITESPARSE_VER) \
&& $(MAKE) library \
LAPACK= \
BLAS=-lopenblas \
UMFPACK_CONFIG=-D'LONGBLAS=long' \
CHOLMOD_CONFIG=-D'LONGBLAS=long' \
LDFLAGS='-L$(INSTALL_DIR)/lib -L$(BUILD_DIR)/suitesparse-$(SUITESPARSE_VER)/lib' \
CMAKE_OPTIONS="-D'CMAKE_INSTALL_PREFIX=$(INSTALL_DIR)' \
-D'CMAKE_INSTALL_BINDIR=$(INSTALL_DIR)/bin' \
-D'CMAKE_INSTALL_LIBDIR=$(INSTALL_DIR)/lib' \
-D'CMAKE_INSTALL_INCLUDEDIR=$(INSTALL_DIR)/include'" \
&& $(SUDO_INSTALL) $(MAKE) install \
INSTALL=$(INSTALL_DIR) \
INSTALL_DOC=/tmp/doc \
LAPACK= \
BLAS=-lopenblas \
LDFLAGS='-L$(INSTALL_DIR)/lib -L$(BUILD_DIR)/suitesparse-$(SUITESPARSE_VER)/lib' \
CMAKE_OPTIONS="-D'CMAKE_INSTALL_PREFIX=$(INSTALL_DIR)' \
-D'CMAKE_INSTALL_BINDIR=$(INSTALL_DIR)/bin' \
-D'CMAKE_INSTALL_LIBDIR=$(INSTALL_DIR)/lib' \
-D'CMAKE_INSTALL_INCLUDEDIR=$(INSTALL_DIR)/include'"
suitesparse: $(INSTALL_DIR)/lib/libsuitesparseconfig.so
################################################################################
#
# QRUPDATE - http://sourceforge.net/projects/qrupdate/
#
# The QRUPDATE library will be build from a specific version, ensuring
# 64 bit indices and using the self compiled OpenBLAS.
#
################################################################################
QRUPDATE_VER ?= 1.1.2
QRUPDATE_CONFIG_FLAGS = \
PREFIX=$(INSTALL_DIR) \
LAPACK="" \
BLAS="-lopenblas" \
FFLAGS="-L$(INSTALL_DIR)/lib -fdefault-integer-8"
$(SRC_CACHE)/qrupdate-$(QRUPDATE_VER).tar.gz:
@echo -e "\n>>> Download QRUPDATE $(QRUPDATE_VER) <<<\n"
cd $(SRC_CACHE) && wget -q \
"http://sourceforge.net/projects/qrupdate/files/qrupdate/1.2/qrupdate-$(QRUPDATE_VER).tar.gz"
$(INSTALL_DIR)/lib/libqrupdate.so: \
$(SRC_CACHE)/qrupdate-$(QRUPDATE_VER).tar.gz \
$(INSTALL_DIR)/lib/libopenblas.so
@echo -e "\n>>> Untar QRUPDATE $(QRUPDATE_VER) <<<\n"
cd $(BUILD_DIR) && tar -xf $<
# build and install library
cd $(BUILD_DIR)/qrupdate-$(QRUPDATE_VER) \
&& $(MAKE) test $(QRUPDATE_CONFIG_FLAGS) \
&& $(SUDO_INSTALL) $(MAKE) install $(QRUPDATE_CONFIG_FLAGS)
qrupdate: $(INSTALL_DIR)/lib/libqrupdate.so
################################################################################
#
# ARPACK-NG - https://github.com/opencollab/arpack-ng
#
# The ARPACK-NG library will be build from a specific version, ensuring
# 64 bit indices and using the self compiled OpenBLAS.
#
################################################################################
ARPACK-NG_VER ?= 3.7.0
$(SRC_CACHE)/arpack-ng-$(ARPACK-NG_VER).tar.gz:
@echo -e "\n>>> Download ARPACK-NG $(ARPACK-NG_VER) <<<\n"
cd $(SRC_CACHE) && wget -q \
"https://github.com/opencollab/arpack-ng/archive/$(ARPACK-NG_VER).tar.gz" \
&& mv $(ARPACK-NG_VER).tar.gz $@
$(INSTALL_DIR)/lib/libarpack.so: \
$(SRC_CACHE)/arpack-ng-$(ARPACK-NG_VER).tar.gz \
$(INSTALL_DIR)/lib/libopenblas.so
@echo -e "\n>>> Untar ARPACK-NG $(ARPACK-NG_VER) <<<\n"
cd $(BUILD_DIR) && tar -xf $<
# build and install library
cd $(BUILD_DIR)/arpack-ng-$(ARPACK-NG_VER) \
&& ./bootstrap \
&& ./configure --prefix=$(INSTALL_DIR) \
--libdir=$(INSTALL_DIR)/lib \
--with-blas='-lopenblas' \
--with-lapack='' \
INTERFACE64=1 \
LT_SYS_LIBRARY_PATH=$(INSTALL_DIR)/lib \
LDFLAGS='-L$(INSTALL_DIR)/lib' \
&& $(MAKE) check \
&& $(SUDO_INSTALL) $(MAKE) install
arpack-ng: $(INSTALL_DIR)/lib/libarpack.so
################################################################################
#
# (Optional) GLPK - https://www.gnu.org/software/glpk/
#
# The GLPK library will be build from a specific version, because Debian
# systems make SuiteSparse a requirements for GLPK.
#
################################################################################
GLPK_VER ?= 4.65
$(SRC_CACHE)/glpk-$(GLPK_VER).tar.gz:
@echo -e "\n>>> Download GLPK $(GLPK_VER) <<<\n"
cd $(SRC_CACHE) && wget -q \
"https://ftpmirror.gnu.org/glpk/glpk-$(GLPK_VER).tar.gz"
$(INSTALL_DIR)/lib/libglpk.so: \
$(SRC_CACHE)/glpk-$(GLPK_VER).tar.gz
@echo -e "\n>>> Untar GLPK $(GLPK_VER) <<<\n"
cd $(BUILD_DIR) && tar -xf $<
# build and install library
cd $(BUILD_DIR)/glpk-$(GLPK_VER) \
&& ./configure --with-gmp \
--prefix=$(INSTALL_DIR) \
--libdir=$(INSTALL_DIR)/lib \
&& $(MAKE) check \
&& $(SUDO_INSTALL) $(MAKE) install
glpk: $(INSTALL_DIR)/lib/libglpk.so
################################################################################
#
# GNU Octave - http://www.gnu.org/software/octave/
#
# Build GNU Octave using --enable-64 and all requirements.
#
################################################################################
OCTAVE_VER ?= 5.2.0
OCTAVE_CONFIG_FLAGS = \
CPPFLAGS='-I$(INSTALL_DIR)/include' \
LDFLAGS='-L$(INSTALL_DIR)/lib' \
F77_INTEGER_8_FLAG='-fdefault-integer-8' \
LD_LIBRARY_PATH='$(INSTALL_DIR)/lib' \
--prefix=$(INSTALL_DIR) \
--libdir='$(INSTALL_DIR)/lib' \
--enable-64 \
--with-blas='-lopenblas'
$(SRC_CACHE)/octave-$(OCTAVE_VER).tar.gz:
@echo -e "\n>>> Download GNU Octave $(OCTAVE_VER) <<<\n"
cd $(SRC_CACHE) && wget -q \
"https://ftpmirror.gnu.org/octave/octave-$(OCTAVE_VER).tar.gz"
$(INSTALL_DIR)/bin/octave-$(OCTAVE_VER): \
$(SRC_CACHE)/octave-$(OCTAVE_VER).tar.gz \
$(INSTALL_DIR)/lib/libopenblas.so \
$(INSTALL_DIR)/lib/libsuitesparseconfig.so \
$(INSTALL_DIR)/lib/libqrupdate.so \
$(INSTALL_DIR)/lib/libarpack.so
@echo -e "\n>>> Untar GNU Octave $(OCTAVE_VER) <<<\n"
mkdir -p $(BUILD_DIR)/octave-$(OCTAVE_VER)
cd $(BUILD_DIR) && tar -xf $<
@echo -e "\n>>> Configure GNU Octave $(OCTAVE_VER) (1/3) <<<\n"
cd $(BUILD_DIR)/octave-$(OCTAVE_VER) \
&& ./configure $(OCTAVE_CONFIG_FLAGS)
@echo -e "\n>>> Build GNU Octave $(OCTAVE_VER) (2/3) <<<\n"
cd $(BUILD_DIR)/octave-$(OCTAVE_VER) \
&& $(SUDO_INSTALL) $(MAKE) install
@echo -e "\n>>> Check GNU Octave $(OCTAVE_VER) (3/3) <<<\n"
cd $(BUILD_DIR)/octave-$(OCTAVE_VER) \
&& $(MAKE) check LD_LIBRARY_PATH='$(INSTALL_DIR)/lib'
octave: $(INSTALL_DIR)/bin/octave-$(OCTAVE_VER)
@echo -e "\n\n"
@echo -e " >>> Finished building GNU Octave $(OCTAVE_VER)"
@echo -e " with 64-bit libraries!!! <<<"
@echo -e "\n To start GNU Octave run:\n\n $<\n\n"