source: Sophya/trunk/SophyaLib/Mgr/Makefile.h@ 2541

Last change on this file since 2541 was 2501, checked in by ansari, 22 years ago

modifs suite compil sur MacOSX 10.3 (portable G4) - Reza 24 Fev 2004

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