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