kusano 2b45e8
TOPDIR	= .
kusano 2b45e8
export GOTOBLAS_MAKEFILE = 1
kusano 2b45e8
-include $(TOPDIR)/Makefile.conf_last
kusano 2b45e8
include ./Makefile.system
kusano 2b45e8
kusano 2b45e8
OPENBLAS_INCLUDE_DIR:=$(PREFIX)/include
kusano 2b45e8
OPENBLAS_LIBRARY_DIR:=$(PREFIX)/lib
kusano 2b45e8
kusano 2b45e8
.PHONY : install
kusano 2b45e8
.NOTPARALLEL : install
kusano 2b45e8
kusano 2b45e8
lib.grd :
kusano 2b45e8
	$(error OpenBLAS: Please run "make" firstly)
kusano 2b45e8
kusano 2b45e8
install : 	lib.grd
kusano 2b45e8
	@-mkdir -p $(PREFIX)
kusano 2b45e8
	@-mkdir -p $(OPENBLAS_INCLUDE_DIR)
kusano 2b45e8
	@-mkdir -p $(OPENBLAS_LIBRARY_DIR)
kusano 2b45e8
	@echo Generating openblas_config.h in $(OPENBLAS_INCLUDE_DIR)
kusano 2b45e8
#for inc 
kusano 2b45e8
	@echo \#ifndef OPENBLAS_CONFIG_H > $(OPENBLAS_INCLUDE_DIR)/openblas_config.h
kusano 2b45e8
	@echo \#define OPENBLAS_CONFIG_H >> $(OPENBLAS_INCLUDE_DIR)/openblas_config.h
kusano 2b45e8
	@cat config_last.h >> $(OPENBLAS_INCLUDE_DIR)/openblas_config.h
kusano 2b45e8
	@echo \#define VERSION \" OpenBLAS $(VERSION) \" >> $(OPENBLAS_INCLUDE_DIR)/openblas_config.h
kusano 2b45e8
	@cat openblas_config_template.h >> $(OPENBLAS_INCLUDE_DIR)/openblas_config.h
kusano 2b45e8
	@echo \#endif  \/\* OPENBLAS_CONFIG_H \*\/ >> $(OPENBLAS_INCLUDE_DIR)/openblas_config.h
kusano 2b45e8
kusano 2b45e8
	@echo Generating f77blas.h in $(OPENBLAS_INCLUDE_DIR)
kusano 2b45e8
	@echo \#ifndef OPENBLAS_F77BLAS_H > $(OPENBLAS_INCLUDE_DIR)/f77blas.h
kusano 2b45e8
	@echo \#define OPENBLAS_F77BLAS_H >> $(OPENBLAS_INCLUDE_DIR)/f77blas.h
kusano 2b45e8
	@echo \#include \"openblas_config.h\" >> $(OPENBLAS_INCLUDE_DIR)/f77blas.h
kusano 2b45e8
	@cat common_interface.h >> $(OPENBLAS_INCLUDE_DIR)/f77blas.h
kusano 2b45e8
	@echo \#endif >> $(OPENBLAS_INCLUDE_DIR)/f77blas.h
kusano 2b45e8
kusano 2b45e8
	@echo Generating cblas.h in $(OPENBLAS_INCLUDE_DIR)
kusano 2b45e8
	@sed 's/common/openblas_config/g' cblas.h > $(OPENBLAS_INCLUDE_DIR)/cblas.h
kusano 2b45e8
kusano 2b45e8
ifndef NO_LAPACKE
kusano 2b45e8
	@echo Copying LAPACKE header files to $(OPENBLAS_LIBRARY_DIR)
kusano 2b45e8
	@-cp $(NETLIB_LAPACK_DIR)/lapacke/include/lapacke.h $(OPENBLAS_INCLUDE_DIR)/lapacke.h
kusano 2b45e8
	@-cp $(NETLIB_LAPACK_DIR)/lapacke/include/lapacke_config.h $(OPENBLAS_INCLUDE_DIR)/lapacke_config.h
