Avoid truncating cblas.h when compiling gencblas target
[platform/upstream/openblas.git] / Makefile
index 2e37888..27923aa 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -7,10 +7,6 @@ ifneq ($(DYNAMIC_ARCH), 1)
 BLASDIRS += kernel
 endif
 
-ifdef UTEST_CHECK
-SANITY_CHECK = 1
-endif
-
 ifdef SANITY_CHECK
 BLASDIRS += reference
 endif
@@ -20,6 +16,8 @@ ifneq ($(NO_LAPACK), 1)
 SUBDIRS        += lapack
 endif
 
+LAPACK_NOOPT := $(filter-out -O0 -O1 -O2 -O3 -Ofast,$(LAPACK_FFLAGS))
+
 SUBDIRS_ALL = $(SUBDIRS) test ctest utest exports benchmark ../laswp ../bench
 
 .PHONY : all libs netlib test ctest shared install
@@ -83,22 +81,22 @@ endif
 
 shared :
 ifndef NO_SHARED
-ifeq ($(OSNAME), Linux)
+ifeq ($(OSNAME), $(filter $(OSNAME),Linux SunOS Android))
        @$(MAKE) -C exports so
-       @-ln -fs $(LIBSONAME) $(LIBPREFIX).so
-       @-ln -fs $(LIBSONAME) $(LIBPREFIX).so.$(MAJOR_VERSION)
+       @ln -fs $(LIBSONAME) $(LIBPREFIX).so
+       @ln -fs $(LIBSONAME) $(LIBPREFIX).so.$(MAJOR_VERSION)
 endif
 ifeq ($(OSNAME), FreeBSD)
        @$(MAKE) -C exports so
-       @-ln -fs $(LIBSONAME) $(LIBPREFIX).so
+       @ln -fs $(LIBSONAME) $(LIBPREFIX).so
 endif
 ifeq ($(OSNAME), NetBSD)
        @$(MAKE) -C exports so
-       @-ln -fs $(LIBSONAME) $(LIBPREFIX).so
+       @ln -fs $(LIBSONAME) $(LIBPREFIX).so
 endif
 ifeq ($(OSNAME), Darwin)
        @$(MAKE) -C exports dyn
-       @-ln -fs $(LIBDYNNAME) $(LIBPREFIX).dylib
+       @ln -fs $(LIBDYNNAME) $(LIBPREFIX).dylib
 endif
 ifeq ($(OSNAME), WINNT)
        @$(MAKE) -C exports dll
@@ -110,28 +108,22 @@ endif
 
 tests :
 ifndef NOFORTRAN
-ifndef TARGET
-ifndef CROSS
        touch $(LIBNAME)
 ifndef NO_FBLAS
        $(MAKE) -C test all
-ifdef UTEST_CHECK
        $(MAKE) -C utest all
 endif
-endif
 ifndef NO_CBLAS
        $(MAKE) -C ctest all
 endif
 endif
-endif
-endif
 
 libs :
 ifeq ($(CORE), UNKOWN)
        $(error OpenBLAS: Detecting CPU failed. Please set TARGET explicitly, e.g. make TARGET=your_cpu_target. Please read README for the detail.)
 endif
 ifeq ($(NOFORTRAN), 1)
-       $(error OpenBLAS: Detecting fortran compiler failed. Please install fortran compiler, e.g. gfortran, ifort, openf90.)
+       $(info OpenBLAS: Detecting fortran compiler failed. Cannot compile LAPACK. Only compile BLAS.)
 endif
 ifeq ($(NO_STATIC), 1)
 ifeq ($(NO_SHARED), 1)
@@ -231,7 +223,7 @@ ifndef NOFORTRAN
        -@echo "FORTRAN     = $(FC)" > $(NETLIB_LAPACK_DIR)/make.inc
        -@echo "OPTS        = $(LAPACK_FFLAGS)" >> $(NETLIB_LAPACK_DIR)/make.inc
        -@echo "POPTS       = $(LAPACK_FPFLAGS)" >> $(NETLIB_LAPACK_DIR)/make.inc
-       -@echo "NOOPT       = $(LAPACK_FFLAGS) -O0" >> $(NETLIB_LAPACK_DIR)/make.inc
+       -@echo "NOOPT       = -O0 $(LAPACK_NOOPT)" >> $(NETLIB_LAPACK_DIR)/make.inc
        -@echo "PNOOPT      = $(LAPACK_FPFLAGS) -O0" >> $(NETLIB_LAPACK_DIR)/make.inc
        -@echo "LOADOPTS    = $(FFLAGS) $(EXTRALIB)" >> $(NETLIB_LAPACK_DIR)/make.inc
        -@echo "CC          = $(CC)" >> $(NETLIB_LAPACK_DIR)/make.inc
