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

Karen Tian
Powered by
ViewCVS 0.9.4