From 5e1b8f5be8ea8f42092fd346e35ee0160625eb2e Mon Sep 17 00:00:00 2001
From: Rene Brun <Rene.Brun@cern.ch>
Date: Wed, 14 May 2008 15:15:35 +0000
Subject: [PATCH] From Federico: New version of the VMC makefile

git-svn-id: http://root.cern.ch/svn/root/trunk@23853 27541ba8-7e3a-0410-8455-c3a389f83636
---
 etc/vmc/Makefile.linuxx8664gcc | 68 +++++++++++++++++++++++++++++++---
 1 file changed, 62 insertions(+), 6 deletions(-)

diff --git a/etc/vmc/Makefile.linuxx8664gcc b/etc/vmc/Makefile.linuxx8664gcc
index 2f4610803b7..06313b00720 100644
--- a/etc/vmc/Makefile.linuxx8664gcc
+++ b/etc/vmc/Makefile.linuxx8664gcc
@@ -3,12 +3,21 @@
 # Linux platform dependent definitions
 
 # The compilers
-CXX   = g++ 
-F77	  = g77
+CXX       = g++ 
 CC	  = gcc
 
+ifneq (,$(findstring g95,$(ROOTBUILD)))
+F77	  = g95
+else
+ifneq (,$(findstring gfortran,$(ROOTBUILD)))
+F77	  = gfortran
+else
+F77	  = g77
+endif
+endif
+
 # Global optimisation
-OPT   = -g #-O
+OPT   = -O2 -g
 
 # Shared library suffix
 SL	  = so
@@ -21,9 +30,26 @@ AWK	  = awk
 # starting from root.2.22 on Linux the flags -fno-rtti -fno-exceptions are
 # not necessary any more
 #
-CXXOPTS       = $(OPT) -Wall -fPIC -pipe
-COPT	      = $(OPT) -fPIC
-FOPT	      = $(OPT) -fno-second-underscore -fno-f2c -fPIC
+CXXOPTS       = $(OPT) -Wall -W -fPIC -pipe -Woverloaded-virtual -m64
+COPT	      = $(OPT) -m64 -fPIC
+
+ifneq (,$(findstring g95,$(ROOTBUILD)))
+FOPT	      = $(OPT) -fno-second-underscore
+else
+ifneq (,$(findstring gfortran,$(ROOTBUILD)))
+FOPT	      = $(OPT) -fno-second-underscore
+else
+FOPT	      = $(OPT) -fno-second-underscore
+endif
+endif
+
+GCC_MAJOR    := $(shell $(CXX) -v 2>&1 | \
+                  grep version | cut -d' ' -f3  | cut -d'.' -f1)
+ifneq ($(GCC_MAJOR),3)
+   FOPT      := $(filter-out -O%,$(FOPT))
+endif
+
+FOPT += -m64 -fno-f2c -fPIC
 
 # CERNLIB defines
 
@@ -32,10 +58,40 @@ CLIBCXXOPTS   = $(CLIBDEFS)
 CLIBCOPT      = $(CLIBDEFS)
 CLIBFOPT      = $(CLIBDEFS)
 
+ifneq (,$(findstring g95,$(ROOTBUILD)))
+CLIBDEFS     += -DCERNLIB_G95
+else
+ifneq (,$(findstring gfortran,$(ROOTBUILD)))
+CLIBDEFS     += -DCERNLIB_GFORTRAN
+else
+
+endif
+endif
+
 LD            = g++
 LDFLAGS       = $(OPT)
 
 SHLD	      = $(LD)
 SOFLAGS       = -Wl,-soname,$(notdir $@) -shared 
+
+ifneq (,$(findstring g95,$(ROOTBUILD)))
+SHLIB += -L$(shell g95 --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)
+else
 SHLIB         = -lg2c
+endif
+endif
+
+# Graphics
+#  
+X11FLAGS  := -I/usr/include/X11/extensions -I/usr/include/X11
+XMFLAGS   := -I/usr/X11R6/include
+ifndef OGLFLAGS
+  ifneq ($(OGLHOME),/usr) 
+    OGLFLAGS  := -I$(OGLHOME)/include
+  endif 
+endif
 
-- 
GitLab