Merge remote branch 'origin/master' into haswell
[platform/upstream/openblas.git] / Makefile.install
1 TOPDIR  = .
2 export GOTOBLAS_MAKEFILE = 1
3 -include $(TOPDIR)/Makefile.conf_last
4 include ./Makefile.system
5
6 PREFIX?=/opt/OpenBLAS
7
8 OPENBLAS_INCLUDE_DIR:=$(PREFIX)/include
9 OPENBLAS_LIBRARY_DIR:=$(PREFIX)/lib
10 OPENBLAS_BUILD_DIR:=$(CURDIR)
11
12 .PHONY : install
13 .NOTPARALLEL : install
14
15 lib.grd :
16         $(error OpenBLAS: Please run "make" firstly)
17
18 install :       lib.grd
19         @-mkdir -p $(PREFIX)
20         @-mkdir -p $(OPENBLAS_INCLUDE_DIR)
21         @-mkdir -p $(OPENBLAS_LIBRARY_DIR)
22         @echo Generating openblas_config.h in $(OPENBLAS_INCLUDE_DIR)
23 #for inc 
24         @echo \#ifndef OPENBLAS_CONFIG_H > $(OPENBLAS_INCLUDE_DIR)/openblas_config.h
25         @echo \#define OPENBLAS_CONFIG_H >> $(OPENBLAS_INCLUDE_DIR)/openblas_config.h
26         @awk '{print $$1, "OPENBLAS_"$$2, $$3}' config_last.h >> $(OPENBLAS_INCLUDE_DIR)/openblas_config.h
27         @echo \#define OPENBLAS_VERSION \" OpenBLAS $(VERSION) \" >> $(OPENBLAS_INCLUDE_DIR)/openblas_config.h
28         @cat openblas_config_template.h >> $(OPENBLAS_INCLUDE_DIR)/openblas_config.h
29         @echo \#endif  \/\* OPENBLAS_CONFIG_H \*\/ >> $(OPENBLAS_INCLUDE_DIR)/openblas_config.h
30
31         @echo Generating f77blas.h in $(OPENBLAS_INCLUDE_DIR)
32         @echo \#ifndef OPENBLAS_F77BLAS_H > $(OPENBLAS_INCLUDE_DIR)/f77blas.h
33         @echo \#define OPENBLAS_F77BLAS_H >> $(OPENBLAS_INCLUDE_DIR)/f77blas.h
34         @echo \#include \"openblas_config.h\" >> $(OPENBLAS_INCLUDE_DIR)/f77blas.h
35         @cat common_interface.h >> $(OPENBLAS_INCLUDE_DIR)/f77blas.h
36         @echo \#endif >> $(OPENBLAS_INCLUDE_DIR)/f77blas.h
37
38 ifndef NO_CBLAS
39         @echo Generating cblas.h in $(OPENBLAS_INCLUDE_DIR)
40         @sed 's/common/openblas_config/g' cblas.h > $(OPENBLAS_INCLUDE_DIR)/cblas.h
41 endif
42
43 ifndef NO_LAPACKE
44         @echo Copying LAPACKE header files to $(OPENBLAS_LIBRARY_DIR)
45         @-cp $(NETLIB_LAPACK_DIR)/lapacke/include/lapacke.h $(OPENBLAS_INCLUDE_DIR)/lapacke.h
46         @-cp $(NETLIB_LAPACK_DIR)/lapacke/include/lapacke_config.h $(OPENBLAS_INCLUDE_DIR)/lapacke_config.h
47         @-cp $(NETLIB_LAPACK_DIR)/lapacke/include/lapacke_mangling_with_flags.h $(OPENBLAS_INCLUDE_DIR)/lapacke_mangling.h
48         @-cp $(NETLIB_LAPACK_DIR)/lapacke/include/lapacke_utils.h $(OPENBLAS_INCLUDE_DIR)/lapacke_utils.h
49 endif
50
51 #for install static library 
52         @echo Copy the static library to $(OPENBLAS_LIBRARY_DIR)
53         @cp $(LIBNAME) $(OPENBLAS_LIBRARY_DIR)
54         @cd $(OPENBLAS_LIBRARY_DIR) ; \
55         ln -fs $(LIBNAME) $(LIBPREFIX).$(LIBSUFFIX)
56 #for install shared library 
57         @echo Copy the shared library to $(OPENBLAS_LIBRARY_DIR)
58 ifeq ($(OSNAME), Linux)
59         @cp $(LIBSONAME) $(OPENBLAS_LIBRARY_DIR)
60         @cd $(OPENBLAS_LIBRARY_DIR) ; \
61         ln -fs $(LIBSONAME) $(LIBPREFIX).so ; \
62         ln -fs $(LIBSONAME) $(LIBPREFIX).so.$(MAJOR_VERSION)
63 endif
64 ifeq ($(OSNAME), FreeBSD)
65         @cp $(LIBSONAME) $(OPENBLAS_LIBRARY_DIR)
66         @cd $(OPENBLAS_LIBRARY_DIR) ; \
67         ln -fs $(LIBSONAME) $(LIBPREFIX).so
68 endif
69 ifeq ($(OSNAME), NetBSD)
70         @cp $(LIBSONAME) $(OPENBLAS_LIBRARY_DIR)
71         @cd $(OPENBLAS_LIBRARY_DIR) ; \
72         ln -fs $(LIBSONAME) $(LIBPREFIX).so
73 endif
74 ifeq ($(OSNAME), Darwin)     
75         @-cp $(LIBDYNNAME) $(OPENBLAS_LIBRARY_DIR)
76         @-install_name_tool -id $(OPENBLAS_LIBRARY_DIR)/$(LIBDYNNAME) $(OPENBLAS_LIBRARY_DIR)/$(LIBDYNNAME)
77         @-ln -fs $(OPENBLAS_LIBRARY_DIR)/$(LIBDYNNAME) $(OPENBLAS_LIBRARY_DIR)/$(LIBPREFIX).dylib
78 endif
79 ifeq ($(OSNAME), WINNT)
80         @-cp $(LIBDLLNAME) $(OPENBLAS_LIBRARY_DIR)
81 endif
82 ifeq ($(OSNAME), CYGWIN_NT)
83         @-cp $(LIBDLLNAME) $(OPENBLAS_LIBRARY_DIR)
84 endif
85
86         @echo Install OK!
87