[218] | 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
|
---|
| 16 | MACHEROS := $(shell echo `uname`)
|
---|
| 17 | # define the -D option
|
---|
| 18 | MACHEROSD := $(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++
|
---|
| 24 | ifdef EROSCXX
|
---|
| 25 | CXX := $(EROSCXX)
|
---|
| 26 | endif
|
---|
| 27 |
|
---|
| 28 | ifeq ($(CXX),gcc)
|
---|
| 29 | override CXX := g++
|
---|
| 30 | endif
|
---|
| 31 |
|
---|
| 32 | ifeq ($(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++
|
---|
| 36 | endif
|
---|
| 37 |
|
---|
| 38 | ifeq ($(CC),xlC)
|
---|
| 39 | override CXX := xlC
|
---|
| 40 | endif
|
---|
| 41 |
|
---|
| 42 | #### C
|
---|
| 43 | ifeq ($(CXX), xlC)
|
---|
| 44 | override CC := xlC
|
---|
| 45 | endif
|
---|
| 46 |
|
---|
| 47 | ifeq ($(CXX), g++)
|
---|
| 48 | CC := gcc
|
---|
| 49 | endif
|
---|
| 50 |
|
---|
| 51 | ifeq ($(EROSCXX), egcs++)
|
---|
| 52 | CC := egcs
|
---|
| 53 | endif
|
---|
| 54 |
|
---|
| 55 | #### Fortran (tout ce qui est lie au Fortran est defini ici #############
|
---|
| 56 | FC = f77
|
---|
| 57 | ifeq ($(SITE),CCIN2P3)
|
---|
| 58 | ifeq ($(MACHEROS),AIX)
|
---|
| 59 | override FC := xlf
|
---|
| 60 | endif
|
---|
| 61 | endif
|
---|
| 62 | ifeq (${MACHEROS},Linux)
|
---|
| 63 | # override FC := f77
|
---|
| 64 | override FC := g77
|
---|
| 65 | endif
|
---|
| 66 |
|
---|
| 67 | ifeq (${MACHEROS},OSF1)
|
---|
| 68 | LIBFORT = -lfor -lFutil -lots -lUfor
|
---|
| 69 | endif
|
---|
| 70 | ifeq (${MACHEROS},Linux)
|
---|
| 71 | LIBFORT = -lf2c
|
---|
| 72 | endif
|
---|
| 73 | #########################################################################
|
---|
| 74 |
|
---|
| 75 |
|
---|
| 76 | MACHDIR := $(MACHEROS)-$(CXX)
|
---|
| 77 |
|
---|
| 78 |
|
---|
| 79 | #-
|
---|
| 80 | #- Define Makefile paths
|
---|
| 81 | #- (NE PAS TOUCHER CES LIGNES: generation automatique de MakefileUser.h)
|
---|
| 82 | #-
|
---|
| 83 | PP := ${DPCBASEREP}/${MACHDIR}/
|
---|
| 84 | PPH := ${HOME}/${MACHDIR}/
|
---|
| 85 | LIB := ${PP}/Libs/
|
---|
| 86 | SLB := ${PP}/ShLibs/
|
---|
| 87 | OBJ := ${PPH}/Objs/
|
---|
| 88 | EXE := ${PPH}/Exec/
|
---|
| 89 | INC := ${DPCBASEREP}/Include/
|
---|
| 90 | CCI := ${INC}/CInc/
|
---|
| 91 | GLB := ${GNU}/${MACHEROS}/lib/
|
---|
| 92 | #--
|
---|
| 93 |
|
---|
| 94 | #- Flag for optimisation/ debug
|
---|
| 95 | # Pour forcer sans debug, DBGFLAG = -g0
|
---|
| 96 | ifndef OPTFLAG
|
---|
| 97 | OPTFLAG := -O
|
---|
| 98 | endif
|
---|
| 99 |
|
---|
| 100 | ifndef DBGFLAG
|
---|
| 101 | DBGFLAG := -g
|
---|
| 102 | endif
|
---|
| 103 |
|
---|
| 104 | # DBGFLAG a -g0 veut dire pas de debug. Tout le monde a ca par defaut...
|
---|
| 105 | ifeq ($(DBGFLAG), -g0)
|
---|
| 106 | override DBGFLAG :=
|
---|
| 107 | endif
|
---|
| 108 |
|
---|
| 109 | # xlC ne connait pas -O0, par defaut il n'optimise pas.
|
---|
| 110 | ifeq ($(OPTFLAG), -O0)
|
---|
| 111 | ifeq ($(CC), xlC)
|
---|
| 112 | override OPTFLAG :=
|
---|
| 113 | endif
|
---|
| 114 | endif
|
---|
| 115 |
|
---|
| 116 | AR := ar
|
---|
| 117 | ARFLAGS := -rcs
|
---|
| 118 |
|
---|
| 119 | # le gnu ar ne fonctionne pas bien sur OSF...
|
---|
| 120 | ifeq (${MACHEROS},OSF1)
|
---|
| 121 | AR := /usr/bin/ar
|
---|
| 122 | endif
|
---|
| 123 | # et sur AIX il nous sort des tas de warnings inutiles
|
---|
| 124 | ifeq ($(MACHEROS),AIX)
|
---|
| 125 | AR := /usr/bin/ar
|
---|
| 126 | endif
|
---|
| 127 |
|
---|
| 128 | # Avec certains compilateurs C++ (KCC, aCC) , il faut fabriquer les librairies et
|
---|
| 129 | # les shared libs avec la meme commande
|
---|
| 130 | override ARCXX :=
|
---|
| 131 | ifeq ($(CXX),KCC)
|
---|
| 132 | ARCXX := KCC
|
---|
| 133 | endif
|
---|
| 134 | ifeq ($(CXX),aCC)
|
---|
| 135 | ARCXX := aCC
|
---|
| 136 | endif
|
---|
| 137 |
|
---|
| 138 | # Les chemins speciaux pour includes systemes et bibliotheques
|
---|
| 139 | ifeq (${MACHEROS},HP-UX)
|
---|
| 140 | XLDLIBS := -L.
|
---|
| 141 | XCFLAGS := -I.
|
---|
| 142 | endif
|
---|
| 143 |
|
---|
[478] | 144 |
|
---|
[218] | 145 | # Pour compiler PI, sous Linux, les includes et libs se trouve souvent ds /usr/X11/include /usr/X11/lib/
|
---|
| 146 | ifeq (${MACHEROS},Linux)
|
---|
| 147 | XLDLIBS := -L/usr/X11/lib
|
---|
| 148 | XCFLAGS := -I/usr/X11/include
|
---|
| 149 | LDLIBS := -ldl
|
---|
| 150 | endif
|
---|
| 151 |
|
---|
| 152 | # Pour RFIO
|
---|
| 153 | ifeq ($(SITE),CCIN2P3)
|
---|
| 154 | XCFLAGS := $(XCFLAGS) -D RFIO -I/usr/local/include/shift
|
---|
| 155 | XLDLIBS := $(XLDLIBS) -L/usr/local/lib -lshift
|
---|
| 156 | endif
|
---|
| 157 |
|
---|
| 158 | # Les bibliotheques gnu C pour le fort du CCPN
|
---|
| 159 | ifeq ($(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
|
---|
| 168 | endif
|
---|
| 169 |
|
---|
[478] | 170 | # Chemin pour la librairie cfitsio
|
---|
| 171 | FITSIOREP :=
|
---|
| 172 | FITSIOLIB :=
|
---|
| 173 | ifeq ($(SITE),LAL)
|
---|
| 174 | override FITSIOREP :=/exp/planck/FitsIO/cfitsio/
|
---|
| 175 | override FITSIOLIB := -L$(FITSIOREP) -lcfitsio
|
---|
| 176 | endif
|
---|
| 177 |
|
---|
[218] | 178 | # S'il y a des flags particulier pour un module de compilation
|
---|
| 179 | #ifndef MODULECPPFLAGS
|
---|
| 180 | override MODULECPPFLAGS :=
|
---|
| 181 | #endif
|
---|
| 182 |
|
---|
[478] | 183 | CPPFLAGS := -I${INC} -I$(FITSIOREP) -D${MACHEROSD} -I$(INC)/tnt $(MODULECPPFLAGS)
|
---|
[218] | 184 |
|
---|
| 185 | # Les options selon les divers compilateurs
|
---|
| 186 | # GNU
|
---|
| 187 | ifeq ($(CC), gcc)
|
---|
| 188 | CFLAGS := -Wall -Wpointer-arith \
|
---|
| 189 | -Wmissing-prototypes -Wsynth -I$(INC) $(XCFLAGS) \
|
---|
| 190 | $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
|
---|
| 191 | LDLIBS := $(LDLIBS) $(XLDLIBS)
|
---|
| 192 | endif
|
---|
| 193 | ifeq ($(CC), egcs)
|
---|
| 194 | CFLAGS := -Wall -Wpointer-arith \
|
---|
| 195 | -Wmissing-prototypes -Wsynth -I$(INC) $(XCFLAGS) \
|
---|
| 196 | $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS)
|
---|
| 197 | LDLIBS := $(LDLIBS) $(XLDLIBS)
|
---|
| 198 | endif
|
---|
| 199 |
|
---|
| 200 | ifeq ($(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
|
---|
| 212 | endif
|
---|
| 213 | ifeq ($(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
|
---|
| 221 | endif
|
---|
| 222 |
|
---|
| 223 | # Compilateur C natif HP-UX
|
---|
| 224 | ifeq (${MACHEROS},HP-UX)
|
---|
| 225 | ifeq ($(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 |
|
---|
| 233 | endif
|
---|
| 234 | ifeq ($(CXX),aCC)
|
---|
| 235 | CXXFLAGS := $(XCFLAGS) $(OPTFLAG) $(DBGFLAG) $(MYCFLAGS) +Z -D__aCC__
|
---|
| 236 | # -DCOMPILER_EXCEPTIONS -D__ANSI_TEMPLATES__ definis ds defs.h
|
---|
| 237 | endif
|
---|
| 238 | endif
|
---|
| 239 |
|
---|
| 240 | # AIX, xlC comme compilateur C et C++
|
---|
| 241 | ifeq ($(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)
|
---|
| 257 | endif
|
---|
| 258 |
|
---|
| 259 | #gcc sur Solaris
|
---|
| 260 | ifeq ($(MACHEROS),SunOS)
|
---|
| 261 | override NOSHLIB := Y
|
---|
| 262 | endif
|
---|
| 263 |
|
---|
| 264 | ifeq ($(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
|
---|
| 320 | endif
|
---|
| 321 | ifeq ($(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
|
---|
| 339 | endif
|
---|
| 340 |
|
---|
| 341 |
|
---|
| 342 | # Compilateur KAI
|
---|
| 343 | ifeq ($(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
|
---|
| 347 | endif
|
---|
| 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
|
---|