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 " GotoBLAS build complete."
36 @echo " OS ... $(OSNAME) "
37 @echo " Architecture ... $(ARCH) "
39 @echo " BINARY ... 32bit "
41 @echo " BINARY ... 64bit "
43 @echo " C compiler ... $(C_COMPILER) (command line : $(CC))"
44 @echo " Fortran compiler ... $(F_COMPILER) (command line : $(FC))"
45 ifneq ($(OSNAME), AIX)
46 @echo -n " Library Name ... $(LIBNAME)"
48 @echo " Library Name ... $(LIBNAME)"
52 @echo " (Single threaded) "
54 @echo " (Multi threaded; Max num-threads is $(NUM_THREADS))"
59 ifeq ($(OSNAME), Linux)
61 -ln -fs $(LIBSONAME) libopenblas.so
63 ifeq ($(OSNAME), FreeBSD)
65 -ln -fs $(LIBSONAME) libopenblas.so
67 ifeq ($(OSNAME), NetBSD)
69 -ln -fs $(LIBSONAME) libopenblas.so
71 ifeq ($(OSNAME), Darwin)
72 $(MAKE) -C exports dyn
73 -ln -fs $(LIBDYNNAME) libopenblas.dylib
75 ifeq ($(OSNAME), WINNT)
76 $(MAKE) -C exports dll
77 -ln -fs $(LIBDLLNAME) libopenblas.dll
79 ifeq ($(OSNAME), CYGWIN_NT)
80 $(MAKE) -C exports dll
81 -ln -fs $(LIBDLLNAME) libopenblas.dll
103 ifeq ($(CORE), UNKOWN)
104 $(error OpenBLAS: Detecting CPU failed. Please set TARGET explicitly, e.g. make TARGET=your_cpu_target. Please read README for the detail.)
106 ifeq ($(NOFORTRAN), 1)
107 $(error OpenBLAS: Detecting fortran compiler failed. Please install fortran compiler, e.g. gfortran, ifort, openf90.)
109 -ln -fs $(LIBNAME) libopenblas.$(LIBSUFFIX)
110 for d in $(SUBDIRS) ; \
111 do if test -d $$d; then \
112 $(MAKE) -C $$d $(@F) || exit 1 ; \
115 #Save the config files for installation
116 cp Makefile.conf Makefile.conf_last
117 cp config.h config_last.h
119 $(MAKE) -C kernel commonlibs || exit 1
120 for d in $(DYNAMIC_CORE) ; \
121 do $(MAKE) GOTOBLAS_MAKEFILE= -C kernel TARGET_CORE=$$d kernel || exit 1 ;\
123 echo DYNAMIC_ARCH=1 >> Makefile.conf_last
127 prof : prof_blas prof_lapack
130 ln -fs $(LIBNAME_P) libopenblas_p.$(LIBSUFFIX)
131 for d in $(SUBDIRS) ; \
132 do if test -d $$d; then \
133 $(MAKE) -C $$d prof || exit 1 ; \
137 $(MAKE) -C kernel commonprof || exit 1
141 ln -fs $(LIBNAME) libopenblas.$(LIBSUFFIX)
142 for d in $(BLASDIRS) ; \
143 do if test -d $$d; then \
144 $(MAKE) -C $$d libs || exit 1 ; \
149 ln -fs $(LIBNAME) libopenblas.$(LIBSUFFIX)
150 for d in $(BLASDIRS) ../laswp exports ; \
151 do if test -d $$d; then \
152 $(MAKE) -C $$d $(@F) || exit 1 ; \
156 $(MAKE) -C kernel commonlibs || exit 1
157 for d in $(DYNAMIC_CORE) ; \
158 do $(MAKE) GOTOBLAS_MAKEFILE= -C kernel TARGET_CORE=$$d kernel || exit 1 ;\
163 ln -fs $(LIBNAME_P) libopenblas_p.$(LIBSUFFIX)
164 for d in $(SUBDIRS) ../laswp exports ; \
165 do if test -d $$d; then \
166 $(MAKE) -C $$d $(@F) || exit 1 ; \
170 ifeq ($(NO_LAPACK), 1)
174 netlib : lapack-3.1.1 patch.for_lapack-3.1.1 lapack-3.1.1/make.inc
176 -@$(MAKE) -C lapack-3.1.1 lapacklib
180 prof_lapack : lapack-3.1.1 lapack-3.1.1/make.inc
181 -@$(MAKE) -C lapack-3.1.1 lapack_prof
183 lapack-3.1.1/make.inc :
185 -@echo "FORTRAN = $(FC)" > lapack-3.1.1/make.inc
186 -@echo "OPTS = $(FFLAGS)" >> lapack-3.1.1/make.inc
187 -@echo "POPTS = $(FPFLAGS)" >> lapack-3.1.1/make.inc
188 -@echo "NOOPT = $(FFLAGS) -O0" >> lapack-3.1.1/make.inc
189 -@echo "PNOOPT = $(FPFLAGS) -O0" >> lapack-3.1.1/make.inc
190 -@echo "LOADOPTS = $(FFLAGS) $(EXTRALIB)" >> lapack-3.1.1/make.inc
191 -@echo "ARCH = $(AR)" >> lapack-3.1.1/make.inc
192 -@echo "RANLIB = $(RANLIB)" >> lapack-3.1.1/make.inc
193 -@echo "LAPACKLIB = ../$(LIBNAME)" >> lapack-3.1.1/make.inc
194 -@echo "LAPACKLIB_P = ../$(LIBNAME_P)" >> lapack-3.1.1/make.inc
195 -@echo "SUFFIX = $(SUFFIX)" >> lapack-3.1.1/make.inc
196 -@echo "PSUFFIX = $(PSUFFIX)" >> lapack-3.1.1/make.inc
197 # -@echo "CEXTRALIB = $(CEXTRALIB)" >> lapack-3.1.1/make.inc
198 -@cat make.inc >> lapack-3.1.1/make.inc
201 lapack-3.1.1 : lapack-3.1.1.tgz
203 @if test `$(MD5SUM) lapack-3.1.1.tgz | $(AWK) '{print $$1}'` = 00b21551a899bcfbaa7b8443e1faeef9; then \
204 echo $(TAR) zxf $< ;\
205 $(TAR) zxf $< && (cd lapack-3.1.1; $(PATCH) -p1 < ../patch.for_lapack-3.1.1) ;\
207 echo " lapack-3.1.1.tgz check sum is wrong (Please use orignal)." ;\
208 rm -rf lapack-3.1.1 ;\
214 -wget http://www.netlib.org/lapack/lapack-3.1.1.tgz
219 -wget http://www.netlib.org/lapack/timing/large.tgz
224 -wget http://www.netlib.org/lapack/timing/timing.tgz
227 lapack-timing : lapack-3.1.1 large.tgz timing.tgz
229 (cd lapack-3.1.1; $(TAR) zxf ../timing.tgz TIMING)
230 (cd lapack-3.1.1/TIMING; $(TAR) zxf ../../large.tgz )
231 make -C lapack-3.1.1 tmglib
232 make -C lapack-3.1.1/TIMING
237 $(MAKE) -C lapack-3.1.1 tmglib
238 $(MAKE) -C lapack-3.1.1/TESTING xeigtstc xeigtstd xeigtsts xeigtstz xlintstc xlintstd xlintstds xlintsts xlintstz xlintstzc
239 @rm -f lapack-3.1.1/TESTING/*.out
240 $(MAKE) -j 1 -C lapack-3.1.1/TESTING
241 $(GREP) failed lapack-3.1.1/TESTING/*.out
246 $(MAKE) -f Makefile.install install
249 @for d in $(SUBDIRS_ALL) ; \
250 do if test -d $$d; then \
251 $(MAKE) -C $$d $(@F) || exit 1 ; \
255 @$(MAKE) -C kernel clean
257 @rm -f *.$(LIBSUFFIX) *.so *~ *.exe getarch getarch_2nd *.dll *.lib *.$(SUFFIX) *.dwf libopenblas.$(LIBSUFFIX) libopenblas_p.$(LIBSUFFIX) *.lnk myconfig.h
258 @rm -f Makefile.conf config.h Makefile_kernel.conf config_kernel.h st* *.dylib
259 @if test -d lapack-3.1.1; then \
260 echo deleting lapack-3.1.1; \
261 rm -rf lapack-3.1.1 ;\
263 @rm -f *.grd Makefile.conf_last config_last.h