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

Last change on this file since 1796 was 1783, checked in by aubourg, 24 years ago

pour compilation darwin (MacOS X 10.1.1)

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