Fixed issue with DATE which caused SLC 4 builds to fail
[u/mrichter/AliRoot.git] / cmake / modules / ALICEMacros.cmake
index 7ebf859492b6ceaa5d394422b0fc6e8568ab87fb..603d13e8871787b08fdc550f84459d38b93e02d9 100644 (file)
@@ -1,5 +1,6 @@
 # -*- mode: cmake -*-
 #_______________________________________________________________________________
+
 Macro(CHANGE_FILE_EXTENSION OLD_EXT NEW_EXT RESULT LIST)
 
 # This is probably an obsolete Macro
@@ -41,13 +42,14 @@ EndMacro (CHECK_OUT_OF_SOURCE_BUILD)
 Function (AddLibrary LIB SRCS DHDRS)
 
 # Adds an AliRoot library as a target
+  string(REGEX REPLACE "$ENV{ALICE_ROOT}/?([^/]*)/?.*" "\\1" label ${CMAKE_CURRENT_SOURCE_DIR})
 
+  # Message(STATUS Debug ${LIB})
   Set(_path)
   List(LENGTH SRCS _len)
   If(_len GREATER 0)
     List(GET SRCS 0 _file)
     Get_filename_component(_path ${_file} PATH)
-#    Message(STATUS Debug ${_file} ${_path})
   Endif(_len GREATER 0)
 
   Set(LDEF)
@@ -61,27 +63,39 @@ Function (AddLibrary LIB SRCS DHDRS)
     Endif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_path}/${LIB}LinkDef.h)
   Endif(_path)
 
+  # Message(STATUS Debug - ${CMAKE_CURRENT_SOURCE_DIR} - ${LIB} - ${LDEF})
+
   Set(DICT)
+  # Message(STATUS Debug ${LDEF})
   If(LDEF)
 # even with no cxx files, one may want to build an empty lib as a placeholder
 # in AliRoot this is signalled by the existence of an (empty) ${LIB}LinkDef.h
     Set(DICT "G__${LIB}.cxx")
     Set(ASRCS ${SRCS} ${DICT})
     Root_Generate_Dictionary("${DHDRS}" "${LDEF}" "${DICT}" "${INCLUDE_DIRECTORIES}")
+    If(ALICE_STATIC_BUILD)
+      Set(STATIC_DICT "G__${LIB}_a.cxx")
+      Set(STATIC_ASRCS ${SRCS} ${STATIC_DICT})
+      Root_Generate_Dictionary("${DHDRS}" "${LDEF}" "${STATIC_DICT}" "${INCLUDE_DIRECTORIES}")
+    EndIf(ALICE_STATIC_BUILD)
   Else(LDEF)
     Message(STATUS "No ${LIB}LinkDef.h found... building lib with no ROOT dict")
     Set(ASRCS ${SRCS})
+    If(ALICE_STATIC_BUILD)
+      Set(STATIC_ASRCS ${SRCS})
+    EndIf(ALICE_STATIC_BUILD)
   Endif(LDEF)
 
   Add_Library(${LIB} SHARED ${ASRCS})
-  Target_Link_Libraries(${LIB} ${ALIROOT_LIBRARIES})
+  set_property(TARGET ${LIB} PROPERTY LABELS ${label})
+  Target_Link_Libraries(${LIB} ${ALIROOT_LIBRARIES} ${DMONLIBS})
   Set_Target_Properties(${LIB} PROPERTIES ${ALIROOT_LIBRARY_PROPERTIES})
-  
+#  message("${LIB}-${label}")
   Install(TARGETS ${LIB} DESTINATION ${ALIROOT_INSTALL_DIR}/lib
     COMPONENT shared)
 
   If(ALICE_STATIC_BUILD)
-    Add_Library(${LIB}_a STATIC ${ASRCS})
+    Add_Library(${LIB}_a STATIC ${STATIC_ASRCS})
     Install(TARGETS ${LIB}_a DESTINATION ${ALIROOT_INSTALL_DIR}/lib/static)
   EndIf(ALICE_STATIC_BUILD)
 
