1 arta 1.1 VPATH = $(SRCDIR)
2 STATIC =
3 DBNAME = POSTGRESQL
4
|
5 arta 1.45 # This optional file has custom definitions created by the configure script
6 -include $(SRCDIR)/custom.mk
7
|
8 arta 1.46 PGIPATH = /usr/include/pgsql
|
9 arta 1.1
|
10 arta 1.46 _JSOCROOT_ = ..
11
12 #***********************************************************************************************#
13 #
14 # COMPILER SELECTION
15 #
|
16 rick 1.29 COMPILER = icc
|
17 arta 1.46 FCOMPILER = ifort
18
|
19 arta 1.47 ifneq ($(JSOC_AUTOCOMPILER),)
20 COMPILER = $(JSOC_AUTOCOMPILER)
|
21 arta 1.46 endif
22
|
23 arta 1.47 ifneq ($(JSOC_AUTOFCOMPILER),)
24 FCOMPILER = $(JSOC_AUTOFCOMPILER)
|
25 arta 1.46 endif
|
26 arta 1.41
|
27 arta 1.46 # can set through custom.mk or through environment
|
28 arta 1.47 ifneq ($(JSOC_COMPILER),)
29 COMPILER = $(JSOC_COMPILER)
|
30 arta 1.45 endif
|
31 arta 1.46
|
32 arta 1.47 ifneq ($(JSOC_FCOMPILER),)
33 FCOMPILER = $(JSOC_FCOMPILER)
|
34 arta 1.45 endif
|
35 arta 1.46 #***********************************************************************************************#
|
36 arta 1.1
|
37 arta 1.46
38 #***********************************************************************************************#
39 #
40 # DEBUGGING
41 #
|
42 arta 1.1 # Check for debug vs. release build - release is default.
|
43 arta 1.30 # To do a debug build, either set the environment variable JSOC_DEBUG to 1, OR
44 # modify the following line so that DEBUG = 1. The environment variable takes precedence.
|
45 arta 1.46 #
|
46 arta 1.30 DEBUG = 0
|
47 arta 1.1
48 ifdef JSOC_DEBUG
49 ifeq ($(JSOC_DEBUG), 1)
50 DEBUG = 1
51 else
52 DEBUG = 0
53 endif
54 endif
|
55 arta 1.46 #***********************************************************************************************#
|
56 arta 1.1
|
57 arta 1.46
58 #***********************************************************************************************#
59 #
60 # WARNINGS
61 #
|
62 arta 1.1 # No warnings are displayed, by default, for a release build.
|
63 arta 1.46 #
|
64 arta 1.1 WARN = 0
65
|
66 rick 1.29 # Builder can request warnings via environment variable (setenv JSOC_WARN 1).
67 # The environment variable takes precedence.
|
68 arta 1.1 ifdef JSOC_WARN
69 ifeq ($(JSOC_WARN), 1)
70 WARN = 1
71 else
72 WARN = 0
73 endif
74 endif
75
76 # Warnings are always displayed for a debug build.
77 ifeq ($(DEBUG), 1)
78 WARN = 1
79 endif
|
80 arta 1.46 #***********************************************************************************************#
|
81 arta 1.1
82
|
83 arta 1.39 #***********************************************************************************************#
84 #
|
85 arta 1.46 # THIRD-PARTY LIBRARIES
86 #
|
87 arta 1.39 # This section contains make variables that hold the paths to and names of third-party libraries.
88 # Variables that end in 'H' contain the -I link flags that contain the include paths
89 # for the library headers, variables that end in 'L' contain the -L link flags that
90 # contain the paths to the library binaries, and variables
91 # that end in "LIBS" contain the full link cmd (the -L flag plus the -l flag)
92 #
|
93 arta 1.1 # Path to 3rd-party library headers
94 FMATHLIBSH = -I$(_JSOCROOT_)/lib_third_party/include
|
95 arta 1.6 CFITSIOH = -I$(_JSOCROOT_)/lib_third_party/include
|
96 arta 1.22 GSLH = -I$(_JSOCROOT_)/lib_third_party/include
|
97 arta 1.1
|
98 arta 1.14 ifeq ($(JSOC_MACHINE), linux_x86_64)
|
99 arta 1.5 # FMATHLIBS = -lmkl_lapack -lmkl -L$(_JSOCROOT_)/lib_third_party/lib/linux-x86_64/ -lfftw3f -lcfitsio
|
100 arta 1.13 # Path to 64-bit 3rd-party libraries
101 FMATHLIBSL = -L$(_JSOCROOT_)/lib_third_party/lib/linux_x86_64/
102 CFITSIOL = -L$(_JSOCROOT_)/lib_third_party/lib/linux_x86_64/
|
103 arta 1.16 GSLL = -L$(_JSOCROOT_)/lib_third_party/lib/linux_x86_64/
|
104 arta 1.15 ECPGL = -L$(_JSOCROOT_)/lib_third_party/lib/linux_x86_64/
|
105 arta 1.14 endif
106 ifeq ($(JSOC_MACHINE), linux_ia32)
|
107 arta 1.5 # FMATHLIBS = -lmkl_lapack -lmkl -L$(_JSOCROOT_)/lib_third_party/lib/linux-ia32/ -lfftw3f -lcfitsio
|
108 arta 1.13 # Path to 32-bit 3rd-party libraries
109 FMATHLIBSL = -L$(_JSOCROOT_)/lib_third_party/lib/linux_ia32/
110 CFITSIOL = -L$(_JSOCROOT_)/lib_third_party/lib/linux_ia32/
|
111 arta 1.16 GSLL = -L$(_JSOCROOT_)/lib_third_party/lib/linux_ia32/
|
112 arta 1.15 ECPGL = -L$(_JSOCROOT_)/lib_third_party/lib/linux_ia32/
|
113 arta 1.1 endif
|
114 rick 1.29 ifeq ($(JSOC_MACHINE), mac_osx_ppc)
115 # FMATHLIBS = -lmkl_lapack -lmkl -L$(_JSOCROOT_)/lib_third_party/lib/linux-ia32/ -lfftw3f -lcfitsio
116 # Path to appropriate 3rd-party libraries
117 FMATHLIBSL = -L$(_JSOCROOT_)/lib_third_party/lib/mac_osx_ppc/
118 CFITSIOL = -L$(_JSOCROOT_)/lib_third_party/lib/mac_osx_ppc/
119 GSLL = -L$(_JSOCROOT_)/lib_third_party/lib/mac_osx_ppc/
120 ECPGL = -L$(_JSOCROOT_)/lib_third_party/lib/mac_osx_ppc/
121 endif
122 ifeq ($(JSOC_MACHINE), mac_osx_ia32)
|
123 arta 1.14 # FMATHLIBS = -lmkl_lapack -lmkl -L$(_JSOCROOT_)/lib_third_party/lib/linux-ia32/ -lfftw3f -lcfitsio
|
124 rick 1.29 # Path to appropriate 3rd-party libraries
125 FMATHLIBSL = -L$(_JSOCROOT_)/lib_third_party/lib/mac_osx_ia32/
126 CFITSIOL = -L$(_JSOCROOT_)/lib_third_party/lib/mac_osx_ia32/
127 GSLL = -L$(_JSOCROOT_)/lib_third_party/lib/mac_osx_ia32/
128 ECPGL = -L$(_JSOCROOT_)/lib_third_party/lib/mac_osx_ia32/
|
129 arta 1.15 endif
|
130 arta 1.14
|
131 arta 1.15 # All 3rd-party math libraries - local rules can define a subset
|
132 arta 1.39 FMATHLIBS = $(FMATHLIBSL) -lfftw3f
|
133 arta 1.15 CFITSIOLIBS = $(CFITSIOL) -lcfitsio
|
134 arta 1.25
|
135 arta 1.24 ifeq ($(COMPILER), gcc)
136 ifeq ($(JSOC_MACHINE), linux_x86_64)
|
137 arta 1.25 ifneq ($(CFITSIOFNAME_GCC_X86_64),)
138 FMATHLIBS = $(FMATHLIBSL) -lfftw3f -l$(CFITSIOFNAME_GCC_X86_64)
139 CFITSIOLIBS = $(CFITSIOL) -l$(CFITSIOFNAME_GCC_X86_64)
140 endif
|
141 arta 1.24 endif
142 endif
143
|
144 arta 1.16 GSLLIBS = $(GSLL) -lgsl -lgslcblas
|
145 arta 1.39 #***********************************************************************************************#
146
|
147 arta 1.1
|
148 arta 1.46 #***********************************************************************************************#
149 #
150 # CUSTOM BUILDS
151 #
|
152 arta 1.31 # Compilation define customizations (eg., for remote DRMS builds)
153 CUSTOMSW =
154 ifneq ($(DRMS_DEFAULT_RETENTION),)
155 # CUSTOMSW = $(CUSTOMSW) -DDRMS_DEFAULT_RETENTION="\"$(DRMS_DEFAULT_RETENTION)\""
156 CUSTOMSW := $(CUSTOMSW) -DDRMS_DEFAULT_RETENTION=$(DRMS_DEFAULT_RETENTION)
157 endif
158
|
159 arta 1.36 ifneq ($(CUSTOM_DEFINES),)
|
160 arta 1.37 CUSTOMSW := $(CUSTOMSW) -D$(CUSTOM_DEFINES)
|
161 arta 1.36 endif
162
|
163 arta 1.1 #
|
164 arta 1.46 #***********************************************************************************************#
|
165 arta 1.1
166
|
167 arta 1.46 #***********************************************************************************************#
168 #
169 # WARNINGS
170 #
|
171 arta 1.1 # Disable several warnings/remarks when compiling with icc - icc's Wall is a bit picky, it
172 # complains about extern declarations in .c files.
173 # 1418 (remark) - external function definition with no prior declaration
174 # 1419 (warning) - external declaration in primary source file
175 # 310 (remark) - old style function declaration (pre-ANSI)
176 # 981 (remark) - operands are evaluted in unspecified order
177
178 ifeq ($(WARN), 1)
179 # Show warnings (always true for a debug build).
180 ICC_WARN = -Winline -Wall -wd1418 -wd1419 -wd310 -wd279 -wd981 -Wno-comment
181 GCC_WARN = -Winline -Wall -Wno-comment
|
182 arta 1.46 FCOMPILER_WARN =
|
183 arta 1.1 else
184 # Don't show warnings.
185 ICC_WARN = -w0 -vec-report0 -Wno-comment
186 GCC_WARN = -Wno-comment
|
187 arta 1.46 ifeq ($(FCOMPILER), ifort)
188 FCOMPILER_WARN = -vec-report0
189 else
190 FCOMPILER_WARN =
191 endif
|
192 arta 1.1 endif
|
193 arta 1.46 #***********************************************************************************************#
194
195
196 #***********************************************************************************************#
197 #
198 # GLOBAL LINK FLAGS
199 #
200 # Link flags for all targets
201 #
202 LL_ALL = $(SYSLIBS)
203 GCC_LF_ALL = $(STATIC)
204 ICC_LF_ALL = $(STATIC)
205
206 # Fortran global LINK flags
207 F_LF_ALL = -nofor_main -no-ipo
208 #***********************************************************************************************#
209
210 #***********************************************************************************************#
211 #
212 # GLOBAL COMPILE FLAGS
213 #
214 arta 1.46 GCC_CF_GCCCOMP = -DGCCCOMP
215 ICC_CF_ICCCOMP = -DICCCOMP
|
216 arta 1.1
|
217 arta 1.7 # can't figure out how to get stupid make to do if/else if/else
|
218 arta 1.1 ifeq ($(DEBUG), 0)
|
219 arta 1.31 GCC_CF_ALL = -I$(SRCDIR)/base/include -std=gnu99 -O2 $(GCC_WARN) $(GCC_CF_GCCCOMP) $(CUSTOMSW)
|
220 arta 1.46 # -xW tells the icc compiler to optimize for Pentium 4
|
221 arta 1.40 ICC_CF_ALL = -I$(SRCDIR)/base/include -std=c99 -D_GNU_SOURCE -xW $(ICC_WARN) $(ICC_CF_ICCCOMP) $(CUSTOMSW)
|
222 arta 1.7
|
223 arta 1.1 ifeq ($(JSOC_MACHINE), linux_x86_64)
|
224 arta 1.31 GCC_CF_ALL = -I$(SRCDIR)/base/include -std=gnu99 -O2 -march=opteron $(GCC_WARN) $(GCC_CF_GCCCOMP) $(CUSTOMSW)
|
225 arta 1.7 endif
226
227 ifeq ($(JSOC_MACHINE), linux_ia64)
|
228 arta 1.40 ICC_CF_ALL = -I$(SRCDIR)/base/include -std=c99 -D_GNU_SOURCE $(ICC_WARN) $(ICC_CF_ICCCOMP) $(CUSTOMSW)
|
229 arta 1.7 endif
230
231 ifeq ($(JSOC_MACHINE), linux_ia32)
|
232 arta 1.31 GCC_CF_ALL = -I$(SRCDIR)/base/include -std=gnu99 -O2 -march=i686 $(GCC_WARN) $(GCC_CF_GCCCOMP) $(CUSTOMSW)
|
233 arta 1.1 endif
234
235 else
|
236 arta 1.46 # -g tells the icc and gcc compilers to generate full debugging information
|
237 arta 1.31 GCC_CF_ALL = -I$(SRCDIR)/base/include -std=gnu99 -g $(GCC_WARN) $(GCC_CF_GCCCOMP) $(CUSTOMSW)
|
238 arta 1.40 ICC_CF_ALL = -I$(SRCDIR)/base/include -std=c99 -D_GNU_SOURCE -g $(ICC_WARN) $(ICC_CF_ICCCOMP) $(CUSTOMSW)
|
239 arta 1.46 endif
|
240 arta 1.1
|
241 arta 1.46 # Fortran global COMPILE flags
242 ifeq ($(JSOC_MACHINE), linux_x86_64)
243 ifeq ($(FCOMPILER), ifort)
244 F_CF_ALL := -mcmodel=medium
245 endif
|
246 arta 1.1 endif
247
|
248 arta 1.46 # Other compiler-specific Fortran COMPILE flags
249 ifeq ($(FCOMPILER), ifort)
250 ifeq ($(JSOC_MACHINE), linux_x86_64)
251 FCFLAGS_OPT := -xW
252 endif
253 FCLFAGS_INIT := -ftrapuv
254 else
255 # must be gfortran
256 FCFLAGS_OPT := -g
257 FCLFAGS_INIT :=
258 endif
|
259 arta 1.1
260 ifeq ($(DEBUG), 0)
|
261 arta 1.46 # -xW optimizes ifort compilation for Pentium 4
262 # -ftrapuv initializes stack local variables to an unusual value to aid error detection.
263 F_CF_ALL := $(F_CF_ALL) $(FCFLAGS_OPT) $(FCLFAGS_INIT) $(FCOMPILER_WARN)
|
264 arta 1.1 else
|
265 arta 1.46 F_CF_ALL := $(F_CF_ALL) $(FCLFAGS_INIT) $(FCOMPILER_WARN)
|
266 arta 1.1 endif
|
267 arta 1.46 #***********************************************************************************************#
268
|
269 arta 1.1
|
270 arta 1.46 #***********************************************************************************************#
271 #
272 # BUILD TOOLS
|
273 arta 1.1 #
274 # The C compiler named here must output full (header) dependencies in $(@).d.
275 # It may be necessary to create a script similar to ccd-gcc for your compiler.
276 #
277 GCC_CMPLR = $(SRCDIR)/build/ccd-gcc
278 ICC_CMPLR = $(SRCDIR)/build/ccd-icc
279 ARCHIVE = ar crus $@ $^
280
281 ECPG = ecpg -o $@ -c $<
|
282 karen 1.17 SWIG = swig -perl5 -o $@ $<
|
283 arta 1.1
284 GCC_COMP = $(GCC_CMPLR) $(GCC_CF_ALL) $(CF_TGT) -o $@ -c $<
285 ICC_COMP = $(ICC_CMPLR) $(ICC_CF_ALL) $(CF_TGT) -o $@ -c $<
286
287 GCC_LINK = $(GCC_CMPLR) $(GCC_LF_ALL) $(LF_TGT) -o $@ $^ $(LL_TGT) $(LL_ALL)
288 ICC_LINK = $(ICC_CMPLR) $(ICC_LF_ALL) $(LF_TGT) -o $@ $^ $(LL_TGT) $(LL_ALL)
289
290 GCC_COMPLINK = $(GCC_CMPLR) $(GCC_CF_ALL) $(CF_TGT) $(GCC_LF_ALL) $(LF_TGT) -o $@ $< $(LL_TGT) $(LL_ALL)
291 ICC_COMPLINK = $(ICC_CMPLR) $(GCC_CF_ALL) $(CF_TGT) $(ICC_LF_ALL) $(LF_TGT) -o $@ $< $(LL_TGT) $(LL_ALL)
292
293 ifneq ($(COMPILER), icc)
294 COMP = $(GCC_COMP)
295 LINK = $(GCC_LINK)
296 COMPLINK = $(GCC_COMPLINK)
297 else
298 COMP = $(ICC_COMP)
299 LINK = $(ICC_LINK)
300 COMPLINK = $(ICC_COMPLINK)
301 endif
302
|
303 arta 1.46 FCOMP = $(FCOMPILER) $(F_CF_ALL) $(FF_TGT) -o $@ -c $<
304 FLINK = $(FCOMPILER) $(F_LF_ALL) $(LF_TGT) -o $@ $^ $(LL_TGT) $(LL_ALL)
|
305 arta 1.1
306 SLBIN = ln -sf ../../_$(JSOC_MACHINE)/$@ ../bin/$(JSOC_MACHINE)/
307 SLLIB = ln -sf ../../_$(JSOC_MACHINE)/$@ ../lib/$(JSOC_MACHINE)/
|
308 arta 1.46 #***********************************************************************************************#
309
|
310 arta 1.1
|
311 arta 1.46 #***********************************************************************************************#
312 #
313 # LIBRARY COLLECTIONS
314 #
|
315 arta 1.43 ALL_LIBS_FPIC = $(LIBDRMSCLIENT_FPIC) $(LIBDBCLIENT_FPIC) $(LIBCMDPARAMS_FPIC) $(LIBTHREADUTIL_FPIC) $(LIBRICECOMP_FPIC) $(LIBDEFS_FPIC) $(LIBMISC_FPIC) $(LIBDSTRUCT_FPIC) $(LIBTIMEIO_FPIC) $(LIBFITSRW_FPIC)
|
316 arta 1.1
317 ### Standard parts
318 #
319 include $(SRCDIR)/Rules.mk
320
321 # Libraries from src/util linked with all programs.
|
322 arta 1.12 ifneq ($(COMPILER), icc)
|
323 phil 1.34 SYSLIBS = -lz -ldl -lpthread -lm
|
324 arta 1.12 else
|
325 phil 1.34 SYSLIBS = -lz -ldl -lpthread
|
326 arta 1.12 endif
|
327 arta 1.43 SRCLIBS = $(LIBTHREADUTIL) $(LIBRICECOMP) $(LIBCMDPARAMS) $(LIBTIMEIO) $(LIBFITSRW) $(LIBERRLOG) $(LIBMISC) $(LIBDSTRUCT)
328 FSRCLIBS = $(LIBTHREADUTIL) $(LIBRICECOMP) $(LIBCMDPARAMSF) $(LIBTIMEIO) $(LIBFITSRW) $(LIBERRLOG) $(LIBMISC) $(LIBDSTRUCT)
|
329 arta 1.1
330 ########## Libraries to link for server executables, ##############
331 ########## standalone executables and pipeline modules. ##############
332
333 # SERVERLIBS: Libraries linked with "server" programs that
334 # need direct access to the DRMS databases.
|
335 arta 1.35 SERVERLIBS = $(LIBDRMS) $(LIBDEFSSERVER) $(LIBDB) $(LIBSUMSAPI) $(SRCLIBS)
|
336 arta 1.1
337 # EXELIBS: Libraries linked with standalone executables.
|
338 arta 1.35 EXELIBS = $(LIBDRMSCLIENT) $(LIBDEFSCLIENT) $(LIBDBCLIENT) $(SRCLIBS)
|
339 arta 1.1
340 # MODLIBS: Libraries linked with DRMS modules.
341 MODLIBS = $(LIBJSOC_MAIN) $(SERVERLIBS)
342
343 # MODLIBS_SOCK: Libraries linked with DRMS modules with socket connection to a drms_server
|
344 arta 1.35 MODLIBS_SOCK = $(LIBJSOC_MAIN_SOCK) $(LIBDRMSCLIENT) $(LIBDEFSCLIENT) $(LIBDBCLIENT) $(LIBSUMSAPI) $(SRCLIBS)
|
345 arta 1.1
346 # FMODLIBS: Libraries linked with DRMS Fortran modules
|
347 arta 1.35 FMODLIBS_SOCK = $(LIBJSOC_MAIN_SOCK_F) $(LIBINTHANDLESF) $(LIBDRMSCLIENT) $(LIBDEFSCLIENT) $(LIBDBCLIENT) $(FSRCLIBS)
|
348 arta 1.46 #***********************************************************************************************#
349
|
350 arta 1.1
|
351 arta 1.46 #***********************************************************************************************#
352 #
353 # PROJECT MAKE RULES
354 #
|
355 arta 1.1 # Make rules that apply to all projects outside of the base DRMS/SUMS system
|
356 arta 1.3 -include $(SRCDIR)/proj/make_basic.mk
|
357 arta 1.46 #***********************************************************************************************#
|
358 arta 1.1
|
359 arta 1.46
360 #***********************************************************************************************#
361 #
362 # MODULE TYPES
363 #
|
364 arta 1.1 # Make rules that apply to all projects, inside and outside of the base DRMS/SUMS system
365 $(CEXE): %: %.o $(EXELIBS)
366 $(LINK)
367 $(SLBIN)
368
|
369 arta 1.42 $(FEXE): %: %.o $(FMATHLIBS)
|
370 arta 1.1 $(FLINK)
371 $(SLBIN)
372
|
373 arta 1.11 $(SERVEREXE): LL_TGT := $(LL_TGT) -lpq $(CFITSIOLIBS)
|
374 arta 1.1 $(SERVEREXE): %: %.o $(SERVERLIBS)
375 $(LINK)
376 $(SLBIN)
377
|
378 arta 1.11 $(MODEXE): LL_TGT := $(LL_TGT) -lpq $(CFITSIOLIBS)
|
379 arta 1.1 $(MODEXE): %: %.o $(MODLIBS)
380 $(LINK)
381 $(SLBIN)
382
|
383 arta 1.11 $(MODEXE_SOCK): LL_TGT := $(LL_TGT) $(CFITSIOLIBS)
|
384 arta 1.1 $(MODEXE_SOCK): %_sock: %.o $(MODLIBS_SOCK)
385 $(LINK)
386 $(SLBIN)
|
387 arta 1.42 # FMODEXE_SOCK contains all Fortran modules - the DoIt() function is defined inside a .f file.
|
388 arta 1.39 # These are socket-connect modules only. Assume they use third-party Fortran libraries
389 # (although this may not be the case).
|
390 arta 1.42 $(FMODEXE_SOCK): LL_TGT := $(LL_TGT) $(CFITSIOLIBS) $(FMATHLIBS)
391 $(FMODEXE_SOCK): %_sock: %.o $(FMODLIBS_SOCK)
|
392 arta 1.1 $(FLINK)
393 $(SLBIN)
|
394 tplarson 1.20
|
395 arta 1.39 # MODEXE_USEF contains all C direct-connect modules that use third-party Fortran libraries.
396 $(MODEXE_USEF): LL_TGT := $(LL_TGT) -lpq $(CFITSIOLIBS) $(FMATHLIBS)
|
397 tplarson 1.20 $(MODEXE_USEF): %: %.o $(MODLIBS)
398 $(FLINK)
399 $(SLBIN)
|
400 arta 1.39 # MODEXE_USEF contains all C socket-connect modules that use third-party Fortran libraries.
401 $(MODEXE_USEF_SOCK): LL_TGT := $(LL_TGT) $(CFITSIOLIBS) $(FMATHLIBS)
|
402 tplarson 1.20 $(MODEXE_USEF_SOCK): %_sock: %.o $(MODLIBS_SOCK)
403 $(FLINK)
404 $(SLBIN)
|
405 arta 1.46 #***********************************************************************************************#
|