Add DESTDIR support for easier building on RPM based distros.
Use install command instead of cp to install files with permissions control.
This commit is contained in:
parent
0f6e79f918
commit
2f0d2ce1ea
|
@ -3,11 +3,11 @@ export GOTOBLAS_MAKEFILE = 1
|
||||||
-include $(TOPDIR)/Makefile.conf_last
|
-include $(TOPDIR)/Makefile.conf_last
|
||||||
include ./Makefile.system
|
include ./Makefile.system
|
||||||
|
|
||||||
PREFIX?=/opt/OpenBLAS
|
PREFIX ?= /opt/OpenBLAS
|
||||||
|
|
||||||
OPENBLAS_INCLUDE_DIR:=$(PREFIX)/include
|
OPENBLAS_INCLUDE_DIR := $(PREFIX)/include
|
||||||
OPENBLAS_LIBRARY_DIR:=$(PREFIX)/lib
|
OPENBLAS_LIBRARY_DIR := $(PREFIX)/lib
|
||||||
OPENBLAS_BUILD_DIR:=$(CURDIR)
|
OPENBLAS_BUILD_DIR := $(CURDIR)
|
||||||
|
|
||||||
.PHONY : install
|
.PHONY : install
|
||||||
.NOTPARALLEL : install
|
.NOTPARALLEL : install
|
||||||
|
@ -16,65 +16,65 @@ lib.grd :
|
||||||
$(error OpenBLAS: Please run "make" firstly)
|
$(error OpenBLAS: Please run "make" firstly)
|
||||||
|
|
||||||
install : lib.grd
|
install : lib.grd
|
||||||
@-mkdir -p $(PREFIX)
|
@-mkdir -p $(DESTDIR)$(PREFIX)
|
||||||
@-mkdir -p $(OPENBLAS_INCLUDE_DIR)
|
@-mkdir -p $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)
|
||||||
@-mkdir -p $(OPENBLAS_LIBRARY_DIR)
|
@-mkdir -p $(DESTDIR)$(OPENBLAS_LIBRARY_DIR)
|
||||||
@echo Generating openblas_config.h in $(OPENBLAS_INCLUDE_DIR)
|
@echo Generating openblas_config.h in $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)
|
||||||
#for inc
|
#for inc
|
||||||
@echo \#ifndef OPENBLAS_CONFIG_H > $(OPENBLAS_INCLUDE_DIR)/openblas_config.h
|
@echo \#ifndef OPENBLAS_CONFIG_H > $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)/openblas_config.h
|
||||||
@echo \#define OPENBLAS_CONFIG_H >> $(OPENBLAS_INCLUDE_DIR)/openblas_config.h
|
@echo \#define OPENBLAS_CONFIG_H >> $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)/openblas_config.h
|
||||||
@awk '{print $$1, "OPENBLAS_"$$2, $$3}' config_last.h >> $(OPENBLAS_INCLUDE_DIR)/openblas_config.h
|
@awk '{print $$1, "OPENBLAS_"$$2, $$3}' config_last.h >> $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)/openblas_config.h
|
||||||
@echo \#define OPENBLAS_VERSION \" OpenBLAS $(VERSION) \" >> $(OPENBLAS_INCLUDE_DIR)/openblas_config.h
|
@echo \#define OPENBLAS_VERSION \" OpenBLAS $(VERSION) \" >> $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)/openblas_config.h
|
||||||
@cat openblas_config_template.h >> $(OPENBLAS_INCLUDE_DIR)/openblas_config.h
|
@cat openblas_config_template.h >> $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)/openblas_config.h
|
||||||
@echo \#endif \/\* OPENBLAS_CONFIG_H \*\/ >> $(OPENBLAS_INCLUDE_DIR)/openblas_config.h
|
@echo \#endif \/\* OPENBLAS_CONFIG_H \*\/ >> $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)/openblas_config.h
|
||||||
|
|
||||||
@echo Generating f77blas.h in $(OPENBLAS_INCLUDE_DIR)
|
@echo Generating f77blas.h in $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)
|
||||||
@echo \#ifndef OPENBLAS_F77BLAS_H > $(OPENBLAS_INCLUDE_DIR)/f77blas.h
|
@echo \#ifndef OPENBLAS_F77BLAS_H > $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)/f77blas.h
|
||||||
@echo \#define OPENBLAS_F77BLAS_H >> $(OPENBLAS_INCLUDE_DIR)/f77blas.h
|
@echo \#define OPENBLAS_F77BLAS_H >> $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)/f77blas.h
|
||||||
@echo \#include \"openblas_config.h\" >> $(OPENBLAS_INCLUDE_DIR)/f77blas.h
|
@echo \#include \"openblas_config.h\" >> $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)/f77blas.h
|
||||||
@cat common_interface.h >> $(OPENBLAS_INCLUDE_DIR)/f77blas.h
|
@cat common_interface.h >> $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)/f77blas.h
|
||||||
@echo \#endif >> $(OPENBLAS_INCLUDE_DIR)/f77blas.h
|
@echo \#endif >> $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)/f77blas.h
|
||||||
|
|
||||||
ifndef NO_CBLAS
|
ifndef NO_CBLAS
|
||||||
@echo Generating cblas.h in $(OPENBLAS_INCLUDE_DIR)
|
@echo Generating cblas.h in $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)
|
||||||
@sed 's/common/openblas_config/g' cblas.h > $(OPENBLAS_INCLUDE_DIR)/cblas.h
|
@sed 's/common/openblas_config/g' cblas.h > $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)/cblas.h
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifndef NO_LAPACKE
|
ifndef NO_LAPACKE
|
||||||
@echo Copying LAPACKE header files to $(OPENBLAS_LIBRARY_DIR)
|
@echo Copying LAPACKE header files to $(DESTDIR)$(OPENBLAS_LIBRARY_DIR)
|
||||||
@-cp $(NETLIB_LAPACK_DIR)/lapacke/include/lapacke.h $(OPENBLAS_INCLUDE_DIR)/lapacke.h
|
@-install -pDm644 $(NETLIB_LAPACK_DIR)/lapacke/include/lapacke.h $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)/lapacke.h
|
||||||
@-cp $(NETLIB_LAPACK_DIR)/lapacke/include/lapacke_config.h $(OPENBLAS_INCLUDE_DIR)/lapacke_config.h
|
@-install -pDm644 $(NETLIB_LAPACK_DIR)/lapacke/include/lapacke_config.h $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)/lapacke_config.h
|
||||||
@-cp $(NETLIB_LAPACK_DIR)/lapacke/include/lapacke_mangling_with_flags.h $(OPENBLAS_INCLUDE_DIR)/lapacke_mangling.h
|
@-install -pDm644 $(NETLIB_LAPACK_DIR)/lapacke/include/lapacke_mangling_with_flags.h $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)/lapacke_mangling.h
|
||||||
@-cp $(NETLIB_LAPACK_DIR)/lapacke/include/lapacke_utils.h $(OPENBLAS_INCLUDE_DIR)/lapacke_utils.h
|
@-install -pDm644 $(NETLIB_LAPACK_DIR)/lapacke/include/lapacke_utils.h $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)/lapacke_utils.h
|
||||||
endif
|
endif
|
||||||
|
|
||||||
#for install static library
|
#for install static library
|
||||||
@echo Copy the static library to $(OPENBLAS_LIBRARY_DIR)
|
@echo Copying the static library to $(DESTDIR)$(OPENBLAS_LIBRARY_DIR)
|
||||||
@cp $(LIBNAME) $(OPENBLAS_LIBRARY_DIR)
|
@install -pm644 $(LIBNAME) $(DESTDIR)$(OPENBLAS_LIBRARY_DIR)
|
||||||
@cd $(OPENBLAS_LIBRARY_DIR) ; \
|
@cd $(DESTDIR)$(OPENBLAS_LIBRARY_DIR) ; \
|
||||||
ln -fs $(LIBNAME) $(LIBPREFIX).$(LIBSUFFIX)
|
ln -fs $(LIBNAME) $(LIBPREFIX).$(LIBSUFFIX)
|
||||||
#for install shared library
|
#for install shared library
|
||||||
@echo Copy the shared library to $(OPENBLAS_LIBRARY_DIR)
|
@echo Copying the shared library to $(DESTDIR)$(OPENBLAS_LIBRARY_DIR)
|
||||||
ifeq ($(OSNAME), Linux)
|
ifeq ($(OSNAME), Linux)
|
||||||
@cp $(LIBSONAME) $(OPENBLAS_LIBRARY_DIR)
|
@install -pm755 $(LIBSONAME) $(DESTDIR)$(OPENBLAS_LIBRARY_DIR)
|
||||||
@cd $(OPENBLAS_LIBRARY_DIR) ; \
|
@cd $(DESTDIR)$(OPENBLAS_LIBRARY_DIR) ; \
|
||||||
ln -fs $(LIBSONAME) $(LIBPREFIX).so ; \
|
ln -fs $(LIBSONAME) $(LIBPREFIX).so ; \
|
||||||
ln -fs $(LIBSONAME) $(LIBPREFIX).so.$(MAJOR_VERSION)
|
ln -fs $(LIBSONAME) $(LIBPREFIX).so.$(MAJOR_VERSION)
|
||||||
endif
|
endif
|
||||||
ifeq ($(OSNAME), FreeBSD)
|
ifeq ($(OSNAME), FreeBSD)
|
||||||
@cp $(LIBSONAME) $(OPENBLAS_LIBRARY_DIR)
|
@cp $(LIBSONAME) $(DESTDIR)$(OPENBLAS_LIBRARY_DIR)
|
||||||
@cd $(OPENBLAS_LIBRARY_DIR) ; \
|
@cd $(DESTDIR)$(OPENBLAS_LIBRARY_DIR) ; \
|
||||||
ln -fs $(LIBSONAME) $(LIBPREFIX).so
|
ln -fs $(LIBSONAME) $(LIBPREFIX).so
|
||||||
endif
|
endif
|
||||||
ifeq ($(OSNAME), NetBSD)
|
ifeq ($(OSNAME), NetBSD)
|
||||||
@cp $(LIBSONAME) $(OPENBLAS_LIBRARY_DIR)
|
@cp $(LIBSONAME) $(DESTDIR)$(OPENBLAS_LIBRARY_DIR)
|
||||||
@cd $(OPENBLAS_LIBRARY_DIR) ; \
|
@cd $(DESTDIR)$(OPENBLAS_LIBRARY_DIR) ; \
|
||||||
ln -fs $(LIBSONAME) $(LIBPREFIX).so
|
ln -fs $(LIBSONAME) $(LIBPREFIX).so
|
||||||
endif
|
endif
|
||||||
ifeq ($(OSNAME), Darwin)
|
ifeq ($(OSNAME), Darwin)
|
||||||
@-cp $(LIBDYNNAME) $(OPENBLAS_LIBRARY_DIR)
|
@-cp $(LIBDYNNAME) $(DESTDIR)$(OPENBLAS_LIBRARY_DIR)
|
||||||
@-install_name_tool -id $(OPENBLAS_LIBRARY_DIR)/$(LIBDYNNAME) $(OPENBLAS_LIBRARY_DIR)/$(LIBDYNNAME)
|
@-install_name_tool -id $(DESTDIR)$(OPENBLAS_LIBRARY_DIR)/$(LIBDYNNAME) $(DESTDIR)$(OPENBLAS_LIBRARY_DIR)/$(LIBDYNNAME)
|
||||||
@-ln -fs $(OPENBLAS_LIBRARY_DIR)/$(LIBDYNNAME) $(OPENBLAS_LIBRARY_DIR)/$(LIBPREFIX).dylib
|
@-ln -fs $(DESTDIR)$(OPENBLAS_LIBRARY_DIR)/$(LIBDYNNAME) $(DESTDIR)$(OPENBLAS_LIBRARY_DIR)/$(LIBPREFIX).dylib
|
||||||
endif
|
endif
|
||||||
ifeq ($(OSNAME), WINNT)
|
ifeq ($(OSNAME), WINNT)
|
||||||
@-cp $(LIBDLLNAME) $(OPENBLAS_LIBRARY_DIR)
|
@-cp $(LIBDLLNAME) $(OPENBLAS_LIBRARY_DIR)
|
||||||
|
|
Loading…
Reference in New Issue