@@ -92,6 +106,75 @@ Function (AddLibrary LIB SRCS DHDRS)
   CheckViols(${LIB} "${SRCS}")
 
 EndFunction (AddLibrary)
+#_______________________________________________________________________________
+Function (AddHLTLibrary LIB SRCS DHDRS)
+
+# Adds an AliRoot library as a target
+  string(REGEX REPLACE "$ENV{ALICE_ROOT}/?([^/]*)/?.*" "\\1" label ${CMAKE_CURRENT_SOURCE_DIR})
+  Set(_path)
+  List(LENGTH SRCS _len)
+  If(_len GREATER 0)
+    List(GET SRCS 0 _file)
+    Get_filename_component(_path ${_file} PATH)
+  Endif(_len GREATER 0)
+
+  Set(LDEF)
+  If(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${LIB}LinkDef.h)
+    Set(LDEF "${CMAKE_CURRENT_BINARY_DIR}/${LIB}LinkDef.h")
+  Endif(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${LIB}LinkDef.h)
+  
+  If(NOT LDEF)
+    If(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIB}LinkDef.h)
+      Set(LDEF "${LIB}LinkDef.h")
+    Endif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIB}LinkDef.h)
+  EndIf(NOT LDEF)
+
+  If(_path AND NOT LDEF)
+    If(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_path}/${LIB}LinkDef.h)
+      Set(LDEF "${_path}/${LIB}LinkDef.h")
+    Endif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_path}/${LIB}LinkDef.h)
+  Endif(_path AND NOT LDEF)
+
+  Set(DICT)
+  If(LDEF)
+# even with no cxx files, one may want to build an empty lib as a placeholder
+# in AliRoot this is signalled by the existence of an (empty) ${LIB}LinkDef.h
+    Set(DICT "G__${LIB}.cxx")
+    Set(ASRCS ${SRCS} ${DICT})
+    Root_Generate_Dictionary("${DHDRS}" "${LDEF}" "${DICT}" "${INCLUDE_DIRECTORIES}")
+    If(ALICE_STATIC_BUILD)
+      Set(STATIC_DICT "G__${LIB}_a.cxx")
+      Set(STATIC_ASRCS ${SRCS} ${STATIC_DICT})
+      Root_Generate_Dictionary("${DHDRS}" "${LDEF}" "${STATIC_DICT}" "${INCLUDE_DIRECTORIES}")
+    EndIf(ALICE_STATIC_BUILD)
+  Else(LDEF)
+    Message(STATUS "No ${LIB}LinkDef.h found... building lib with no ROOT dict")
+    Set(ASRCS ${SRCS})
+    If(ALICE_STATIC_BUILD)
+      Set(STATIC_ASRCS ${SRCS})
+    EndIf(ALICE_STATIC_BUILD)
+  Endif(LDEF)
+
+  Add_Library(${LIB} SHARED ${ASRCS})
+  set_property(TARGET ${LIB} PROPERTY LABELS ${label})
+  Target_Link_Libraries(${LIB} ${ALIROOT_LIBRARIES} ${DMONLIBS})
+  Set_Target_Properties(${LIB} PROPERTIES ${ALIROOT_LIBRARY_PROPERTIES})
+#  message("${LIB}-${label}")  
+  Install(TARGETS ${LIB} DESTINATION ${ALIROOT_INSTALL_DIR}/lib
+    COMPONENT shared)
+
+  If(ALICE_STATIC_BUILD)
+    Add_Library(${LIB}_a STATIC ${STATIC_ASRCS})
+    Install(TARGETS ${LIB}_a DESTINATION ${ALIROOT_INSTALL_DIR}/lib/static)
+  EndIf(ALICE_STATIC_BUILD)
+
+  If(ARGV3)
+    Install(FILES ${ARGV3} DESTINATION ${ALIROOT_INSTALL_DIR}/include)
+  Endif(ARGV3)
+
+  CheckViols(${LIB} "${SRCS}")
+
+EndFunction (AddHLTLibrary)
 
 #_______________________________________________________________________________
 Macro (SetModule)