kusano 2b45e8
	@-cp $(NETLIB_LAPACK_DIR)/lapacke/include/lapacke_mangling_with_flags.h $(OPENBLAS_INCLUDE_DIR)/lapacke_mangling.h
kusano 2b45e8
	@-cp $(NETLIB_LAPACK_DIR)/lapacke/include/lapacke_utils.h $(OPENBLAS_INCLUDE_DIR)/lapacke_utils.h
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
#for install static library 
kusano 2b45e8
	@echo Copy the static library to $(OPENBLAS_LIBRARY_DIR)
kusano 2b45e8
	@cp $(LIBNAME) $(OPENBLAS_LIBRARY_DIR)
kusano 2b45e8
	@-ln -fs $(OPENBLAS_LIBRARY_DIR)/$(LIBNAME) $(OPENBLAS_LIBRARY_DIR)/$(LIBPREFIX).$(LIBSUFFIX)
kusano 2b45e8
#for install shared library 
kusano 2b45e8
	@echo Copy the shared library to $(OPENBLAS_LIBRARY_DIR)
kusano 2b45e8
ifeq ($(OSNAME), Linux)
kusano 2b45e8
	-cp $(LIBSONAME) $(OPENBLAS_LIBRARY_DIR)
kusano 2b45e8
	-ln -fs $(OPENBLAS_LIBRARY_DIR)/$(LIBSONAME) $(OPENBLAS_LIBRARY_DIR)/$(LIBPREFIX).so
kusano 2b45e8
	-ln -fs $(OPENBLAS_LIBRARY_DIR)/$(LIBSONAME) $(OPENBLAS_LIBRARY_DIR)/$(LIBPREFIX).so.$(MAJOR_VERSION)
kusano 2b45e8
endif
kusano 2b45e8
ifeq ($(OSNAME), FreeBSD)
kusano 2b45e8
	-cp $(LIBSONAME) $(OPENBLAS_LIBRARY_DIR)
kusano 2b45e8
	-ln -fs $(OPENBLAS_LIBRARY_DIR)/$(LIBSONAME) $(OPENBLAS_LIBRARY_DIR)/$(LIBPREFIX).so
kusano 2b45e8
endif
kusano 2b45e8
ifeq ($(OSNAME), NetBSD)
kusano 2b45e8
	-cp $(LIBSONAME) $(OPENBLAS_LIBRARY_DIR)
kusano 2b45e8
	-ln -fs $(OPENBLAS_LIBRARY_DIR)/$(LIBSONAME) $(OPENBLAS_LIBRARY_DIR)/$(LIBPREFIX).so
kusano 2b45e8
endif
kusano 2b45e8
ifeq ($(OSNAME), Darwin)     
kusano 2b45e8
	-cp $(LIBDYNNAME) $(OPENBLAS_LIBRARY_DIR)
kusano 2b45e8
	-install_name_tool -id $(OPENBLAS_LIBRARY_DIR)/$(LIBDYNNAME) $(OPENBLAS_LIBRARY_DIR)/$(LIBDYNNAME)
kusano 2b45e8
	-ln -fs $(OPENBLAS_LIBRARY_DIR)/$(LIBDYNNAME) $(OPENBLAS_LIBRARY_DIR)/$(LIBPREFIX).dylib
kusano 2b45e8
endif
kusano 2b45e8
ifeq ($(OSNAME), WINNT)
kusano 2b45e8
	-cp $(LIBDLLNAME) $(OPENBLAS_LIBRARY_DIR)
kusano 2b45e8
	-ln -fs $(OPENBLAS_LIBRARY_DIR)/$(LIBDLLNAME) $(OPENBLAS_LIBRARY_DIR)/$(LIBPREFIX).dll
kusano 2b45e8
endif
kusano 2b45e8
ifeq ($(OSNAME), CYGWIN_NT)
kusano 2b45e8
	-cp $(LIBDLLNAME) $(OPENBLAS_LIBRARY_DIR)
kusano 2b45e8
	-ln -fs $(OPENBLAS_LIBRARY_DIR)/$(LIBDLLNAME) $(OPENBLAS_LIBRARY_DIR)/$(LIBPREFIX).dll
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
	@echo Install OK!
kusano 2b45e8