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

Last change on this file since 1978 was 1918, checked in by ansari, 24 years ago

Adaptation makefiles MacOSX/Darwin - Reza 06/03/2002

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