(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 # This optional file has custom definitions created by the configure script
  6            -include $(SRCDIR)/custom.mk
  7 arta  1.46 
  8 arta  1.58 # If MACH was set when the make command was issued (eg., make MACH='N02'), then
  9            # use its value for the output/obj directory and use the custom.mk variables
 10            # relevant to its value. Otherwise, use $(JSOC_MACHINE).
 11 arta  1.57 ifeq ($(MACH),)
 12            MACH = $(JSOC_MACHINE)
 13            endif
 14            
 15 arta  1.46 #***********************************************************************************************#
 16            #
 17            # COMPILER SELECTION
 18            #
 19 rick  1.29 COMPILER = icc
 20 arta  1.46 FCOMPILER = ifort
 21            
 22 arta  1.47 ifneq ($(JSOC_AUTOCOMPILER),)
 23            COMPILER = $(JSOC_AUTOCOMPILER)
 24 arta  1.46 endif
 25            
 26 arta  1.47 ifneq ($(JSOC_AUTOFCOMPILER),)
 27            FCOMPILER = $(JSOC_AUTOFCOMPILER)
 28 arta  1.46 endif
 29 arta  1.41 
 30 arta  1.46 # can set through custom.mk or through environment
 31 arta  1.47 ifneq ($(JSOC_COMPILER),)
 32            COMPILER = $(JSOC_COMPILER)
 33 arta  1.45 endif
 34 arta  1.46 
 35 arta  1.47 ifneq ($(JSOC_FCOMPILER),)
 36            FCOMPILER = $(JSOC_FCOMPILER)
 37 arta  1.45 endif
 38 arta  1.46 #***********************************************************************************************#
 39 arta  1.1  
 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            GLOBALSW = -DDRMS_LIBDIR="\"$(CURDIR)/../lib/$(MACH)\""
141            #
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.50 CCFLAGS_OPT	:=
200               
201               ifeq ($(COMPILER), icc)
202                 ifeq ($(JSOC_MACHINE), linux_x86_64)
203 kehcheng 1.60     CCFLAGS_OPT	:=
204 arta     1.50   endif
205               endif
206               
207 arta     1.7  # can't figure out how to get stupid make to do if/else if/else
208 arta     1.1  ifeq ($(DEBUG), 0)
209 arta     1.57   GCC_CF_ALL	= -I$(SRCDIR)/base/include -std=gnu99 -O2 $(GCC_WARN) $(GCC_CF_GCCCOMP) $(CUSTOMSW) $(GLOBALSW)
210 arta     1.46 # -xW tells the icc compiler to optimize for Pentium 4
211 arta     1.57   ICC_CF_ALL = -I$(SRCDIR)/base/include -std=c99 -D_GNU_SOURCE $(CCFLAGS_OPT) $(ICC_WARN) $(ICC_CF_ICCCOMP) $(CUSTOMSW) $(GLOBALSW)
212 arta     1.7  
213 arta     1.1    ifeq ($(JSOC_MACHINE), linux_x86_64)
214 arta     1.57     GCC_CF_ALL	= -I$(SRCDIR)/base/include -std=gnu99 -O2 -march=opteron $(GCC_WARN) $(GCC_CF_GCCCOMP) $(CUSTOMSW) $(GLOBALSW)
215 arta     1.7    endif
216               
217                 ifeq ($(JSOC_MACHINE), linux_ia64)
218 arta     1.57     ICC_CF_ALL	= -I$(SRCDIR)/base/include -std=c99 -D_GNU_SOURCE $(ICC_WARN) $(ICC_CF_ICCCOMP) $(CUSTOMSW) $(GLOBALSW)
219 arta     1.7    endif
220               
221                 ifeq ($(JSOC_MACHINE), linux_ia32)
222 arta     1.57     GCC_CF_ALL	= -I$(SRCDIR)/base/include -std=gnu99 -O2 -march=i686 $(GCC_WARN) $(GCC_CF_GCCCOMP) $(CUSTOMSW) $(GLOBALSW)
223 arta     1.1    endif	
224               
225               else
226 arta     1.46 # -g tells the icc and gcc compilers to generate full debugging information
227 arta     1.57   GCC_CF_ALL = -I$(SRCDIR)/base/include -std=gnu99 -g $(GCC_WARN) $(GCC_CF_GCCCOMP) $(CUSTOMSW) $(GLOBALSW)
228                 ICC_CF_ALL = -I$(SRCDIR)/base/include -std=c99 -D_GNU_SOURCE -g $(ICC_WARN) $(ICC_CF_ICCCOMP) $(CUSTOMSW) $(GLOBALSW)
229 arta     1.46 endif
230 arta     1.1  
231 arta     1.46 # Fortran global COMPILE flags
232               ifeq ($(JSOC_MACHINE), linux_x86_64)
233                 ifeq ($(FCOMPILER), ifort)
234 kehcheng 1.60     F_CF_ALL := -openmp
235 arta     1.46   endif
236 arta     1.1  endif
237               
238 arta     1.46 # Other compiler-specific Fortran COMPILE flags
239               ifeq ($(FCOMPILER), ifort)
240                 ifeq ($(JSOC_MACHINE), linux_x86_64)
241 kehcheng 1.60     FCFLAGS_OPT	:=
242 arta     1.46   endif
243 arta     1.49   FCFLAGS_INIT := -ftrapuv
244 arta     1.46 else
245                 # must be gfortran
246 arta     1.49   FCFLAGS_OPT	:= 
247                 FCFLAGS_INIT  := 
248 arta     1.46 endif
249 arta     1.1  
250               ifeq ($(DEBUG), 0)
251 arta     1.46 # -xW optimizes ifort compilation for Pentium 4
252               # -ftrapuv initializes stack local variables to an unusual value to aid error detection. 
253 arta     1.49   F_CF_ALL	:= $(F_CF_ALL) $(FCFLAGS_OPT) $(FCOMPILER_WARN)
254 arta     1.1  else
255 arta     1.49   F_CF_ALL	:= $(F_CF_ALL) -g $(FCFLAGS_INIT) $(FCOMPILER_WARN)
256 arta     1.1  endif
257 arta     1.46 #***********************************************************************************************#
258               
259 arta     1.1  
260 arta     1.46 #***********************************************************************************************#
261               #
262               # BUILD TOOLS
263 arta     1.1  # 
264               # The C compiler named here must output full (header) dependencies in $(@).d.
265               # It may be necessary to create a script similar to ccd-gcc for your compiler.
266               # 
267               GCC_CMPLR	= $(SRCDIR)/build/ccd-gcc
268               ICC_CMPLR	= $(SRCDIR)/build/ccd-icc
269               ARCHIVE		= ar crus $@ $^
270               
271               ECPG		= ecpg -o $@ -c $<
272 karen    1.17 SWIG		= swig -perl5 -o $@ $<
273 arta     1.1  
274               GCC_COMP	= $(GCC_CMPLR) $(GCC_CF_ALL) $(CF_TGT) -o $@ -c $<
275               ICC_COMP	= $(ICC_CMPLR) $(ICC_CF_ALL) $(CF_TGT) -o $@ -c $<
276               
277               GCC_LINK	= $(GCC_CMPLR) $(GCC_LF_ALL) $(LF_TGT) -o $@ $^ $(LL_TGT) $(LL_ALL)
278               ICC_LINK	= $(ICC_CMPLR) $(ICC_LF_ALL) $(LF_TGT) -o $@ $^ $(LL_TGT) $(LL_ALL)
279               
280               GCC_COMPLINK	= $(GCC_CMPLR) $(GCC_CF_ALL) $(CF_TGT) $(GCC_LF_ALL) $(LF_TGT) -o $@ $< $(LL_TGT) $(LL_ALL)
281               ICC_COMPLINK	= $(ICC_CMPLR) $(GCC_CF_ALL) $(CF_TGT) $(ICC_LF_ALL) $(LF_TGT) -o $@ $< $(LL_TGT) $(LL_ALL)
282               
283               ifneq ($(COMPILER), icc)
284                 COMP 		= $(GCC_COMP)
285                 LINK		= $(GCC_LINK)
286                 COMPLINK	= $(GCC_COMPLINK)
287               else
288                 COMP 		= $(ICC_COMP)
289                 LINK		= $(ICC_LINK)
290                 COMPLINK	= $(ICC_COMPLINK)
291               endif
292               
293 arta     1.46 FCOMP		= $(FCOMPILER) $(F_CF_ALL) $(FF_TGT) -o $@ -c $<
294               FLINK		= $(FCOMPILER) $(F_LF_ALL) $(LF_TGT) -o $@ $^ $(LL_TGT) $(LL_ALL)
295 arta     1.1  
296 arta     1.58 SLBIN           = ln -sf ../../_$(MACH)/$@ ../bin/$(MACH)/
297               SLLIB		= ln -sf ../../_$(MACH)/$@ ../lib/$(MACH)/
298 arta     1.46 #***********************************************************************************************#
299               
300 arta     1.1  
301 arta     1.46 #***********************************************************************************************#
302               #
303               # LIBRARY COLLECTIONS
304               #
305 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) 
306 arta     1.1  
307               ### Standard parts
308               #
309               include	$(SRCDIR)/Rules.mk
310               
311               # Libraries from src/util linked with all programs.
312 arta     1.12 ifneq ($(COMPILER), icc)
313 phil     1.34   SYSLIBS = -lz -ldl -lpthread -lm
314 arta     1.12 else
315 phil     1.34   SYSLIBS = -lz -ldl -lpthread 
316 arta     1.12 endif
317 arta     1.43 SRCLIBS = $(LIBTHREADUTIL) $(LIBRICECOMP) $(LIBCMDPARAMS) $(LIBTIMEIO) $(LIBFITSRW) $(LIBERRLOG) $(LIBMISC) $(LIBDSTRUCT)
318               FSRCLIBS = $(LIBTHREADUTIL) $(LIBRICECOMP) $(LIBCMDPARAMSF) $(LIBTIMEIO) $(LIBFITSRW) $(LIBERRLOG) $(LIBMISC) $(LIBDSTRUCT)
319 arta     1.1  
320               ########## Libraries to link for server executables,    ##############
321               ########## standalone executables and pipeline modules. ##############
322               
323               # SERVERLIBS: Libraries linked with "server" programs that 
324               # need direct access to the DRMS databases.
325 arta     1.35 SERVERLIBS = $(LIBDRMS) $(LIBDEFSSERVER) $(LIBDB) $(LIBSUMSAPI) $(SRCLIBS)
326 arta     1.1  
327               # EXELIBS: Libraries linked with standalone executables.
328 arta     1.35 EXELIBS = $(LIBDRMSCLIENT) $(LIBDEFSCLIENT) $(LIBDBCLIENT) $(SRCLIBS)
329 arta     1.1  
330               # MODLIBS: Libraries linked with DRMS modules.
331               MODLIBS = $(LIBJSOC_MAIN) $(SERVERLIBS)
332               
333               # MODLIBS_SOCK: Libraries linked with DRMS modules with socket connection to a drms_server
334 arta     1.35 MODLIBS_SOCK = $(LIBJSOC_MAIN_SOCK) $(LIBDRMSCLIENT) $(LIBDEFSCLIENT) $(LIBDBCLIENT) $(LIBSUMSAPI) $(SRCLIBS)
335 arta     1.1  
336               # FMODLIBS: Libraries linked with DRMS Fortran modules
337 arta     1.35 FMODLIBS_SOCK = $(LIBJSOC_MAIN_SOCK_F) $(LIBINTHANDLESF) $(LIBDRMSCLIENT) $(LIBDEFSCLIENT) $(LIBDBCLIENT) $(FSRCLIBS)
338 arta     1.46 #***********************************************************************************************#
339               
340 arta     1.1  
341 arta     1.46 #***********************************************************************************************#
342               #
343               # PROJECT MAKE RULES
344               #
345 arta     1.1  # Make rules that apply to all projects outside of the base DRMS/SUMS system
346 arta     1.3  -include $(SRCDIR)/proj/make_basic.mk
347 arta     1.46 #***********************************************************************************************#
348 arta     1.1  
349 arta     1.46 
350               #***********************************************************************************************#
351               #
352               # MODULE TYPES
353               #
354 arta     1.1  # Make rules that apply to all projects, inside and outside of the base DRMS/SUMS system
355               $(CEXE):	%:	%.o $(EXELIBS)
356               		$(LINK)
357               		$(SLBIN)
358               
359 arta     1.56 $(FEXE):	%:	%.o 
360 arta     1.1  		$(FLINK)
361               		$(SLBIN)
362               
363 arta     1.56 $(SERVEREXE):   LL_TGT := $(LL_TGT) $(PGLIBS) $(CFITSIOLIBS)
364 arta     1.1  $(SERVEREXE):	%:	%.o $(SERVERLIBS)
365               			$(LINK)
366               			$(SLBIN)
367               
368 arta     1.56 $(MODEXE):      LL_TGT := $(LL_TGT) $(PGLIBS) $(CFITSIOLIBS)
369 arta     1.1  $(MODEXE):	%:	%.o $(MODLIBS)
370               			$(LINK)
371               			$(SLBIN)
372               
373 arta     1.11 $(MODEXE_SOCK):	LL_TGT := $(LL_TGT) $(CFITSIOLIBS)
374 arta     1.1  $(MODEXE_SOCK): %_sock: %.o $(MODLIBS_SOCK)
375               			$(LINK)
376               			$(SLBIN)
377 arta     1.42 # FMODEXE_SOCK contains all Fortran modules - the DoIt() function is defined inside a .f file.
378 arta     1.39 # These are socket-connect modules only. Assume they use third-party Fortran libraries
379               # (although this may not be the case).
380 arta     1.56 $(FMODEXE_SOCK):	LL_TGT := $(LL_TGT) $(CFITSIOLIBS) 
381 arta     1.42 $(FMODEXE_SOCK):     %_sock:	%.o $(FMODLIBS_SOCK) 
382 arta     1.1  			$(FLINK)
383               			$(SLBIN)
384 tplarson 1.20 
385 arta     1.39 # MODEXE_USEF contains all C direct-connect modules that use third-party Fortran libraries.
386 arta     1.56 $(MODEXE_USEF):	LL_TGT := $(LL_TGT) $(PGLIBS) $(CFITSIOLIBS) 
387 tplarson 1.20 $(MODEXE_USEF):     %:	%.o $(MODLIBS)
388               			$(FLINK)
389               			$(SLBIN)
390 arta     1.39 # MODEXE_USEF contains all C socket-connect modules that use third-party Fortran libraries.
391 arta     1.56 $(MODEXE_USEF_SOCK):	LL_TGT := $(LL_TGT) $(CFITSIOLIBS) 
392 tplarson 1.20 $(MODEXE_USEF_SOCK): %_sock: %.o $(MODLIBS_SOCK)
393               			$(FLINK)
394               			$(SLBIN)
395 arta     1.46 #***********************************************************************************************#

Karen Tian
Powered by
ViewCVS 0.9.4