]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - build/Makefile.linux
Compilation on Windows/Cygwin
[u/mrichter/AliRoot.git] / build / Makefile.linux
index dced5509d92199a64cd884d58f1e4ff00f8d0a78..6771cf3de1bc461c17be93acfeeaa484e80cf104 100644 (file)
+# -*- mode: makefile -*-
 # Makefile to build AliRoot for Linux
 
-PLATFORM      = 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)
+F77          = $(shell root-config --f77)
 
 # Global optimisation
 OPT           = -O -g
+NOOPT         = -g
 
-ifeq ($(CCMAJORV),2)
-CXXOPTS       = $(OPT) -W -Wall -fPIC -pipe
-else
-CXXOPTS       = $(OPT) -W -Wall -Werror -fPIC -pipe -fmessage-length=0 -Wno-long-long -pedantic-errors -ansi
-endif
+CXXOPT        = $(OPT)
+CXXNOOPT      = $(NOOPT)
 COPT         = $(OPT)
-FOPT         = $(OPT) -fno-second-underscore
-CXXFLAGS      = $(CXXOPTS)
-CFLAGS       = $(OPT) -Wall -Werror -fPIC -pipe -Wno-long-long -pedantic-errors -ansi
-
-# rootcint flags
-CINTFLAGS     = 
+FOPT         = $(OPT)
 
 # CERNLIB defines
-
 CLIBDEFS      = -DCERNLIB_LINUX -DCERNLIB_BLDLIB -DCERNLIB_CZ
 CLIBCXXOPTS   =
 CLIBCOPT      =
-CLIBFOPT      =
+CLIBFOPT      = $(CLIBDEFS)
+
+# Compiler flags
+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
+
+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)
+
+# rootcint flags
+CINTFLAGS     = 
 
-# Common Fortran compilation flags
-FFLAGS = $(CLIBFOPT)  $(CLIBDEFS) $(FOPT)
-               
 LD            = g++
 LDFLAGS       = $(OPT) 
 
 SHLD         = $(LD)
 SOFLAGS       = $(OPT) -shared -Wl 
-SHLIB         = -lg2c
 SOEXT        = so
 
+#System libraries
+SYSLIBS      := -ldl -lcrypt -L/usr/X11R6/lib -lX11
+
+ifeq (g95,$(F77))
+SHLIB += -L$(shell g95 --print-search-dirs | sed -n -e 's/install: //p') -lf95
+else
+ifeq (gfortran,$(F77))
+SHLIB := $(shell gfortran -print-file-name=libgfortran.so)
+SHLIB += $(shell gfortran -print-file-name=libgfortranbegin.a)
+SYSLIBS += $(SHLIB)
+else
+SHLIB         = -lg2c
+SYSLIBS +=  -lg2c
+endif
+endif
+
 ALLD         = ar
 ALFLAGS       = cr
 ALLIB         = 
 AEXT         = a
 
 # additional ROOT libraries
-ROOTLIBS  += -lcrypt 
 
-# rmkdepend flags for building dependencies of FORTRAN files
-DEPENDFFLAGS = $(FFLAGS)
-
-LIBNOVER      = `find /lib -name 'libNoVersion*.so' | xargs --replace basename {} .so | sed -e 's/lib/ -l/'`
-GLIBS         = -L/usr/X11R6/lib -lX11  $(LIBNOVER)
-
-#System libraries
-SYSLIBS = -ldl
 
-EXEFLAGS+= -lg2c