source: Sophya/trunk/Poubelle/DPC:FitsIOServer/Mgr/Makefile.h@ 658

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

no message

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