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

Karen Tian
Powered by
ViewCVS 0.9.4