(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.45 # 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 arta  1.41 F77 = ifort
 12            
 13 arta  1.45 ifeq ($(JSOC_MACHINE), mac_osx_ppc) 
 14            COMPILER = gcc
 15            F77 = f77
 16            endif
 17            ifeq ($(JSOC_MACHINE), mac_osx_ia32)
 18            COMPILER = gcc
 19            F77 = f77
 20            endif
 21 arta  1.1  
 22            # Check for debug vs. release build - release is default.
 23 arta  1.30 #   To do a debug build, either set the environment variable JSOC_DEBUG to 1, OR
 24            #   modify the following line so that DEBUG = 1.  The environment variable takes precedence.
 25            DEBUG = 0
 26 arta  1.1  
 27            ifdef JSOC_DEBUG
 28            ifeq ($(JSOC_DEBUG), 1)
 29            DEBUG = 1
 30            else
 31            DEBUG = 0
 32            endif
 33            endif
 34            
 35            # No warnings are displayed, by default, for a release build.
 36            WARN = 0
 37            
 38 rick  1.29 # Builder can request warnings via environment variable (setenv JSOC_WARN 1).
 39            #   The environment variable takes precedence.
 40 arta  1.1  ifdef JSOC_WARN
 41            ifeq ($(JSOC_WARN), 1)
 42            WARN = 1
 43            else
 44            WARN = 0
 45            endif
 46            endif
 47            
 48            # Warnings are always displayed for a debug build.
 49            ifeq ($(DEBUG), 1)
 50            WARN = 1
 51            endif
 52            
 53            _JSOCROOT_ = ..
 54            
 55            # if fortran compiler
 56            D_GCC_FORT = 
 57            ifeq ($(F77), ifort)
 58              D_GCC_FORT = -DINTEL_FORTRAN
 59            endif
 60            
 61 arta  1.1  ifeq ($(JSOC_MACHINE), linux_x86_64)
 62 arta  1.41   ifeq ($(F77), ifort)
 63                F77 = ifort -mcmodel=medium
 64              endif
 65 arta  1.1  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 arta  1.40   ICC_CF_ALL = -I$(SRCDIR)/base/include -std=c99 -D_GNU_SOURCE -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.40     ICC_CF_ALL	= -I$(SRCDIR)/base/include -std=c99 -D_GNU_SOURCE $(ICC_WARN) $(ICC_CF_ICCCOMP) $(CUSTOMSW)
185 arta  1.7    endif
186            
187              ifeq ($(JSOC_MACHINE), linux_ia32)
188 arta  1.31     GCC_CF_ALL	= -I$(SRCDIR)/base/include -std=gnu99 -O2 -march=i686 $(GCC_WARN) $(GCC_CF_GCCCOMP) $(CUSTOMSW)
189 arta  1.1    endif	
190            
191            else
192            
193 arta  1.31   GCC_CF_ALL = -I$(SRCDIR)/base/include -std=gnu99 -g $(GCC_WARN) $(GCC_CF_GCCCOMP) $(CUSTOMSW)
194 arta  1.40   ICC_CF_ALL = -I$(SRCDIR)/base/include -std=c99 -D_GNU_SOURCE -g $(ICC_WARN) $(ICC_CF_ICCCOMP) $(CUSTOMSW)
195 arta  1.1  
196            endif
197            
198            # Fortran global LINK flags
199            F_LF_ALL	= -nofor_main -no-ipo
200            
201            # Fortran global COMPILE flags
202            ifeq ($(DEBUG), 0)
203            FF_ALL		= -xW -ftrapuv $(F77_WARN)
204            else
205            FF_ALL		= -ftrapuv $(F77_WARN)
206            endif
207            
208            ### Build tools
209            # 
210            # The C compiler named here must output full (header) dependencies in $(@).d.
211            # It may be necessary to create a script similar to ccd-gcc for your compiler.
212            # 
213            GCC_CMPLR	= $(SRCDIR)/build/ccd-gcc
214            ICC_CMPLR	= $(SRCDIR)/build/ccd-icc
215            ARCHIVE		= ar crus $@ $^
216 arta  1.1  
217            ECPG		= ecpg -o $@ -c $<
218 karen 1.17 SWIG		= swig -perl5 -o $@ $<
219 arta  1.1  
220            GCC_COMP	= $(GCC_CMPLR) $(GCC_CF_ALL) $(CF_TGT) -o $@ -c $<
221            ICC_COMP	= $(ICC_CMPLR) $(ICC_CF_ALL) $(CF_TGT) -o $@ -c $<
222            
223            GCC_LINK	= $(GCC_CMPLR) $(GCC_LF_ALL) $(LF_TGT) -o $@ $^ $(LL_TGT) $(LL_ALL)
224            ICC_LINK	= $(ICC_CMPLR) $(ICC_LF_ALL) $(LF_TGT) -o $@ $^ $(LL_TGT) $(LL_ALL)
225            
226            GCC_COMPLINK	= $(GCC_CMPLR) $(GCC_CF_ALL) $(CF_TGT) $(GCC_LF_ALL) $(LF_TGT) -o $@ $< $(LL_TGT) $(LL_ALL)
227            ICC_COMPLINK	= $(ICC_CMPLR) $(GCC_CF_ALL) $(CF_TGT) $(ICC_LF_ALL) $(LF_TGT) -o $@ $< $(LL_TGT) $(LL_ALL)
228            
229            ifneq ($(COMPILER), icc)
230              COMP 		= $(GCC_COMP)
231              LINK		= $(GCC_LINK)
232              COMPLINK	= $(GCC_COMPLINK)
233            else
234              COMP 		= $(ICC_COMP)
235              LINK		= $(ICC_LINK)
236              COMPLINK	= $(ICC_COMPLINK)
237            endif
238            
239            FCOMP		= $(F77) $(FF_ALL) $(FF_TGT) -o $@ -c $<
240 arta  1.1  FLINK		= $(F77) $(F_LF_ALL) $(LF_TGT) -o $@ $^ $(LL_TGT) $(LL_ALL)
241            
242            SLBIN           = ln -sf ../../_$(JSOC_MACHINE)/$@ ../bin/$(JSOC_MACHINE)/
243            SLLIB		= ln -sf ../../_$(JSOC_MACHINE)/$@ ../lib/$(JSOC_MACHINE)/
244            
245 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) 
246 arta  1.1  
247            ### Standard parts
248            #
249            include	$(SRCDIR)/Rules.mk
250            
251            # Libraries from src/util linked with all programs.
252 arta  1.12 ifneq ($(COMPILER), icc)
253 phil  1.34   SYSLIBS = -lz -ldl -lpthread -lm
254 arta  1.12 else
255 phil  1.34   SYSLIBS = -lz -ldl -lpthread 
256 arta  1.12 endif
257 arta  1.43 SRCLIBS = $(LIBTHREADUTIL) $(LIBRICECOMP) $(LIBCMDPARAMS) $(LIBTIMEIO) $(LIBFITSRW) $(LIBERRLOG) $(LIBMISC) $(LIBDSTRUCT)
258            FSRCLIBS = $(LIBTHREADUTIL) $(LIBRICECOMP) $(LIBCMDPARAMSF) $(LIBTIMEIO) $(LIBFITSRW) $(LIBERRLOG) $(LIBMISC) $(LIBDSTRUCT)
259 arta  1.1  
260            ########## Libraries to link for server executables,    ##############
261            ########## standalone executables and pipeline modules. ##############
262            
263            # SERVERLIBS: Libraries linked with "server" programs that 
264            # need direct access to the DRMS databases.
265 arta  1.35 SERVERLIBS = $(LIBDRMS) $(LIBDEFSSERVER) $(LIBDB) $(LIBSUMSAPI) $(SRCLIBS)
266 arta  1.1  
267            # EXELIBS: Libraries linked with standalone executables.
268 arta  1.35 EXELIBS = $(LIBDRMSCLIENT) $(LIBDEFSCLIENT) $(LIBDBCLIENT) $(SRCLIBS)
269 arta  1.1  
270            # MODLIBS: Libraries linked with DRMS modules.
271            MODLIBS = $(LIBJSOC_MAIN) $(SERVERLIBS)
272            
273            # MODLIBS_SOCK: Libraries linked with DRMS modules with socket connection to a drms_server
274 arta  1.35 MODLIBS_SOCK = $(LIBJSOC_MAIN_SOCK) $(LIBDRMSCLIENT) $(LIBDEFSCLIENT) $(LIBDBCLIENT) $(LIBSUMSAPI) $(SRCLIBS)
275 arta  1.1  
276            # FMODLIBS: Libraries linked with DRMS Fortran modules
277 arta  1.35 FMODLIBS_SOCK = $(LIBJSOC_MAIN_SOCK_F) $(LIBINTHANDLESF) $(LIBDRMSCLIENT) $(LIBDEFSCLIENT) $(LIBDBCLIENT) $(FSRCLIBS)
278 arta  1.1  
279            # Make rules that apply to all projects outside of the base DRMS/SUMS system
280 arta  1.3  -include $(SRCDIR)/proj/make_basic.mk
281 arta  1.1  
282            # Make rules that apply to all projects, inside and outside of the base DRMS/SUMS system
283            $(CEXE):	%:	%.o $(EXELIBS)
284            		$(LINK)
285            		$(SLBIN)
286            
287 arta  1.42 $(FEXE):	%:	%.o $(FMATHLIBS)
288 arta  1.1  		$(FLINK)
289            		$(SLBIN)
290            
291 arta  1.11 $(SERVEREXE):   LL_TGT := $(LL_TGT) -lpq $(CFITSIOLIBS)
292 arta  1.1  $(SERVEREXE):	%:	%.o $(SERVERLIBS)
293            			$(LINK)
294            			$(SLBIN)
295            
296 arta  1.11 $(MODEXE):      LL_TGT := $(LL_TGT) -lpq $(CFITSIOLIBS)
297 arta  1.1  $(MODEXE):	%:	%.o $(MODLIBS)
298            			$(LINK)
299            			$(SLBIN)
300            
301 arta  1.11 $(MODEXE_SOCK):	LL_TGT := $(LL_TGT) $(CFITSIOLIBS)
302 arta  1.1  $(MODEXE_SOCK): %_sock: %.o $(MODLIBS_SOCK)
303            			$(LINK)
304            			$(SLBIN)
305 arta  1.42 # FMODEXE_SOCK contains all Fortran modules - the DoIt() function is defined inside a .f file.
306 arta  1.39 # These are socket-connect modules only. Assume they use third-party Fortran libraries
307            # (although this may not be the case).
308 arta  1.42 $(FMODEXE_SOCK):	LL_TGT := $(LL_TGT) $(CFITSIOLIBS) $(FMATHLIBS)
309            $(FMODEXE_SOCK):     %_sock:	%.o $(FMODLIBS_SOCK) 
310 arta  1.1  			$(FLINK)
311            			$(SLBIN)
312 tplarson 1.20 
313 arta     1.39 # MODEXE_USEF contains all C direct-connect modules that use third-party Fortran libraries.
314               $(MODEXE_USEF):	LL_TGT := $(LL_TGT) -lpq $(CFITSIOLIBS) $(FMATHLIBS)
315 tplarson 1.20 $(MODEXE_USEF):     %:	%.o $(MODLIBS)
316               			$(FLINK)
317               			$(SLBIN)
318 arta     1.39 # MODEXE_USEF contains all C socket-connect modules that use third-party Fortran libraries.
319               $(MODEXE_USEF_SOCK):	LL_TGT := $(LL_TGT) $(CFITSIOLIBS) $(FMATHLIBS)
320 tplarson 1.20 $(MODEXE_USEF_SOCK): %_sock: %.o $(MODLIBS_SOCK)
321               			$(FLINK)
322               			$(SLBIN)

Karen Tian
Powered by
ViewCVS 0.9.4