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

Last change on this file since 2693 was 2678, checked in by ansari, 20 years ago

flag -LANG:std ajoute pour SGI-CC en -64 , Reza 19/4/2005

File size: 12.2 KB
RevLine 
[218]1# -*- makefile -*-
[740]2# ######################### Sophya #############################
[218]3# ##### LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA #####
4# ###############################################################
[740]5# General setup GNU Makefile for Sopyha/Planck. To be included in all makefiles.
[218]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:
[2437]11# - Path to Exec, Include, Libs, Obj directories (from SOPHYADEVREP env. var.)
[218]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++
[2437]24ifdef SOPHYACXX
25 CXX := $(SOPHYACXX)
[218]26endif
27
28ifeq ($(CXX),gcc)
29 override CXX := g++
30endif
31
[2437]32ifeq ($(SOPHYACXX),egcs++)
[218]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
[2437]51ifeq ($(SOPHYACXX), egcs++)
[218]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)
[1471]66 #LIBFORT = -lf2c
67 LIBFORT = -lg2c
[218]68endif
69#########################################################################
70
71
72MACHDIR := $(MACHEROS)-$(CXX)
73
74
75#-
76#- Define Makefile paths
77#- (NE PAS TOUCHER CES LIGNES: generation automatique de MakefileUser.h)
78#-
[2437]79PP := ${SOPHYADEVREP}/${MACHDIR}/
[218]80LIB := ${PP}/Libs/
81SLB := ${PP}/ShLibs/
82OBJ := ${PP}/Objs/
83EXE := ${PP}/Exec/
[2437]84INC := ${SOPHYADEVREP}/Include/
[480]85GLB := /usr/local/lib/
[218]86#--
87
[1979]88# Si Makefile.h utilise pour la construction d'autres librairies
89ifdef MYBUILDDEVREP
90 MYPP := ${MYBUILDDEVREP}/${MACHDIR}/
91 MYLIB := ${MYPP}/Libs/
92 MYSLB := ${MYPP}/ShLibs/
93 OBJ := ${MYPP}/Objs/
[1986]94 EXE := ${MYPP}/Exec/
[1979]95endif
96
[218]97#- Flag for optimisation/ debug
98# Pour forcer sans debug, DBGFLAG = -g0
99ifndef OPTFLAG
100 OPTFLAG := -O
[2438]101 ifeq (${MACHEROS},OSF1)
102 ifeq ($(CXX), cxx)
103 override OPTFLAG := -O -pthread
104 endif
105 endif
[218]106endif
107
108ifndef DBGFLAG
109 DBGFLAG := -g
[480]110# Probleme sur DEC/OSF1 -g avec g++/egcs pose probleme a l'assembleur
111# Reza 09/99 - On met -gcoff
112 ifeq (${MACHEROS},OSF1)
113 ifeq ($(CXX), g++)
114 override DBGFLAG := -gcoff
115 endif
116 endif
[218]117endif
118
119# DBGFLAG a -g0 veut dire pas de debug. Tout le monde a ca par defaut...
120ifeq ($(DBGFLAG), -g0)
121 override DBGFLAG :=
122endif
123
124# xlC ne connait pas -O0, par defaut il n'optimise pas.
125ifeq ($(OPTFLAG), -O0)
126 ifeq ($(CC), xlC)
127 override OPTFLAG :=
128 endif
129endif
130
131AR := ar
132ARFLAGS := -rcs
[1797]133ARARGS := ?
[218]134
135# le gnu ar ne fonctionne pas bien sur OSF...
136ifeq (${MACHEROS},OSF1)
137AR := /usr/bin/ar
138endif
139# et sur AIX il nous sort des tas de warnings inutiles
140ifeq ($(MACHEROS),AIX)
141AR := /usr/bin/ar
142endif
143
[1783]144ifeq ($(MACHEROS),Darwin)
145AR := libtool
146ARFLAGS := -static -o
[1797]147ARARGS := ^
[2501]148SOPHYACXX := c++
149CXX := c++
[1783]150CC := cc
[2348]151# Pour enlever les erreurs au link des slb en -O. Pas d'avenir!
[2570]152OPTFLAG := -g
[1783]153endif
154
[218]155# Avec certains compilateurs C++ (KCC, aCC) , il faut fabriquer les librairies et
156# les shared libs avec la meme commande
[480]157override ARCXX := $(AR)
158override ARCXXFLAGS := $(ARFLAGS)
159#RZ0999 ifeq ($(CXX),KCC)
160#RZ0999 override ARCXX := KCC
161#RZ0999 override ARCXXFLAGS := -o
162#RZ0999 endif
[218]163ifeq ($(CXX),aCC)
[480]164override ARCXX := aCC
165override ARCXXFLAGS := -o
[218]166endif
167
168# Les chemins speciaux pour includes systemes et bibliotheques
169ifeq (${MACHEROS},HP-UX)
170 XLDLIBS := -L.
[2310]171 XCFLAGS :=
172 XCPPFLAGS :=
[218]173endif
174
[478]175
[218]176# Pour compiler PI, sous Linux, les includes et libs se trouve souvent ds /usr/X11/include /usr/X11/lib/
177ifeq (${MACHEROS},Linux)
[480]178 XLDLIBS := -L/usr/X11/lib -L/usr/X11R6/lib
[2310]179 XCPPFLAGS := -I/usr/X11/include -I/usr/X11R6/include
[218]180 LDLIBS := -ldl
181endif
182
[1783]183ifeq (${MACHEROS},Darwin)
[2501]184 XLDLIBS := -L/usr/X11R6/lib
[2570]185 XCPPFLAGS := -I/usr/X11R6/include -I/sw/include
186# XCPPFLAGS := -I/usr/X11R6/include
[2675]187# XCFLAGS := -fkeep-inline-functions -fno-common -fcoalesce
188 XCFLAGS := -fno-common
[1783]189endif
190
[737]191# Chemin pour les include et fichiers d'autres librairies
[740]192EXTINCPI :=
193EXTLIBPL :=
194EXTSLBPL :=
195EXTINCPATH :=
196EXTLIBPATH :=
197EXTSLBPATH :=
[737]198
199ifdef EXTLIBDIR
[740]200 EXTINCPI := -I$(EXTLIBDIR)/Include/
201 EXTLIBPL := -L$(EXTLIBDIR)/$(MACHDIR)/Libs/
202 EXTSLBPL := -L$(EXTLIBDIR)/$(MACHDIR)/ShLibs/
203 EXTINCPATH := $(EXTLIBDIR)/Include/
204 EXTLIBPATH := $(EXTLIBDIR)/$(MACHDIR)/Libs/
205 EXTSLBPATH := $(EXTLIBDIR)/$(MACHDIR)/ShLibs/
[478]206endif
207
[218]208# S'il y a des flags particulier pour un module de compilation
209#ifndef MODULECPPFLAGS
210 override MODULECPPFLAGS :=
211#endif
212
[2310]213CPPFLAGS := -I${INC} $(EXTINCPI) $(XCPPFLAGS) -D${MACHEROSD} $(MODULECPPFLAGS)
[218]214
[911]215# Si la variable d'environnement SOPHYA_DEBUG est definie : Activation des
216# compilations conditionnelles pour le debug/bound-checking/... ds le code
217ifdef SOPHYA_DEBUG
218 CPPFLAGS := $(CPPFLAGS) -DSOPHYA_DEBUG
219endif
220
[218]221# Les options selon les divers compilateurs
222# GNU
223ifeq ($(CC), gcc)
224 CFLAGS := -Wall -Wpointer-arith \
[2501]225 -Wmissing-prototypes -I$(INC) $(XCFLAGS) \
[218]226 $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
227 LDLIBS := $(LDLIBS) $(XLDLIBS)
228endif
229ifeq ($(CC), egcs)
230 CFLAGS := -Wall -Wpointer-arith \
231 -Wmissing-prototypes -Wsynth -I$(INC) $(XCFLAGS) \
232 $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
233 LDLIBS := $(LDLIBS) $(XLDLIBS)
234endif
235
236ifeq ($(CXX), g++)
237 CXXFLAGS := -Wall -Wpointer-arith \
238 -Wmissing-prototypes -Wsynth -I$(INC) $(XCFLAGS) \
239 $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
240 LDLIBS := $(LDLIBS) $(XLDLIBS)
[631]241# ifdef NOSHLIB
242# LDFLAGS := -static
243# endif
[218]244endif
245ifeq ($(CXX), egcs++)
246 CXXFLAGS := -Wall -Wpointer-arith \
247 -Wmissing-prototypes -Wsynth -I$(INC) $(XCFLAGS) \
248 $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
249 LDLIBS := $(LDLIBS) $(XLDLIBS)
250 ifdef NOSHLIB
251 LDFLAGS := -static
252 endif
253endif
254
[1918]255# Compilateur natif (GNU-gcc) sous MacOSX (Darwin)
256ifeq (${MACHEROS},Darwin)
257 CFLAGS := -Wall -Wpointer-arith \
258 -Wmissing-prototypes -Wsynth -I$(INC) $(XCFLAGS) \
259 $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
[2570]260 CXXFLAGS := -Wall -Wpointer-arith \
261 -Wmissing-prototypes -Wsynth -I$(INC) $(XCFLAGS) \
262 $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
263 LDLIBS := -Xlinker -bind_at_load $(LDLIBS) $(XLDLIBS)
[1918]264endif
265
[218]266# Compilateur C natif HP-UX
267ifeq (${MACHEROS},HP-UX)
268ifeq ($(CC),cc)
269 CFLAGS := +Z -Aa -Ae $(XCFLAGS) $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
270 FFLAGS := -Aa -I${INC} -D${MACHEROSD}
271 CPPFLAGS := -I${INC} -I$(INC)/tnt -D${MACHEROSD} \
272 -D_HPUX_SOURCE $(MODULECPPFLAGS)
273 LDLIBS := $(XLDLIBS)
274 override NOSHLIB := Y
275
276endif
277ifeq ($(CXX),aCC)
278 CXXFLAGS := $(XCFLAGS) $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS) +Z -D__aCC__
279# -DCOMPILER_EXCEPTIONS -D__ANSI_TEMPLATES__ definis ds defs.h
280endif
281endif
282
283# AIX, xlC comme compilateur C et C++
284ifeq ($(CXX), xlC)
285 CFLAGS := $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS) $(XCFLAGS)
286 CPPFLAGS := -I$(INC)/Syst -I${INC} -I$(INC)/tnt -D${MACHEROSD} $(MODULECPPFLAGS)
[1014]287 CXXFLAGS := $(CFLAGS) -D__xlC
[218]288# -DCOMPILER_EXCEPTIONS defini ds defs.h
289 LDLIBS := $(XLDLIBS)
290
291# Pour faire des bibliotheques partagees, il faut faire un truc du
292# style
293#ld -o shrsub.o subs1.o subs2.o -bE:shrsub.exp -bM:SRE -lc
294
295# Pour le moment on ne se fatigue pas, tant pis
296 override NOSHLIB := Y
297
298# Et puis 1540-293: (W) est un FAUX warning, on supprime les warnings
299 CXXFLAGS := -qflag=e $(CXXFLAGS)
300endif
301
302
303ifeq ($(CXX), cxx)
304 ifeq ($(DBGFLAG), -g)
305 ifdef OPTFLAG
306 override DBGFLAG := -g1
307 endif
308# ifdef XOPT
309# override DBGFLAG := -g1
310# endif
311 endif
312
313# chemin pour repository CXX
314 REP := $(OBJ)/cxxrep/
315 REPPI := $(OBJ)/cxxrep_PI/
316 REPCXX := -ptr $(OBJ)/cxxrep/
317 ifdef MODULECXXREPNAME
318 REPCXX := -ptr $(OBJ)/cxxrep_$(MODULECXXREPNAME)/ -ptr $(OBJ)/cxxrep/
319 REPM := $(OBJ)/cxxrep_$(MODULECXXREPNAME)/
320 endif
321
322 LDLIBS := $(XLDLIBS) -lrt
323
[1014]324 CXXFLAGS := $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS) \
[696]325 $(REPCXX) -no_implicit_include
326# $(REPCXX) -no_implicit_include -D__USE_STD_IOSTREAM passe pas avec cxx 6.0 Reza 23/12/99
[218]327 CFLAGS := $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
[1014]328# CXXFLAGS := $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS) \
[218]329# -nopt -define_templates
330 ifeq ($(XOPT), 1)
331 override DBGFLAG :=
[1014]332 CXXFLAGS := $(DBGFLAG) $(MYCFLAGS) \
[218]333 $(REPCXX) -fp_reorder \
334 -O5 -inline speed -tune host
335 endif
336 ifeq ($(XOPT), 2)
337 override DBGFLAG :=
[1014]338 CXXFLAGS := $(DBGFLAG) $(MYCFLAGS) \
[218]339 $(REPCXX) -fp_reorder \
340 -O5 -inline speed -tune host \
341 -assume trusted_short_alignment
342 endif
343 ifeq ($(XOPT), 3)
344 override DBGFLAG :=
[1014]345 CXXFLAGS := $(DBGFLAG) $(MYCFLAGS) \
[218]346 $(REPCXX) -fp_reorder \
347 -O5 -inline speed -tune host \
348 -assume trusted_short_alignment \
349 -non_shared -om
350 override NOSHLIB := Y
351 endif
352
353# le fichier X11/Xlib.h contient des declarations de fonctions sans type
354# Cela genere un grand nombre de warning avec cxx V6
355# La variable MODULEDECCXXFLAGS permet de specifier des options de compilation
356# pour un module donne
357 ifdef MODULEDECCXXFLAGS
358 CXXFLAGS := $(CXXFLAGS) $(MODULEDECCXXFLAGS)
359 endif
360endif
361ifeq ($(CC),cc)
362 ifeq ($(MACHEROS),OSF1)
363 ifeq ($(XOPT), 1)
364 CFLAGS := $(DBGFLAG) $(MYCFLAGS) -fp_reorder \
365 -O4 -inline speed -tune host
366 endif
367 ifeq ($(XOPT), 2)
368 CFLAGS := $(DBGFLAG) $(MYCFLAGS) -fp_reorder \
369 -O4 -inline speed -tune host \
370 -assume trusted_short_alignment -fast
371 endif
372 ifeq ($(XOPT), 3)
373 CFLAGS := $(DBGFLAG) $(MYCFLAGS) -fp_reorder \
374 -O4 -inline speed -tune host \
375 -assume trusted_short_alignment -fast \
376 -non_shared -om
377 endif
378 endif
379endif
380
[480]381# --- Compilateur KAI (OK pour v 3.3)
[218]382ifeq ($(CXX), KCC)
383 CXXFLAGS := --exceptions --rtti --auto_instantiation --one_instantiation_per_object -D__KCC__
[911]384 CXXFLAGS := $(CXXFLAGS) $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
385 CFLAGS := $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
[218]386# Flag --one_instantiation_per_object mis - Reza 02/03/99
387endif
388
[911]389# --- Systeme IRIX64 de Silixon Graphics (SGI)
390ifeq ($(MACHEROS), IRIX64)
[480]391# --- Compilateur natif CC de SGI
392 ifeq ($(CXX), CC)
[911]393 CFLAGS := $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
[2345]394 CXXFLAGS := -prelink -D__SGICC__ -LANG:std $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
395 LINK.cc := CC $(CPPFLAGS) -D__SGICC__ -LANG:std $(DBGFLAG) $(OPTFLAG)
[911]396# sur SGI, les libs/executables ont deux formats 32 et 64 bits (trois avec o32)
397# -n32 Generates a (new) 32-bit object default to -mips3 if -mips4 has not been specified
398# -64 Generates a 64-bit object - defaults to -mips4 if -mips3 has not been specified
399# La variable d'environnement SOPHYA_SGI64 controle cette option
400 ifdef SOPHYA_SGI64
[1249]401 CFLAGS := -64 -DSGI_ARCH64 $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
[2435]402 CXXFLAGS := -64 -prelink -DSGI_ARCH64 -D__SGICC__ -LANG:std $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
[2678]403 LINK.cc := CC -64 $(CPPFLAGS) -D__SGICC__ -LANG:std $(DBGFLAG) $(OPTFLAG)
[911]404 endif
[480]405 endif
[1398]406 ifeq ($(CXX), g++)
407 ifdef SOPHYA_SGI64
408 CFLAGS := $(CFLAGS) -DSGI_ARCH64 -mips4 -mlong64 -mfp64 -mgp64 -mabi=64
409 CXXFLAGS := $(CXXFLAGS) -DSGI_ARCH64 -mips4 -mlong64 -mfp64 -mgp64 -mabi=64
410 LINK.cc := $(LINK.cc) -DSGI_ARCH64 -mips4 -mlong64 -mfp64 -mgp64 -mabi=64
411 endif
412 endif
[480]413endif
414
[218]415# Autres compilateurs natifs.
416
417# CFLAGS := -I$(INC) $(XCFLAGS) $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
418# CXXFLAGS := $(CFLAGS)
419# LDLIBS := $(XLDLIBS)
420
421#- redefine implicit rule. Les .o sont dans $(OBJ).
422$(OBJ)%.o:%.c
423 $(COMPILE.c) -o $@ $<
424
425$(OBJ)%.o:%.cc
426 $(COMPILE.cc) -o $@ $<
427
428$(OBJ)%.o:%.f
429 $(COMPILE.f) -o $@ $<
430
431#OSF1
432#LDFC est f77
433#LDFCFLAGS est rien
434
435#parfois
436#LDFC est cc
437#LDFCFLAGS est -ltruc
438
439#------------------------------------------------- End of Makefile.h -------
Note: See TracBrowser for help on using the repository browser.