Blob Blame Raw
TOPDIR	= .
export GOTOBLAS_MAKEFILE = 1
-include $(TOPDIR)/Makefile.conf_last
include ./Makefile.system

OPENBLAS_INCLUDE_DIR:=$(PREFIX)/include
OPENBLAS_LIBRARY_DIR:=$(PREFIX)/lib

.PHONY : install
.NOTPARALLEL : install

lib.grd :
	$(error OpenBLAS: Please run "make" firstly)

install : 	lib.grd
	@-mkdir -p $(PREFIX)
	@-mkdir -p $(OPENBLAS_INCLUDE_DIR)
	@-mkdir -p $(OPENBLAS_LIBRARY_DIR)
	@echo Generating openblas_config.h in $(OPENBLAS_INCLUDE_DIR)
#for inc 
	@echo \#ifndef OPENBLAS_CONFIG_H > $(OPENBLAS_INCLUDE_DIR)/openblas_config.h
	@echo \#define OPENBLAS_CONFIG_H >> $(OPENBLAS_INCLUDE_DIR)/openblas_config.h
	@cat config_last.h >> $(OPENBLAS_INCLUDE_DIR)/openblas_config.h
	@echo \#define VERSION \" OpenBLAS $(VERSION) \" >> $(OPENBLAS_INCLUDE_DIR)/openblas_config.h
	@cat openblas_config_template.h >> $(OPENBLAS_INCLUDE_DIR)/openblas_config.h
	@echo \#endif  \/\* OPENBLAS_CONFIG_H \*\/ >> $(OPENBLAS_INCLUDE_DIR)/openblas_config.h

	@echo Generating f77blas.h in $(OPENBLAS_INCLUDE_DIR)
	@echo \#ifndef OPENBLAS_F77BLAS_H > $(OPENBLAS_INCLUDE_DIR)/f77blas.h
	@echo \#define OPENBLAS_F77BLAS_H >> $(OPENBLAS_INCLUDE_DIR)/f77blas.h
	@echo \#include \"openblas_config.h\" >> $(OPENBLAS_INCLUDE_DIR)/f77blas.h
	@cat common_interface.h >> $(OPENBLAS_INCLUDE_DIR)/f77blas.h
	@echo \#endif >> $(OPENBLAS_INCLUDE_DIR)/f77blas.h

	@echo Generating cblas.h in $(OPENBLAS_INCLUDE_DIR)
	@sed 's/common/openblas_config/g' cblas.h > $(OPENBLAS_INCLUDE_DIR)/cblas.h

ifndef NO_LAPACKE
	@echo Copying LAPACKE header files to $(OPENBLAS_LIBRARY_DIR)
	@-cp $(NETLIB_LAPACK_DIR)/lapacke/include/lapacke.h $(OPENBLAS_INCLUDE_DIR)/lapacke.h
	@-cp $(NETLIB_LAPACK_DIR)/lapacke/include/lapacke_config.h $(OPENBLAS_INCLUDE_DIR)/lapacke_config.h
	@-cp $(NETLIB_LAPACK_DIR)/lapacke/include/lapacke_mangling_with_flags.h $(OPENBLAS_INCLUDE_DIR)/lapacke_mangling.h
	@-cp $(NETLIB_LAPACK_DIR)/lapacke/include/lapacke_utils.h $(OPENBLAS_INCLUDE_DIR)/lapacke_utils.h
endif

#for install static library 
	@echo Copy the static library to $(OPENBLAS_LIBRARY_DIR)
	@cp $(LIBNAME) $(OPENBLAS_LIBRARY_DIR)
	@-ln -fs $(OPENBLAS_LIBRARY_DIR)/$(LIBNAME) $(OPENBLAS_LIBRARY_DIR)/$(LIBPREFIX).$(LIBSUFFIX)
#for install shared library 
	@echo Copy the shared library to $(OPENBLAS_LIBRARY_DIR)
ifeq ($(OSNAME), Linux)
	-cp $(LIBSONAME) $(OPENBLAS_LIBRARY_DIR)
	-ln -fs $(OPENBLAS_LIBRARY_DIR)/$(LIBSONAME) $(OPENBLAS_LIBRARY_DIR)/$(LIBPREFIX).so
	-ln -fs $(OPENBLAS_LIBRARY_DIR)/$(LIBSONAME) $(OPENBLAS_LIBRARY_DIR)/$(LIBPREFIX).so.$(MAJOR_VERSION)
endif
ifeq ($(OSNAME), FreeBSD)
	-cp $(LIBSONAME) $(OPENBLAS_LIBRARY_DIR)
	-ln -fs $(OPENBLAS_LIBRARY_DIR)/$(LIBSONAME) $(OPENBLAS_LIBRARY_DIR)/$(LIBPREFIX).so
endif
ifeq ($(OSNAME), NetBSD)
	-cp $(LIBSONAME) $(OPENBLAS_LIBRARY_DIR)
	-ln -fs $(OPENBLAS_LIBRARY_DIR)/$(LIBSONAME) $(OPENBLAS_LIBRARY_DIR)/$(LIBPREFIX).so
endif
ifeq ($(OSNAME), Darwin)     
	-cp $(LIBDYNNAME) $(OPENBLAS_LIBRARY_DIR)
	-install_name_tool -id $(OPENBLAS_LIBRARY_DIR)/$(LIBDYNNAME) $(OPENBLAS_LIBRARY_DIR)/$(LIBDYNNAME)
	-ln -fs $(OPENBLAS_LIBRARY_DIR)/$(LIBDYNNAME) $(OPENBLAS_LIBRARY_DIR)/$(LIBPREFIX).dylib
endif
ifeq ($(OSNAME), WINNT)
	-cp $(LIBDLLNAME) $(OPENBLAS_LIBRARY_DIR)
	-ln -fs $(OPENBLAS_LIBRARY_DIR)/$(LIBDLLNAME) $(OPENBLAS_LIBRARY_DIR)/$(LIBPREFIX).dll
endif
ifeq ($(OSNAME), CYGWIN_NT)
	-cp $(LIBDLLNAME) $(OPENBLAS_LIBRARY_DIR)
	-ln -fs $(OPENBLAS_LIBRARY_DIR)/$(LIBDLLNAME) $(OPENBLAS_LIBRARY_DIR)/$(LIBPREFIX).dll
endif

	@echo Install OK!