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

Last change on this file since 1614 was 1471, checked in by cmv, 24 years ago

f2c -> g2c pour compil fortran/hbook linux RedHat6.? cmv 18/4/01

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