@@ -106,21 +189,31 @@ EndMacro(SetModule)
 Function (AddExecutable BIN SRCS LIBS)
 
 # Adds an AliRoot executable as a target
+    
+  string(REGEX REPLACE "$ENV{ALICE_ROOT}/?([^/]*)/?.*" "\\1" label ${CMAKE_CURRENT_SOURCE_DIR})
+  String(REGEX REPLACE "(.*)exe" "\\1" executable_name "${BIN}")
+  # MESSAGE("EXECUTABLE: ${executable_name}")
 
   Add_Executable(${BIN} ${SRCS})
-  Target_Link_Libraries(${BIN} ${ROOT_LIBRARIES} ${LIBS})
+  set_property(TARGET ${BIN} PROPERTY LABELS ${label})
+#  message("${BIN}-${label}")
+  Target_Link_Libraries(${BIN} ${ROOT_LIBRARIES} ${LIBS} ${DMONLIBS})
+  set_target_properties(${BIN} PROPERTIES OUTPUT_NAME ${executable_name})
   Install(TARGETS ${BIN} DESTINATION ${ALIROOT_INSTALL_DIR}/bin)
 
   If(ALICE_STATIC_BUILD)
     Add_Executable(${BIN}_a ${SRCS})
     Set(_ar_libs)
+    # There are no static libs for external libraries, so we have to filter
+    # here. This is an ugly way how to do it, so this has to be improved.
     Foreach(_lib ${LIBS})
-      Set(_ar_libs ${_ar_libs} ${_lib}_a)
+      If(${_lib} STREQUAL GLU OR ${_lib} STREQUAL XMLParser)
+        Set(_ar_libs ${_ar_libs} ${_lib})
+      Else(${_lib} STREQUAL GLU OR ${_lib} STREQUAL XMLParser)
+        Set(_ar_libs ${_ar_libs} ${_lib}_a)
+      EndIf(${_lib} STREQUAL GLU OR ${_lib} STREQUAL XMLParser)
     EndForeach(_lib ${LIBS})
-    Foreach(_lib ${LIBS})
-      Set(_ar_libs ${_ar_libs} ${_lib}_a)
-    EndForeach(_lib ${LIBS})
-    Target_Link_Libraries(${BIN}_a ${ROOT_LIBRARIES} ${_ar_libs})
+    Target_Link_Libraries(${BIN}_a ${ALIROOT_LIBRARIES} ${_ar_libs})
     Install(TARGETS ${BIN}_a DESTINATION ${ALIROOT_INSTALL_DIR}/bin)
   EndIf(ALICE_STATIC_BUILD)
 
@@ -156,21 +249,17 @@ If(ALICE_TARGET STREQUAL macosx64)
 #  Set(CMAKE_CXX_LINK_EXECUTABLE 
 #    "MACOSX_DEPLOYMENT_TARGET=${MACOSX_MAJOR}.${MACOSX_MINOR} ${CMAKE_CXX_LINK_EXECUTABLE}")
 
-  Set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} -flat_namespace -single_module -undefined dynamic_lookup -m64")
+  Set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} -O -g -flat_namespace -single_module -undefined dynamic_lookup -m64")
 
-  Set(CMAKE_Fortran_FLAGS "-fno-second-underscore -m64")
+  Set(CMAKE_Fortran_FLAGS "-O -g -fno-second-underscore -m64")
 
   Set(CLIBDEFS "-DCERNLIB_LXIA64 -DCERNLIB_BLDLIB -DCERNLIB_CZ -DCERNLIB_PPC")
 
