--- DarthVader/Makefile 2006/11/07 17:12:40 1.19 +++ DarthVader/Makefile 2014/09/16 19:47:29 1.70 @@ -1,46 +1,12 @@ # DarthVader flight analysis software # SOFTWARE VERSION IS -VER= v2r00 -# An almost general purpouse Makefile for PAMELA repository -# Let's start with some usefull definition for colorize the echo -RED='\E[1;31;40m' -GREEN='\E[1;32;40m' -YELLOW='\E[1;33;40m' -BLUE='\E[1;34;40m' -WHITE='\E[1;37;40m' -VIOLET='\E[1;35;40m' -CYAN='\E[1;36;40m' -# Here the echo definition to use them -EVIOLET=echo -e ${VIOLET} -ECYAN=echo -e ${CYAN} -ERED=echo -e ${RED} -EGREEN=echo -e ${GREEN} -EYELLOW=echo -e ${YELLOW} -EBLUE=echo -e ${BLUE} -EWHITE=echo -e ${WHITE} -# Reset the terminal -RESET=tput sgr0 -# Here the variables used to override the standard make flags -#MAKE -MAKE=make -# C -CC=gcc -#CFLAGS=-Wall -O -fPIC -pthread -g -CFLAGS=-Wall -O -fPIC -pthread -# Enviroment: -GCCVER=`gcc --version | head -1` -UNAMEA=`uname -a` -TODAY=`date` -# F77 -F77=g77 -#F77FLAGS= -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -g -extend_source -static -fno-backslash -F77FLAGS= -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -extend_source -static -fno-backslash -# C++ -CXX=g++ -#CXXFLAGS=-Wall -O -fPIC -pthread -g -CXXFLAGS=-Wall -O -fPIC -pthread -# ROOTCINT -ROOTCINT=rootcint +VER= v10r18 +# +include Make.def +#CERNLIB +CERNLIB=./docs/cernlib_pam +#CERNLIB=cernlib + # Here the variables definig the local directories DIRTOP=${shell pwd} #DIRLIB=../lib/${ARCH} @@ -109,7 +75,7 @@ MACROSSRCS= -CALIBFILES=${DIRCALIB}/trk-param ${DIRCALIB}/cal-param ${DIRCALIB}/tof-param +CALIBFILES=${DIRCALIB}/trk-param ${DIRCALIB}/cal-param ${DIRCALIB}/tof-param ${DIRCALIB}/orb-param DOCFILES= @@ -133,10 +99,9 @@ #all: test mkbindir mklibdir mkverpath ${FOBJS} ${CPPOBJS} ${LIBROOTLIBS} ${LIBCPPLIBS} ${CXXEXELIBS} all: - @for dir in `echo ${SUBDIR}`; do \ - echo "Making all in $${dir}"; \ - (cd $${dir} && ${MAKE} all); \ - done; make locall + @for dir in `echo ${SUBDIR}`; do (${EBLUE} "Making all in $${dir}"; ${RESET}); (cd $${dir} &>/dev/null && ${MAKE} -s all); done +# @for dir in `echo ${SUBDIR}`; do (${EBLUE} "Making all in $${dir}"; ${RESET}); (cd $${dir} && ${MAKE} all); done + @make -s locall ; locall: prepare libs exe locall: @@ -187,7 +152,7 @@ # create .so # @(${EGREEN} "Creating shared library: "${WHITE} "`basename $@`"; ${RESET}) - @${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ -lg2c -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_YODA}/include/yoda/ -I${PAM_INC}/ ${DIRTOP}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`.o ${DIRTOP}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.o 1>/dev/null + @${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ $(LG2C) -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_YODA}/include/yoda/ -I${PAM_INC}/ ${DIRTOP}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`.o ${DIRTOP}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.o 1>/dev/null @ln -sf ${DIRTOP}/${DIRLIB}/$(@F) ${DIRTOP}/${DIRLIB}/$(patsubst %_${VER}.so,%.so,$(@F)) ${LIBCPPLIBS}: ${LIBSRCS} ${COBJS} ${FOBJS} @@ -200,13 +165,15 @@ # create .so # @(${EGREEN} "Creating shared library: "${WHITE} "`basename $@`"; ${RESET}) - @${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ -lg2c -I${DIRTOP}/${DIRINC} -I${DIRTOP} ${SUBINC} -I${PAM_YODA}/include/yoda/ -I${PAM_INC}/ ${DIRTOP}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`.o ${FOBJS} ${COBJS} 1>/dev/null + @${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ $(LG2C) -I${DIRTOP}/${DIRINC} -I${DIRTOP} ${SUBINC} -I${PAM_YODA}/include/yoda/ -I${PAM_INC}/ ${DIRTOP}/${DIRSRC}/`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)) ${CXXEXELIBS}: ${CPPOBJS} ${COBJS} ${CXXEXEOBJS} @(${EGREEN} "Creating exec file: "${WHITE} "$@"; ${RESET}) - @${CXX} ${CXXFLAGS} -o ${DIRBIN}/$@ ${DIRTOP}/${DIRLIB}/$@.o ${OBJS} ${PAM_LIB}/libGLTables.so ${PAM_LIB}/libsgp4.so ${PAM_YODA}/lib/libyoda.so ${PAM_LIB}/libshift.so -lThread `root-config --cflags --glibs` `cernlib_noshift mathlib` - @${CXX} ${CXXFLAGS} -Xlinker -soname=libDarthVader_${VER}.so -shared -o ${DIRTOP}/${DIRLIB}/libDarthVader_${VER}.so -lg2c ${DIRTOP}/${DIRLIB}/libAcLevel2.so ${DIRTOP}/${DIRLIB}/libCaloLevel2.so ${PAM_LIB}/libsgp4.so ${DIRTOP}/${DIRLIB}/libNDLevel2.so ${DIRTOP}/${DIRLIB}/libS4Level2.so ${DIRTOP}/${DIRLIB}/libToFLevel2.so ${DIRTOP}/${DIRLIB}/libTrigLevel2.so ${DIRTOP}/${DIRLIB}/libTrkLevel2.so ${DIRTOP}/${DIRLIB}/libTrkLevel1.so ${PAM_LIB}/libGLTables.so ${DIRTOP}/${DIRLIB}/libRunInfo.so ${DIRTOP}/${DIRLIB}/libOrbitalInfo.so + @${CXX} ${CXXFLAGS} -o ${DIRBIN}/$@ ${DIRTOP}/${DIRLIB}/$@.o ${OBJS} ${PAM_LIB}/libGLTables.so ${PAM_LIB}/libsgp4.so ${PAM_YODA}/lib/libyoda.so -lThread `root-config --cflags --glibs` `${CERNLIB} mathlib` + @(${EGREEN} "Creating libDarthVader.so library: "${WHITE} "libDarthVader_${VER}.so"; ${RESET}) + @${CXX} ${CXXFLAGS} -Xlinker -soname=libDarthVader_${VER}.so -shared -o ${DIRTOP}/${DIRLIB}/libDarthVader_${VER}.so $(LG2C) ${DIRTOP}/${DIRLIB}/libAcLevel2.so ${DIRTOP}/${DIRLIB}/libCaloLevel0.so ${DIRTOP}/${DIRLIB}/libCaloLevel1.so ${DIRTOP}/${DIRLIB}/libCaloLevel2.so ${PAM_LIB}/libsgp4.so ${DIRTOP}/${DIRLIB}/libNDLevel2.so ${DIRTOP}/${DIRLIB}/libS4Level2.so ${DIRTOP}/${DIRLIB}/libToFLevel2.so ${DIRTOP}/${DIRLIB}/libTrigLevel2.so ${DIRTOP}/${DIRLIB}/libTrkLevel2.so ${DIRTOP}/${DIRLIB}/libTrkLevel1.so ${DIRTOP}/${DIRLIB}/libTrkLevel0.so ${DIRTOP}/${DIRLIB}/libTrkHough.so ${DIRTOP}/${DIRLIB}/libTrkCalib.so ${DIRTOP}/${DIRLIB}/libTrkParams.so ${PAM_LIB}/libGLTables.so ${DIRTOP}/${DIRLIB}/libRunInfo.so ${DIRTOP}/${DIRLIB}/libOrbitalInfo.so ${DIRTOP}/${DIRLIB}/libOrientationInfo.so ${DIRTOP}/${DIRLIB}/libInclinationInfo.so ${DIRTOP}/${DIRLIB}/libExtTrkingAlg.so ${DIRTOP}/${DIRLIB}/libExtTrack.so `root-config --glibs` `${CERNLIB} mathlib` + # @${CXX} ${CXXFLAGS} -o ${DIRBIN}/$@ ${DIRTOP}/${DIRLIB}/$@.o ${OBJS} ${PAM_YODA}/lib/libyoda.so ${PAM_YODA}/lib/libutils.so -lThread `root-config --cflags --glibs` `cernlib mathlib` # A small target to check environmental variables @@ -227,9 +194,9 @@ # Here what has to be deleted in clean target clean: @for dir in `echo ${SUBDIR}`; do \ - echo "Making clean in $${dir}"; \ - (cd $${dir} && ${MAKE} clean); \ - done; make locclean + (${EBLUE} "Making clean in $${dir}"; ${RESET});\ + (cd $${dir} &>/dev/null && ${MAKE} -s clean); \ + done; make -s locclean locclean: TOBEDEL= ${DIRSRC}/*.o ${DIRSRC}/*Dict.cpp ${DIRSRC}/*Dict.h ${FOBJS} ${FULLLIBS} ${DIRBIN}/${CXXEXELIBS} ${CPPOBJS} ${CXXEXEOBJS} ${FULLLINKCLIBS} ${FULLMACROCLIBS} ${FULLLINKMACROCLIBS} ${DIRSRC}/DarthVaderVerl2.cpp locclean: @@ -237,9 +204,9 @@ distclean: @for dir in `echo ${SUBDIR}`; do \ - echo "Making distclean in $${dir}"; \ - (cd $${dir} && ${MAKE} distclean); \ - done; make locdistclean + (${EBLUE} "Making distclean in $${dir}"; ${RESET});\ + (cd $${dir} &>/dev/null && ${MAKE} -s distclean); \ + done; make -s locdistclean locdistclean: clean locdistclean: TOBEDEL= ${DIRBIN} ${DIRLIB} @@ -249,8 +216,8 @@ forceinstall: @for dir in `echo ${SUBDIR}`; do \ - echo "Making forceinstall in $${dir}"; \ - (cd $${dir} && ${MAKE} forceinstall); \ + (${EBLUE} "Making forceinstall in $${dir}"; ${RESET});\ + (cd $${dir} &>/dev/null && ${MAKE} -s forceinstall); \ done; make locforceinstall locforceinstall: FORCE=-f @@ -258,21 +225,32 @@ upgrade: @for dir in `echo ${SUBDIR}`; do \ - echo "Making upgrade in $${dir}"; \ - (cd $${dir} && ${MAKE} upgrade); \ - done; make locupgrade + (${EBLUE} "Making upgrade in $${dir}"; ${RESET});\ + (cd $${dir}&>/dev/null && ${MAKE} -s upgrade); \ + done; make -s locupgrade locupgrade: FORCE=-u locupgrade: locinstall +upgradenc: + @for dir in `echo ${SUBDIR}`; do \ + (${EBLUE} "Making upgradenc in $${dir}"; ${RESET});\ + (cd $${dir}&>/dev/null && ${MAKE} -s upgrade); \ + done; make -s locupgradenc + +locupgradenc: FORCE=-u +locupgradenc: locinstallnc + install: @for dir in `echo ${SUBDIR}`; do \ - echo "Making install in $${dir}"; \ - (cd $${dir} && ${MAKE} install); \ - done; make locinstall + (${EBLUE} "Making install in $${dir}"; ${RESET});\ + (cd $${dir} &>/dev/null && ${MAKE} -s install); \ + done; make -s locinstall locinstall: installlib installinc installmacros installcalib installdoc installexe installcmacro +locinstallnc: installlib installinc installmacros installdoc installexe installcmacro + installlib: LINK=y installlib: TOBEMOVED= $(FULLLIBS:${DIRLIB}%=${PAM_LIB}%) installlib: ORIGIN=${DIRLIB} @@ -311,7 +289,7 @@ @${test_and_cp} mkverpath: - @echo '#include ' > ${DIRTOP}/${DIRSRC}/DarthVaderVerl2.cpp; echo ' char *DarthVaderInfo(bool print){ if ( print ) printf("\nPAMELA Level2 flight package version: ${VER}\n\nCompiled on '${TODAY}' with: '${GCCVER}'\n\nOn: '${UNAMEA}'\n\n"); return("${VER}"); }' >> ${DIRTOP}/${DIRSRC}/DarthVaderVerl2.cpp + @echo '#include ' > ${DIRTOP}/${DIRSRC}/DarthVaderVerl2.cpp; echo 'const char *DarthVaderInfo(bool print){ if ( print ) printf("\nPAMELA Level2 flight package version: ${VER}\n\nCompiled on '${TODAY}' with: '${GCCVER}'\n\nOn: '${UNAMEA}'\n\n"); return("${VER}"); }' >> ${DIRTOP}/${DIRSRC}/DarthVaderVerl2.cpp @sleep 0.8 @@ -389,7 +367,13 @@ ${EYELLOW} " Copying directory: "${WHITE} ${ORIGIN}/$${i##/*/} ;\ ${EYELLOW} " to: "${WHITE} ${PAM_CALIB} ; ${RESET}; \ cp -rf ${ORIGIN}/$${i##/*/} ${PAM_CALIB}; \ -done +done; \ +${EYELLOW} " Extracting mask directories into: "${WHITE} ${PAM_CALIB}/trk-param ; ${RESET}; \ +cd ${PAM_CALIB}/trk-param/ ;\ +tar jxf mask_param.tar.bz2; \ +rm -rf mask_param.tar.bz2; \ +cd - &>/dev/null; \ +${EYELLOW} " done "; ${RESET} endef define test_and_mk