# Calorimeter flight analysis software # SOFTWARE VERSION VER= v7r09 # include ../Make.def # ifeq ($(GCC4),0) EXTRAOPT=-Wno-globals -fvxt else EXTRAOPT= endif #F77FLAGS= -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -g -extend_source -static -fno-backslash ${PAM_BIT} #F77FLAGS= -fforce-addr -funroll-all-loops -ffinite-math-only -Wall -funroll-loops -Wno-globals -fPIC -fvxt -fno-automatic -fbounds-check -extend_source -static -fno-backslash ${PAM_BIT} F77FLAGS= -O1 -fforce-addr -funroll-all-loops -ffinite-math-only -Wall -funroll-loops -fPIC $(EXTRAOPT) -fno-automatic -fbounds-check -extend_source -static -fno-backslash ${PAM_BIT} #F77FLAGS= -g -O1 -fforce-addr -funroll-all-loops -ffinite-math-only -Wall -funroll-loops -fPIC $(EXTRAOPT) -fno-automatic -fbounds-check -extend_source -static -fno-backslash ${PAM_BIT} #F77FLAGS= -g -fforce-addr -funroll-all-loops -ffinite-math-only -Wall -funroll-loops -Wno-globals -fPIC -fvxt -fno-automatic -fbounds-check -extend_source -static -fno-backslash ${PAM_BIT} #F77FLAGS= -Wall -Wno-globals -fPIC -fvxt -fno-automatic -fbounds-check -extend_source -static -fno-backslash ${PAM_BIT} # Here the variables definig the local directories DIRTOP=${shell pwd} DIRLIB=../lib/${ARCH} DIRBIN=../bin/${ARCH} #DIRLIB=lib/${ARCH} #DIRBIN=bin/${ARCH} DIRSRC=src DIRINC=inc DIRDOC=doc DIRMACROS=macros DIRCALIB=calib # Here the PAMELA environmental variables to be checked PAM_ENV= PAM_BIN_env PAM_LIB_env PAM_INC_env PAM_DOC_env PAM_YODA_env # Here the local variables used to build the targets # -- F77 - no libraries -- FSRCS=${DIRSRC}/direction.for \ ${DIRSRC}/lastriscia.for \ ${DIRSRC}/millim.for \ ${DIRSRC}/nshower.for \ ${DIRSRC}/nointer.for \ ${DIRSRC}/elio.for \ ${DIRSRC}/nuclei.for \ ${DIRSRC}/cluster.for \ ${DIRSRC}/cluster2.for \ ${DIRSRC}/cluster4.for \ ${DIRSRC}/laterale.for \ ${DIRSRC}/baric.for \ ${DIRSRC}/selftrig.for \ ${DIRSRC}/calol2cm.for \ ${DIRSRC}/calol2tr.for FOBJS=$(FSRCS:${DIRSRC}%.for=${DIRLIB}%.o) # -- CPP - no libraries -- CPPSRCS= CPPOBJS=$(CPPSRCS:${DIRSRC}%.cpp=${DIRLIB}%.o) # -- C - no libraries -- CSRCS=${DIRSRC}/delay.c COBJS=$(CSRCS:${DIRSRC}%.c=${DIRLIB}%.o) # -- CPP - ROOT libraries -- LIBROOTSRCS=${DIRSRC}/CaloLevel0.cpp \ ${DIRSRC}/CaloLevel1.cpp \ ${DIRSRC}/CaloLevel2.cpp LIBROOTLIBS=$(LIBROOTSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so) #LIBROOTOBJS=${DIRLIB}/millim.o LIBROOTOBJS=${FOBJS} ${COBJS} LIBROOTCLIBS=libCaloLevel2 libCaloLevel1 libCaloLevel0 FULLROOTCLIBS=$(LIBROOTCLIBS:%=${DIRLIB}/%_${VER}.so) # -- CPP - NON-ROOT libraries -- LIBCPPSRCS=${DIRSRC}/CaloCore.cpp \ ${DIRSRC}/CaloVerl2.cpp LIBCPPLIBS=$(LIBCPPSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so) LIBCPPCLIBS=libCaloCore libCaloVerl2 FULLLIBCPPLIBS=$(LIBCPPCLIBS:%=${DIRLIB}/%_${VER}.so) # -- CPP - Executables -- CXXEXESRCS=${DIRSRC}/CalorimeterLevel2.cpp CXXEXEOBJS=$(CXXEXESRCS:${DIRSRC}%.cpp=${DIRLIB}%.o) CXXEXELIBS:=CalorimeterLevel2 # -- list of tracker objects needed to link TRKOBJS=${DIRLIB}/libTrkLevel2.so ${PAM_LIB}/libGLTables.so ${DIRLIB}/libRunInfo.so # -- directory where to find tracker headers needed to compile SUBDIR=../RunInfo ../TrackerLevel2 SUBINC=$(shell for dir in `echo ${SUBDIR}`; do echo -I$${dir}/inc; done) # List of all libraries we want to install FULLLIBS = ${FULLROOTCLIBS} ${FULLLIBCPPLIBS} # Other objects to install EXESRCS=${DIRBIN}/CalorimeterLevel2 INCSRCS=${DIRINC}/CaloLevel0.h ${DIRINC}/CaloLevel1.h ${DIRINC}/CaloLevel2.h ${DIRINC}/CaloStruct.h ${DIRINC}/CaloCore.h ${DIRINC}/INTEST.TXT MACROSSRCS= CALIBFILES= DOCFILES= # Here the Variables used for info target PACKAGE=Calorimeter analysis flight software EXECUTABLES= ${EXESRCS} LIBS= ${FULLLIBS} DOCS= SRCS= #SRCS= ${FSRCS} ${CRSCS} ${CXXEXESRCS} ${LIBROOTSRCS} ${LIBCPPSRCS} MACROS= ${MACROSSRCS} INCLUDE= ${INCSRCS} # TOBEDEL = junk ROOTINC=$$${shell root-config --incdir} NROOTINC=${shell root-config --incdir} # Let's start #all: test mkbindir mklibdir mkverpath ${FOBJS} ${CPPOBJS} ${LIBROOTLIBS} ${LIBCPPLIBS} ${CXXEXELIBS} all: prepare libs all: # @echo -e ${GREEN} "" # @(${EGREEN} " Finished, now you can install the package \n (use: make install or make upgrade or make forceinstall) "; ${RESET}) @echo -e ${GREEN} "" @${RESET} standalone: all exe prepare: test mkbindir mklibdir mkverpath exe: prepare ${CXXEXELIBS} libs: prepare ${LIBROOTLIBS} ${LIBCPPLIBS} # include ../Make.dect # A small target to check environmental variables %_env: @${test_env} .PHONY: install installdoc installlib installmacros installinc installexe installcmacro .PHONY: clean depclean info mkbindir mklibdir testcern testpamenv test mkbindir: ${DIRBIN} ${DIRBIN}: @${test_and_mk} mklibdir: ${DIRLIB} ${DIRLIB}: @${test_and_mk} # Here what has to be deleted in clean target clean: TOBEDEL= ${DIRSRC}/*.o ${DIRSRC}/*Dict.cpp ${DIRSRC}/*Dict.h ${FOBJS} ${FULLLIBS} ${DIRBIN}/${CXXEXELIBS} ${CPPOBJS} ${CXXEXEOBJS} ${FULLLINKCLIBS} ${FULLMACROCLIBS} ${FULLLINKMACROCLIBS} ${DIRSRC}/CaloVerl2.cpp clean: @${test_and_rm} distclean: clean distclean: TOBEDEL= ${DIRBIN} ${DIRLIB} distclean: @${test_and_rm} forceinstall: FORCE=-f forceinstall: install forceinstallstandalone: FORCE=-f forceinstallstandalone: installstandalone upgrade: FORCE=-u upgrade: install upgradestandalone: FORCE=-u upgradestandalone: installstandalone install: installlib installinc installmacros installcalib installdoc installcmacro installstandalone: install installexe installlib: LINK=y installlib: TOBEMOVED= $(FULLLIBS:${DIRLIB}%=${PAM_LIB}%) installlib: ORIGIN=${DIRLIB} installlib: @${test_and_cp} installcmacro: LINK=y installcmacro: TOBEMOVED= $(FULLMACROCLIBS:${DIRLIB}%=${PAM_LIB}%) installcmacro: ORIGIN=${DIRLIB} installcmacro: @${test_and_cp} installinc: TOBEMOVED= $(INCSRCS:${DIRINC}/%=${PAM_INC}/%) installinc: ORIGIN=${DIRINC} installinc: @${test_and_cp} installexe: TOBEMOVED= $(EXESRCS:${DIRBIN}/%=${PAM_BIN}/%) installexe: ORIGIN=${DIRBIN} installexe: @${test_and_cp} installmacros: TOBEMOVED= $(MACROSSRCS:${DIRMACROS}/%=${PAM_MACROS}/%) installmacros: ORIGIN=${DIRMACROS} installmacros: @${test_and_cp} installcalib: TOBEMOVED= $(CALIBFILES:${DIRCALIB}/%=${PAM_CALIB}/%) installcalib: ORIGIN=${DIRCALIB} installcalib: @${test_and_cp} installdoc: TOBEMOVED= $(DOCFILES:${DIRDOC}/%=${PAM_DOC}/%) installdoc: ORIGIN=${DIRDOC} installdoc: @${test_and_cp} mkverpath: @echo '#include ' > ${DIRTOP}/${DIRSRC}/CaloVerl2.cpp; echo 'const char *CaloInfo(bool print){ if ( print ) printf("\nCalorimeter Level2 flight package version: ${VER}\n\nCompiled on '${TODAY}' with: '${GCCVER}'\n\nOn: '${UNAMEA}'\n\n"); return("${VER}"); }' >> ${DIRTOP}/${DIRSRC}/CaloVerl2.cpp @sleep 0.8 info: @echo " " @${EGREEN} "Infos for package :" ${WHITE} ${PACKAGE} @${EGREEN} " VERSION :" ${WHITE} ${VER} @${EGREEN} " EXECUTABLES :" ${WHITE} ${EXECUTABLES} @${EGREEN} " LIBS :" ${WHITE} ${LIBS} @${EGREEN} " DOCS :" ${WHITE} ${DOCS} @${EGREEN} " SRCS :" ${WHITE} ${SRCS} @${EGREEN} " MACROS :" ${WHITE} ${MACROS} @${EGREEN} " INCLUDE :" ${WHITE} ${INCLUDE} @echo " " @${RESET} test: testpamenv testpamenv: ${PAM_ENV} root-config: OPT=--cflags root-config: @${test_cmd} # Here follows some usefull macros define test_and_cp wd=`pwd`;\ for i in ${TOBEMOVED} ; do \ wv=$${i##/*/}; \ dest=$${i/$${wv}/}; \ ${EGREEN} "Testing for :" ${WHITE} "$${i}" ; ${RESET}; \ if [ ! "${FORCE}" ] ; then \ if [ ! -f $${i} ]; then \ ${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\ ${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \ cp ${ORIGIN}/$${i##/*/} $${i}; \ else \ ${ERED} "File already exist !!!! Please delete it " ${WHITE}; ${RESET}; \ fi;\ else \ if [ "${FORCE}" == "-u" ] ; then \ if [ "`basename $${i}`" != "`basename $${i} _${VER}.so`" ]; then \ ${EYELLOW} "Removing: "${WHITE} ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so; ${RESET}; \ rm -f ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so ; \ ${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\ ${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \ cp ${ORIGIN}/$${i##/*/} $${i}; \ else \ ${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\ ${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \ cp -f ${ORIGIN}/$${i##/*/} $${i}; \ fi; \ else \ ${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\ ${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \ cp ${FORCE} ${ORIGIN}/$${i##/*/} $${i}; \ fi;\ fi ;\ if [ ! -z ${LINK} ] ; then \ ${EGREEN} "Creating symlink from : "${WHITE} $${wv/_${VER}/} ;\ ${EGREEN} " to : "${WHITE} $${i##/*/} ; ${RESET}; \ cd $${dest}; \ ln -sf $${wv} $${wv/_${VER}/}; \ cd $${wd}; \ fi \ done endef define test_and_mk ${EGREEN} "Testing for :" ${WHITE} "$@"; ${RESET} test -d "$@" || \ (${EGREEN} "Creating : "${WHITE} "$@"; ${RESET}; mkdir -p $@) endef define test_env ${EGREEN} "Testing for env:" ${WHITE} $(patsubst %_env,%,$@); ${RESET} printenv $(patsubst %_env,%,$@) 1>/dev/null || \ (${ERED} "ERROR, variable : "${WHITE} $(patsubst %_env,%,$@) \ ${RED} "not defined !!! Check your env. settings"; \ ${RESET}; exit 1) ${EGREEN} " Defined:" ${WHITE} $${$(patsubst %_env,%,$@)}; ${RESET} endef define test_cmd ${EGREEN} "Testing for cmd:" ${WHITE} $@ ${OPT}; ${RESET} $@ ${OPT} 1>/dev/null 2>&1 || \ (${ERED} "ERROR, command : "${WHITE} $@ ${OPT}\ ${RED} "not found !!! Check your installation"; \ ${RESET}; exit 1) ${EGREEN} " Present:" ${WHITE} $@ ${OPT}; ${RESET} endef define test_and_rm for i in ${TOBEDEL}; do \ test -d $${i} || (${ERED} "Removing file :"${WHITE} $${i}; ${RESET}; \ rm -f $${i} ); \ test ! -d $${i} || (${ERED} "Removing dir :"${WHITE} $${i}; ${RESET}; \ rm -rf $${i} ); \ done endef