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