2 include ./Makefile.system
4 BLASDIRS = interface driver/level2 driver/level3 driver/others
6 ifneq ($(DYNAMIC_ARCH), 1)
15 ifneq ($(NO_LAPACK), 1)
20 ifeq ($(BUILD_RELAPACK), 1)
24 ifeq ($(NO_FORTRAN), 1)
35 LAPACK_NOOPT := $(filter-out -O0 -O1 -O2 -O3 -Ofast,$(LAPACK_FFLAGS))
37 SUBDIRS_ALL = $(SUBDIRS) test ctest utest exports benchmark ../laswp ../bench
39 .PHONY : all libs netlib $(RELA) test ctest shared install
40 .NOTPARALLEL : all libs $(RELA) prof lapack-test install blas-test
42 all :: libs netlib $(RELA) tests shared
44 @echo " OpenBLAS build complete. ($(LIB_COMPONENTS))"
46 @echo " OS ... $(OSNAME) "
47 @echo " Architecture ... $(ARCH) "
49 @echo " BINARY ... 32bit "
51 @echo " BINARY ... 64bit "
55 ifneq ($(INTERFACE64), 0)
56 @echo " Use 64 bits int (equivalent to \"-i8\" in Fortran) "
60 @echo " C compiler ... $(C_COMPILER) (command line : $(CC))"
61 ifeq ($(NOFORTRAN), $(filter 0,$(NOFORTRAN)))
62 @echo " Fortran compiler ... $(F_COMPILER) (command line : $(FC))"
64 ifneq ($(OSNAME), AIX)
65 @echo -n " Library Name ... $(LIBNAME)"
67 @echo " Library Name ... $(LIBNAME)"
71 @echo " (Single threaded) "
73 @echo " (Multi threaded; Max num-threads is $(NUM_THREADS))"
76 ifeq ($(USE_OPENMP), 1)
78 @echo " Use OpenMP in the multithreading. Because of ignoring OPENBLAS_NUM_THREADS and GOTO_NUM_THREADS flags, "
79 @echo " you should use OMP_NUM_THREADS environment variable to control the number of threads."
83 ifeq ($(OSNAME), Darwin)
84 @echo "WARNING: If you plan to use the dynamic library $(LIBDYNNAME), you must run:"
86 @echo "\"make PREFIX=/your_installation_path/ install\"."
88 @echo "(or set PREFIX in Makefile.rule and run make install."
89 @echo "If you want to move the .dylib to a new location later, make sure you change"
90 @echo "the internal name of the dylib with:"
92 @echo "install_name_tool -id /new/absolute/path/to/$(LIBDYNNAME) $(LIBDYNNAME)"
95 @echo "To install the library, you can run \"make PREFIX=/path/to/your/installation install\"."
100 ifeq ($(OSNAME), $(filter $(OSNAME),Linux SunOS Android Haiku))
101 @$(MAKE) -C exports so
102 @ln -fs $(LIBSONAME) $(LIBPREFIX).so
103 @ln -fs $(LIBSONAME) $(LIBPREFIX).so.$(MAJOR_VERSION)
105 ifeq ($(OSNAME), $(filter $(OSNAME),FreeBSD OpenBSD NetBSD DragonFly))
106 @$(MAKE) -C exports so
107 @ln -fs $(LIBSONAME) $(LIBPREFIX).so
109 ifeq ($(OSNAME), Darwin)
110 @$(MAKE) -C exports dyn
111 @ln -fs $(LIBDYNNAME) $(LIBPREFIX).dylib
113 ifeq ($(OSNAME), WINNT)
114 @$(MAKE) -C exports dll
116 ifeq ($(OSNAME), CYGWIN_NT)
117 @$(MAKE) -C exports dll
122 ifeq ($(NOFORTRAN), $(filter 0,$(NOFORTRAN)))
134 ifeq ($(CORE), UNKOWN)
135 $(error OpenBLAS: Detecting CPU failed. Please set TARGET explicitly, e.g. make TARGET=your_cpu_target. Please read README for the detail.)
137 ifeq ($(NOFORTRAN), 1)
138 $(info OpenBLAS: Detecting fortran compiler failed. Cannot compile LAPACK. Only compile BLAS.)
140 ifeq ($(NO_STATIC), 1)
141 ifeq ($(NO_SHARED), 1)
142 $(error OpenBLAS: neither static nor shared are enabled.)
145 @-ln -fs $(LIBNAME) $(LIBPREFIX).$(LIBSUFFIX)
146 @for d in $(SUBDIRS) ; \
147 do if test -d $$d; then \
148 $(MAKE) -C $$d $(@F) || exit 1 ; \
151 #Save the config files for installation
152 @cp Makefile.conf Makefile.conf_last
153 @cp config.h config_last.h
155 @echo "#define QUAD_PRECISION">> config_last.h
157 ifeq ($(EXPRECISION), 1)
158 @echo "#define EXPRECISION">> config_last.h
161 ifeq ($(DYNAMIC_ARCH), 1)
162 @$(MAKE) -C kernel commonlibs || exit 1
163 @for d in $(DYNAMIC_CORE) ; \
164 do $(MAKE) GOTOBLAS_MAKEFILE= -C kernel TARGET_CORE=$$d kernel || exit 1 ;\
166 @echo DYNAMIC_ARCH=1 >> Makefile.conf_last
167 ifeq ($(DYNAMIC_OLDER), 1)
168 @echo DYNAMIC_OLDER=1 >> Makefile.conf_last
172 @echo USE_THREAD=$(USE_THREAD) >> Makefile.conf_last
176 prof : prof_blas prof_lapack
179 ln -fs $(LIBNAME_P) $(LIBPREFIX)_p.$(LIBSUFFIX)
180 for d in $(SUBDIRS) ; \
181 do if test -d $$d; then \
182 $(MAKE) -C $$d prof || exit 1 ; \
185 ifeq ($(DYNAMIC_ARCH), 1)
186 $(MAKE) -C kernel commonprof || exit 1
190 ln -fs $(LIBNAME) $(LIBPREFIX).$(LIBSUFFIX)
191 for d in $(BLASDIRS) ; \
192 do if test -d $$d; then \
193 $(MAKE) -C $$d libs || exit 1 ; \
198 ln -fs $(LIBNAME) $(LIBPREFIX).$(LIBSUFFIX)
199 for d in $(BLASDIRS) ../laswp exports ; \
200 do if test -d $$d; then \
201 $(MAKE) -C $$d $(@F) || exit 1 ; \
204 ifeq ($(DYNAMIC_ARCH), 1)
205 $(MAKE) -C kernel commonlibs || exit 1
206 for d in $(DYNAMIC_CORE) ; \
207 do $(MAKE) GOTOBLAS_MAKEFILE= -C kernel TARGET_CORE=$$d kernel || exit 1 ;\
212 ln -fs $(LIBNAME_P) $(LIBPREFIX)_p.$(LIBSUFFIX)
213 for d in $(SUBDIRS) ../laswp exports ; \
214 do if test -d $$d; then \
215 $(MAKE) -C $$d $(@F) || exit 1 ; \
219 ifeq ($(NO_LAPACK), 1)
223 netlib : lapack_prebuild
224 ifeq ($(NOFORTRAN), $(filter 0,$(NOFORTRAN)))
225 @$(MAKE) -C $(NETLIB_LAPACK_DIR) lapacklib
226 @$(MAKE) -C $(NETLIB_LAPACK_DIR) tmglib
229 @$(MAKE) -C $(NETLIB_LAPACK_DIR) lapackelib
233 ifeq ($(NO_LAPACK), 1)
241 prof_lapack : lapack_prebuild
242 @$(MAKE) -C $(NETLIB_LAPACK_DIR) lapack_prof
245 ifeq ($(NOFORTRAN), $(filter 0,$(NOFORTRAN)))
246 -@echo "FORTRAN = $(FC)" > $(NETLIB_LAPACK_DIR)/make.inc
247 -@echo "OPTS = $(LAPACK_FFLAGS)" >> $(NETLIB_LAPACK_DIR)/make.inc
248 -@echo "POPTS = $(LAPACK_FPFLAGS)" >> $(NETLIB_LAPACK_DIR)/make.inc
249 -@echo "NOOPT = -O0 $(LAPACK_NOOPT)" >> $(NETLIB_LAPACK_DIR)/make.inc
250 -@echo "PNOOPT = $(LAPACK_FPFLAGS) -O0" >> $(NETLIB_LAPACK_DIR)/make.inc
251 -@echo "LOADOPTS = $(FFLAGS) $(EXTRALIB)" >> $(NETLIB_LAPACK_DIR)/make.inc
252 -@echo "CC = $(CC)" >> $(NETLIB_LAPACK_DIR)/make.inc
253 -@echo "override CFLAGS = $(LAPACK_CFLAGS)" >> $(NETLIB_LAPACK_DIR)/make.inc
254 -@echo "ARCH = $(AR)" >> $(NETLIB_LAPACK_DIR)/make.inc
255 -@echo "ARCHFLAGS = $(ARFLAGS) -ru" >> $(NETLIB_LAPACK_DIR)/make.inc
256 -@echo "RANLIB = $(RANLIB)" >> $(NETLIB_LAPACK_DIR)/make.inc
257 -@echo "LAPACKLIB = ../$(LIBNAME)" >> $(NETLIB_LAPACK_DIR)/make.inc
258 -@echo "TMGLIB = ../$(LIBNAME)" >> $(NETLIB_LAPACK_DIR)/make.inc
259 -@echo "BLASLIB = ../../../$(LIBNAME)" >> $(NETLIB_LAPACK_DIR)/make.inc
260 -@echo "LAPACKELIB = ../$(LIBNAME)" >> $(NETLIB_LAPACK_DIR)/make.inc
261 -@echo "LAPACKLIB_P = ../$(LIBNAME_P)" >> $(NETLIB_LAPACK_DIR)/make.inc
262 -@echo "SUFFIX = $(SUFFIX)" >> $(NETLIB_LAPACK_DIR)/make.inc
263 -@echo "PSUFFIX = $(PSUFFIX)" >> $(NETLIB_LAPACK_DIR)/make.inc
264 -@echo "CEXTRALIB = $(EXTRALIB)" >> $(NETLIB_LAPACK_DIR)/make.inc
265 ifeq ($(F_COMPILER), GFORTRAN)
266 -@echo "TIMER = INT_ETIME" >> $(NETLIB_LAPACK_DIR)/make.inc
268 ifeq ($(OSNAME), WINNT)
269 -@echo "LOADER = $(FC)" >> $(NETLIB_LAPACK_DIR)/make.inc
270 else ifeq ($(OSNAME), Haiku)
271 -@echo "LOADER = $(FC)" >> $(NETLIB_LAPACK_DIR)/make.inc
273 -@echo "LOADER = $(FC) -pthread" >> $(NETLIB_LAPACK_DIR)/make.inc
276 -@echo "LOADER = $(FC)" >> $(NETLIB_LAPACK_DIR)/make.inc
279 -@echo "TIMER = NONE" >> $(NETLIB_LAPACK_DIR)/make.inc
280 -@echo "LOADER = $(FC)" >> $(NETLIB_LAPACK_DIR)/make.inc
282 ifeq ($(BUILD_LAPACK_DEPRECATED), 1)
283 -@echo "BUILD_DEPRECATED = 1" >> $(NETLIB_LAPACK_DIR)/make.inc
285 -@echo "LAPACKE_WITH_TMG = 1" >> $(NETLIB_LAPACK_DIR)/make.inc
286 -@cat make.inc >> $(NETLIB_LAPACK_DIR)/make.inc
290 ifeq ($(NOFORTRAN), $(filter 0,$(NOFORTRAN)))
292 -wget http://www.netlib.org/lapack/timing/large.tgz;
297 ifeq ($(NOFORTRAN), $(filter 0,$(NOFORTRAN)))
299 -wget http://www.netlib.org/lapack/timing/timing.tgz;
303 lapack-timing : large.tgz timing.tgz
304 ifeq ($(NOFORTRAN), $(filter 0,$(NOFORTRAN)))
305 (cd $(NETLIB_LAPACK_DIR); $(TAR) zxf ../timing.tgz TIMING)
306 (cd $(NETLIB_LAPACK_DIR)/TIMING; $(TAR) zxf ../../large.tgz )
307 $(MAKE) -C $(NETLIB_LAPACK_DIR)/TIMING
312 (cd $(NETLIB_LAPACK_DIR)/TESTING && rm -f x* *.out)
313 $(MAKE) -j 1 -C $(NETLIB_LAPACK_DIR)/TESTING/EIG xeigtstc xeigtstd xeigtsts xeigtstz
314 $(MAKE) -j 1 -C $(NETLIB_LAPACK_DIR)/TESTING/LIN xlintstc xlintstd xlintstds xlintstrfd xlintstrfz xlintsts xlintstz xlintstzc xlintstrfs xlintstrfc
316 ( cd $(NETLIB_LAPACK_DIR)/INSTALL; make all; ./testlsame; ./testslamch; ./testdlamch; \
317 ./testsecond; ./testdsecnd; ./testieee; ./testversion )
318 (cd $(NETLIB_LAPACK_DIR); ./lapack_testing.py -r )
322 ( cd $(NETLIB_LAPACK_DIR)/INSTALL; ./testlsame; ./testslamch; ./testdlamch; \
323 ./testsecond; ./testdsecnd; ./testieee; ./testversion )
324 (cd $(NETLIB_LAPACK_DIR); ./lapack_testing.py -r )
328 (cd $(NETLIB_LAPACK_DIR)/BLAS/TESTING && rm -f x* *.out)
329 $(MAKE) -j 1 -C $(NETLIB_LAPACK_DIR) blas_testing
330 (cd $(NETLIB_LAPACK_DIR)/BLAS/TESTING && cat *.out)
336 $(MAKE) -f Makefile.install install
339 @for d in $(SUBDIRS_ALL) ; \
340 do if test -d $$d; then \
341 $(MAKE) -C $$d $(@F) || exit 1 ; \
345 @$(MAKE) -C kernel clean
347 @$(MAKE) -C reference clean
348 @rm -f *.$(LIBSUFFIX) *.so *~ *.exe getarch getarch_2nd *.dll *.lib *.$(SUFFIX) *.dwf $(LIBPREFIX).$(LIBSUFFIX) $(LIBPREFIX)_p.$(LIBSUFFIX) $(LIBPREFIX).so.$(MAJOR_VERSION) *.lnk myconfig.h
349 ifeq ($(OSNAME), Darwin)
350 @rm -rf getarch.dSYM getarch_2nd.dSYM
352 @rm -f Makefile.conf config.h Makefile_kernel.conf config_kernel.h st* *.dylib
353 @touch $(NETLIB_LAPACK_DIR)/make.inc
354 @$(MAKE) -C $(NETLIB_LAPACK_DIR) clean
355 @rm -f $(NETLIB_LAPACK_DIR)/make.inc $(NETLIB_LAPACK_DIR)/lapacke/include/lapacke_mangling.h
356 @$(MAKE) -C relapack clean
357 @rm -f *.grd Makefile.conf_last config_last.h
358 @(cd $(NETLIB_LAPACK_DIR)/TESTING && rm -f x* *.out testing_results.txt)