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