@@ -247,10 +239,14 @@ ifndef NOFORTRAN
        -@echo "SUFFIX      = $(SUFFIX)" >> $(NETLIB_LAPACK_DIR)/make.inc
        -@echo "PSUFFIX     = $(PSUFFIX)" >> $(NETLIB_LAPACK_DIR)/make.inc
        -@echo "CEXTRALIB   = $(EXTRALIB)" >> $(NETLIB_LAPACK_DIR)/make.inc
-ifeq ($(FC), GFORTRAN)
+ifeq ($(F_COMPILER), GFORTRAN)
        -@echo "TIMER       = INT_ETIME" >> $(NETLIB_LAPACK_DIR)/make.inc
 ifdef SMP
+ifeq ($(OSNAME), WINNT)
+       -@echo "LOADER      = $(FC)" >> $(NETLIB_LAPACK_DIR)/make.inc
+else
        -@echo "LOADER      = $(FC) -pthread" >> $(NETLIB_LAPACK_DIR)/make.inc
+endif
 else
        -@echo "LOADER      = $(FC)" >> $(NETLIB_LAPACK_DIR)/make.inc
 endif
@@ -258,6 +254,9 @@ else
        -@echo "TIMER       = NONE" >> $(NETLIB_LAPACK_DIR)/make.inc
        -@echo "LOADER      = $(FC)" >> $(NETLIB_LAPACK_DIR)/make.inc
 endif
+ifeq ($(BUILD_LAPACK_DEPRECATED), 1)
+       -@echo "BUILD_DEPRECATED      = 1" >> $(NETLIB_LAPACK_DIR)/make.inc
+endif
        -@cat  make.inc >> $(NETLIB_LAPACK_DIR)/make.inc
 endif
 
@@ -279,18 +278,28 @@ lapack-timing : large.tgz timing.tgz
 ifndef NOFORTRAN
        (cd $(NETLIB_LAPACK_DIR); $(TAR) zxf ../timing.tgz TIMING)
        (cd $(NETLIB_LAPACK_DIR)/TIMING; $(TAR) zxf ../../large.tgz )
-       make -C $(NETLIB_LAPACK_DIR)/TIMING
+       $(MAKE) -C $(NETLIB_LAPACK_DIR)/TIMING
 endif
 
 
 lapack-test :
        (cd $(NETLIB_LAPACK_DIR)/TESTING && rm -f x* *.out)
-       make -j 1 -C $(NETLIB_LAPACK_DIR)/TESTING xeigtstc  xeigtstd  xeigtsts  xeigtstz  xlintstc  xlintstd  xlintstds  xlintstrfd  xlintstrfz  xlintsts  xlintstz  xlintstzc xlintstrfs xlintstrfc
+       $(MAKE) -j 1 -C $(NETLIB_LAPACK_DIR)/TESTING xeigtstc  xeigtstd  xeigtsts  xeigtstz  xlintstc  xlintstd  xlintstds  xlintstrfd  xlintstrfz  xlintsts  xlintstz  xlintstzc xlintstrfs xlintstrfc
+ifneq ($(CROSS), 1)
+       ( cd $(NETLIB_LAPACK_DIR)/INSTALL; ./testlsame; ./testslamch; ./testdlamch; \
+        ./testsecond; ./testdsecnd; ./testieee; ./testversion )
+       (cd $(NETLIB_LAPACK_DIR); ./lapack_testing.py -r )
+endif
+
+lapack-runtest:
+       ( cd $(NETLIB_LAPACK_DIR)/INSTALL; ./testlsame; ./testslamch; ./testdlamch; \
+        ./testsecond; ./testdsecnd; ./testieee; ./testversion )
        (cd $(NETLIB_LAPACK_DIR); ./lapack_testing.py -r )
 
+
 blas-test:
        (cd $(NETLIB_LAPACK_DIR)/BLAS && rm -f x* *.out)
-       make -j 1 -C $(NETLIB_LAPACK_DIR) blas_testing
+       $(MAKE) -j 1 -C $(NETLIB_LAPACK_DIR) blas_testing
        (cd $(NETLIB_LAPACK_DIR)/BLAS && cat *.out)
 
 
@@ -320,3 +329,8 @@ endif
        @rm -f *.grd Makefile.conf_last config_last.h
        @(cd $(NETLIB_LAPACK_DIR)/TESTING && rm -f x* *.out testing_results.txt)
        @echo Done.
+
+# Makefile debugging trick:
+# call print-VARIABLE to see the runtime value of any variable
+print-%:
+       @echo '$*=$($*)'