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