1 | # -*- makefile -*-
|
---|
2 | # ######################### PEIDA++ #############################
|
---|
3 | # ##### LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA #####
|
---|
4 | # ###############################################################
|
---|
5 | # General setup GNU Makefile for EROS. 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 := ${DPCBASEREP}/${MACHDIR}/
|
---|
79 | PPH := ${HOME}/${MACHDIR}/
|
---|
80 | LIB := ${PP}/Libs/
|
---|
81 | SLB := ${PP}/ShLibs/
|
---|
82 | OBJ := ${PPH}/Objs/
|
---|
83 | EXE := ${PPH}/Exec/
|
---|
84 | INC := ${DPCBASEREP}/Include/
|
---|
85 | GLB := /usr/local/lib/
|
---|
86 | #--
|
---|
87 |
|
---|
88 | #- Flag for optimisation/ debug
|
---|
89 | # Pour forcer sans debug, DBGFLAG = -g0
|
---|
90 | ifndef OPTFLAG
|
---|
91 | OPTFLAG := -O
|
---|
92 | endif
|
---|
93 |
|
---|
94 | ifndef DBGFLAG
|
---|
95 | DBGFLAG := -g
|
---|
96 | # Probleme sur DEC/OSF1 -g avec g++/egcs pose probleme a l'assembleur
|
---|
97 | # Reza 09/99 - On met -gcoff
|
---|
98 | ifeq (${MACHEROS},OSF1)
|
---|
99 | ifeq ($(CXX), g++)
|
---|
100 | override DBGFLAG := -gcoff
|
---|
101 | endif
|
---|
102 | endif
|
---|
103 | endif
|
---|
104 |
|
---|
105 | # DBGFLAG a -g0 veut dire pas de debug. Tout le monde a ca par defaut...
|
---|
106 | ifeq ($(DBGFLAG), -g0)
|
---|
107 | override DBGFLAG :=
|
---|
108 | endif
|
---|
109 |
|
---|
110 | # xlC ne connait pas -O0, par defaut il n'optimise pas.
|
---|
111 | ifeq ($(OPTFLAG), -O0)
|
---|
112 | ifeq ($(CC), xlC)
|
---|
113 | override OPTFLAG :=
|
---|
114 | endif
|
---|
115 | endif
|
---|
116 |
|
---|
117 | AR := ar
|
---|
118 | ARFLAGS := -rcs
|
---|
119 |
|
---|
120 | # le gnu ar ne fonctionne pas bien sur OSF...
|
---|
121 | ifeq (${MACHEROS},OSF1)
|
---|
122 | AR := /usr/bin/ar
|
---|
123 | endif
|
---|
124 | # et sur AIX il nous sort des tas de warnings inutiles
|
---|
125 | ifeq ($(MACHEROS),AIX)
|
---|
126 | AR := /usr/bin/ar
|
---|
127 | endif
|
---|
128 |
|
---|
129 | # Avec certains compilateurs C++ (KCC, aCC) , il faut fabriquer les librairies et
|
---|
130 | # les shared libs avec la meme commande
|
---|
131 | override ARCXX := $(AR)
|
---|
132 | override ARCXXFLAGS := $(ARFLAGS)
|
---|
133 | #RZ0999 ifeq ($(CXX),KCC)
|
---|
134 | #RZ0999 override ARCXX := KCC
|
---|
135 | #RZ0999 override ARCXXFLAGS := -o
|
---|
136 | #RZ0999 endif
|
---|
137 | ifeq ($(CXX),aCC)
|
---|
138 | override ARCXX := aCC
|
---|
139 | override ARCXXFLAGS := -o
|
---|
140 | endif
|
---|
141 |
|
---|
142 | # Les chemins speciaux pour includes systemes et bibliotheques
|
---|
143 | ifeq (${MACHEROS},HP-UX)
|
---|
144 | XLDLIBS := -L.
|
---|
145 | XCFLAGS := -I.
|
---|
146 | endif
|
---|
147 |
|
---|
148 |
|
---|
149 | # Pour compiler PI, sous Linux, les includes et libs se trouve souvent ds /usr/X11/include /usr/X11/lib/
|
---|
150 | ifeq (${MACHEROS},Linux)
|
---|
151 | XLDLIBS := -L/usr/X11/lib -L/usr/X11R6/lib
|
---|
152 | XCFLAGS := -I/usr/X11/include -I/usr/X11R6/include
|
---|
153 | LDLIBS := -ldl
|
---|
154 | endif
|
---|
155 |
|
---|
156 |
|
---|
157 | # Chemin pour la librairie cfitsio
|
---|
158 | FITSIOREP :=
|
---|
159 | FITSIOLIB :=
|
---|
160 | ifeq ($(SITE),LAL)
|
---|
161 | override FITSIOREP :=/exp/planck/FitsIO/cfitsio/
|
---|
162 | override FITSIOLIB := -L$(FITSIOREP) -lcfitsio
|
---|
163 | endif
|
---|
164 |
|
---|
165 | # S'il y a des flags particulier pour un module de compilation
|
---|
166 | #ifndef MODULECPPFLAGS
|
---|
167 | override MODULECPPFLAGS :=
|
---|
168 | #endif
|
---|
169 |
|
---|
170 | CPPFLAGS := -I${INC} -I$(FITSIOREP) -D${MACHEROSD} $(MODULECPPFLAGS)
|
---|
171 |
|
---|
172 | # Les options selon les divers compilateurs
|
---|
173 | # GNU
|
---|
174 | ifeq ($(CC), gcc)
|
---|
175 | CFLAGS := -Wall -Wpointer-arith \
|
---|
176 | -Wmissing-prototypes -Wsynth -I$(INC) $(XCFLAGS) \
|
---|
177 | $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
|
---|
178 | LDLIBS := $(LDLIBS) $(XLDLIBS)
|
---|
179 | endif
|
---|
180 | ifeq ($(CC), egcs)
|
---|
181 | CFLAGS := -Wall -Wpointer-arith \
|
---|
182 | -Wmissing-prototypes -Wsynth -I$(INC) $(XCFLAGS) \
|
---|
183 | $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
|
---|
184 | LDLIBS := $(LDLIBS) $(XLDLIBS)
|
---|
185 | endif
|
---|
186 |
|
---|
187 | ifeq ($(CXX), g++)
|
---|
188 | CXXFLAGS := -Wall -Wpointer-arith \
|
---|
189 | -Wmissing-prototypes -Wsynth -I$(INC) $(XCFLAGS) \
|
---|
190 | $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
|
---|
191 | LDLIBS := $(LDLIBS) $(XLDLIBS)
|
---|
192 | # Il faut trouver un moyen d'automatiser ca $CHECK$ Reza 23/12/98
|
---|
193 | ifdef GCCV28
|
---|
194 | CXXFLAGS := $(CXXFLAGS) -fguiding-decls -fname-mangling-version-1 -DCOMPILER_EXCEPTIONS
|
---|
195 | endif
|
---|
196 | ifdef NOSHLIB
|
---|
197 | LDFLAGS := -static
|
---|
198 | endif
|
---|
199 | endif
|
---|
200 | ifeq ($(CXX), egcs++)
|
---|
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 |
|
---|
210 | # Compilateur C natif HP-UX
|
---|
211 | ifeq (${MACHEROS},HP-UX)
|
---|
212 | ifeq ($(CC),cc)
|
---|
213 | CFLAGS := +Z -Aa -Ae $(XCFLAGS) $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
|
---|
214 | FFLAGS := -Aa -I${INC} -D${MACHEROSD}
|
---|
215 | CPPFLAGS := -I${INC} -I$(INC)/tnt -D${MACHEROSD} \
|
---|
216 | -D_HPUX_SOURCE $(MODULECPPFLAGS)
|
---|
217 | LDLIBS := $(XLDLIBS)
|
---|
218 | override NOSHLIB := Y
|
---|
219 |
|
---|
220 | endif
|
---|
221 | ifeq ($(CXX),aCC)
|
---|
222 | CXXFLAGS := $(XCFLAGS) $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS) +Z -D__aCC__
|
---|
223 | # -DCOMPILER_EXCEPTIONS -D__ANSI_TEMPLATES__ definis ds defs.h
|
---|
224 | endif
|
---|
225 | endif
|
---|
226 |
|
---|
227 | # AIX, xlC comme compilateur C et C++
|
---|
228 | ifeq ($(CXX), xlC)
|
---|
229 | CFLAGS := $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS) $(XCFLAGS)
|
---|
230 | CPPFLAGS := -I$(INC)/Syst -I${INC} -I$(INC)/tnt -D${MACHEROSD} $(MODULECPPFLAGS)
|
---|
231 | CXXFLAGS := $(CFLAGS) -D__xlC -DCOMPILER_EXCEPTIONS
|
---|
232 | # -DCOMPILER_EXCEPTIONS defini ds defs.h
|
---|
233 | LDLIBS := $(XLDLIBS)
|
---|
234 |
|
---|
235 | # Pour faire des bibliotheques partagees, il faut faire un truc du
|
---|
236 | # style
|
---|
237 | #ld -o shrsub.o subs1.o subs2.o -bE:shrsub.exp -bM:SRE -lc
|
---|
238 |
|
---|
239 | # Pour le moment on ne se fatigue pas, tant pis
|
---|
240 | override NOSHLIB := Y
|
---|
241 |
|
---|
242 | # Et puis 1540-293: (W) est un FAUX warning, on supprime les warnings
|
---|
243 | CXXFLAGS := -qflag=e $(CXXFLAGS)
|
---|
244 | endif
|
---|
245 |
|
---|
246 |
|
---|
247 | ifeq ($(CXX), cxx)
|
---|
248 | ifeq ($(DBGFLAG), -g)
|
---|
249 | ifdef OPTFLAG
|
---|
250 | override DBGFLAG := -g1
|
---|
251 | endif
|
---|
252 | # ifdef XOPT
|
---|
253 | # override DBGFLAG := -g1
|
---|
254 | # endif
|
---|
255 | endif
|
---|
256 |
|
---|
257 | # chemin pour repository CXX
|
---|
258 | REP := $(OBJ)/cxxrep/
|
---|
259 | REPPI := $(OBJ)/cxxrep_PI/
|
---|
260 | REPCXX := -ptr $(OBJ)/cxxrep/
|
---|
261 | ifdef MODULECXXREPNAME
|
---|
262 | REPCXX := -ptr $(OBJ)/cxxrep_$(MODULECXXREPNAME)/ -ptr $(OBJ)/cxxrep/
|
---|
263 | REPM := $(OBJ)/cxxrep_$(MODULECXXREPNAME)/
|
---|
264 | endif
|
---|
265 |
|
---|
266 | LDLIBS := $(XLDLIBS) -lrt
|
---|
267 |
|
---|
268 | CXXFLAGS := $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS) -DCOMPILER_EXCEPTIONS \
|
---|
269 | $(REPCXX) -no_implicit_include
|
---|
270 | CFLAGS := $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
|
---|
271 | # CXXFLAGS := $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS) -DCOMPILER_EXCEPTIONS \
|
---|
272 | # -nopt -define_templates
|
---|
273 | ifeq ($(XOPT), 1)
|
---|
274 | override DBGFLAG :=
|
---|
275 | CXXFLAGS := $(DBGFLAG) $(MYCFLAGS) -DCOMPILER_EXCEPTIONS \
|
---|
276 | $(REPCXX) -fp_reorder \
|
---|
277 | -O5 -inline speed -tune host
|
---|
278 | endif
|
---|
279 | ifeq ($(XOPT), 2)
|
---|
280 | override DBGFLAG :=
|
---|
281 | CXXFLAGS := $(DBGFLAG) $(MYCFLAGS) -DCOMPILER_EXCEPTIONS \
|
---|
282 | $(REPCXX) -fp_reorder \
|
---|
283 | -O5 -inline speed -tune host \
|
---|
284 | -assume trusted_short_alignment
|
---|
285 | endif
|
---|
286 | ifeq ($(XOPT), 3)
|
---|
287 | override DBGFLAG :=
|
---|
288 | CXXFLAGS := $(DBGFLAG) $(MYCFLAGS) -DCOMPILER_EXCEPTIONS \
|
---|
289 | $(REPCXX) -fp_reorder \
|
---|
290 | -O5 -inline speed -tune host \
|
---|
291 | -assume trusted_short_alignment \
|
---|
292 | -non_shared -om
|
---|
293 | override NOSHLIB := Y
|
---|
294 | endif
|
---|
295 |
|
---|
296 | # le fichier X11/Xlib.h contient des declarations de fonctions sans type
|
---|
297 | # Cela genere un grand nombre de warning avec cxx V6
|
---|
298 | # La variable MODULEDECCXXFLAGS permet de specifier des options de compilation
|
---|
299 | # pour un module donne
|
---|
300 | ifdef MODULEDECCXXFLAGS
|
---|
301 | CXXFLAGS := $(CXXFLAGS) $(MODULEDECCXXFLAGS)
|
---|
302 | endif
|
---|
303 | endif
|
---|
304 | ifeq ($(CC),cc)
|
---|
305 | ifeq ($(MACHEROS),OSF1)
|
---|
306 | ifeq ($(XOPT), 1)
|
---|
307 | CFLAGS := $(DBGFLAG) $(MYCFLAGS) -fp_reorder \
|
---|
308 | -O4 -inline speed -tune host
|
---|
309 | endif
|
---|
310 | ifeq ($(XOPT), 2)
|
---|
311 | CFLAGS := $(DBGFLAG) $(MYCFLAGS) -fp_reorder \
|
---|
312 | -O4 -inline speed -tune host \
|
---|
313 | -assume trusted_short_alignment -fast
|
---|
314 | endif
|
---|
315 | ifeq ($(XOPT), 3)
|
---|
316 | CFLAGS := $(DBGFLAG) $(MYCFLAGS) -fp_reorder \
|
---|
317 | -O4 -inline speed -tune host \
|
---|
318 | -assume trusted_short_alignment -fast \
|
---|
319 | -non_shared -om
|
---|
320 | endif
|
---|
321 | endif
|
---|
322 | endif
|
---|
323 |
|
---|
324 | # --- Compilateur KAI (OK pour v 3.3)
|
---|
325 | ifeq ($(CXX), KCC)
|
---|
326 | CXXFLAGS := --exceptions --rtti --auto_instantiation --one_instantiation_per_object -D__KCC__
|
---|
327 | # Flag --one_instantiation_per_object mis - Reza 02/03/99
|
---|
328 | # -DCOMPILER_EXCEPTIONS -D__ANSI_TEMPLATES__ definis ds defs.h
|
---|
329 | endif
|
---|
330 |
|
---|
331 | # --- Compilateur natif CC de SGI
|
---|
332 | ifeq ($(MACHEROS), IRIX64)
|
---|
333 | ifeq ($(CXX), CC)
|
---|
334 | CXXFLAGS := -prelink -D__SGICC__
|
---|
335 | endif
|
---|
336 | endif
|
---|
337 |
|
---|
338 | # Autres compilateurs natifs.
|
---|
339 |
|
---|
340 | # CFLAGS := -I$(INC) $(XCFLAGS) $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
|
---|
341 | # CXXFLAGS := $(CFLAGS)
|
---|
342 | # LDLIBS := $(XLDLIBS)
|
---|
343 |
|
---|
344 | #- redefine implicit rule. Les .o sont dans $(OBJ).
|
---|
345 | $(OBJ)%.o:%.c
|
---|
346 | $(COMPILE.c) -o $@ $<
|
---|
347 |
|
---|
348 | $(OBJ)%.o:%.cc
|
---|
349 | $(COMPILE.cc) -o $@ $<
|
---|
350 |
|
---|
351 | $(OBJ)%.o:%.f
|
---|
352 | $(COMPILE.f) -o $@ $<
|
---|
353 |
|
---|
354 | #OSF1
|
---|
355 | #LDFC est f77
|
---|
356 | #LDFCFLAGS est rien
|
---|
357 |
|
---|
358 | #parfois
|
---|
359 | #LDFC est cc
|
---|
360 | #LDFCFLAGS est -ltruc
|
---|
361 |
|
---|
362 | #------------------------------------------------- End of Makefile.h -------
|
---|
363 | # fin gene auto MakefileUser.h
|
---|