-  Set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -pipe -Wall -W -Wno-long-double -pipe -fbounds-check -fsigned-char -fno-common -fmessage-length=0 -Woverloaded-virtual -Weffc++ -Wconversion -Wshadow -fno-default-inline -fno-inline -I/usr/X11R6/include -I${FINK_ROOT}/include")
-  Set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} -m64 -Wall -W -fno-common -pipe -I${FINK_ROOT}/include")
+  Set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O -g -m64 -pipe -Wall -W -pipe -fbounds-check -fsigned-char -fno-common -fmessage-length=0 -Woverloaded-virtual -Weffc++ -Wshadow -fno-default-inline -fno-inline -I/usr/X11R6/include -I${FINK_ROOT}/include")
+  Set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} -O -g -m64 -Wall -W -fno-common -pipe -I${FINK_ROOT}/include")
 
   If(CMAKE_Fortran_COMPILER MATCHES g95) 
     Set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fbounds-check -ftrace=full -DFORTRAN_G95")
-    Execute_process(COMMAND g95 --print-search-dirs 
-      OUTPUT_VARIABLE _out)
-    String(REGEX REPLACE "^.*install: *([^\n]*)/\n.*$" "\\1" _libdir ${_out})
-    Set(ROOT_LIBRARIES "${ROOT_LIBRARIES} -L${_libdir} -lf95")
   Else(CMAKE_Fortran_COMPILER MATCHES g95)
     Set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -DFORTRAN_GFORTRAN")
     Execute_process(
@@ -185,11 +274,9 @@ If(ALICE_TARGET STREQUAL macosx64)
     Set(ROOT_LIBRARIES "${ROOT_LIBRARIES} ${FLIB}")
   Endif(CMAKE_Fortran_COMPILER MATCHES g95) 
 
-  Set(LINK_FLAGS "${LINK_FLAGS} -m64")
-
 # I think this is useless
 #  Set(ALIROOT_LIBRARIES "${ROOT_LIBRARIES} -L/usr/X11R6/lib -lX11")
-  Set(ALIROOT_LIBRARIES "${ROOT_LIBRARIES}")
+  Set(ALIROOT_LIBRARIES "${ROOT_LIBRARIES} -L/usr/X11/lib")
 
 # Would like to use this, but did not manage on the Mac
 #Include(FindOpenGL)
@@ -198,8 +285,6 @@ If(ALICE_TARGET STREQUAL macosx64)
 # Poor man's version of the above
   Set(ALIROOT_INCLUDE_DIR ${ROOT_INCLUDE_DIR} /usr/X11/include)
 
-  Set(LINK_FLAGS "${LINK_FLAGS} -bind_at_load")
-
 # 
 # LD            = export MACOSX_DEPLOYMENT_TARGET=$(MACOSX_MAJOR).$(MACOSX_MINOR) ; \
 #              unset LD_PREBIND ; \
@@ -216,21 +301,17 @@ Endif(ALICE_TARGET STREQUAL macosx64)
 If(ALICE_TARGET STREQUAL linuxx8664gcc) 
 
 
-  Set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} -shared -Wl")
+  Set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} -O -g -shared -Wl")
 
-  Set(CMAKE_Fortran_FLAGS "-fno-second-underscore -m64")
+  Set(CMAKE_Fortran_FLAGS "-O -g -fno-second-underscore -m64")
 
   Set(CLIBDEFS "-DCERNLIB_LXIA64 -DCERNLIB_BLDLIB -DCERNLIB_CZ")
 
-  Set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -pipe -W -Wall -Weffc++ -Woverloaded-virtual -fmessage-length=0 -Wno-long-long -Dlinux -I/usr/X11R6/include")
-  Set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} -m64 -Wall -W -pipe")
+  Set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O -g -m64 -pipe -W -Wall -Weffc++ -Woverloaded-virtual -fmessage-length=0 -Wno-long-long -Dlinux -I/usr/X11R6/include")
+  Set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} -O -g -m64 -Wall -W -pipe")
 
   If(CMAKE_Fortran_COMPILER MATCHES g95) 
     Set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fbounds-check -ftrace=full -DFORTRAN_G95")
