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

Last change on this file since 738 was 737, checked in by ansari, 26 years ago

nouveau schema pour librairies externes (Var EXTLIBDIR) - Reza 22/02/2000

File size: 9.7 KB
Line 
1# -*- makefile -*-
2# ######################### PEIDA++ #############################
3# ##### LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA #####
4# ###############################################################
5# General setup GNU Makefile for EROS. 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
156# Chemin pour la librairie cfitsio
157# les *.h doivent etre sous $CFITSIODIR
158# la librairie *.a sous $CFITSIODIR
159# ifdef CFITSIODIR
160# FITSIOREP := -I$(CFITSIODIR)
161# FITSIOLIB := -L$(CFITSIODIR)/$(MACHDIR) -lcfitsio
162# endif
163
164# Chemin pour les include et fichiers d'autres librairies
165EXTINC :=
166EXTLIB :=
167EXTSLB :=
168
169ifdef EXTLIBDIR
170 EXTINC := $(EXTLIBDIR)/Include/
171 EXTLIB := $(EXTLIBDIR)/$(MACHDIR)/Libs/
172 EXTSLB := $(EXTLIBDIR)/$(MACHDIR)/ShLibs/
173endif
174
175# S'il y a des flags particulier pour un module de compilation
176#ifndef MODULECPPFLAGS
177 override MODULECPPFLAGS :=
178#endif
179
180CPPFLAGS := -I${INC} -I$(EXTINC) -D${MACHEROSD} $(MODULECPPFLAGS)
181
182# Les options selon les divers compilateurs
183# GNU
184ifeq ($(CC), gcc)
185 CFLAGS := -Wall -Wpointer-arith \
186 -Wmissing-prototypes -Wsynth -I$(INC) $(XCFLAGS) \
187 $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
188 LDLIBS := $(LDLIBS) $(XLDLIBS)
189endif
190ifeq ($(CC), egcs)
191 CFLAGS := -Wall -Wpointer-arith \
192 -Wmissing-prototypes -Wsynth -I$(INC) $(XCFLAGS) \
193 $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
194 LDLIBS := $(LDLIBS) $(XLDLIBS)
195endif
196
197ifeq ($(CXX), g++)
198 CXXFLAGS := -Wall -Wpointer-arith \
199 -Wmissing-prototypes -Wsynth -I$(INC) $(XCFLAGS) \
200 $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
201 LDLIBS := $(LDLIBS) $(XLDLIBS)
202# ifdef NOSHLIB
203# LDFLAGS := -static
204# endif
205endif
206ifeq ($(CXX), egcs++)
207 CXXFLAGS := -Wall -Wpointer-arith \
208 -Wmissing-prototypes -Wsynth -I$(INC) $(XCFLAGS) \
209 $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
210 LDLIBS := $(LDLIBS) $(XLDLIBS)
211 ifdef NOSHLIB
212 LDFLAGS := -static
213 endif
214endif
215
216# Compilateur C natif HP-UX
217ifeq (${MACHEROS},HP-UX)
218ifeq ($(CC),cc)
219 CFLAGS := +Z -Aa -Ae $(XCFLAGS) $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
220 FFLAGS := -Aa -I${INC} -D${MACHEROSD}
221 CPPFLAGS := -I${INC} -I$(INC)/tnt -D${MACHEROSD} \
222 -D_HPUX_SOURCE $(MODULECPPFLAGS)
223 LDLIBS := $(XLDLIBS)
224 override NOSHLIB := Y
225
226endif
227ifeq ($(CXX),aCC)
228 CXXFLAGS := $(XCFLAGS) $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS) +Z -D__aCC__
229# -DCOMPILER_EXCEPTIONS -D__ANSI_TEMPLATES__ definis ds defs.h
230endif
231endif
232
233# AIX, xlC comme compilateur C et C++
234ifeq ($(CXX), xlC)
235 CFLAGS := $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS) $(XCFLAGS)
236 CPPFLAGS := -I$(INC)/Syst -I${INC} -I$(INC)/tnt -D${MACHEROSD} $(MODULECPPFLAGS)
237 CXXFLAGS := $(CFLAGS) -D__xlC -DCOMPILER_EXCEPTIONS
238# -DCOMPILER_EXCEPTIONS defini ds defs.h
239 LDLIBS := $(XLDLIBS)
240
241# Pour faire des bibliotheques partagees, il faut faire un truc du
242# style
243#ld -o shrsub.o subs1.o subs2.o -bE:shrsub.exp -bM:SRE -lc
244
245# Pour le moment on ne se fatigue pas, tant pis
246 override NOSHLIB := Y
247
248# Et puis 1540-293: (W) est un FAUX warning, on supprime les warnings
249 CXXFLAGS := -qflag=e $(CXXFLAGS)
250endif
251
252
253ifeq ($(CXX), cxx)
254 ifeq ($(DBGFLAG), -g)
255 ifdef OPTFLAG
256 override DBGFLAG := -g1
257 endif
258# ifdef XOPT
259# override DBGFLAG := -g1
260# endif
261 endif
262
263# chemin pour repository CXX
264 REP := $(OBJ)/cxxrep/
265 REPPI := $(OBJ)/cxxrep_PI/
266 REPCXX := -ptr $(OBJ)/cxxrep/
267 ifdef MODULECXXREPNAME
268 REPCXX := -ptr $(OBJ)/cxxrep_$(MODULECXXREPNAME)/ -ptr $(OBJ)/cxxrep/
269 REPM := $(OBJ)/cxxrep_$(MODULECXXREPNAME)/
270 endif
271
272 LDLIBS := $(XLDLIBS) -lrt
273
274 CXXFLAGS := $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS) -DCOMPILER_EXCEPTIONS \
275 $(REPCXX) -no_implicit_include
276# $(REPCXX) -no_implicit_include -D__USE_STD_IOSTREAM passe pas avec cxx 6.0 Reza 23/12/99
277 CFLAGS := $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
278# CXXFLAGS := $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS) -DCOMPILER_EXCEPTIONS \
279# -nopt -define_templates
280 ifeq ($(XOPT), 1)
281 override DBGFLAG :=
282 CXXFLAGS := $(DBGFLAG) $(MYCFLAGS) -DCOMPILER_EXCEPTIONS \
283 $(REPCXX) -fp_reorder \
284 -O5 -inline speed -tune host
285 endif
286 ifeq ($(XOPT), 2)
287 override DBGFLAG :=
288 CXXFLAGS := $(DBGFLAG) $(MYCFLAGS) -DCOMPILER_EXCEPTIONS \
289 $(REPCXX) -fp_reorder \
290 -O5 -inline speed -tune host \
291 -assume trusted_short_alignment
292 endif
293 ifeq ($(XOPT), 3)
294 override DBGFLAG :=
295 CXXFLAGS := $(DBGFLAG) $(MYCFLAGS) -DCOMPILER_EXCEPTIONS \
296 $(REPCXX) -fp_reorder \
297 -O5 -inline speed -tune host \
298 -assume trusted_short_alignment \
299 -non_shared -om
300 override NOSHLIB := Y
301 endif
302
303# le fichier X11/Xlib.h contient des declarations de fonctions sans type
304# Cela genere un grand nombre de warning avec cxx V6
305# La variable MODULEDECCXXFLAGS permet de specifier des options de compilation
306# pour un module donne
307 ifdef MODULEDECCXXFLAGS
308 CXXFLAGS := $(CXXFLAGS) $(MODULEDECCXXFLAGS)
309 endif
310endif
311ifeq ($(CC),cc)
312 ifeq ($(MACHEROS),OSF1)
313 ifeq ($(XOPT), 1)
314 CFLAGS := $(DBGFLAG) $(MYCFLAGS) -fp_reorder \
315 -O4 -inline speed -tune host
316 endif
317 ifeq ($(XOPT), 2)
318 CFLAGS := $(DBGFLAG) $(MYCFLAGS) -fp_reorder \
319 -O4 -inline speed -tune host \
320 -assume trusted_short_alignment -fast
321 endif
322 ifeq ($(XOPT), 3)
323 CFLAGS := $(DBGFLAG) $(MYCFLAGS) -fp_reorder \
324 -O4 -inline speed -tune host \
325 -assume trusted_short_alignment -fast \
326 -non_shared -om
327 endif
328 endif
329endif
330
331# --- Compilateur KAI (OK pour v 3.3)
332ifeq ($(CXX), KCC)
333 CXXFLAGS := --exceptions --rtti --auto_instantiation --one_instantiation_per_object -D__KCC__
334# Flag --one_instantiation_per_object mis - Reza 02/03/99
335# -DCOMPILER_EXCEPTIONS -D__ANSI_TEMPLATES__ definis ds defs.h
336endif
337
338# --- Compilateur natif CC de SGI
339ifeq ($(MACHEROS), IRIX64)
340 ifeq ($(CXX), CC)
341 CXXFLAGS := -prelink -D__SGICC__
342 LINK.cc := CC $(CPPFLAGS) -D__SGICC__ $(DBGFLAG) $(OPTFLAG)
343 endif
344endif
345
346# Autres compilateurs natifs.
347
348# CFLAGS := -I$(INC) $(XCFLAGS) $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
349# CXXFLAGS := $(CFLAGS)
350# LDLIBS := $(XLDLIBS)
351
352#- redefine implicit rule. Les .o sont dans $(OBJ).
353$(OBJ)%.o:%.c
354 $(COMPILE.c) -o $@ $<
355
356$(OBJ)%.o:%.cc
357 $(COMPILE.cc) -o $@ $<
358
359$(OBJ)%.o:%.f
360 $(COMPILE.f) -o $@ $<
361
362#OSF1
363#LDFC est f77
364#LDFCFLAGS est rien
365
366#parfois
367#LDFC est cc
368#LDFCFLAGS est -ltruc
369
370#------------------------------------------------- End of Makefile.h -------
Note: See TracBrowser for help on using the repository browser.