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

Last change on this file since 599 was 554, checked in by ansari, 26 years ago

gestion des inc et lib cfitsio cmv 9/11/99

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