-    Execute_process(COMMAND g95 --print-search-dirs 
-      OUTPUT_VARIABLE _out)
-    String(REGEX REPLACE "^.*install: *([^\n]*)/\n.*$" "\\1" _libdir ${_out})
-    Set(ROOT_LIBRARIES "${ROOT_LIBRARIES} -L${_libdir} -lf95")
   Else(CMAKE_Fortran_COMPILER MATCHES g95)
     Set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -DFORTRAN_GFORTRAN")
     Execute_process(
@@ -245,16 +326,47 @@ If(ALICE_TARGET STREQUAL linuxx8664gcc)
     Set(ROOT_LIBRARIES "${ROOT_LIBRARIES} ${FLIB}")
   Endif(CMAKE_Fortran_COMPILER MATCHES g95) 
 
-  Set(LINK_FLAGS "${LINK_FLAGS} -m64")
-
   Set(ALIROOT_LIBRARIES "${ROOT_LIBRARIES}")
 
   Set(ALIROOT_INCLUDE_DIR ${ROOT_INCLUDE_DIR} /usr/X11/include)
 
-  Set(LINK_FLAGS "${LINK_FLAGS}")
-
 Endif(ALICE_TARGET STREQUAL linuxx8664gcc)
 
+# linux
+If(ALICE_TARGET STREQUAL linux) 
+
+
+  Set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} -O -g -shared -Wl")
+
+  Set(CMAKE_Fortran_FLAGS "-O -g -fno-second-underscore -m32")
+
+  Set(CLIBDEFS "-DCERNLIB_LINUX -DCERNLIB_BLDLIB -DCERNLIB_CZ")
+
+  Set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O -g -m32 -pipe -W -Wall -Weffc++ -Woverloaded-virtual -fmessage-length=0 -Wno-long-long -Dlinux -I/usr/X11R6/include")
+  Set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} -O -g -m32 -Wall -W -pipe")
+
+  If(CMAKE_Fortran_COMPILER MATCHES g95) 
+    Set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fbounds-check -ftrace=full -DFORTRAN_G95")
+  Else(CMAKE_Fortran_COMPILER MATCHES g95)
+    Set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -DFORTRAN_GFORTRAN")
+    Execute_process(
+      COMMAND gfortran -m32 -print-file-name=libgfortran.so
+      OUTPUT_VARIABLE FLIB
+      OUTPUT_STRIP_TRAILING_WHITESPACE)
+    Set(ROOT_LIBRARIES "${ROOT_LIBRARIES} ${FLIB}")
+    Execute_process(
+      COMMAND gfortran -m32 -print-file-name=libgfortranbegin.a
+      OUTPUT_VARIABLE FLIB
+      OUTPUT_STRIP_TRAILING_WHITESPACE)
+    Set(ROOT_LIBRARIES "${ROOT_LIBRARIES} ${FLIB}")
+  Endif(CMAKE_Fortran_COMPILER MATCHES g95) 
+
+  Set(ALIROOT_LIBRARIES "${ROOT_LIBRARIES}")
+
+  Set(ALIROOT_INCLUDE_DIR ${ROOT_INCLUDE_DIR} /usr/X11/include)
+
+Endif(ALICE_TARGET STREQUAL linux)
+
 # macosx
 If(ALICE_TARGET STREQUAL macosx) 
 
@@ -270,23 +382,19 @@ If(ALICE_TARGET STREQUAL macosx)
 
   Find_Package(fink)
   
-  Set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} -flat_namespace -single_module -undefined dynamic_lookup -m32")
+  Set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} -O -g -flat_namespace -single_module -undefined dynamic_lookup -m32")
 
-  Set(CMAKE_Fortran_FLAGS "-fno-second-underscore -m32")
+  Set(CMAKE_Fortran_FLAGS "-O -g -fno-second-underscore -m32")
 
   Set(CLIBDEFS "-DCERNLIB_LINUX -DCERNLIB_BLDLIB -DCERNLIB_CZ -DCERNLIB_PPC")
 
