# Tracker flight analysis software # SOFTWARE VERSION VER= v7r05 DEBUG=0 # include ../Make.def ifeq ($(PAM_BIT),"-m32") MALIGN=-malign-double else MALIGN= endif 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= -malign-double -Wall -funroll-loops -Wno-globals -fvxt -fno-automatic -fbounds-check -extend_source -static -fno-backslash -fPIC ${PAM_BIT} #F77FLAGS= -malign-double -Wall -funroll-loops -Wno-globals -fvxt -fno-automatic -fbounds-check -extend_source -static -fno-backslash -fPIC ${PAM_BIT} export F77FLAGS= -O2 $(MALIGN) -Wall -funroll-loops $(EXTRAOPT) -fno-automatic -fbounds-check -extend_source -static -fno-backslash -fPIC ${PAM_BIT} #F77FLAGS= -malign-double -Wall -funroll-loops -Wno-globals -fvxt -fno-automatic -fbounds-check -extend_source -static -fno-backslash -fPIC ${PAM_BIT} #F77FLAGS= -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -extend_source -static -fno-backslash -fPIC ${PAM_BIT} #F77FLAGS= -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -extend_source -static -fno-backslash -fPIC ${PAM_BIT} ROOTCINT=rootcint # 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 #------------------------------------------------- FSRCS=${DIRSRC}/F77/fillpedsig.f \ ${DIRSRC}/F77/readallparam.f \ ${DIRSRC}/F77/functions.f \ ${DIRSRC}/F77/cncomp.f \ ${DIRSRC}/F77/filladc.f \ ${DIRSRC}/F77/reductionflight.f \ ${DIRSRC}/F77/functionspfa.f \ ${DIRSRC}/F77/mini.f \ ${DIRSRC}/F77/tricircle.f \ ${DIRSRC}/F77/analysissubroutines.f \ ${DIRSRC}/F77/analysisflight.f \ ${DIRSRC}/F77/readB.f \ ${DIRSRC}/F77/interB.f \ ${DIRSRC}/F77/track.f \ ${DIRSRC}/F77/grkuta.f \ ${DIRSRC}/F77/bdll.f \ ${DIRSRC}/F77/mini_ext.f FOBJS=$(FSRCS:${DIRSRC}/F77/%.f=${DIRLIB}/%.o) #------------------------------------------------- CSRCS= COBJS=$(CSRCS:${DIRSRC}%.cpp=${DIRLIB}/%.o) #------------------------------------------------- # librerie utilizzabili da root (ci deve essere anche il ***LinkDef.h ) LIBROOTSRCS=${DIRSRC}/TrkParams.cpp \ ${DIRSRC}/TrkLevel2.cpp \ ${DIRSRC}/TrkLevel1.cpp \ ${DIRSRC}/TrkLevel0.cpp \ ${DIRSRC}/TrkHough.cpp \ ${DIRSRC}/TrkCalib.cpp \ ${DIRSRC}/ExtTrack.cpp #LIBROOTSRCS= LIBROOTLIBS=$(LIBROOTSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so) LIBROOTOBJS=${DIRLIB}/readB.o \ ${DIRLIB}/interB.o \ ${DIRLIB}/track.o \ ${DIRLIB}/grkuta.o \ ${DIRLIB}/bdll.o \ ${DIRLIB}/functionspfa.o \ ${DIRLIB}/readallparam.o \ ${DIRLIB}/functions.o \ ${DIRLIB}/mini.o \ ${DIRLIB}/tricircle.o \ ${DIRLIB}/analysisflight.o \ ${DIRLIB}/analysissubroutines.o \ ${DIRLIB}/fillpedsig.o \ ${DIRLIB}/cncomp.o \ ${DIRLIB}/filladc.o \ ${DIRLIB}/reductionflight.o LIBROOTCLIBS= libTrkParams libTrkLevel2 libTrkLevel1 libTrkLevel0 libTrkHough libTrkCalib libExtTrack #LIBROOTCLIBS= FULLROOTCLIBS=$(LIBROOTCLIBS:%=${DIRLIB}/%_${VER}.so) #------------------------------------------------- # librerie C++ NON utilizzabili da root #LIBCPPSRCS= ${DIRSRC}/TrkLevel2.cpp \ # ${DIRSRC}/TrkLevel0.cpp LIBCPPSRCS=${DIRSRC}/TrkStruct.cpp \ ${DIRSRC}/TrkProcess.cpp \ ${DIRSRC}/TrkVerl2.cpp \ ${DIRSRC}/TrkCore.cpp \ ${DIRSRC}/ExtTrkingAlg.cpp \ # ${DIRSRC}/TrkLevel0.cpp LIBCPPLIBSTRK=$(LIBCPPSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so) #LIBCPPCLIBS=libTrkLevel2 libTrkLevel0 LIBCPPCLIBS= libTrkStruct libTrkProcess libTrkCore libTrkVerl2 libExtTrkingAlg #libTrkLevel0 FULLCPPCLIBS=$(LIBCPPCLIBS:%=${DIRLIB}/%_${VER}.so) #------------------------------------------------- # librerie F77 NON utilizzabili da root LIBF77SRCS= LIBF77OBJS= $(LIBF77SRCS:${DIRSRC}/F77/%.f=${DIRLIB}/%.o) LIBF77LIBS= $(LIBF77SRCS:${DIRSRC}/F77/%.f=${DIRLIB}/lib%_${VER}.so) LIBF77CLIBS= FULLF77CLIBS=$(LIBF77CLIBS:%=${DIRLIB}/%_${VER}.so) #------------------------------------------------- FULLLIBS=${FULLROOTCLIBS} ${FULLCPPCLIBS} ${FULLF77CLIBS} #------------------------------------------------- # eseguibile CXXEXESRCS=${DIRSRC}/TrackerLevel2.cpp CXXEXEOBJS=$(CXXEXESRCS:${DIRSRC}%.cpp=${DIRLIB}%.o) CXXEXELIBS:=TrackerLevel2 OTHERLIBS=${PAM_LIB}/libGLTables.so ${DIRLIB}/libRunInfo.so SUBDIR=../RunInfo SUBINC=$(shell for dir in `echo ${SUBDIR}`; do echo -I$${dir}/inc; done) #------------------------------------------------- # variabili per l'installazione EXESRCS=${DIRBIN}/TrackerLevel2 INCSRCS= \ ${DIRINC}/ExtTrack.h \ ${DIRINC}/ExtTrkingAlg.h \ ${DIRINC}/TrkLevel2.h \ ${DIRINC}/TrkLevel1.h \ ${DIRINC}/TrkLevel0.h \ ${DIRINC}/TrkHough.h \ ${DIRINC}/TrkCalib.h \ ${DIRINC}/TrkParams.h \ ${DIRINC}/TrkStruct.h \ ${DIRINC}/TrkProcess.h \ ${DIRINC}/TrkCore.h \ ${DIRINC}/TrkVerl2.h MACROSSRCS= CALIBFILES= DOCFILES= # Here the Variables used for info target PACKAGE=Tracker flight software EXECUTABLES=${EXESRCS} LIBS= ${FULLLIBS} ${OTHERLIBS} DOCS= SRCS= MACROS= ${MACROSSRCS} INCLUDE= ${INCSRCS} # TOBEDEL = junk ROOTINC=$$${shell root-config --incdir} NROOTINC=${shell root-config --incdir} # Let's start #all : test mkbindir mklibdir mkverpath ${LIBF77LIBS} ${LIBROOTLIBS} ${LIBCPPLIBS} ${FOBJS} ${COBJS} ${CXXEXELIBS} all : test mkbindir mklibdir mkverpath ${LIBF77LIBS} ${LIBROOTLIBS} ${LIBCPPLIBSTRK} 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 ${CXXEXELIBS} include ../Make.dect ${DIRLIB}/%.o : ${DIRSRC}/F77/%.f @(${EGREEN} "Creating tracker F77 object file: "${WHITE} "$@"; ${RESET}) @${F77} ${F77FLAGS} -c -o $@ ${DIRSRC}/F77/`basename ${@} .o`.f -I${DIRTOP}/${DIRINC}/F77 -I${NROOTINC} ${SUBINC} -I${PAM_YODA}/include/yoda -I${PAM_INC}/ ${LIBCPPLIBSTRK}: ${LIBSRCS} ${COBJS} ${FOBJS} # # create .o # @(${EGREEN} "Compiling CPP file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`.cpp"; ${RESET}) @${CXX} ${CXXFLAGS} -c ${DIRTOP}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`.cpp -o ${DIRTOP}/${DIRLIB}/`basename $(@F) _${VER}.so | sed s/lib//`.o -I${DIRTOP}/${DIRINC} -I${DIRTOP} ${SUBINC} -I${PAM_YODA}/include/yoda/ -I${PAM_INC}/ -I${NROOTINC} -I${DIRTOP}/../CalorimeterLevel2/inc -I${DIRTOP}/../ToFLevel2/inc -I${DIRTOP}/../TriggerLevel2/inc -I${DIRTOP}/../OrbitalInfo/inc # # create .so # @(${EGREEN} "Creating shared library: "${WHITE} "`basename $@`"; ${RESET}) @${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ $(LG2C) ${DIRTOP}/${DIRLIB}/`basename $(@F) _${VER}.so | sed s/lib//`.o ${FOBJS} ${COBJS} 1>/dev/null @ln -sf ${DIRTOP}/${DIRLIB}/$(@F) ${DIRTOP}/${DIRLIB}/$(patsubst %_${VER}.so,%.so,$(@F)) # 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} ${COBJS} ${CXXEXEOBJS} ${DIRSRC}/TrkVerl2.cpp clean: @${test_and_rm} distclean: clean distclean: TOBEDEL= ${DIRBIN} ${DIRLIB} distclean: @${test_and_rm} forceinstall: FORCE=-f forceinstall: install 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}/TrkVerl2.cpp; echo ' void info(){ printf("\nTracker Level2 flight package version: ${VER}\n\nCompiled on '${TODAY}' with: '${GCCVER}'\n\nOn: '${UNAMEA}'\n\n"); }' >> ${DIRTOP}/${DIRSRC}/TrkVerl2.cpp @echo '#include ' > ${DIRTOP}/${DIRSRC}/TrkVerl2.cpp; echo ' const char *TrkInfo(bool print){ if ( print ) printf("\nTracker Level2 flight package version: ${VER}\n\nCompiled on '${TODAY}' with: '${GCCVER}'\n\nOn: '${UNAMEA}'\n\n"); return("${VER}"); }' >> ${DIRTOP}/${DIRSRC}/TrkVerl2.cpp @sleep 0.8 info: @echo " " @${EGREEN} "Infos for package :" ${WHITE} ${PACKAGE} @${EGREEN} " VERSION :" ${WHITE} ${VER} @${EGREEN} " EXECUTABLES :" ${WHITE} ${EXECUTABLES} @${EGREEN} " INCLUDES :" ${WHITE} ${INCLUDE} @${EGREEN} " LIBS :" ${WHITE} ${LIBS} @${EGREEN} " DOCS :" ${WHITE} ${DOCS} @${EGREEN} " SRCS :" ${WHITE} ${SRCS} @${EGREEN} " MACROS :" ${WHITE} ${MACROS} @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