# An almost general purpouse Makefile for PAMELA repository
# Let's start with some usefull definition for colorize the echo 
export RED='\E[1;31;40m'
export GREEN='\E[1;32;40m'
export YELLOW='\E[1;33;40m'
export BLUE='\E[1;34;40m'
export WHITE='\E[1;37;40m'
export VIOLET='\E[1;35;40m'
export CYAN='\E[1;36;40m'
# Here the echo definition to use them
export EVIOLET=echo -e ${VIOLET}
export ECYAN=echo -e ${CYAN}
export ERED=echo -e ${RED}
export EGREEN=echo -e ${GREEN}
export EYELLOW=echo -e ${YELLOW}
export EBLUE=echo -e ${BLUE}
export EWHITE=echo -e ${WHITE}
# Reset the terminal
export RESET=tput sgr0
# Enviroment:
export GCCVER=`gcc --version | head -1`
export UNAMEA=`uname -a`
export TODAY=`date`
#
ifeq ($(GCC4),)
export GCCVERS=$(shell echo `gcc -dumpversion | sed 's/\./\ /g'`)
export GCCVERMAJ=$(word 1,$(GCCVERS))
export GCC4=$(shell echo `echo "${GCCVERMAJ} > 3" |bc -l`)
endif
#
# Here the variables used to override the standard make flags
# C
export CC=gcc
#CFLAGS=-Wall -O -fPIC -pthread -g ${PAM_BIT} 
export CFLAGS=-Wall -O3 -funroll-loops -fPIC -pthread ${PAM_BIT} 
# F77
ifeq ($(GCC4),1)
export F77=gfortran
export LG2C=-lgfortran
export EXTRAOPT=
else
export F77=g77
export LG2C=-lg2c
export EXTRAOPT=-Wno-globals -fvxt
endif
#F77FLAGS=  -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -g -extend_source -static -fno-backslash ${PAM_BIT} 
export F77FLAGS=  -Wall -funroll-loops -fPIC $(EXTRAOPT) -fno-automatic -fbounds-check -extend_source -static -fno-backslash ${PAM_BIT} 
# C++
export CXX=g++
export CXXFLAGS=-Wall -O -fPIC -pthread -g ${PAM_BIT} 
#export CXXFLAGS=-Wall -O3 -funroll-loops -fPIC -pthread ${PAM_BIT} 
# ROOTCINT
export ROOTCINT=rootcint

