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

Karen Tian
Powered by
ViewCVS 0.9.4