Debian Codegraph @

contrib/ms-sbvar/utilities_dw/test_routines/matrix_test/c++/make_libraries_master

raw
1 # -*- Makefile -*-
2 # Generic makefile for IMSL, MKL, blas/lapack, and FORTRAN libraries
3 # Generic makefile Tao's and Dan's C routines
4
5 # LIBRARIES SUPPORTED
6 #USE_TZ = USE_TZ - TZ_DIR
7 #USE_DW = USE_DW - DW_BASE_DIR
8 # USE_DW_MATRIX = USE_DW_MATRIX - matrix.o bmatrix_blas_laback.o dw_error.o
9 # USE_DW_ERROR = USE_DW_ERROR - dw_error.o
10 # USE_DW_ARRAY = USE_DW_ARRAY - dw_array.o (dw_matrix_array.o if USE_DW_MATRIX is set)
11 # USE_DW_ASCII = USE_DW_ASCII - dw_ascii.o dw_parse_cmd.o
12 # USE_DW_STAT = USE_DW_STAT - dw_rand_gsl.o if USE_GSL is set, otherwise dw_rand.o (dw_matrix_rand.o if USE_DW_MATRIX is set)
13 # USE_DW_SORT = USE_DW_SORT - dw_matrix_sort.o
14 # USE_DW_ELLIPTICAL = USE_DW_ELLIPTICAL - dw_elliptical.o
15 # USE_DW_HISTO = USE_DW_HISTO - dw_histogram.o
16 # USE_DW_MATH = USE_DW_MATH - dw_math.o
17 # USE_DW_SWITCH = USE_DW_SWITCH - only VPATH is set
18 # USE_DW_STATE_SPACE = USE_DW_STATE_SPACE - only VPATH is set
19 #USE_MKL = USE_MKL - MKL_BASE_DIR and MKL_LIBS
20 #USE_ATLAS = USE_ATLAS - ATLAS_LIBS_BASE and ATLAS_LIBS
21 #USE_IMSL = USE_IMSL - IMSL_BASE_DIR
22 #USE_LAPACK = USE_LAPACK - none (LAPACK_LIBS and LAPACK_LIBS_DIR may be defined)
23 #USE_GSL = USE_GLS - none (GSL_LIBS_DIR and GSL_INCLUDE_DIR may be defined)
24 #USE_GSL_CBLAS = USE_GSL_CBLAS - none (GSL_LIBS_DIR and GSL_INCLUDE_DIR may be defined)
25 #USE_NPSOL = USE_NPSOL - NPSOL_LIBS and NPSOL_DIR
26 #USE_FORTRAN = USE_FORTRAN - none (FORTRAN_LIBS and FORTRAN_DIR may be defined)
27 #USE_MATH = USE_MATH - none
28 #USE_PTHREAD = USE_PTHREAD - none
29
30
31 #################################################################################
32 VPATH = $(OUT_DIR)
33 INCLUDE_DIR =
34 LIBS_DIR =
35 LIBS =
36 OBJS =
37 #################################################################################
38
39 ### TAO'S FILES #################################################################
40 # TZ_DIR MUST be defined.
41 ifdef USE_TZ
42 VPATH := $(VPATH) $(TZ_DIR)
43 INCLUDE_DIR := $(INCLUDE_DIR) -I$(TZ_DIR)
44 endif
45 #################################################################################
46
47 ### DAN'S FILES #################################################################
48 # DW_BASE_DIR MUST be defined. The directories utilities_dw and switch_dw must
49 # be subdirectories of DW_BASE_DIR.
50 ifdef USE_DW
51 INCLUDE_DIR := $(INCLUDE_DIR) -I$(DW_BASE_DIR)/utilities_dw/include
52
53 DW_UTILITIES_BASE = $(DW_BASE_DIR)/utilities_dw
54 DW_MATRIX_DIR =$(DW_UTILITIES_BASE)/matrix
55 DW_ERROR_DIR = $(DW_UTILITIES_BASE)/error
56 DW_ARRAY_DIR = $(DW_UTILITIES_BASE)/arrays
57 DW_ASCII_DIR = $(DW_UTILITIES_BASE)/ascii
58 DW_STAT_DIR = $(DW_UTILITIES_BASE)/stat
59 DW_SORT_DIR = $(DW_UTILITIES_BASE)/sort
60 DW_HISTO_DIR = $(DW_UTILITIES_BASE)/histogram
61 DW_ELLIPTICAL_DIR = $(DW_UTILITIES_BASE)/elliptical
62 DW_MATH_DIR = $(DW_UTILITIES_BASE)/math
63
64 DW_SWITCH_BASE = $(DW_BASE_DIR)/switch_dw
65 DW_SWITCH_DIR = $(DW_SWITCH_BASE)/switching
66 DW_STATE_SPACE_DIR = $(DW_SWITCH_BASE)/state_space
67
68 ifdef USE_DW_MATRIX
69 VPATH := $(VPATH) $(DW_MATRIX_DIR)
70 OBJS := $(OBJS) matrix.o bmatrix_blas_lapack.o
71 USE_DW_ERROR = USE_DW_ERROR
72 endif
73 ifdef USE_DW_ERROR
74 VPATH := $(VPATH) $(DW_ERROR_DIR)
75 OBJS := $(OBJS) dw_error.o
76 endif
77 ifdef USE_DW_ARRAY
78 VPATH := $(VPATH) $(DW_ARRAY_DIR)
79 OBJS := $(OBJS) dw_array.o
80 ifdef USE_DW_MATRIX
81 OBJS := $(OBJS) dw_matrix_array.o
82 endif
83 endif
84 ifdef USE_DW_ASCII
85 VPATH := $(VPATH) $(DW_ASCII_DIR)
86 OBJS := $(OBJS) dw_ascii.o dw_parse_cmd.o
87 endif
88 ifdef USE_DW_STAT
89 VPATH := $(VPATH) $(DW_STAT_DIR)
90 ifdef USE_GSL
91 OBJS := $(OBJS) dw_rand_gsl.o
92 else
93 OBJS := $(OBJS) dw_rand.o
94 endif
95 ifdef USE_DW_MATRIX
96 OBJS := $(OBJS) dw_matrix_rand.o
97 endif
98 endif
99 ifdef USE_DW_SORT
100 VPATH := $(VPATH) $(DW_SORT_DIR)
101 OBJS := $(OBJS) dw_matrix_sort.o
102 endif
103 ifdef USE_DW_HISTO
104 VPATH := $(VPATH) $(DW_HISTO_DIR)
105 OBJS := $(OBJS) dw_histogram.o
106 endif
107 ifdef USE_DW_ELLIPTICAL
108 VPATH := $(VPATH) $(DW_ELLIPTICAL_DIR)
109 OBJS := $(OBJS) dw_elliptical.o
110 endif
111 ifdef USE_DW_MATH
112 VPATH := $(VPATH) $(DW_MATH_DIR)
113 OBJS := $(OBJS) dw_math.o
114 endif
115
116 ifdef USE_DW_SWITCH
117 VPATH := $(VPATH) $(DW_SWITCH_DIR)
118 INCLUDE_DIR := $(INCLUDE_DIR) -I$(DW_SWITCH_DIR)
119 # dw_dirichlet_restrictions.o dw_mdd_switch.o dw_metropolis_simulation.o
120 # dw_metropolis_theta.o dw_switch.o dw_switch_opt.o dw_switchio.o dw_temp_output.o
121 endif
122 ifdef USE_DW_STATE_SPACE
123 VPATH := $(VPATH) $(DW_STATE_SPACE_DIR)
124 INCLUDE_DIR := $(INCLUDE_DIR) -I$(DW_STATE_SPACE_DIR)
125 # dw_MSStateSpace.o dw_state_space_impulse_response.o dw_state_space_forecast
126 endif
127 endif
128 #################################################################################
129
130 ### GLS #########################################################################
131 # GSL_LIBS_DIR and GSL_INCLUDE_DIR must be defined. Following GSL convention,
132 # .h files are in GSL_INCLUDE_DIR/include and this is encoded in the include
133 # directive
134 ifdef USE_GSL
135 INCLUDE_DIR := $(INCLUDE_DIR) -I$(GSL_INCLUDE_DIR)
136 LIBS_DIR := $(LIBS_DIR) -L$(GSL_LIBS_DIR)
137 LIBS := $(LIBS) -lgsl
138 endif
139 #################################################################################
140
141 ### GLS CBLAS ###################################################################
142 # GSL_LIBS_DIR and GSL_INCLUDE_DIR muste be defined
143 ifdef USE_GSL_CBLAS
144 ifndef USE_GSL
145 INCLUDE_DIR := $(INCLUDE_DIR) -I$(GSL_INCLUDE_DIR)
146 LIBS_DIR := $(LIBS_DIR) -L$(GSL_LIBS_DIR)
147 endif
148 LIBS := $(LIBS) -lgslcblas
149 endif
150 #################################################################################
151
152 ### IMSL ########################################################################
153 # IMSL_BASE_DIR must be defined.
154 ifdef USE_IMSL
155 USE_PTHREAD = USE_PTHREAD
156 IMSL_LIBS_DIR =$(IMSL_BASE_DIR)/lib/lib.linux_icc
157 INCLUDE_DIR := $(INCLUDE_DIR) -I$(IMSL_BASE_DIR)/include
158 LIBS_DIR := $(LIBS_DIR) -L$(IMSL_LIBS_DIR)
159 LIBS := $(LIBS) $(IMSL_LIBS_DIR)/libimslcmath.a $(IMSL_LIBS_DIR)/libimslcstat.a
160 endif
161 #################################################################################
162
163 ### NPSOL #######################################################################
164 # NPSOL_LIBS and NPSOL_DIR must be defined.
165 ifdef USE_NPSOL
166 NPSOL_LIBS = -lnpsol_f77 -llssol_f77
167 LIBS_DIR := $(LIBS_DIR) -L$(NPSOL_DIR)
168 LIBS := $(LIBS) $(NPSOL_LIBS)
169 endif
170 #################################################################################
171
172 ### MKL #########################################################################
173 # MKL_BASE_DIR and MKL_LIBS must be defined. The directory include must be a
174 # subdirectory of MKL_BASE_DIR.
175 ifdef USE_MKL
176 USE_PTHREAD = USE_PTHREAD
177 INCLUDE_DIR := $(INCLUDE_DIR) -I$(MKL_BASE_DIR)/include
178 LIBS_DIR := $(LIBS_DIR) -L$(MKL_LIBS_DIR)
179 LIBS := $(LIBS) $(MKL_LIBS)
180 endif
181 #################################################################################
182
183 ### ATLAS #######################################################################
184 # ATLAS_LIBS_BASE and ATLAS_LIBS must be defined. The directory lib must be a
185 # subdirectory of ATLAS_LIBS_BASE.
186 ifdef USE_ATLAS
187 USE_PTHREAD = USE_PTHREAD
188 USE_FORTRAN = USE_FORTRAN
189 LIBS_DIR := $(LIBS_DIR) -L$(ATLAS_LIBS_BASE)/lib
190 LIBS := $(LIBS) $(ATLAS_LIBS)
191 endif
192 #################################################################################
193
194 ### BLAS / LAPACK LIBRARIES #####################################################
195 # LAPACK_LIBS and LAPACK_LIBS_DIR may be defined.
196 ifdef USE_LAPACK
197 ifndef USE_MKL
198 ifndef USE_ATLAS
199 USE_FORTRAN = USE_FORTRAN
200 ifdef LAPACK_LIBS_DIR
201 LIBS_DIR := $(LIBS_DIR) -L$(LAPACK_LIBS_DIR)
202 endif
203 ifdef LAPACK_LIBS
204 LIBS := $(LIBS) $(LAPACK_LIBS)
205 else
206 LIBS := $(LIBS) -llapack -lblas
207 endif
208 endif
209 endif
210 endif
211 #################################################################################
212
213 ### FORTRAN #####################################################################
214 # FORTRAN_LIBS and FORTRAN_LIBS_DIR may be defined.
215 ifdef USE_FORTRAN
216 ifdef FORTRAN_LIBS_DIR
217 LIBS_DIR := $(LIBS_DIR) -L$(FORTRAN_LIBS_DIR)
218 endif
219 ifdef (FORTRAN_LIBS)
220 LIBS := $(LIBS) $(FORTRAN_LIBS)
221 else
222 LIBS := $(LIBS) -lgfortran
223 endif
224 endif
225 #################################################################################
226
227 ### PTHREAD #####################################################################
228 ifdef USE_PTHREAD
229 LIBS := $(LIBS) -lpthread
230 endif
231 #################################################################################
232
233 ### MATH LIBRARY ################################################################
234 ifdef USE_MATH
235 LIBS := $(LIBS) -lm
236 endif
237 #################################################################################