No effective C++ option for compilation of C files
[u/mrichter/AliRoot.git] / build / Makefile.macosx
index 2d6cb64..4042d0d 100644 (file)
@@ -1,29 +1,56 @@
 # Makefile for AliRoot for MacOS X with gcc
 
+XARGS = xargs
+
+# OS version
+MACOSX_MAJOR := $(strip $(shell sw_vers | sed -n 's/ProductVersion://p' | cut -d . -f 1))
+MACOSX_MINOR := $(strip $(shell sw_vers | sed -n 's/ProductVersion://p' | cut -d . -f 2))
+
+# fink directories
+FINK_ROOT := $(shell which fink | sed -e 's?/bin/fink??')
+ifeq (,$(FINK_ROOT))
+# No fink, build will probably fail, but we try a guess
+FINK_ROOT=/usr/local
+endif
+
 # The compilers
 CXX           = g++ 
-F77          = g77
 CC           = gcc
 
+ifeq (g95,$(findstring g95,$(ROOTBUILD)))
+F77          = g95
+else
+F77          = gfortran
+endif
+
 # Global optimisation
-OPT           = -O0 -g
+OPT           = -O -g
 NOOPT         = -g
 
 CXXOPT        = $(OPT) 
 CXXNOOPT      = $(NOOPT) 
 COPT         = $(OPT)
 FOPT         = $(OPT) -fno-second-underscore 
+ifeq (g95,$(findstring g95,$(ROOTBUILD)))
+FOPT        += -fbounds-check
+endif
 
 # CERNLIB defines
-CLIBDEFS      = -DCERNLIB_LINUX -DCERNLIB_BLDLIB -DCERNLIB_CZ
+CLIBDEFS      = -DCERNLIB_LINUX -DCERNLIB_BLDLIB -DCERNLIB_CZ -DCERNLIB_PPC
 CLIBCXXOPTS   =
 CLIBCOPT      =
 CLIBFOPT      = $(CLIBDEFS)
 
 # Compiler flags
-CXXFLAGS      = $(CXXOPT) -Wall -W -pipe -fsigned-char -fno-common -fweak-coalesced -fmessage-length=0 -I/sw/include
-CXXFLAGSNO    = $(CXXNOOPT) -Wall -W -pipe -fsigned-char -fno-common -fweak-coalesced -fmessage-length=0 -I/sw/include
-CFLAGS       = $(COPT) -Wall -W -fno-common -fweak-coalesced -pipe -I/sw/include
+CXXFLAGS      = $(CXXOPT)   -Wall -W -Wno-long-double -pipe -fbounds-check -fsigned-char -fno-common -fmessage-length=0 -I/usr/X11R6/include -I$(FINK_ROOT)/include -Woverloaded-virtual -Weffc++ 
+
+ifeq (g95,$(findstring g95,$(ROOTBUILD)))
+CXXFLAGS+=-DFORTRAN_G95
+endif
+CXXFLAGSNO    = $(CXXNOOPT) -Wall -W -pipe -fsigned-char -fno-common -fmessage-length=0 -I$(FINK_ROOT)/include  -Wno-long-double
+
+CFLAGS       = $(COPT) -Wall -W -fno-common -pipe -I$(FINK_ROOT)/include
+
 FFLAGS        = $(CLIBFOPT) $(FOPT)
 # rmkdepend flags for building dependencies of FORTRAN files
 DEPENDFFLAGS  = $(FFLAGS)
@@ -31,51 +58,19 @@ DEPENDFFLAGS  = $(FFLAGS)
 # rootcint flags
 CINTFLAGS     = 
 
