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 := ${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 |
|
---|
156 | # Chemin pour la librairie cfitsio
|
---|
157 | # les *.h doivent etre sous $CFITSIODIR
|
---|
158 | # la librairie *.a sous $CFITSIODIR
|
---|
159 | ifdef CFITSIODIR
|
---|
160 | FITSIOREP := -I$(CFITSIODIR)
|
---|
161 | FITSIOLIB := -L$(CFITSIODIR)/$(MACHDIR) -lcfitsio
|
---|
162 | endif
|
---|
163 |
|
---|
164 | # S'il y a des flags particulier pour un module de compilation
|
---|
165 | #ifndef MODULECPPFLAGS
|
---|
166 | override MODULECPPFLAGS :=
|
---|
167 | #endif
|
---|
168 |
|
---|
169 | CPPFLAGS := -I${INC} $(FITSIOREP) -D${MACHEROSD} $(MODULECPPFLAGS)
|
---|
170 |
|
---|
171 | # Les options selon les divers compilateurs
|
---|
172 | # GNU
|
---|
173 | ifeq ($(CC), gcc)
|
---|
174 | CFLAGS := -Wall -Wpointer-arith \
|
---|
175 | -Wmissing-prototypes -Wsynth -I$(INC) $(XCFLAGS) \
|
---|
176 | $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
|
---|
177 | LDLIBS := $(LDLIBS) $(XLDLIBS)
|
---|
178 | endif
|
---|
179 | ifeq ($(CC), egcs)
|
---|
180 | CFLAGS := -Wall -Wpointer-arith \
|
---|
181 | -Wmissing-prototypes -Wsynth -I$(INC) $(XCFLAGS) \
|
---|
182 | $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
|
---|
183 | LDLIBS := $(LDLIBS) $(XLDLIBS)
|
---|
184 | endif
|
---|
185 |
|
---|
186 | ifeq ($(CXX), g++)
|
---|
187 | CXXFLAGS := -Wall -Wpointer-arith \
|
---|
188 | -Wmissing-prototypes -Wsynth -I$(INC) $(XCFLAGS) \
|
---|
189 | $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
|
---|
190 | LDLIBS := $(LDLIBS) $(XLDLIBS)
|
---|
191 | # Il faut trouver un moyen d'automatiser ca $CHECK$ Reza 23/12/98
|
---|
192 | ifdef GCCV28
|
---|
193 | CXXFLAGS := $(CXXFLAGS) -fguiding-decls -fname-mangling-version-1 -DCOMPILER_EXCEPTIONS
|
---|
194 | endif
|
---|
195 | ifdef NOSHLIB
|
---|
196 | LDFLAGS := -static
|
---|
197 | endif
|
---|
198 | endif
|
---|
199 | ifeq ($(CXX), egcs++)
|
---|
200 | CXXFLAGS := -Wall -Wpointer-arith \
|
---|
201 | -Wmissing-prototypes -Wsynth -I$(INC) $(XCFLAGS) \
|
---|
202 | $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
|
---|
203 | LDLIBS := $(LDLIBS) $(XLDLIBS)
|
---|
204 | ifdef NOSHLIB
|
---|
205 | LDFLAGS := -static
|
---|
206 | endif
|
---|
207 | endif
|
---|
208 |
|
---|
209 | # Compilateur C natif HP-UX
|
---|
210 | ifeq (${MACHEROS},HP-UX)
|
---|
211 | ifeq ($(CC),cc)
|
---|
212 | CFLAGS := +Z -Aa -Ae $(XCFLAGS) $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
|
---|
213 | FFLAGS := -Aa -I${INC} -D${MACHEROSD}
|
---|
214 | CPPFLAGS := -I${INC} -I$(INC)/tnt -D${MACHEROSD} \
|
---|
215 | -D_HPUX_SOURCE $(MODULECPPFLAGS)
|
---|
216 | LDLIBS := $(XLDLIBS)
|
---|
217 | override NOSHLIB := Y
|
---|
218 |
|
---|
219 | endif
|
---|
220 | ifeq ($(CXX),aCC)
|
---|
221 | CXXFLAGS := $(XCFLAGS) $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS) +Z -D__aCC__
|
---|
222 | # -DCOMPILER_EXCEPTIONS -D__ANSI_TEMPLATES__ definis ds defs.h
|
---|
223 | endif
|
---|
224 | endif
|
---|
225 |
|
---|
226 | # AIX, xlC comme compilateur C et C++
|
---|
227 | ifeq ($(CXX), xlC)
|
---|
228 | CFLAGS := $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS) $(XCFLAGS)
|
---|
229 | CPPFLAGS := -I$(INC)/Syst -I${INC} -I$(INC)/tnt -D${MACHEROSD} $(MODULECPPFLAGS)
|
---|
230 | CXXFLAGS := $(CFLAGS) -D__xlC -DCOMPILER_EXCEPTIONS
|
---|
231 | # -DCOMPILER_EXCEPTIONS defini ds defs.h
|
---|
232 | LDLIBS := $(XLDLIBS)
|
---|
233 |
|
---|
234 | # Pour faire des bibliotheques partagees, il faut faire un truc du
|
---|
235 | # style
|
---|
236 | #ld -o shrsub.o subs1.o subs2.o -bE:shrsub.exp -bM:SRE -lc
|
---|
237 |
|
---|
238 | # Pour le moment on ne se fatigue pas, tant pis
|
---|
239 | override NOSHLIB := Y
|
---|
240 |
|
---|
241 | # Et puis 1540-293: (W) est un FAUX warning, on supprime les warnings
|
---|
242 | CXXFLAGS := -qflag=e $(CXXFLAGS)
|
---|
243 | endif
|
---|
244 |
|
---|
245 |
|
---|
246 | ifeq ($(CXX), cxx)
|
---|
247 | ifeq ($(DBGFLAG), -g)
|
---|
248 | ifdef OPTFLAG
|
---|
249 | override DBGFLAG := -g1
|
---|
250 | endif
|
---|
251 | # ifdef XOPT
|
---|
252 | # override DBGFLAG := -g1
|
---|
253 | # endif
|
---|
254 | endif
|
---|
255 |
|
---|
256 | # chemin pour repository CXX
|
---|
257 | REP := $(OBJ)/cxxrep/
|
---|
258 | REPPI := $(OBJ)/cxxrep_PI/
|
---|
259 | REPCXX := -ptr $(OBJ)/cxxrep/
|
---|
260 | ifdef MODULECXXREPNAME
|
---|
261 | REPCXX := -ptr $(OBJ)/cxxrep_$(MODULECXXREPNAME)/ -ptr $(OBJ)/cxxrep/
|
---|
262 | REPM := $(OBJ)/cxxrep_$(MODULECXXREPNAME)/
|
---|
263 | endif
|
---|
264 |
|
---|
265 | LDLIBS := $(XLDLIBS) -lrt
|
---|
266 |
|
---|
267 | CXXFLAGS := $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS) -DCOMPILER_EXCEPTIONS \
|
---|
268 | $(REPCXX) -no_implicit_include
|
---|
269 | CFLAGS := $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
|
---|
270 | # CXXFLAGS := $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS) -DCOMPILER_EXCEPTIONS \
|
---|
271 | # -nopt -define_templates
|
---|
272 | ifeq ($(XOPT), 1)
|
---|
273 | override DBGFLAG :=
|
---|
274 | CXXFLAGS := $(DBGFLAG) $(MYCFLAGS) -DCOMPILER_EXCEPTIONS \
|
---|
275 | $(REPCXX) -fp_reorder \
|
---|
276 | -O5 -inline speed -tune host
|
---|
277 | endif
|
---|
278 | ifeq ($(XOPT), 2)
|
---|
279 | override DBGFLAG :=
|
---|
280 | CXXFLAGS := $(DBGFLAG) $(MYCFLAGS) -DCOMPILER_EXCEPTIONS \
|
---|
281 | $(REPCXX) -fp_reorder \
|
---|
282 | -O5 -inline speed -tune host \
|
---|
283 | -assume trusted_short_alignment
|
---|
284 | endif
|
---|
285 | ifeq ($(XOPT), 3)
|
---|
286 | override DBGFLAG :=
|
---|
287 | CXXFLAGS := $(DBGFLAG) $(MYCFLAGS) -DCOMPILER_EXCEPTIONS \
|
---|
288 | $(REPCXX) -fp_reorder \
|
---|
289 | -O5 -inline speed -tune host \
|
---|
290 | -assume trusted_short_alignment \
|
---|
291 | -non_shared -om
|
---|
292 | override NOSHLIB := Y
|
---|
293 | endif
|
---|
294 |
|
---|
295 | # le fichier X11/Xlib.h contient des declarations de fonctions sans type
|
---|
296 | # Cela genere un grand nombre de warning avec cxx V6
|
---|
297 | # La variable MODULEDECCXXFLAGS permet de specifier des options de compilation
|
---|
298 | # pour un module donne
|
---|
299 | ifdef MODULEDECCXXFLAGS
|
---|
300 | CXXFLAGS := $(CXXFLAGS) $(MODULEDECCXXFLAGS)
|
---|
301 | endif
|
---|
302 | endif
|
---|
303 | ifeq ($(CC),cc)
|
---|
304 | ifeq ($(MACHEROS),OSF1)
|
---|
305 | ifeq ($(XOPT), 1)
|
---|
306 | CFLAGS := $(DBGFLAG) $(MYCFLAGS) -fp_reorder \
|
---|
307 | -O4 -inline speed -tune host
|
---|
308 | endif
|
---|
309 | ifeq ($(XOPT), 2)
|
---|
310 | CFLAGS := $(DBGFLAG) $(MYCFLAGS) -fp_reorder \
|
---|
311 | -O4 -inline speed -tune host \
|
---|
312 | -assume trusted_short_alignment -fast
|
---|
313 | endif
|
---|
314 | ifeq ($(XOPT), 3)
|
---|
315 | CFLAGS := $(DBGFLAG) $(MYCFLAGS) -fp_reorder \
|
---|
316 | -O4 -inline speed -tune host \
|
---|
317 | -assume trusted_short_alignment -fast \
|
---|
318 | -non_shared -om
|
---|
319 | endif
|
---|
320 | endif
|
---|
321 | endif
|
---|
322 |
|
---|
323 | # --- Compilateur KAI (OK pour v 3.3)
|
---|
324 | ifeq ($(CXX), KCC)
|
---|
325 | CXXFLAGS := --exceptions --rtti --auto_instantiation --one_instantiation_per_object -D__KCC__
|
---|
326 | # Flag --one_instantiation_per_object mis - Reza 02/03/99
|
---|
327 | # -DCOMPILER_EXCEPTIONS -D__ANSI_TEMPLATES__ definis ds defs.h
|
---|
328 | endif
|
---|
329 |
|
---|
330 | # --- Compilateur natif CC de SGI
|
---|
331 | ifeq ($(MACHEROS), IRIX64)
|
---|
332 | ifeq ($(CXX), CC)
|
---|
333 | CXXFLAGS := -prelink -D__SGICC__
|
---|
334 | LINK.cc := CC $(CPPFLAGS) -D__SGICC__ $(DBGFLAG) $(OPTFLAG)
|
---|
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 -------
|
---|