1 | # -*- makefile -*-
|
---|
2 | # ######################### Sophya #############################
|
---|
3 | # ##### LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA #####
|
---|
4 | # ###############################################################
|
---|
5 | # General setup GNU Makefile for Sopyha/Planck. To be included in all makefiles.
|
---|
6 | # Define makefile variables according to CPU
|
---|
7 | # MACHEROSD = `uname | sed 's/-//'` i.e. { AIX HPUX OSF1 Linux ... }
|
---|
8 | # and compilers {g++, cxx, KCC, xlC, aCC, ...}
|
---|
9 | #
|
---|
10 | # Makefile variables set are:
|
---|
11 | # - Path to Exec, Include, Libs, Obj directories (from DPCDEVREP env. var.)
|
---|
12 | # i.e. variables LIB, OBJ, EXE, INC
|
---|
13 | #---------------------------------------------------------------------------
|
---|
14 |
|
---|
15 | # define MACHEROS from uname
|
---|
16 | MACHEROS := $(shell echo `uname`)
|
---|
17 | # define the -D option
|
---|
18 | MACHEROSD := $(shell echo `uname | sed 's/-//'`)
|
---|
19 | # Le sous-repertoire des objets specifique machine-compilo
|
---|
20 | # OSF1 : Alpha avec gcc
|
---|
21 | # OSF1-cxx : Alpha avec cxx
|
---|
22 |
|
---|
23 | #### C++
|
---|
24 | ifdef EROSCXX
|
---|
25 | CXX := $(EROSCXX)
|
---|
26 | endif
|
---|
27 |
|
---|
28 | ifeq ($(CXX),gcc)
|
---|
29 | override CXX := g++
|
---|
30 | endif
|
---|
31 |
|
---|
32 | ifeq ($(EROSCXX),egcs++)
|
---|
33 | # en fait de compilo de egcs++ s'appelle g++ !
|
---|
34 | # comme il faut bien differentier ln -s /usr/bin/g++ /usr/bin/egcs++
|
---|
35 | override CXX := egcs++
|
---|
36 | endif
|
---|
37 |
|
---|
38 | ifeq ($(CC),xlC)
|
---|
39 | override CXX := xlC
|
---|
40 | endif
|
---|
41 |
|
---|
42 | #### C
|
---|
43 | ifeq ($(CXX), xlC)
|
---|
44 | override CC := xlC
|
---|
45 | endif
|
---|
46 |
|
---|
47 | ifeq ($(CXX), g++)
|
---|
48 | CC := gcc
|
---|
49 | endif
|
---|
50 |
|
---|
51 | ifeq ($(EROSCXX), egcs++)
|
---|
52 | CC := egcs
|
---|
53 | endif
|
---|
54 |
|
---|
55 | #### Fortran (tout ce qui est lie au Fortran est defini ici #############
|
---|
56 | FC = f77
|
---|
57 | ifeq (${MACHEROS},Linux)
|
---|
58 | # override FC := f77
|
---|
59 | override FC := g77
|
---|
60 | endif
|
---|
61 |
|
---|
62 | ifeq (${MACHEROS},OSF1)
|
---|
63 | LIBFORT = -lfor -lFutil -lots -lUfor
|
---|
64 | endif
|
---|
65 | ifeq (${MACHEROS},Linux)
|
---|
66 | LIBFORT = -lf2c
|
---|
67 | endif
|
---|
68 | #########################################################################
|
---|
69 |
|
---|
70 |
|
---|
71 | MACHDIR := $(MACHEROS)-$(CXX)
|
---|
72 |
|
---|
73 |
|
---|
74 | #-
|
---|
75 | #- Define Makefile paths
|
---|
76 | #- (NE PAS TOUCHER CES LIGNES: generation automatique de MakefileUser.h)
|
---|
77 | #-
|
---|
78 | PP := ${DPCDEVREP}/${MACHDIR}/
|
---|
79 | LIB := ${PP}/Libs/
|
---|
80 | SLB := ${PP}/ShLibs/
|
---|
81 | OBJ := ${PP}/Objs/
|
---|
82 | EXE := ${PP}/Exec/
|
---|
83 | INC := ${DPCDEVREP}/Include/
|
---|
84 | GLB := /usr/local/lib/
|
---|
85 | #--
|
---|
86 |
|
---|
87 | #- Flag for optimisation/ debug
|
---|
88 | # Pour forcer sans debug, DBGFLAG = -g0
|
---|
89 | ifndef OPTFLAG
|
---|
90 | OPTFLAG := -O
|
---|
91 | endif
|
---|
92 |
|
---|
93 | ifndef DBGFLAG
|
---|
94 | DBGFLAG := -g
|
---|
95 | # Probleme sur DEC/OSF1 -g avec g++/egcs pose probleme a l'assembleur
|
---|
96 | # Reza 09/99 - On met -gcoff
|
---|
97 | ifeq (${MACHEROS},OSF1)
|
---|
98 | ifeq ($(CXX), g++)
|
---|
99 | override DBGFLAG := -gcoff
|
---|
100 | endif
|
---|
101 | endif
|
---|
102 | endif
|
---|
103 |
|
---|
104 | # DBGFLAG a -g0 veut dire pas de debug. Tout le monde a ca par defaut...
|
---|
105 | ifeq ($(DBGFLAG), -g0)
|
---|
106 | override DBGFLAG :=
|
---|
107 | endif
|
---|
108 |
|
---|
109 | # xlC ne connait pas -O0, par defaut il n'optimise pas.
|
---|
110 | ifeq ($(OPTFLAG), -O0)
|
---|
111 | ifeq ($(CC), xlC)
|
---|
112 | override OPTFLAG :=
|
---|
113 | endif
|
---|
114 | endif
|
---|
115 |
|
---|
116 | AR := ar
|
---|
117 | ARFLAGS := -rcs
|
---|
118 |
|
---|
119 | # le gnu ar ne fonctionne pas bien sur OSF...
|
---|
120 | ifeq (${MACHEROS},OSF1)
|
---|
121 | AR := /usr/bin/ar
|
---|
122 | endif
|
---|
123 | # et sur AIX il nous sort des tas de warnings inutiles
|
---|
124 | ifeq ($(MACHEROS),AIX)
|
---|
125 | AR := /usr/bin/ar
|
---|
126 | endif
|
---|
127 |
|
---|
128 | # Avec certains compilateurs C++ (KCC, aCC) , il faut fabriquer les librairies et
|
---|
129 | # les shared libs avec la meme commande
|
---|
130 | override ARCXX := $(AR)
|
---|
131 | override ARCXXFLAGS := $(ARFLAGS)
|
---|
132 | #RZ0999 ifeq ($(CXX),KCC)
|
---|
133 | #RZ0999 override ARCXX := KCC
|
---|
134 | #RZ0999 override ARCXXFLAGS := -o
|
---|
135 | #RZ0999 endif
|
---|
136 | ifeq ($(CXX),aCC)
|
---|
137 | override ARCXX := aCC
|
---|
138 | override ARCXXFLAGS := -o
|
---|
139 | endif
|
---|
140 |
|
---|
141 | # Les chemins speciaux pour includes systemes et bibliotheques
|
---|
142 | ifeq (${MACHEROS},HP-UX)
|
---|
143 | XLDLIBS := -L.
|
---|
144 | XCFLAGS := -I.
|
---|
145 | endif
|
---|
146 |
|
---|
147 |
|
---|
148 | # Pour compiler PI, sous Linux, les includes et libs se trouve souvent ds /usr/X11/include /usr/X11/lib/
|
---|
149 | ifeq (${MACHEROS},Linux)
|
---|
150 | XLDLIBS := -L/usr/X11/lib -L/usr/X11R6/lib
|
---|
151 | XCFLAGS := -I/usr/X11/include -I/usr/X11R6/include
|
---|
152 | LDLIBS := -ldl
|
---|
153 | endif
|
---|
154 |
|
---|
155 | # Chemin pour les include et fichiers d'autres librairies
|
---|
156 | EXTINCPI :=
|
---|
157 | EXTLIBPL :=
|
---|
158 | EXTSLBPL :=
|
---|
159 | EXTINCPATH :=
|
---|
160 | EXTLIBPATH :=
|
---|
161 | EXTSLBPATH :=
|
---|
162 |
|
---|
163 | ifdef EXTLIBDIR
|
---|
164 | EXTINCPI := -I$(EXTLIBDIR)/Include/
|
---|
165 | EXTLIBPL := -L$(EXTLIBDIR)/$(MACHDIR)/Libs/
|
---|
166 | EXTSLBPL := -L$(EXTLIBDIR)/$(MACHDIR)/ShLibs/
|
---|
167 | EXTINCPATH := $(EXTLIBDIR)/Include/
|
---|
168 | EXTLIBPATH := $(EXTLIBDIR)/$(MACHDIR)/Libs/
|
---|
169 | EXTSLBPATH := $(EXTLIBDIR)/$(MACHDIR)/ShLibs/
|
---|
170 | endif
|
---|
171 |
|
---|
172 | # S'il y a des flags particulier pour un module de compilation
|
---|
173 | #ifndef MODULECPPFLAGS
|
---|
174 | override MODULECPPFLAGS :=
|
---|
175 | #endif
|
---|
176 |
|
---|
177 | CPPFLAGS := -I${INC} $(EXTINCPI) -D${MACHEROSD} $(MODULECPPFLAGS)
|
---|
178 |
|
---|
179 | # Si la variable d'environnement SOPHYA_DEBUG est definie : Activation des
|
---|
180 | # compilations conditionnelles pour le debug/bound-checking/... ds le code
|
---|
181 | ifdef SOPHYA_DEBUG
|
---|
182 | CPPFLAGS := $(CPPFLAGS) -DSOPHYA_DEBUG
|
---|
183 | endif
|
---|
184 |
|
---|
185 | # Les options selon les divers compilateurs
|
---|
186 | # GNU
|
---|
187 | ifeq ($(CC), gcc)
|
---|
188 | CFLAGS := -Wall -Wpointer-arith \
|
---|
189 | -Wmissing-prototypes -Wsynth -I$(INC) $(XCFLAGS) \
|
---|
190 | $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
|
---|
191 | LDLIBS := $(LDLIBS) $(XLDLIBS)
|
---|
192 | endif
|
---|
193 | ifeq ($(CC), egcs)
|
---|
194 | CFLAGS := -Wall -Wpointer-arith \
|
---|
195 | -Wmissing-prototypes -Wsynth -I$(INC) $(XCFLAGS) \
|
---|
196 | $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
|
---|
197 | LDLIBS := $(LDLIBS) $(XLDLIBS)
|
---|
198 | endif
|
---|
199 |
|
---|
200 | ifeq ($(CXX), g++)
|
---|
201 | CXXFLAGS := -Wall -Wpointer-arith \
|
---|
202 | -Wmissing-prototypes -Wsynth -I$(INC) $(XCFLAGS) \
|
---|
203 | $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
|
---|
204 | LDLIBS := $(LDLIBS) $(XLDLIBS)
|
---|
205 | # ifdef NOSHLIB
|
---|
206 | # LDFLAGS := -static
|
---|
207 | # endif
|
---|
208 | endif
|
---|
209 | ifeq ($(CXX), egcs++)
|
---|
210 | CXXFLAGS := -Wall -Wpointer-arith \
|
---|
211 | -Wmissing-prototypes -Wsynth -I$(INC) $(XCFLAGS) \
|
---|
212 | $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
|
---|
213 | LDLIBS := $(LDLIBS) $(XLDLIBS)
|
---|
214 | ifdef NOSHLIB
|
---|
215 | LDFLAGS := -static
|
---|
216 | endif
|
---|
217 | endif
|
---|
218 |
|
---|
219 | # Compilateur C natif HP-UX
|
---|
220 | ifeq (${MACHEROS},HP-UX)
|
---|
221 | ifeq ($(CC),cc)
|
---|
222 | CFLAGS := +Z -Aa -Ae $(XCFLAGS) $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
|
---|
223 | FFLAGS := -Aa -I${INC} -D${MACHEROSD}
|
---|
224 | CPPFLAGS := -I${INC} -I$(INC)/tnt -D${MACHEROSD} \
|
---|
225 | -D_HPUX_SOURCE $(MODULECPPFLAGS)
|
---|
226 | LDLIBS := $(XLDLIBS)
|
---|
227 | override NOSHLIB := Y
|
---|
228 |
|
---|
229 | endif
|
---|
230 | ifeq ($(CXX),aCC)
|
---|
231 | CXXFLAGS := $(XCFLAGS) $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS) +Z -D__aCC__
|
---|
232 | # -DCOMPILER_EXCEPTIONS -D__ANSI_TEMPLATES__ definis ds defs.h
|
---|
233 | endif
|
---|
234 | endif
|
---|
235 |
|
---|
236 | # AIX, xlC comme compilateur C et C++
|
---|
237 | ifeq ($(CXX), xlC)
|
---|
238 | CFLAGS := $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS) $(XCFLAGS)
|
---|
239 | CPPFLAGS := -I$(INC)/Syst -I${INC} -I$(INC)/tnt -D${MACHEROSD} $(MODULECPPFLAGS)
|
---|
240 | CXXFLAGS := $(CFLAGS) -D__xlC
|
---|
241 | # -DCOMPILER_EXCEPTIONS defini ds defs.h
|
---|
242 | LDLIBS := $(XLDLIBS)
|
---|
243 |
|
---|
244 | # Pour faire des bibliotheques partagees, il faut faire un truc du
|
---|
245 | # style
|
---|
246 | #ld -o shrsub.o subs1.o subs2.o -bE:shrsub.exp -bM:SRE -lc
|
---|
247 |
|
---|
248 | # Pour le moment on ne se fatigue pas, tant pis
|
---|
249 | override NOSHLIB := Y
|
---|
250 |
|
---|
251 | # Et puis 1540-293: (W) est un FAUX warning, on supprime les warnings
|
---|
252 | CXXFLAGS := -qflag=e $(CXXFLAGS)
|
---|
253 | endif
|
---|
254 |
|
---|
255 |
|
---|
256 | ifeq ($(CXX), cxx)
|
---|
257 | ifeq ($(DBGFLAG), -g)
|
---|
258 | ifdef OPTFLAG
|
---|
259 | override DBGFLAG := -g1
|
---|
260 | endif
|
---|
261 | # ifdef XOPT
|
---|
262 | # override DBGFLAG := -g1
|
---|
263 | # endif
|
---|
264 | endif
|
---|
265 |
|
---|
266 | # chemin pour repository CXX
|
---|
267 | REP := $(OBJ)/cxxrep/
|
---|
268 | REPPI := $(OBJ)/cxxrep_PI/
|
---|
269 | REPCXX := -ptr $(OBJ)/cxxrep/
|
---|
270 | ifdef MODULECXXREPNAME
|
---|
271 | REPCXX := -ptr $(OBJ)/cxxrep_$(MODULECXXREPNAME)/ -ptr $(OBJ)/cxxrep/
|
---|
272 | REPM := $(OBJ)/cxxrep_$(MODULECXXREPNAME)/
|
---|
273 | endif
|
---|
274 |
|
---|
275 | LDLIBS := $(XLDLIBS) -lrt
|
---|
276 |
|
---|
277 | CXXFLAGS := $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS) \
|
---|
278 | $(REPCXX) -no_implicit_include
|
---|
279 | # $(REPCXX) -no_implicit_include -D__USE_STD_IOSTREAM passe pas avec cxx 6.0 Reza 23/12/99
|
---|
280 | CFLAGS := $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
|
---|
281 | # CXXFLAGS := $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS) \
|
---|
282 | # -nopt -define_templates
|
---|
283 | ifeq ($(XOPT), 1)
|
---|
284 | override DBGFLAG :=
|
---|
285 | CXXFLAGS := $(DBGFLAG) $(MYCFLAGS) \
|
---|
286 | $(REPCXX) -fp_reorder \
|
---|
287 | -O5 -inline speed -tune host
|
---|
288 | endif
|
---|
289 | ifeq ($(XOPT), 2)
|
---|
290 | override DBGFLAG :=
|
---|
291 | CXXFLAGS := $(DBGFLAG) $(MYCFLAGS) \
|
---|
292 | $(REPCXX) -fp_reorder \
|
---|
293 | -O5 -inline speed -tune host \
|
---|
294 | -assume trusted_short_alignment
|
---|
295 | endif
|
---|
296 | ifeq ($(XOPT), 3)
|
---|
297 | override DBGFLAG :=
|
---|
298 | CXXFLAGS := $(DBGFLAG) $(MYCFLAGS) \
|
---|
299 | $(REPCXX) -fp_reorder \
|
---|
300 | -O5 -inline speed -tune host \
|
---|
301 | -assume trusted_short_alignment \
|
---|
302 | -non_shared -om
|
---|
303 | override NOSHLIB := Y
|
---|
304 | endif
|
---|
305 |
|
---|
306 | # le fichier X11/Xlib.h contient des declarations de fonctions sans type
|
---|
307 | # Cela genere un grand nombre de warning avec cxx V6
|
---|
308 | # La variable MODULEDECCXXFLAGS permet de specifier des options de compilation
|
---|
309 | # pour un module donne
|
---|
310 | ifdef MODULEDECCXXFLAGS
|
---|
311 | CXXFLAGS := $(CXXFLAGS) $(MODULEDECCXXFLAGS)
|
---|
312 | endif
|
---|
313 | endif
|
---|
314 | ifeq ($(CC),cc)
|
---|
315 | ifeq ($(MACHEROS),OSF1)
|
---|
316 | ifeq ($(XOPT), 1)
|
---|
317 | CFLAGS := $(DBGFLAG) $(MYCFLAGS) -fp_reorder \
|
---|
318 | -O4 -inline speed -tune host
|
---|
319 | endif
|
---|
320 | ifeq ($(XOPT), 2)
|
---|
321 | CFLAGS := $(DBGFLAG) $(MYCFLAGS) -fp_reorder \
|
---|
322 | -O4 -inline speed -tune host \
|
---|
323 | -assume trusted_short_alignment -fast
|
---|
324 | endif
|
---|
325 | ifeq ($(XOPT), 3)
|
---|
326 | CFLAGS := $(DBGFLAG) $(MYCFLAGS) -fp_reorder \
|
---|
327 | -O4 -inline speed -tune host \
|
---|
328 | -assume trusted_short_alignment -fast \
|
---|
329 | -non_shared -om
|
---|
330 | endif
|
---|
331 | endif
|
---|
332 | endif
|
---|
333 |
|
---|
334 | # --- Compilateur KAI (OK pour v 3.3)
|
---|
335 | ifeq ($(CXX), KCC)
|
---|
336 | CXXFLAGS := --exceptions --rtti --auto_instantiation --one_instantiation_per_object -D__KCC__
|
---|
337 | CXXFLAGS := $(CXXFLAGS) $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
|
---|
338 | CFLAGS := $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
|
---|
339 | # Flag --one_instantiation_per_object mis - Reza 02/03/99
|
---|
340 | endif
|
---|
341 |
|
---|
342 | # --- Systeme IRIX64 de Silixon Graphics (SGI)
|
---|
343 | ifeq ($(MACHEROS), IRIX64)
|
---|
344 | # --- Compilateur natif CC de SGI
|
---|
345 | ifeq ($(CXX), CC)
|
---|
346 | CFLAGS := $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
|
---|
347 | CXXFLAGS := -prelink -D__SGICC__ $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
|
---|
348 | LINK.cc := CC $(CPPFLAGS) -D__SGICC__ $(DBGFLAG) $(OPTFLAG)
|
---|
349 | # sur SGI, les libs/executables ont deux formats 32 et 64 bits (trois avec o32)
|
---|
350 | # -n32 Generates a (new) 32-bit object default to -mips3 if -mips4 has not been specified
|
---|
351 | # -64 Generates a 64-bit object - defaults to -mips4 if -mips3 has not been specified
|
---|
352 | # La variable d'environnement SOPHYA_SGI64 controle cette option
|
---|
353 | ifdef SOPHYA_SGI64
|
---|
354 | CFLAGS := -64 $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
|
---|
355 | CXXFLAGS := -64 -prelink -D__SGICC__ $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
|
---|
356 | LINK.cc := CC -64 $(CPPFLAGS) -D__SGICC__ $(DBGFLAG) $(OPTFLAG)
|
---|
357 | endif
|
---|
358 | endif
|
---|
359 | endif
|
---|
360 |
|
---|
361 | # Autres compilateurs natifs.
|
---|
362 |
|
---|
363 | # CFLAGS := -I$(INC) $(XCFLAGS) $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
|
---|
364 | # CXXFLAGS := $(CFLAGS)
|
---|
365 | # LDLIBS := $(XLDLIBS)
|
---|
366 |
|
---|
367 | #- redefine implicit rule. Les .o sont dans $(OBJ).
|
---|
368 | $(OBJ)%.o:%.c
|
---|
369 | $(COMPILE.c) -o $@ $<
|
---|
370 |
|
---|
371 | $(OBJ)%.o:%.cc
|
---|
372 | $(COMPILE.cc) -o $@ $<
|
---|
373 |
|
---|
374 | $(OBJ)%.o:%.f
|
---|
375 | $(COMPILE.f) -o $@ $<
|
---|
376 |
|
---|
377 | #OSF1
|
---|
378 | #LDFC est f77
|
---|
379 | #LDFCFLAGS est rien
|
---|
380 |
|
---|
381 | #parfois
|
---|
382 | #LDFC est cc
|
---|
383 | #LDFCFLAGS est -ltruc
|
---|
384 |
|
---|
385 | #------------------------------------------------- End of Makefile.h -------
|
---|