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 ($(OSNAME), Darwin)
61 @echo "WARNING: If you plan to use the dynamic library $(LIBDYNNAME), you must run:"
63 @echo "\"make PREFIX=/your_installation_path/ install\"."
65 @echo "(or set PREFIX in Makefile.rule and run make install."
66 @echo "If you want to move the .dylib to a new location later, make sure you change"
67 @echo "the internal name of the dylib with:"
69 @echo "install_name_tool -id /new/absolute/path/to/$(LIBDYNNAME) $(LIBDYNNAME)"
72 @echo "To install the library, you can run \"make PREFIX=/path/to/your/installation install\"."
76 ifeq ($(OSNAME), Linux)
78 -ln -fs $(LIBSONAME) libopenblas.so
80 ifeq ($(OSNAME), FreeBSD)
82 -ln -fs $(LIBSONAME) libopenblas.so
84 ifeq ($(OSNAME), NetBSD)
86 -ln -fs $(LIBSONAME) libopenblas.so
88 ifeq ($(OSNAME), Darwin)
89 $(MAKE) -C exports dyn
90 -ln -fs $(LIBDYNNAME) libopenblas.dylib
92 ifeq ($(OSNAME), WINNT)
93 $(MAKE) -C exports dll
94 -ln -fs $(LIBDLLNAME) libopenblas.dll
96 ifeq ($(OSNAME), CYGWIN_NT)
97 $(MAKE) -C exports dll
98 -ln -fs $(LIBDLLNAME) libopenblas.dll
120 ifeq ($(CORE), UNKOWN)
121 $(error OpenBLAS: Detecting CPU failed. Please set TARGET explicitly, e.g. make TARGET=your_cpu_target. Please read README for the detail.)
123 ifeq ($(NOFORTRAN), 1)
124 $(error OpenBLAS: Detecting fortran compiler failed. Please install fortran compiler, e.g. gfortran, ifort, openf90.)
126 -ln -fs $(LIBNAME) libopenblas.$(LIBSUFFIX)
127 for d in $(SUBDIRS) ; \
128 do if test -d $$d; then \
129 $(MAKE) -C $$d $(@F) || exit 1 ; \
132 #Save the config files for installation
133 cp Makefile.conf Makefile.conf_last
134 cp config.h config_last.h
136 echo "#define QUAD_PRECISION">> config_last.h
138 ifeq ($(EXPRECISION), 1)
139 echo "#define EXPRECISION">> config_last.h
143 $(MAKE) -C kernel commonlibs || exit 1
144 for d in $(DYNAMIC_CORE) ; \
145 do $(MAKE) GOTOBLAS_MAKEFILE= -C kernel TARGET_CORE=$$d kernel || exit 1 ;\
147 echo DYNAMIC_ARCH=1 >> Makefile.conf_last
151 prof : prof_blas prof_lapack
154 ln -fs $(LIBNAME_P) libopenblas_p.$(LIBSUFFIX)
155 for d in $(SUBDIRS) ; \
156 do if test -d $$d; then \
157 $(MAKE) -C $$d prof || exit 1 ; \
161 $(MAKE) -C kernel commonprof || exit 1
165 ln -fs $(LIBNAME) libopenblas.$(LIBSUFFIX)
166 for d in $(BLASDIRS) ; \
167 do if test -d $$d; then \
168 $(MAKE) -C $$d libs || exit 1 ; \
173 ln -fs $(LIBNAME) libopenblas.$(LIBSUFFIX)
174 for d in $(BLASDIRS) ../laswp exports ; \
175 do if test -d $$d; then \
176 $(MAKE) -C $$d $(@F) || exit 1 ; \
180 $(MAKE) -C kernel commonlibs || exit 1
181 for d in $(DYNAMIC_CORE) ; \
182 do $(MAKE) GOTOBLAS_MAKEFILE= -C kernel TARGET_CORE=$$d kernel || exit 1 ;\
187 ln -fs $(LIBNAME_P) libopenblas_p.$(LIBSUFFIX)
188 for d in $(SUBDIRS) ../laswp exports ; \
189 do if test -d $$d; then \
190 $(MAKE) -C $$d $(@F) || exit 1 ; \
194 ifeq ($(NO_LAPACK), 1)
198 netlib : lapack-3.1.1 patch.for_lapack-3.1.1 lapack-3.1.1/make.inc
200 -@$(MAKE) -C lapack-3.1.1 lapacklib
204 prof_lapack : lapack-3.1.1 lapack-3.1.1/make.inc
205 -@$(MAKE) -C lapack-3.1.1 lapack_prof
207 lapack-3.1.1/make.inc :
209 -@echo "FORTRAN = $(FC)" > lapack-3.1.1/make.inc
210 -@echo "OPTS = $(FFLAGS)" >> lapack-3.1.1/make.inc
211 -@echo "POPTS = $(FPFLAGS)" >> lapack-3.1.1/make.inc
212 -@echo "NOOPT = $(FFLAGS) -O0" >> lapack-3.1.1/make.inc
213 -@echo "PNOOPT = $(FPFLAGS) -O0" >> lapack-3.1.1/make.inc
214 -@echo "LOADOPTS = $(FFLAGS) $(EXTRALIB)" >> lapack-3.1.1/make.inc
215 -@echo "ARCH = $(AR)" >> lapack-3.1.1/make.inc
216 -@echo "RANLIB = $(RANLIB)" >> lapack-3.1.1/make.inc
217 -@echo "LAPACKLIB = ../$(LIBNAME)" >> lapack-3.1.1/make.inc
218 -@echo "LAPACKLIB_P = ../$(LIBNAME_P)" >> lapack-3.1.1/make.inc
219 -@echo "SUFFIX = $(SUFFIX)" >> lapack-3.1.1/make.inc
220 -@echo "PSUFFIX = $(PSUFFIX)" >> lapack-3.1.1/make.inc
221 # -@echo "CEXTRALIB = $(CEXTRALIB)" >> lapack-3.1.1/make.inc
222 -@cat make.inc >> lapack-3.1.1/make.inc
225 lapack-3.1.1 : lapack-3.1.1.tgz
227 @if test `$(MD5SUM) lapack-3.1.1.tgz | $(AWK) '{print $$1}'` = 00b21551a899bcfbaa7b8443e1faeef9; then \
228 echo $(TAR) zxf $< ;\
229 $(TAR) zxf $< && (cd lapack-3.1.1; $(PATCH) -p1 < ../patch.for_lapack-3.1.1) ;\
231 echo " lapack-3.1.1.tgz check sum is wrong (Please use orignal)." ;\
232 rm -rf lapack-3.1.1 ;\
238 -wget http://www.netlib.org/lapack/lapack-3.1.1.tgz
243 -wget http://www.netlib.org/lapack/timing/large.tgz
248 -wget http://www.netlib.org/lapack/timing/timing.tgz
251 lapack-timing : lapack-3.1.1 large.tgz timing.tgz
253 (cd lapack-3.1.1; $(TAR) zxf ../timing.tgz TIMING)
254 (cd lapack-3.1.1/TIMING; $(TAR) zxf ../../large.tgz )
255 make -C lapack-3.1.1 tmglib
256 make -C lapack-3.1.1/TIMING
261 $(MAKE) -C lapack-3.1.1 tmglib
262 $(MAKE) -C lapack-3.1.1/TESTING xeigtstc xeigtstd xeigtsts xeigtstz xlintstc xlintstd xlintstds xlintsts xlintstz xlintstzc
263 @rm -f lapack-3.1.1/TESTING/*.out
264 $(MAKE) -j 1 -C lapack-3.1.1/TESTING
265 $(GREP) failed lapack-3.1.1/TESTING/*.out
270 $(MAKE) -f Makefile.install install
273 @for d in $(SUBDIRS_ALL) ; \
274 do if test -d $$d; then \
275 $(MAKE) -C $$d $(@F) || exit 1 ; \
279 @$(MAKE) -C kernel clean
281 @rm -f *.$(LIBSUFFIX) *.so *~ *.exe getarch getarch_2nd *.dll *.lib *.$(SUFFIX) *.dwf libopenblas.$(LIBSUFFIX) libopenblas_p.$(LIBSUFFIX) *.lnk myconfig.h
282 @rm -f Makefile.conf config.h Makefile_kernel.conf config_kernel.h st* *.dylib
283 @if test -d lapack-3.1.1; then \
284 echo deleting lapack-3.1.1; \
285 rm -rf lapack-3.1.1 ;\
287 @rm -f *.grd Makefile.conf_last config_last.h