# emacs, this is a -*- Makefile -*-
#--------------------------------------------------------------------
# Set Platform type: LINUX or MAC_OSX
PLATFORM_TYPE := $(shell uname -s)

ifeq ($(PLATFORM_TYPE), Linux)
	DO_FPIC := -fpic
	SOFLAGS := -shared
else
	ifeq ($(PLATFORM_TYPE), Darwin)
		DO_FPIC := -fPIC
		SOFLAGS := -dynamiclib -undefined dynamic_lookup
	endif
endif

CXX           = g++ 
CXXFLAGS      =  -Wall -g -O3 $(DO_FPIC) -fno-strict-aliasing # in some cases, no flags produce faster code than -O ones !! 
LD            = g++
LDFLAGS       = -O3  $(DO_FPIC)

cppExtension := .cc         # File extension of source files
CPPFLAGS +=                 # List flags to pass to C/C++ preprocessor

OutPutOpt     = -o # keep whitespace after "-o"

ROOTCFLAGS   := $(shell root-config --cflags)
ROOTLDFLAGS  := $(shell root-config --ldflags)
ROOTLIBS     := $(shell root-config --libs)
ROOTGLIBS    := $(shell root-config --glibs)
ROOTAUXLIBS  := $(shell root-config --auxlibs)
HASTHREAD    := $(shell root-config --has-thread)

LDFLAGS += $(ROOTLDFLAGS)

## STDHEP options---------------------------------------
## Uncomment the following line to enable StdHEP input (needs g77,f77 or gfortran)
#DO_STDHEP = 1
## specify which fortran compiler to use (g77,f77 or gfortran)
#F77 = gfortran

## FastJet options ----------------------------------------
## By default, use fastjet version shipped with spartyjet.
## To use an external fast jet version, uncomment and
## edit the following line :
# FASTJETDIR = /path/to/installation/
# If your fastjet bin/ is in your path you can use:
#FASTJETDIR = $(shell fastjet-config --prefix)
## For example, at cern, on lxplus,  one can use :
## FASTJETDIR = /afs/cern.ch/sw/lcg/external/fastjet/2.3.4/slc4_ia32_gcc34/

## PYTHIA options------------------------------------------
## This requires ROOT to be compiled with pythia8/pythia6 enabled
## Can be done with: cd $ROOTSYS
##                   ./configure -enable-pythia8 --with-pythia8-incdir=<pythia8-incdir> 
##										--with-pythia8-libdir=<pythia8-libdir> --enable-pythia6 
##										--with-pythia6-libdir=<pythia6-libdir>
## then: make
#DO_PYTHIA = 1
#ROOTLIBS += -lEG -lEGPythia8 
#PYTHIA8DIR=/home/physics/software/pythia8/pythia8135
