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

Karen Tian
Powered by
ViewCVS 0.9.4