]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - build/Makefile.linuxx8664gcc
Fixing memory leaks
[u/mrichter/AliRoot.git] / build / Makefile.linuxx8664gcc
index 99d3165467949529840244294e232f8f7c3f743f..a2f6d1468d4df6ebf2f06b9e34939026eb5090b4 100644 (file)
@@ -1,16 +1,15 @@
-# Makefile for AliRoot for Itanium/Linux with gcc
+# -*- mode: makefile -*-
+# Makefile to build AliRoot for Linux
 
 # System dependent commands
 
 XARGS = xargs -r
 
-# The compilers
-CXX           = g++ 
-F77          = g77
-CC           = gcc
+CCMAJORV      = $(shell $(CC) -dumpversion | cut -d. -f1)
+CCMINORV      = $(shell $(CC) -dumpversion | cut -d. -f2)
 
 # Global optimisation
-OPT           = -g -O
+OPT           = -O2 -g
 NOOPT         = -g
 
 CXXOPT        = $(OPT)
@@ -25,36 +24,75 @@ CLIBCOPT      =
 CLIBFOPT      = $(CLIBDEFS)
 
 # Compiler flags
-CXXFLAGS      = $(CXXOPT)  -Wall -fPIC -pipe
-CXXFLAGSNO    = $(CXXNOOPT)  -Wall -fPIC -pipe
-CFLAGS       = -Wall -fPIC -pipe
-FFLAGS        = $(CLIBFOPT) $(FOPT) -fno-second-underscore -fPIC
+ifeq ($(CCMAJORV),2)
+CXXFLAGS       = $(OPT) -W -Wall -fPIC -pipe
+CXXFLAGSNO     = $(NOOPT) -W -Wall -fPIC -pipe
+else
+ifeq ($(CCMAJORV),3)
+CXXFLAGS       = $(OPT) -W -Wall -Weffc++ -Woverloaded-virtual -fPIC -pipe -fmessage-length=0 -Wno-long-long -pedantic-errors -ansi -Dlinux
+CXXFLAGSNO     = $(NOOPT) -W -Wall -Weffc++ -fPIC -pipe -fmessage-length=0 -Wno-long-long -pedantic-errors -ansi
+else
+ifeq ($(CCMAJORV),4)
+CXXFLAGS       = $(OPT) -W -Wall -Weffc++ -Woverloaded-virtual -fPIC -pipe -fmessage-length=0 -Wno-long-long -pedantic-errors -ansi -Dlinux
+CXXFLAGSNO     = $(NOOPT) -W -Wall -Weffc++ -fPIC -pipe -fmessage-length=0 -Wno-long-long -pedantic-errors -ansi
+else
+CXXFLAGS       = $(OPT) -W -Wall -Woverloaded-virtual -fPIC -pipe -fmessage-length=0 -Wno-long-long -ansi -Dlinux
+CXXFLAGSNO     = $(NOOPT) -W -Wall -Weffc++ -fPIC -pipe -fmessage-length=0 -Wno-long-long -ansi
+endif
+endif
+endif
+CFLAGS        = $(OPT) -Wall -Werror -fPIC -pipe -Wno-long-long -pedantic-errors -ansi
+FFLAGS         = $(CLIBFOPT) $(FOPT) -fno-second-underscore -fPIC -fno-f2c
+
+ifeq (g95,$(F77))
+FFLAGS       +=-DFORTRAN_G95
+else
+ifeq (gfortran,$(F77))
+FFLAGS       +=-DFORTRAN_GFORTRAN
+else
+FFLAGS       +=
+endif
+endif
+
 # rmkdepend flags for building dependencies of FORTRAN files
-DEPENDFFLAGS = $(FFLAGS)
+DEPENDFFLAGS   = $(FFLAGS)
 
 # rootcint flags
 CINTFLAGS     = 
 
-LD            = g++
-LDFLAGS       = $(OPT) -Wl,-Map -Wl,$@.map
+LD            = $(shell root-config --ld)
+LDFLAGS       = $(OPT) 
 
-SHLD         = $(LD)
-SOFLAGS       = -shared -Wl -O2
+SHLD         = $(LD) 
+SOFLAGS       = $(OPT) -shared -Wl 
 SOEXT        = so
 
+#System libraries
+LIBNOVER      = `find /lib64 -name 'libNoVersion*.so' | xargs --replace basename {} .so | sed -e 's/lib64/ -l/'`
+
+SYSLIBS      := -ldl -lcrypt -L/usr/X11R6/lib64 -lX11  $(LIBNOVER)
+
+ifneq (,$(findstring g95,$(F77)))
+SHLIB += -L$(shell $(F77) --print-search-dirs | sed -n -e 's/install: //p') -lf95
+else
+ifneq (,$(findstring gfortran,$(F77)))
+SHLIB := $(shell $(F77) -print-file-name=libgfortran.so)
+SHLIB += $(shell $(F77) -print-file-name=libgfortranbegin.a)
+else
+SHLIB         = -lg2c
+SYSLIBS +=  -lg2c
+endif
+endif
+
 ALLD         = ar
 ALFLAGS       = cr
 ALLIB         = 
 AEXT         = a
 
-# additional ROOT libraries
 
-LIBNOVER      = `find /lib64 -name 'libNoVersion*.so' | xargs --replace basename {} .so | sed -e 's/lib64/ -l/'`
 
-#System libraries
-SYSLIBS      := -ldl -lcrypt -L/usr/X11R6/lib64 -lX11  $(LIBNOVER)
 
-EXEFLAGS     := -lg2c
+