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