-  Set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32 -pipe -Wall -W -Wno-long-double -pipe -fbounds-check -fsigned-char -fno-common -fmessage-length=0 -Woverloaded-virtual -Weffc++ -Wconversion -Wshadow -fno-default-inline -fno-inline -I/usr/X11R6/include -I${FINK_ROOT}/include")
-  Set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} -m32 -Wall -W -fno-common -pipe -I${FINK_ROOT}/include")
+  Set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O -g -m32 -pipe -Wall -W -pipe -fbounds-check -fsigned-char -fno-common -fmessage-length=0 -Woverloaded-virtual -Weffc++ -Wconversion -Wshadow -fno-default-inline -fno-inline -I/usr/X11R6/include -I${FINK_ROOT}/include")
+  Set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} -O -g -m32 -Wall -W -fno-common -pipe -I${FINK_ROOT}/include")
 
   If(CMAKE_Fortran_COMPILER MATCHES g95) 
     Set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fbounds-check -ftrace=full -DFORTRAN_G95 -single_module")
-    Execute_process(COMMAND g95 --print-search-dirs 
-      OUTPUT_VARIABLE _out)
-    String(REGEX REPLACE "^.*install: *([^\n]*)/\n.*$" "\\1" _libdir ${_out})
-    Set(ROOT_LIBRARIES "${ROOT_LIBRARIES} -L${_libdir} -lf95")
   Else(CMAKE_Fortran_COMPILER MATCHES g95)
-    Set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -DFORTRAN_GFORTRAN")
+    Set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}  -single_module -DFORTRAN_GFORTRAN")
     Execute_process(
       COMMAND gfortran -m32 -print-file-name=libgfortran.dylib
       OUTPUT_VARIABLE FLIB
@@ -303,10 +411,28 @@ If(ALICE_TARGET STREQUAL macosx)
 
   Set(ALIROOT_INCLUDE_DIR ${ROOT_INCLUDE_DIR} /usr/X11/include)
 
-  Set(LINK_FLAGS "${LINK_FLAGS} -bind_at_load -single_module")
-
 Endif(ALICE_TARGET STREQUAL macosx)
 
+# solarisCC5
+If(ALICE_TARGET STREQUAL solarisCC5) 
+
+  Set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} -O -g")
+
+  Set(CLIBDEFS "-DCERNLIB_SUN -DCERNLIB_BLDLIB -DCERNLIB_CZ")
+
+  Set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O -g +w -KPIC -template=no%extdef")
+  Set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} -O -g -KPIC -erroff=%none")
+
+  Set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -O -g -KPIC -erroff=%none")
+
+  Set(ALIROOT_LIBRARIES "${ROOT_LIBRARIES}")
+
+  Set(ALIROOT_INCLUDE_DIR ${ROOT_INCLUDE_DIR} /usr/X11/include)
+
+  Set(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} -L/usr/dt/lib -L/usr/openwin/lib -L/usr/ccs/lib -lXm -lXt -lX11 -lm -lgen -ldl -lsocket -lsunmath -lfsu -lfui -lnsl")
+
+Endif(ALICE_TARGET STREQUAL solarisCC5)
+
 EndMacro (SetupSystem)
 
 # ../build/Makefile.alphacxx6
@@ -438,108 +564,6 @@ EndMacro (SetupSystem)
 # 
 # 
 # 
-# ../build/Makefile.linux
-# # -*- mode: makefile -*-
-# # Makefile to build AliRoot for Linux
-# 
-# # System dependent commands
-# 
-# XARGS = xargs -r
-# 
-# # The compilers
-# CXX           = g++ 
-# 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
-# 
-# CXXOPT        = $(OPT)
-# CXXNOOPT      = $(NOOPT)
-# COPT       = $(OPT)
-# FOPT       = $(OPT)
-# 
-# # CERNLIB defines
-# CLIBDEFS      = -DCERNLIB_LINUX -DCERNLIB_BLDLIB -DCERNLIB_CZ
-# CLIBCXXOPTS   =
-# CLIBCOPT      =
-# 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     = 
-# 
-# LD            = g++
-# LDFLAGS       = $(OPT) 
-# 
-# SHLD       = $(LD)
-# SOFLAGS       = $(OPT) -shared -Wl 
-# 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
-# 
-# 
-# 
-# 
-# 
-# 
 # ../build/Makefile.linuxalphagcc
 # # -*- mode: makefile -*-
 # # Makefile to build AliRoot for Linux on alpha