source: Sophya/trunk/SophyaLib/Mgr/MakefileUser.h@ 503

Last change on this file since 503 was 480, checked in by ansari, 26 years ago

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