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

Last change on this file since 1837 was 1797, checked in by aubourg, 24 years ago

darwin

File size: 11.1 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
168 XCFLAGS := -I/usr/X11R6/include -fno-coalesce -fkeep-inline-functions
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 C natif HP-UX
236ifeq (${MACHEROS},HP-UX)
237ifeq ($(CC),cc)
238 CFLAGS := +Z -Aa -Ae $(XCFLAGS) $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
239 FFLAGS := -Aa -I${INC} -D${MACHEROSD}
240 CPPFLAGS := -I${INC} -I$(INC)/tnt -D${MACHEROSD} \
241 -D_HPUX_SOURCE $(MODULECPPFLAGS)
242 LDLIBS := $(XLDLIBS)
243 override NOSHLIB := Y
244
245endif
246ifeq ($(CXX),aCC)
247 CXXFLAGS := $(XCFLAGS) $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS) +Z -D__aCC__
248# -DCOMPILER_EXCEPTIONS -D__ANSI_TEMPLATES__ definis ds defs.h
249endif
250endif
251
252# AIX, xlC comme compilateur C et C++
253ifeq ($(CXX), xlC)
254 CFLAGS := $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS) $(XCFLAGS)
255 CPPFLAGS := -I$(INC)/Syst -I${INC} -I$(INC)/tnt -D${MACHEROSD} $(MODULECPPFLAGS)
256 CXXFLAGS := $(CFLAGS) -D__xlC
257# -DCOMPILER_EXCEPTIONS defini ds defs.h
258 LDLIBS := $(XLDLIBS)
259
260# Pour faire des bibliotheques partagees, il faut faire un truc du
261# style
262#ld -o shrsub.o subs1.o subs2.o -bE:shrsub.exp -bM:SRE -lc
263
264# Pour le moment on ne se fatigue pas, tant pis
265 override NOSHLIB := Y
266
267# Et puis 1540-293: (W) est un FAUX warning, on supprime les warnings
268 CXXFLAGS := -qflag=e $(CXXFLAGS)
269endif
270
271
272ifeq ($(CXX), cxx)
273 ifeq ($(DBGFLAG), -g)
274 ifdef OPTFLAG
275 override DBGFLAG := -g1
276 endif
277# ifdef XOPT
278# override DBGFLAG := -g1
279# endif
280 endif
281
282# chemin pour repository CXX
283 REP := $(OBJ)/cxxrep/
284 REPPI := $(OBJ)/cxxrep_PI/
285 REPCXX := -ptr $(OBJ)/cxxrep/
286 ifdef MODULECXXREPNAME
287 REPCXX := -ptr $(OBJ)/cxxrep_$(MODULECXXREPNAME)/ -ptr $(OBJ)/cxxrep/
288 REPM := $(OBJ)/cxxrep_$(MODULECXXREPNAME)/
289 endif
290
291 LDLIBS := $(XLDLIBS) -lrt
292
293 CXXFLAGS := $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS) \
294 $(REPCXX) -no_implicit_include
295# $(REPCXX) -no_implicit_include -D__USE_STD_IOSTREAM passe pas avec cxx 6.0 Reza 23/12/99
296 CFLAGS := $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
297# CXXFLAGS := $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS) \
298# -nopt -define_templates
299 ifeq ($(XOPT), 1)
300 override DBGFLAG :=
301 CXXFLAGS := $(DBGFLAG) $(MYCFLAGS) \
302 $(REPCXX) -fp_reorder \
303 -O5 -inline speed -tune host
304 endif
305 ifeq ($(XOPT), 2)
306 override DBGFLAG :=
307 CXXFLAGS := $(DBGFLAG) $(MYCFLAGS) \
308 $(REPCXX) -fp_reorder \
309 -O5 -inline speed -tune host \
310 -assume trusted_short_alignment
311 endif
312 ifeq ($(XOPT), 3)
313 override DBGFLAG :=
314 CXXFLAGS := $(DBGFLAG) $(MYCFLAGS) \
315 $(REPCXX) -fp_reorder \
316 -O5 -inline speed -tune host \
317 -assume trusted_short_alignment \
318 -non_shared -om
319 override NOSHLIB := Y
320 endif
321
322# le fichier X11/Xlib.h contient des declarations de fonctions sans type
323# Cela genere un grand nombre de warning avec cxx V6
324# La variable MODULEDECCXXFLAGS permet de specifier des options de compilation
325# pour un module donne
326 ifdef MODULEDECCXXFLAGS
327 CXXFLAGS := $(CXXFLAGS) $(MODULEDECCXXFLAGS)
328 endif
329endif
330ifeq ($(CC),cc)
331 ifeq ($(MACHEROS),OSF1)
332 ifeq ($(XOPT), 1)
333 CFLAGS := $(DBGFLAG) $(MYCFLAGS) -fp_reorder \
334 -O4 -inline speed -tune host
335 endif
336 ifeq ($(XOPT), 2)
337 CFLAGS := $(DBGFLAG) $(MYCFLAGS) -fp_reorder \
338 -O4 -inline speed -tune host \
339 -assume trusted_short_alignment -fast
340 endif
341 ifeq ($(XOPT), 3)
342 CFLAGS := $(DBGFLAG) $(MYCFLAGS) -fp_reorder \
343 -O4 -inline speed -tune host \
344 -assume trusted_short_alignment -fast \
345 -non_shared -om
346 endif
347 endif
348endif
349
350# --- Compilateur KAI (OK pour v 3.3)
351ifeq ($(CXX), KCC)
352 CXXFLAGS := --exceptions --rtti --auto_instantiation --one_instantiation_per_object -D__KCC__
353 CXXFLAGS := $(CXXFLAGS) $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
354 CFLAGS := $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
355# Flag --one_instantiation_per_object mis - Reza 02/03/99
356endif
357
358# --- Systeme IRIX64 de Silixon Graphics (SGI)
359ifeq ($(MACHEROS), IRIX64)
360# --- Compilateur natif CC de SGI
361 ifeq ($(CXX), CC)
362 CFLAGS := $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
363 CXXFLAGS := -prelink -D__SGICC__ $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
364 LINK.cc := CC $(CPPFLAGS) -D__SGICC__ $(DBGFLAG) $(OPTFLAG)
365# sur SGI, les libs/executables ont deux formats 32 et 64 bits (trois avec o32)
366# -n32 Generates a (new) 32-bit object default to -mips3 if -mips4 has not been specified
367# -64 Generates a 64-bit object - defaults to -mips4 if -mips3 has not been specified
368# La variable d'environnement SOPHYA_SGI64 controle cette option
369 ifdef SOPHYA_SGI64
370 CFLAGS := -64 -DSGI_ARCH64 $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
371 CXXFLAGS := -64 -prelink -DSGI_ARCH64 -D__SGICC__ $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
372 LINK.cc := CC -64 $(CPPFLAGS) -D__SGICC__ $(DBGFLAG) $(OPTFLAG)
373 endif
374 endif
375 ifeq ($(CXX), g++)
376 ifdef SOPHYA_SGI64
377 CFLAGS := $(CFLAGS) -DSGI_ARCH64 -mips4 -mlong64 -mfp64 -mgp64 -mabi=64
378 CXXFLAGS := $(CXXFLAGS) -DSGI_ARCH64 -mips4 -mlong64 -mfp64 -mgp64 -mabi=64
379 LINK.cc := $(LINK.cc) -DSGI_ARCH64 -mips4 -mlong64 -mfp64 -mgp64 -mabi=64
380 endif
381 endif
382endif
383
384# Autres compilateurs natifs.
385
386# CFLAGS := -I$(INC) $(XCFLAGS) $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
387# CXXFLAGS := $(CFLAGS)
388# LDLIBS := $(XLDLIBS)
389
390#- redefine implicit rule. Les .o sont dans $(OBJ).
391$(OBJ)%.o:%.c
392 $(COMPILE.c) -o $@ $<
393
394$(OBJ)%.o:%.cc
395 $(COMPILE.cc) -o $@ $<
396
397$(OBJ)%.o:%.f
398 $(COMPILE.f) -o $@ $<
399
400#OSF1
401#LDFC est f77
402#LDFCFLAGS est rien
403
404#parfois
405#LDFC est cc
406#LDFCFLAGS est -ltruc
407
408#------------------------------------------------- End of Makefile.h -------
Note: See TracBrowser for help on using the repository browser.