+# -*- mode: makefile -*-
# Makefile to build AliRoot for Linux
# System dependent commands
XARGS = xargs -r
# The compilers
-CXX = g++
-CC = gcc
+CXX = $(shell root-config --cxx)
+CC = $(shell root-config --cc)
CCMAJORV = $(shell $(CC) -dumpversion | cut -d. -f1)
CCMINORV = $(shell $(CC) -dumpversion | cut -d. -f2)
-
-ifneq (,$(findstring g95,$(ROOTBUILD)))
-F77 = g95
-else
-ifneq (,$(findstring gfortran,$(ROOTBUILD)))
-F77 = gfortran
-else
-F77 = g77
-endif
-endif
+F77 = $(shell root-config --f77)
# Global optimisation
-OPT = -O -g
+OPT = -O0 -g
NOOPT = -g
CXXOPT = $(OPT)
CFLAGS = $(OPT) -Wall -Werror -fPIC -pipe -Wno-long-long -pedantic-errors -ansi
FFLAGS = $(CLIBFOPT) $(FOPT) -fno-second-underscore
-ifneq (,$(findstring g95,$(ROOTBUILD)))
+ifneq (,$(findstring g95,$(F77)))
FFLAGS +=-DFORTRAN_G95
else
-ifneq (,$(findstring gfortran,$(ROOTBUILD)))
+ifneq (,$(findstring gfortran,$(F77)))
FFLAGS +=-DFORTRAN_GFORTRAN
else
FFLAGS +=
# rootcint flags
CINTFLAGS =
-LD = g++
+LD = $(shell root-config --ld)
LDFLAGS = $(OPT)
SHLD = $(LD)
#System libraries
SYSLIBS := -ldl -lcrypt -L/usr/X11R6/lib -lX11
-ifneq (,$(findstring g95,$(ROOTBUILD)))
-SHLIB += -L$(shell g95 --print-search-dirs | sed -n -e 's/install: //p') -lf95
+ifneq (,$(findstring g95,$(F77)))
+SHLIB += -L$(shell $(F77) --print-search-dirs | sed -n -e 's/install: //p') -lf95
else
-ifneq (,$(findstring gfortran,$(ROOTBUILD)))
-SHLIB := $(shell gfortran -print-file-name=libgfortran.so)
-SHLIB += $(shell gfortran -print-file-name=libgfortranbegin.a)
+ifneq (,$(findstring gfortran,$(F77)))
+SHLIB := $(shell $(F77) -print-file-name=libgfortran.so)
+SHLIB += $(shell $(F77) -print-file-name=libgfortranbegin.a)
SYSLIBS += $(SHLIB)
else
SHLIB = -lg2c