2 include ./Makefile.system
4 BLASDIRS = interface driver/level2 driver/level3 driver/others
19 PREFIX = /opt/OpenBLAS
23 ifneq ($(NO_LAPACK), 1)
27 SUBDIRS_ALL = $(SUBDIRS) test ctest utest exports benchmark ../laswp ../bench
29 .PHONY : all libs netlib test ctest shared install
30 .NOTPARALLEL : all libs prof lapack-test install
32 all :: libs netlib tests shared
34 @echo " OpenBLAS build complete."
36 @echo " OS ... $(OSNAME) "
37 @echo " Architecture ... $(ARCH) "
39 @echo " BINARY ... 32bit "
41 @echo " BINARY ... 64bit "
44 @echo " Use 64 bits int (equivalent to \"-i8\" in Fortran) "
46 @echo " C compiler ... $(C_COMPILER) (command line : $(CC))"
47 @echo " Fortran compiler ... $(F_COMPILER) (command line : $(FC))"
48 ifneq ($(OSNAME), AIX)
49 @echo -n " Library Name ... $(LIBNAME)"
51 @echo " Library Name ... $(LIBNAME)"
55 @echo " (Single threaded) "
57 @echo " (Multi threaded; Max num-threads is $(NUM_THREADS))"
60 ifeq ($(USE_OPENMP), 1)
62 @echo " Use OpenMP in the multithreading. Becasue of ignoring OPENBLAS_NUM_THREADS and GOTO_NUM_THREADS flags, "
63 @echo " you should use OMP_NUM_THREADS environment variable to control the number of threads."
67 ifeq ($(OSNAME), Darwin)
68 @echo "WARNING: If you plan to use the dynamic library $(LIBDYNNAME), you must run:"
70 @echo "\"make PREFIX=/your_installation_path/ install\"."
72 @echo "(or set PREFIX in Makefile.rule and run make install."
73 @echo "If you want to move the .dylib to a new location later, make sure you change"
74 @echo "the internal name of the dylib with:"
76 @echo "install_name_tool -id /new/absolute/path/to/$(LIBDYNNAME) $(LIBDYNNAME)"
79 @echo "To install the library, you can run \"make PREFIX=/path/to/your/installation install\"."
83 ifeq ($(OSNAME), Linux)
85 -ln -fs $(LIBSONAME) libopenblas.so
87 ifeq ($(OSNAME), FreeBSD)
89 -ln -fs $(LIBSONAME) libopenblas.so
91 ifeq ($(OSNAME), NetBSD)
93 -ln -fs $(LIBSONAME) libopenblas.so
95 ifeq ($(OSNAME), Darwin)
96 $(MAKE) -C exports dyn
97 -ln -fs $(LIBDYNNAME) libopenblas.dylib
99 ifeq ($(OSNAME), WINNT)
100 $(MAKE) -C exports dll
101 -ln -fs $(LIBDLLNAME) libopenblas.dll
103 ifeq ($(OSNAME), CYGWIN_NT)
104 $(MAKE) -C exports dll
105 -ln -fs $(LIBDLLNAME) libopenblas.dll
127 ifeq ($(CORE), UNKOWN)
128 $(error OpenBLAS: Detecting CPU failed. Please set TARGET explicitly, e.g. make TARGET=your_cpu_target. Please read README for the detail.)
130 ifeq ($(NOFORTRAN), 1)
131 $(error OpenBLAS: Detecting fortran compiler failed. Please install fortran compiler, e.g. gfortran, ifort, openf90.)
133 -ln -fs $(LIBNAME) libopenblas.$(LIBSUFFIX)
134 for d in $(SUBDIRS) ; \
135 do if test -d $$d; then \
136 $(MAKE) -C $$d $(@F) || exit 1 ; \
139 #Save the config files for installation
140 cp Makefile.conf Makefile.conf_last
141 cp config.h config_last.h
143 echo "#define QUAD_PRECISION">> config_last.h
145 ifeq ($(EXPRECISION), 1)
146 echo "#define EXPRECISION">> config_last.h
150 $(MAKE) -C kernel commonlibs || exit 1
151 for d in $(DYNAMIC_CORE) ; \
152 do $(MAKE) GOTOBLAS_MAKEFILE= -C kernel TARGET_CORE=$$d kernel || exit 1 ;\
154 echo DYNAMIC_ARCH=1 >> Makefile.conf_last
158 prof : prof_blas prof_lapack
161 ln -fs $(LIBNAME_P) libopenblas_p.$(LIBSUFFIX)
162 for d in $(SUBDIRS) ; \
163 do if test -d $$d; then \
164 $(MAKE) -C $$d prof || exit 1 ; \
168 $(MAKE) -C kernel commonprof || exit 1
172 ln -fs $(LIBNAME) libopenblas.$(LIBSUFFIX)
173 for d in $(BLASDIRS) ; \
174 do if test -d $$d; then \
175 $(MAKE) -C $$d libs || exit 1 ; \
180 ln -fs $(LIBNAME) libopenblas.$(LIBSUFFIX)
181 for d in $(BLASDIRS) ../laswp exports ; \
182 do if test -d $$d; then \
183 $(MAKE) -C $$d $(@F) || exit 1 ; \
187 $(MAKE) -C kernel commonlibs || exit 1
188 for d in $(DYNAMIC_CORE) ; \
189 do $(MAKE) GOTOBLAS_MAKEFILE= -C kernel TARGET_CORE=$$d kernel || exit 1 ;\
194 ln -fs $(LIBNAME_P) libopenblas_p.$(LIBSUFFIX)
195 for d in $(SUBDIRS) ../laswp exports ; \
196 do if test -d $$d; then \
197 $(MAKE) -C $$d $(@F) || exit 1 ; \
201 ifeq ($(NO_LAPACK), 1)
205 netlib : lapack-3.4.0 patch.for_lapack-3.4.0 lapack-3.4.0/make.inc
207 -@$(MAKE) -C lapack-3.4.0 lapacklib
211 prof_lapack : lapack-3.4.0 lapack-3.4.0/make.inc
212 -@$(MAKE) -C lapack-3.4.0 lapack_prof
214 lapack-3.4.0/make.inc :
216 -@echo "FORTRAN = $(FC)" > lapack-3.4.0/make.inc
217 -@echo "OPTS = $(FFLAGS)" >> lapack-3.4.0/make.inc
218 -@echo "POPTS = $(FPFLAGS)" >> lapack-3.4.0/make.inc
219 -@echo "NOOPT = $(FFLAGS) -O0" >> lapack-3.4.0/make.inc
220 -@echo "PNOOPT = $(FPFLAGS) -O0" >> lapack-3.4.0/make.inc
221 -@echo "LOADOPTS = $(FFLAGS) $(EXTRALIB)" >> lapack-3.4.0/make.inc
222 -@echo "ARCH = $(AR)" >> lapack-3.4.0/make.inc
223 -@echo "RANLIB = $(RANLIB)" >> lapack-3.4.0/make.inc
224 -@echo "LAPACKLIB = ../$(LIBNAME)" >> lapack-3.4.0/make.inc
225 -@echo "LAPACKLIB_P = ../$(LIBNAME_P)" >> lapack-3.4.0/make.inc
226 -@echo "SUFFIX = $(SUFFIX)" >> lapack-3.4.0/make.inc
227 -@echo "PSUFFIX = $(PSUFFIX)" >> lapack-3.4.0/make.inc
228 # -@echo "CEXTRALIB = $(CEXTRALIB)" >> lapack-3.4.0/make.inc
229 -@cat make.inc >> lapack-3.4.0/make.inc
232 lapack-3.4.0 : lapack-3.4.0.tgz
234 @if test `$(MD5SUM) lapack-3.4.0.tgz | $(AWK) '{print $$1}'` = 02d5706ec03ba885fc246e5fa10d8c70; then \
235 echo $(TAR) zxf $< ;\
236 $(TAR) zxf $< && (cd lapack-3.4.0; $(PATCH) -p1 < ../patch.for_lapack-3.4.0) ;\
238 echo " lapack-3.4.0.tgz check sum is wrong (Please use orignal)." ;\
239 rm -rf lapack-3.4.0 ;\
245 -wget http://www.netlib.org/lapack/lapack-3.4.0.tgz
250 -wget http://www.netlib.org/lapack/timing/large.tgz
255 -wget http://www.netlib.org/lapack/timing/timing.tgz
258 lapack-timing : lapack-3.4.0 large.tgz timing.tgz
260 (cd lapack-3.4.0; $(TAR) zxf ../timing.tgz TIMING)
261 (cd lapack-3.4.0/TIMING; $(TAR) zxf ../../large.tgz )
262 make -C lapack-3.4.0 tmglib
263 make -C lapack-3.4.0/TIMING
268 $(MAKE) -C lapack-3.4.0 tmglib
269 $(MAKE) -C lapack-3.4.0/TESTING xeigtstc xeigtstd xeigtsts xeigtstz xlintstc xlintstd xlintstds xlintsts xlintstz xlintstzc
270 @rm -f lapack-3.4.0/TESTING/*.out
271 $(MAKE) -j 1 -C lapack-3.4.0/TESTING
272 $(GREP) failed lapack-3.4.0/TESTING/*.out
277 $(MAKE) -f Makefile.install install
280 @for d in $(SUBDIRS_ALL) ; \
281 do if test -d $$d; then \
282 $(MAKE) -C $$d $(@F) || exit 1 ; \
286 @$(MAKE) -C kernel clean
288 @rm -f *.$(LIBSUFFIX) *.so *~ *.exe getarch getarch_2nd *.dll *.lib *.$(SUFFIX) *.dwf libopenblas.$(LIBSUFFIX) libopenblas_p.$(LIBSUFFIX) *.lnk myconfig.h
289 @rm -f Makefile.conf config.h Makefile_kernel.conf config_kernel.h st* *.dylib
290 @if test -d lapack-3.4.0; then \
291 echo deleting lapack-3.4.0; \
292 rm -rf lapack-3.4.0 ;\
294 @rm -f *.grd Makefile.conf_last config_last.h