(file) Return to make_basic.mk CVS log (file) (dir) Up to [Development] / JSOC

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

Karen Tian
Powered by
ViewCVS 0.9.4