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

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

creation module FitsIOServer 19-OCT-99, GLM

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 ($(SITE),CCIN2P3)
58 ifeq ($(MACHEROS),AIX)
59 override FC := xlf
60 endif
61endif
62ifeq (${MACHEROS},Linux)
63# override FC := f77
64 override FC := g77
65endif
66
67ifeq (${MACHEROS},OSF1)
68 LIBFORT = -lfor -lFutil -lots -lUfor
69endif
70ifeq (${MACHEROS},Linux)
71 LIBFORT = -lf2c
72endif
73#########################################################################
74
75
76MACHDIR := $(MACHEROS)-$(CXX)
77
78
79#-
80#- Define Makefile paths
81#- (NE PAS TOUCHER CES LIGNES: generation automatique de MakefileUser.h)
82#-
83PP := ${DPCBASEREP}/${MACHDIR}/
84PPH := ${HOME}/${MACHDIR}/
85LIB := ${PP}/Libs/
86SLB := ${PP}/ShLibs/
87OBJ := ${PPH}/Objs/
88EXE := ${PPH}/Exec/
89INC := ${DPCBASEREP}/Include/
90CCI := ${INC}/CInc/
91GLB := ${GNU}/${MACHEROS}/lib/
92#--
93
94#- Flag for optimisation/ debug
95# Pour forcer sans debug, DBGFLAG = -g0
96ifndef OPTFLAG
97 OPTFLAG := -O
98endif
99
100ifndef DBGFLAG
101 DBGFLAG := -g
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 :=
131ifeq ($(CXX),KCC)
132ARCXX := KCC
133endif
134ifeq ($(CXX),aCC)
135ARCXX := aCC
136endif
137
138# Les chemins speciaux pour includes systemes et bibliotheques
139ifeq (${MACHEROS},HP-UX)
140 XLDLIBS := -L.
141 XCFLAGS := -I.
142endif
143
144
145# Pour compiler PI, sous Linux, les includes et libs se trouve souvent ds /usr/X11/include /usr/X11/lib/
146ifeq (${MACHEROS},Linux)
147 XLDLIBS := -L/usr/X11/lib
148 XCFLAGS := -I/usr/X11/include
149 LDLIBS := -ldl
150endif
151
152# Pour RFIO
153ifeq ($(SITE),CCIN2P3)
154 XCFLAGS := $(XCFLAGS) -D RFIO -I/usr/local/include/shift
155 XLDLIBS := $(XLDLIBS) -L/usr/local/lib -lshift
156endif
157
158# Les bibliotheques gnu C pour le fort du CCPN
159ifeq ($(SITE),CCIN2P3)
160 ifeq ($(CC), gcc)
161 ifeq ($(MACHEROS),HP-UX)
162 FGLIB := -L/usr/local/lib/gcc-lib/hppa1.1-hp-hpux9.05/2.7.2.1 -lgcc
163 endif
164 ifeq ($(MACHEROS),AIX)
165 FGLIB := -L/usr/local/lib/gcc-lib/rs6000-ibm-aix3.2.5/2.7.2.1 -lgcc
166 endif
167 endif
168endif
169
170# Chemin pour la librairie cfitsio
171FITSIOREP :=
172FITSIOLIB :=
173ifeq ($(SITE),LAL)
174 override FITSIOREP :=/exp/planck/FitsIO/cfitsio/
175 override FITSIOLIB := -L$(FITSIOREP) -lcfitsio
176endif
177
178# S'il y a des flags particulier pour un module de compilation
179#ifndef MODULECPPFLAGS
180 override MODULECPPFLAGS :=
181#endif
182
183CPPFLAGS := -I${INC} -I$(FITSIOREP) -D${MACHEROSD} -I$(INC)/tnt $(MODULECPPFLAGS)
184
185# Les options selon les divers compilateurs
186# GNU
187ifeq ($(CC), gcc)
188 CFLAGS := -Wall -Wpointer-arith \
189 -Wmissing-prototypes -Wsynth -I$(INC) $(XCFLAGS) \
190 $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
191 LDLIBS := $(LDLIBS) $(XLDLIBS)
192endif
193ifeq ($(CC), egcs)
194 CFLAGS := -Wall -Wpointer-arith \
195 -Wmissing-prototypes -Wsynth -I$(INC) $(XCFLAGS) \
196 $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
197 LDLIBS := $(LDLIBS) $(XLDLIBS)
198endif
199
200ifeq ($(CXX), g++)
201 CXXFLAGS := -Wall -Wpointer-arith \
202 -Wmissing-prototypes -Wsynth -I$(INC) $(XCFLAGS) \
203 $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
204 LDLIBS := $(LDLIBS) $(XLDLIBS)
205# Il faut trouver un moyen d'automatiser ca $CHECK$ Reza 23/12/98
206 ifdef GCCV28
207 CXXFLAGS := $(CXXFLAGS) -fguiding-decls -fname-mangling-version-1 -DCOMPILER_EXCEPTIONS
208 endif
209 ifdef NOSHLIB
210 LDFLAGS := -static
211 endif
212endif
213ifeq ($(CXX), egcs++)
214 CXXFLAGS := -Wall -Wpointer-arith \
215 -Wmissing-prototypes -Wsynth -I$(INC) $(XCFLAGS) \
216 $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
217 LDLIBS := $(LDLIBS) $(XLDLIBS)
218 ifdef NOSHLIB
219 LDFLAGS := -static
220 endif
221endif
222
223# Compilateur C natif HP-UX
224ifeq (${MACHEROS},HP-UX)
225ifeq ($(CC),cc)
226 CFLAGS := +Z -Aa -Ae $(XCFLAGS) $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
227 FFLAGS := -Aa -I${INC} -D${MACHEROSD}
228 CPPFLAGS := -I${INC} -I$(INC)/tnt -D${MACHEROSD} \
229 -D_HPUX_SOURCE $(MODULECPPFLAGS)
230 LDLIBS := $(XLDLIBS)
231 override NOSHLIB := Y
232
233endif
234ifeq ($(CXX),aCC)
235 CXXFLAGS := $(XCFLAGS) $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS) +Z -D__aCC__
236# -DCOMPILER_EXCEPTIONS -D__ANSI_TEMPLATES__ definis ds defs.h
237endif
238endif
239
240# AIX, xlC comme compilateur C et C++
241ifeq ($(CXX), xlC)
242 CFLAGS := $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS) $(XCFLAGS)
243 CPPFLAGS := -I$(INC)/Syst -I${INC} -I$(INC)/tnt -D${MACHEROSD} $(MODULECPPFLAGS)
244 CXXFLAGS := $(CFLAGS) -D__xlC -DCOMPILER_EXCEPTIONS
245# -DCOMPILER_EXCEPTIONS defini ds defs.h
246 LDLIBS := $(XLDLIBS)
247
248# Pour faire des bibliotheques partagees, il faut faire un truc du
249# style
250#ld -o shrsub.o subs1.o subs2.o -bE:shrsub.exp -bM:SRE -lc
251
252# Pour le moment on ne se fatigue pas, tant pis
253 override NOSHLIB := Y
254
255# Et puis 1540-293: (W) est un FAUX warning, on supprime les warnings
256 CXXFLAGS := -qflag=e $(CXXFLAGS)
257endif
258
259#gcc sur Solaris
260ifeq ($(MACHEROS),SunOS)
261 override NOSHLIB := Y
262endif
263
264ifeq ($(CXX), cxx)
265 ifeq ($(DBGFLAG), -g)
266 ifdef OPTFLAG
267 override DBGFLAG := -g1
268 endif
269# ifdef XOPT
270# override DBGFLAG := -g1
271# endif
272 endif
273
274# chemin pour repository CXX
275 REP := $(OBJ)/cxxrep/
276 REPPI := $(OBJ)/cxxrep_PI/
277 REPCXX := -ptr $(OBJ)/cxxrep/
278 ifdef MODULECXXREPNAME
279 REPCXX := -ptr $(OBJ)/cxxrep_$(MODULECXXREPNAME)/ -ptr $(OBJ)/cxxrep/
280 REPM := $(OBJ)/cxxrep_$(MODULECXXREPNAME)/
281 endif
282
283 LDLIBS := $(XLDLIBS) -lrt
284
285 CXXFLAGS := $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS) -DCOMPILER_EXCEPTIONS \
286 $(REPCXX) -no_implicit_include
287 CFLAGS := $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
288# CXXFLAGS := $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS) -DCOMPILER_EXCEPTIONS \
289# -nopt -define_templates
290 ifeq ($(XOPT), 1)
291 override DBGFLAG :=
292 CXXFLAGS := $(DBGFLAG) $(MYCFLAGS) -DCOMPILER_EXCEPTIONS \
293 $(REPCXX) -fp_reorder \
294 -O5 -inline speed -tune host
295 endif
296 ifeq ($(XOPT), 2)
297 override DBGFLAG :=
298 CXXFLAGS := $(DBGFLAG) $(MYCFLAGS) -DCOMPILER_EXCEPTIONS \
299 $(REPCXX) -fp_reorder \
300 -O5 -inline speed -tune host \
301 -assume trusted_short_alignment
302 endif
303 ifeq ($(XOPT), 3)
304 override DBGFLAG :=
305 CXXFLAGS := $(DBGFLAG) $(MYCFLAGS) -DCOMPILER_EXCEPTIONS \
306 $(REPCXX) -fp_reorder \
307 -O5 -inline speed -tune host \
308 -assume trusted_short_alignment \
309 -non_shared -om
310 override NOSHLIB := Y
311 endif
312
313# le fichier X11/Xlib.h contient des declarations de fonctions sans type
314# Cela genere un grand nombre de warning avec cxx V6
315# La variable MODULEDECCXXFLAGS permet de specifier des options de compilation
316# pour un module donne
317 ifdef MODULEDECCXXFLAGS
318 CXXFLAGS := $(CXXFLAGS) $(MODULEDECCXXFLAGS)
319 endif
320endif
321ifeq ($(CC),cc)
322 ifeq ($(MACHEROS),OSF1)
323 ifeq ($(XOPT), 1)
324 CFLAGS := $(DBGFLAG) $(MYCFLAGS) -fp_reorder \
325 -O4 -inline speed -tune host
326 endif
327 ifeq ($(XOPT), 2)
328 CFLAGS := $(DBGFLAG) $(MYCFLAGS) -fp_reorder \
329 -O4 -inline speed -tune host \
330 -assume trusted_short_alignment -fast
331 endif
332 ifeq ($(XOPT), 3)
333 CFLAGS := $(DBGFLAG) $(MYCFLAGS) -fp_reorder \
334 -O4 -inline speed -tune host \
335 -assume trusted_short_alignment -fast \
336 -non_shared -om
337 endif
338 endif
339endif
340
341
342# Compilateur KAI
343ifeq ($(CXX), KCC)
344 CXXFLAGS := --exceptions --rtti --auto_instantiation --one_instantiation_per_object -D__KCC__
345# Flag --one_instantiation_per_object mis - Reza 02/03/99
346# -DCOMPILER_EXCEPTIONS -D__ANSI_TEMPLATES__ definis ds defs.h
347endif
348
349# Autres compilateurs natifs.
350
351# CFLAGS := -I$(INC) $(XCFLAGS) $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
352# CXXFLAGS := $(CFLAGS)
353# LDLIBS := $(XLDLIBS)
354
355#- redefine implicit rule. Les .o sont dans $(OBJ).
356$(OBJ)%.o:%.c
357 $(COMPILE.c) -o $@ $<
358
359$(OBJ)%.o:%.cc
360 $(COMPILE.cc) -o $@ $<
361
362$(OBJ)%.o:%.f
363 $(COMPILE.f) -o $@ $<
364
365#OSF1
366#LDFC est f77
367#LDFCFLAGS est rien
368
369#parfois
370#LDFC est cc
371#LDFCFLAGS est -ltruc
372
373#------------------------------------------------- End of Makefile.h -------
374# fin gene auto MakefileUser.h
Note: See TracBrowser for help on using the repository browser.