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 "Because absolute path issue, $(LIBDYNNAME) may not work under this directory."
62 @echo "Thus, you need run \"make PREFIX=/your_installation_path/ install\"."
65 @echo "To install the library, you can run \"make PREFIX=/path/to/your/installation install\"."
69 ifeq ($(OSNAME), Linux)
71 -ln -fs $(LIBSONAME) libopenblas.so
73 ifeq ($(OSNAME), FreeBSD)
75 -ln -fs $(LIBSONAME) libopenblas.so
77 ifeq ($(OSNAME), NetBSD)
79 -ln -fs $(LIBSONAME) libopenblas.so
81 ifeq ($(OSNAME), Darwin)
82 $(MAKE) -C exports dyn
83 -ln -fs $(LIBDYNNAME) libopenblas.dylib
85 ifeq ($(OSNAME), WINNT)
86 $(MAKE) -C exports dll
87 -ln -fs $(LIBDLLNAME) libopenblas.dll
89 ifeq ($(OSNAME), CYGWIN_NT)
90 $(MAKE) -C exports dll
91 -ln -fs $(LIBDLLNAME) libopenblas.dll
113 ifeq ($(CORE), UNKOWN)
114 $(error OpenBLAS: Detecting CPU failed. Please set TARGET explicitly, e.g. make TARGET=your_cpu_target. Please read README for the detail.)
116 ifeq ($(NOFORTRAN), 1)
117 $(error OpenBLAS: Detecting fortran compiler failed. Please install fortran compiler, e.g. gfortran, ifort, openf90.)
119 -ln -fs $(LIBNAME) libopenblas.$(LIBSUFFIX)
120 for d in $(SUBDIRS) ; \
121 do if test -d $$d; then \
122 $(MAKE) -C $$d $(@F) || exit 1 ; \
125 #Save the config files for installation
126 cp Makefile.conf Makefile.conf_last
127 cp config.h config_last.h
129 echo "#define QUAD_PRECISION">> config_last.h
131 ifeq ($(EXPRECISION), 1)
132 echo "#define EXPRECISION">> config_last.h
136 $(MAKE) -C kernel commonlibs || exit 1
137 for d in $(DYNAMIC_CORE) ; \
138 do $(MAKE) GOTOBLAS_MAKEFILE= -C kernel TARGET_CORE=$$d kernel || exit 1 ;\
140 echo DYNAMIC_ARCH=1 >> Makefile.conf_last
144 prof : prof_blas prof_lapack
147 ln -fs $(LIBNAME_P) libopenblas_p.$(LIBSUFFIX)
148 for d in $(SUBDIRS) ; \
149 do if test -d $$d; then \
150 $(MAKE) -C $$d prof || exit 1 ; \
154 $(MAKE) -C kernel commonprof || exit 1
158 ln -fs $(LIBNAME) libopenblas.$(LIBSUFFIX)
159 for d in $(BLASDIRS) ; \
160 do if test -d $$d; then \
161 $(MAKE) -C $$d libs || exit 1 ; \
166 ln -fs $(LIBNAME) libopenblas.$(LIBSUFFIX)
167 for d in $(BLASDIRS) ../laswp exports ; \
168 do if test -d $$d; then \
169 $(MAKE) -C $$d $(@F) || exit 1 ; \
173 $(MAKE) -C kernel commonlibs || exit 1
174 for d in $(DYNAMIC_CORE) ; \
175 do $(MAKE) GOTOBLAS_MAKEFILE= -C kernel TARGET_CORE=$$d kernel || exit 1 ;\
180 ln -fs $(LIBNAME_P) libopenblas_p.$(LIBSUFFIX)
181 for d in $(SUBDIRS) ../laswp exports ; \
182 do if test -d $$d; then \
183 $(MAKE) -C $$d $(@F) || exit 1 ; \
187 ifeq ($(NO_LAPACK), 1)
191 netlib : lapack-3.1.1 patch.for_lapack-3.1.1 lapack-3.1.1/make.inc
193 -@$(MAKE) -C lapack-3.1.1 lapacklib
197 prof_lapack : lapack-3.1.1 lapack-3.1.1/make.inc
198 -@$(MAKE) -C lapack-3.1.1 lapack_prof
200 lapack-3.1.1/make.inc :
202 -@echo "FORTRAN = $(FC)" > lapack-3.1.1/make.inc
203 -@echo "OPTS = $(FFLAGS)" >> lapack-3.1.1/make.inc
204 -@echo "POPTS = $(FPFLAGS)" >> lapack-3.1.1/make.inc
205 -@echo "NOOPT = $(FFLAGS) -O0" >> lapack-3.1.1/make.inc
206 -@echo "PNOOPT = $(FPFLAGS) -O0" >> lapack-3.1.1/make.inc
207 -@echo "LOADOPTS = $(FFLAGS) $(EXTRALIB)" >> lapack-3.1.1/make.inc
208 -@echo "ARCH = $(AR)" >> lapack-3.1.1/make.inc
209 -@echo "RANLIB = $(RANLIB)" >> lapack-3.1.1/make.inc
210 -@echo "LAPACKLIB = ../$(LIBNAME)" >> lapack-3.1.1/make.inc
211 -@echo "LAPACKLIB_P = ../$(LIBNAME_P)" >> lapack-3.1.1/make.inc
212 -@echo "SUFFIX = $(SUFFIX)" >> lapack-3.1.1/make.inc
213 -@echo "PSUFFIX = $(PSUFFIX)" >> lapack-3.1.1/make.inc
214 # -@echo "CEXTRALIB = $(CEXTRALIB)" >> lapack-3.1.1/make.inc
215 -@cat make.inc >> lapack-3.1.1/make.inc
218 lapack-3.1.1 : lapack-3.1.1.tgz
220 @if test `$(MD5SUM) lapack-3.1.1.tgz | $(AWK) '{print $$1}'` = 00b21551a899bcfbaa7b8443e1faeef9; then \
221 echo $(TAR) zxf $< ;\
222 $(TAR) zxf $< && (cd lapack-3.1.1; $(PATCH) -p1 < ../patch.for_lapack-3.1.1) ;\
224 echo " lapack-3.1.1.tgz check sum is wrong (Please use orignal)." ;\
225 rm -rf lapack-3.1.1 ;\
231 -wget http://www.netlib.org/lapack/lapack-3.1.1.tgz
236 -wget http://www.netlib.org/lapack/timing/large.tgz
241 -wget http://www.netlib.org/lapack/timing/timing.tgz
244 lapack-timing : lapack-3.1.1 large.tgz timing.tgz
246 (cd lapack-3.1.1; $(TAR) zxf ../timing.tgz TIMING)
247 (cd lapack-3.1.1/TIMING; $(TAR) zxf ../../large.tgz )
248 make -C lapack-3.1.1 tmglib
249 make -C lapack-3.1.1/TIMING
254 $(MAKE) -C lapack-3.1.1 tmglib
255 $(MAKE) -C lapack-3.1.1/TESTING xeigtstc xeigtstd xeigtsts xeigtstz xlintstc xlintstd xlintstds xlintsts xlintstz xlintstzc
256 @rm -f lapack-3.1.1/TESTING/*.out
257 $(MAKE) -j 1 -C lapack-3.1.1/TESTING
258 $(GREP) failed lapack-3.1.1/TESTING/*.out
263 $(MAKE) -f Makefile.install install
266 @for d in $(SUBDIRS_ALL) ; \
267 do if test -d $$d; then \
268 $(MAKE) -C $$d $(@F) || exit 1 ; \
272 @$(MAKE) -C kernel clean
274 @rm -f *.$(LIBSUFFIX) *.so *~ *.exe getarch getarch_2nd *.dll *.lib *.$(SUFFIX) *.dwf libopenblas.$(LIBSUFFIX) libopenblas_p.$(LIBSUFFIX) *.lnk myconfig.h
275 @rm -f Makefile.conf config.h Makefile_kernel.conf config_kernel.h st* *.dylib
276 @if test -d lapack-3.1.1; then \
277 echo deleting lapack-3.1.1; \
278 rm -rf lapack-3.1.1 ;\
280 @rm -f *.grd Makefile.conf_last config_last.h