-DICTNOLOAD:=
-
-DICTLOAD:= -Wl,-u,_G__cpp_setupG__AliL3Comp -Wl,-u,_G__cpp_setupG__AliL3Hough \
--Wl,-u,_G__cpp_setupG__AliL3Misc -Wl,-u,_G__cpp_setupG__AliL3Src \
--Wl,-u,_G__cpp_setupG__AliPythia6 -Wl,-u,_G__cpp_setupG__CONTAINERS \
--Wl,-u,_G__cpp_setupG__CRT -Wl,-u,_G__cpp_setupG__EMCAL \
--Wl,-u,_G__cpp_setupG__ESD -Wl,-u,_G__cpp_setupG__EVGEN \
--Wl,-u,_G__cpp_setupG__FASTSIM -Wl,-u,_G__cpp_setupG__FMDbase \
--Wl,-u,_G__cpp_setupG__FMDrec -Wl,-u,_G__cpp_setupG__FMDsim \
--Wl,-u,_G__cpp_setupG__ITS -Wl,-u,_G__cpp_setupG__MUONbase \
--Wl,-u,_G__cpp_setupG__MUONgeometry -Wl,-u,_G__cpp_setupG__MUONmapping \
--Wl,-u,_G__cpp_setupG__MUONrec -Wl,-u,_G__cpp_setupG__MUONsim \
--Wl,-u,_G__cpp_setupG__PHOS -Wl,-u,_G__cpp_setupG__PMDbase \
--Wl,-u,_G__cpp_setupG__PMDrec -Wl,-u,_G__cpp_setupG__PMDsim \
--Wl,-u,_G__cpp_setupG__RAW -Wl,-u,_G__cpp_setupG__RICH \
--Wl,-u,_G__cpp_setupG__STARTbase -Wl,-u,_G__cpp_setupG__STARTrec \
--Wl,-u,_G__cpp_setupG__STARTsim -Wl,-u,_G__cpp_setupG__STEER \
--Wl,-u,_G__cpp_setupG__STRUCT -Wl,-u,_G__cpp_setupG__TEPEMGEN \
--Wl,-u,_G__cpp_setupG__THbtp -Wl,-u,_G__cpp_setupG__THerwig \
--Wl,-u,_G__cpp_setupG__THijing -Wl,-u,_G__cpp_setupG__TMEVSIM \
--Wl,-u,_G__cpp_setupG__TOFbase -Wl,-u,_G__cpp_setupG__TOFrec \
--Wl,-u,_G__cpp_setupG__TOFsim -Wl,-u,_G__cpp_setupG__TPCbase \
--Wl,-u,_G__cpp_setupG__TPCfast -Wl,-u,_G__cpp_setupG__TPCrec \
--Wl,-u,_G__cpp_setupG__TPCsim -Wl,-u,_G__cpp_setupG__TPHIC \
--Wl,-u,_G__cpp_setupG__TRDbase -Wl,-u,_G__cpp_setupG__TRDfast \
--Wl,-u,_G__cpp_setupG__TRDrec -Wl,-u,_G__cpp_setupG__TRDsim \
--Wl,-u,_G__cpp_setupG__VZERObase -Wl,-u,_G__cpp_setupG__VZEROrec \
--Wl,-u,_G__cpp_setupG__VZEROsim \
--Wl,-u,_G__cpp_setupG__ZDCbase -Wl,-u,_G__cpp_setupG__ZDCrec \
--Wl,-u,_G__cpp_setupG__ZDCsim -Wl,-u,_G__cpp_setupG__hijing \
--Wl,-u,_G__cpp_setupG__pythia6
-
-LD            = export MACOSX_DEPLOYMENT_TARGET=10.3 ; \
+LD            = export MACOSX_DEPLOYMENT_TARGET=$(MACOSX_MAJOR).$(MACOSX_MINOR) ; \
                unset LD_PREBIND ; \
                g++
 LDFLAGS       = $(OPT) $(DICTLOAD)
 
 SHLD        := $(LD)
 SOFLAGS      := -bundle -undefined dynamic_lookup
-SHLIB        :=
+SHLIB        := 
 SOEXT       := so
 
 DYLD        := $(LD)
 DYFLAGS       = -dynamiclib -undefined dynamic_lookup -single_module
-DYLIB        :=
+DYLIB        := 
 DYEXT        := dylib
 
 ALLD         = ar
@@ -85,10 +80,14 @@ AEXT              = a
 
 DEPENDCXXFLAGS = $(CXXFLAGS) -I/usr/include/sys
 
-GLIBS         = -L/usr/X11R6/lib -lX11
+SYSLIBS      := -L/usr/X11R6/lib -lX11
 
-#System libraries
-SYSLIBS = -ldl
+EXEFLAGS     := -bind_at_load 
 
-EXEFLAGS+= -bind_at_load 
+#System libraries
 
+ifeq (g95,$(findstring g95,$(ROOTBUILD)))
+SYSLIBS += -L$(shell g95 --print-search-dirs | sed -n -e 's/install: //p') -lf95
+else
+SYSLIBS += -ldl -L$(shell gfortran --print-search-dirs | sed -n -e 's/install: //p') -lgfortranbegin -lgfortran
+endif