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

Last change on this file since 802 was 740, checked in by ansari, 26 years ago

Mise en place nouveau schema de creation des Makefile et shared-libs , Reza 25/02/2000

File size: 9.7 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
67endif
68#########################################################################
69
70
71MACHDIR := $(MACHEROS)-$(CXX)
72
73
74#-
75#- Define Makefile paths
76#- (NE PAS TOUCHER CES LIGNES: generation automatique de MakefileUser.h)
77#-
78PP := ${DPCDEVREP}/${MACHDIR}/
79LIB := ${PP}/Libs/
80SLB := ${PP}/ShLibs/
81OBJ := ${PP}/Objs/
82EXE := ${PP}/Exec/
83INC := ${DPCDEVREP}/Include/
84GLB := /usr/local/lib/
85#--
86
87#- Flag for optimisation/ debug
88# Pour forcer sans debug, DBGFLAG = -g0
89ifndef OPTFLAG
90 OPTFLAG := -O
91endif
92
93ifndef DBGFLAG
94 DBGFLAG := -g
95# Probleme sur DEC/OSF1 -g avec g++/egcs pose probleme a l'assembleur
96# Reza 09/99 - On met -gcoff
97 ifeq (${MACHEROS},OSF1)
98 ifeq ($(CXX), g++)
99 override DBGFLAG := -gcoff
100 endif
101 endif
102endif
103
104# DBGFLAG a -g0 veut dire pas de debug. Tout le monde a ca par defaut...
105ifeq ($(DBGFLAG), -g0)
106 override DBGFLAG :=
107endif
108
109# xlC ne connait pas -O0, par defaut il n'optimise pas.
110ifeq ($(OPTFLAG), -O0)
111 ifeq ($(CC), xlC)
112 override OPTFLAG :=
113 endif
114endif
115
116AR := ar
117ARFLAGS := -rcs
118
119# le gnu ar ne fonctionne pas bien sur OSF...
120ifeq (${MACHEROS},OSF1)
121AR := /usr/bin/ar
122endif
123# et sur AIX il nous sort des tas de warnings inutiles
124ifeq ($(MACHEROS),AIX)
125AR := /usr/bin/ar
126endif
127
128# Avec certains compilateurs C++ (KCC, aCC) , il faut fabriquer les librairies et
129# les shared libs avec la meme commande
130override ARCXX := $(AR)
131override ARCXXFLAGS := $(ARFLAGS)
132#RZ0999 ifeq ($(CXX),KCC)
133#RZ0999 override ARCXX := KCC
134#RZ0999 override ARCXXFLAGS := -o
135#RZ0999 endif
136ifeq ($(CXX),aCC)
137override ARCXX := aCC
138override ARCXXFLAGS := -o
139endif
140
141# Les chemins speciaux pour includes systemes et bibliotheques
142ifeq (${MACHEROS},HP-UX)
143 XLDLIBS := -L.
144 XCFLAGS := -I.
145endif
146
147
148# Pour compiler PI, sous Linux, les includes et libs se trouve souvent ds /usr/X11/include /usr/X11/lib/
149ifeq (${MACHEROS},Linux)
150 XLDLIBS := -L/usr/X11/lib -L/usr/X11R6/lib
151 XCFLAGS := -I/usr/X11/include -I/usr/X11R6/include
152 LDLIBS := -ldl
153endif
154
155# Chemin pour les include et fichiers d'autres librairies
156EXTINCPI :=
157EXTLIBPL :=
158EXTSLBPL :=
159EXTINCPATH :=
160EXTLIBPATH :=
161EXTSLBPATH :=
162
163ifdef EXTLIBDIR
164 EXTINCPI := -I$(EXTLIBDIR)/Include/
165 EXTLIBPL := -L$(EXTLIBDIR)/$(MACHDIR)/Libs/
166 EXTSLBPL := -L$(EXTLIBDIR)/$(MACHDIR)/ShLibs/
167 EXTINCPATH := $(EXTLIBDIR)/Include/
168 EXTLIBPATH := $(EXTLIBDIR)/$(MACHDIR)/Libs/
169 EXTSLBPATH := $(EXTLIBDIR)/$(MACHDIR)/ShLibs/
170endif
171
172# S'il y a des flags particulier pour un module de compilation
173#ifndef MODULECPPFLAGS
174 override MODULECPPFLAGS :=
175#endif
176
177CPPFLAGS := -I${INC} $(EXTINCPI) -D${MACHEROSD} $(MODULECPPFLAGS)
178
179# Les options selon les divers compilateurs
180# GNU
181ifeq ($(CC), gcc)
182 CFLAGS := -Wall -Wpointer-arith \
183 -Wmissing-prototypes -Wsynth -I$(INC) $(XCFLAGS) \
184 $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
185 LDLIBS := $(LDLIBS) $(XLDLIBS)
186endif
187ifeq ($(CC), egcs)
188 CFLAGS := -Wall -Wpointer-arith \
189 -Wmissing-prototypes -Wsynth -I$(INC) $(XCFLAGS) \
190 $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
191 LDLIBS := $(LDLIBS) $(XLDLIBS)
192endif
193
194ifeq ($(CXX), g++)
195 CXXFLAGS := -Wall -Wpointer-arith \
196 -Wmissing-prototypes -Wsynth -I$(INC) $(XCFLAGS) \
197 $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
198 LDLIBS := $(LDLIBS) $(XLDLIBS)
199# ifdef NOSHLIB
200# LDFLAGS := -static
201# endif
202endif
203ifeq ($(CXX), egcs++)
204 CXXFLAGS := -Wall -Wpointer-arith \
205 -Wmissing-prototypes -Wsynth -I$(INC) $(XCFLAGS) \
206 $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
207 LDLIBS := $(LDLIBS) $(XLDLIBS)
208 ifdef NOSHLIB
209 LDFLAGS := -static
210 endif
211endif
212
213# Compilateur C natif HP-UX
214ifeq (${MACHEROS},HP-UX)
215ifeq ($(CC),cc)
216 CFLAGS := +Z -Aa -Ae $(XCFLAGS) $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
217 FFLAGS := -Aa -I${INC} -D${MACHEROSD}
218 CPPFLAGS := -I${INC} -I$(INC)/tnt -D${MACHEROSD} \
219 -D_HPUX_SOURCE $(MODULECPPFLAGS)
220 LDLIBS := $(XLDLIBS)
221 override NOSHLIB := Y
222
223endif
224ifeq ($(CXX),aCC)
225 CXXFLAGS := $(XCFLAGS) $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS) +Z -D__aCC__
226# -DCOMPILER_EXCEPTIONS -D__ANSI_TEMPLATES__ definis ds defs.h
227endif
228endif
229
230# AIX, xlC comme compilateur C et C++
231ifeq ($(CXX), xlC)
232 CFLAGS := $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS) $(XCFLAGS)
233 CPPFLAGS := -I$(INC)/Syst -I${INC} -I$(INC)/tnt -D${MACHEROSD} $(MODULECPPFLAGS)
234 CXXFLAGS := $(CFLAGS) -D__xlC -DCOMPILER_EXCEPTIONS
235# -DCOMPILER_EXCEPTIONS defini ds defs.h
236 LDLIBS := $(XLDLIBS)
237
238# Pour faire des bibliotheques partagees, il faut faire un truc du
239# style
240#ld -o shrsub.o subs1.o subs2.o -bE:shrsub.exp -bM:SRE -lc
241
242# Pour le moment on ne se fatigue pas, tant pis
243 override NOSHLIB := Y
244
245# Et puis 1540-293: (W) est un FAUX warning, on supprime les warnings
246 CXXFLAGS := -qflag=e $(CXXFLAGS)
247endif
248
249
250ifeq ($(CXX), cxx)
251 ifeq ($(DBGFLAG), -g)
252 ifdef OPTFLAG
253 override DBGFLAG := -g1
254 endif
255# ifdef XOPT
256# override DBGFLAG := -g1
257# endif
258 endif
259
260# chemin pour repository CXX
261 REP := $(OBJ)/cxxrep/
262 REPPI := $(OBJ)/cxxrep_PI/
263 REPCXX := -ptr $(OBJ)/cxxrep/
264 ifdef MODULECXXREPNAME
265 REPCXX := -ptr $(OBJ)/cxxrep_$(MODULECXXREPNAME)/ -ptr $(OBJ)/cxxrep/
266 REPM := $(OBJ)/cxxrep_$(MODULECXXREPNAME)/
267 endif
268
269 LDLIBS := $(XLDLIBS) -lrt
270
271 CXXFLAGS := $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS) -DCOMPILER_EXCEPTIONS \
272 $(REPCXX) -no_implicit_include
273# $(REPCXX) -no_implicit_include -D__USE_STD_IOSTREAM passe pas avec cxx 6.0 Reza 23/12/99
274 CFLAGS := $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
275# CXXFLAGS := $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS) -DCOMPILER_EXCEPTIONS \
276# -nopt -define_templates
277 ifeq ($(XOPT), 1)
278 override DBGFLAG :=
279 CXXFLAGS := $(DBGFLAG) $(MYCFLAGS) -DCOMPILER_EXCEPTIONS \
280 $(REPCXX) -fp_reorder \
281 -O5 -inline speed -tune host
282 endif
283 ifeq ($(XOPT), 2)
284 override DBGFLAG :=
285 CXXFLAGS := $(DBGFLAG) $(MYCFLAGS) -DCOMPILER_EXCEPTIONS \
286 $(REPCXX) -fp_reorder \
287 -O5 -inline speed -tune host \
288 -assume trusted_short_alignment
289 endif
290 ifeq ($(XOPT), 3)
291 override DBGFLAG :=
292 CXXFLAGS := $(DBGFLAG) $(MYCFLAGS) -DCOMPILER_EXCEPTIONS \
293 $(REPCXX) -fp_reorder \
294 -O5 -inline speed -tune host \
295 -assume trusted_short_alignment \
296 -non_shared -om
297 override NOSHLIB := Y
298 endif
299
300# le fichier X11/Xlib.h contient des declarations de fonctions sans type
301# Cela genere un grand nombre de warning avec cxx V6
302# La variable MODULEDECCXXFLAGS permet de specifier des options de compilation
303# pour un module donne
304 ifdef MODULEDECCXXFLAGS
305 CXXFLAGS := $(CXXFLAGS) $(MODULEDECCXXFLAGS)
306 endif
307endif
308ifeq ($(CC),cc)
309 ifeq ($(MACHEROS),OSF1)
310 ifeq ($(XOPT), 1)
311 CFLAGS := $(DBGFLAG) $(MYCFLAGS) -fp_reorder \
312 -O4 -inline speed -tune host
313 endif
314 ifeq ($(XOPT), 2)
315 CFLAGS := $(DBGFLAG) $(MYCFLAGS) -fp_reorder \
316 -O4 -inline speed -tune host \
317 -assume trusted_short_alignment -fast
318 endif
319 ifeq ($(XOPT), 3)
320 CFLAGS := $(DBGFLAG) $(MYCFLAGS) -fp_reorder \
321 -O4 -inline speed -tune host \
322 -assume trusted_short_alignment -fast \
323 -non_shared -om
324 endif
325 endif
326endif
327
328# --- Compilateur KAI (OK pour v 3.3)
329ifeq ($(CXX), KCC)
330 CXXFLAGS := --exceptions --rtti --auto_instantiation --one_instantiation_per_object -D__KCC__
331# Flag --one_instantiation_per_object mis - Reza 02/03/99
332# -DCOMPILER_EXCEPTIONS -D__ANSI_TEMPLATES__ definis ds defs.h
333endif
334
335# --- Compilateur natif CC de SGI
336ifeq ($(MACHEROS), IRIX64)
337 ifeq ($(CXX), CC)
338 CXXFLAGS := -prelink -D__SGICC__
339 LINK.cc := CC $(CPPFLAGS) -D__SGICC__ $(DBGFLAG) $(OPTFLAG)
340 endif
341endif
342
343# Autres compilateurs natifs.
344
345# CFLAGS := -I$(INC) $(XCFLAGS) $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
346# CXXFLAGS := $(CFLAGS)
347# LDLIBS := $(XLDLIBS)
348
349#- redefine implicit rule. Les .o sont dans $(OBJ).
350$(OBJ)%.o:%.c
351 $(COMPILE.c) -o $@ $<
352
353$(OBJ)%.o:%.cc
354 $(COMPILE.cc) -o $@ $<
355
356$(OBJ)%.o:%.f
357 $(COMPILE.f) -o $@ $<
358
359#OSF1
360#LDFC est f77
361#LDFCFLAGS est rien
362
363#parfois
364#LDFC est cc
365#LDFCFLAGS est -ltruc
366
367#------------------------------------------------- End of Makefile.h -------
Note: See TracBrowser for help on using the repository browser.