| 1 | 
 # Tracker flight analysis software  | 
 # Tracker flight analysis software  | 
| 2 | 
 # SOFTWARE VERSION | 
 # SOFTWARE VERSION | 
| 3 | 
 VER= v2r01 | 
 VER= v6r02 | 
| 4 | 
 DEBUG=0 | 
 DEBUG=0 | 
| 5 | 
 # An almost general purpouse Makefile for PAMELA repository | 
 # An almost general purpouse Makefile for PAMELA repository | 
| 6 | 
 # Let's start with some usefull definition for colorize the echo  | 
 # Let's start with some usefull definition for colorize the echo  | 
| 24 | 
 # Here the variables used to override the standard make flags | 
 # Here the variables used to override the standard make flags | 
| 25 | 
 # C | 
 # C | 
| 26 | 
 CC=gcc | 
 CC=gcc | 
| 27 | 
 #CFLAGS=-Wall -O -fPIC -pthread -g | 
 #CFLAGS=-Wall -O -fPIC -pthread -g ${PAM_BIT}  | 
| 28 | 
 CFLAGS=-Wall -O -fPIC -pthread | 
 #CFLAGS=-Wall -O -fPIC -pthread ${PAM_BIT}  | 
| 29 | 
  | 
 CFLAGS=-Wall -O3 -funroll-loops -fPIC -pthread ${PAM_BIT}  | 
| 30 | 
  | 
 #CFLAGS=-Wall -fPIC -pthread ${PAM_BIT}  | 
| 31 | 
 # Enviroment: | 
 # Enviroment: | 
| 32 | 
 GCCVER=`gcc --version | head -1` | 
 GCCVER=`gcc --version | head -1` | 
| 33 | 
 UNAMEA=`uname -a` | 
 UNAMEA=`uname -a` | 
| 34 | 
 TODAY=`date` | 
 TODAY=`date` | 
| 35 | 
  | 
 # | 
| 36 | 
  | 
 ifeq ($(PAM_BIT),"-m32") | 
| 37 | 
  | 
         MALIGN=-malign-double | 
| 38 | 
  | 
 else | 
| 39 | 
  | 
         MALIGN= | 
| 40 | 
  | 
 endif | 
| 41 | 
 # F77 | 
 # F77 | 
| 42 | 
 F77=g77 | 
 F77=g77 | 
| 43 | 
 #F77FLAGS=  -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -g -extend_source -static -fno-backslash  | 
 #F77FLAGS=  -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -g -extend_source -static -fno-backslash  ${PAM_BIT}  | 
| 44 | 
 F77FLAGS=  -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -extend_source -static -fno-backslash -fPIC | 
 #F77FLAGS=  -malign-double -Wall -funroll-loops -Wno-globals -fvxt -fno-automatic -fbounds-check -extend_source -static -fno-backslash -fPIC ${PAM_BIT}  | 
| 45 | 
  | 
 #F77FLAGS=  -malign-double -Wall -funroll-loops -Wno-globals -fvxt -fno-automatic -fbounds-check -extend_source -static -fno-backslash -fPIC ${PAM_BIT}  | 
| 46 | 
  | 
 F77FLAGS=  -O2 $(MALIGN) -Wall -funroll-loops -Wno-globals -fvxt -fno-automatic -fbounds-check -extend_source -static -fno-backslash -fPIC ${PAM_BIT}  | 
| 47 | 
  | 
 #F77FLAGS=  -malign-double -Wall -funroll-loops -Wno-globals -fvxt -fno-automatic -fbounds-check -extend_source -static -fno-backslash -fPIC ${PAM_BIT}  | 
| 48 | 
  | 
 #F77FLAGS=   -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -extend_source -static -fno-backslash -fPIC ${PAM_BIT}  | 
| 49 | 
  | 
 #F77FLAGS=  -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -extend_source -static -fno-backslash -fPIC ${PAM_BIT}  | 
| 50 | 
 # C++ | 
 # C++ | 
| 51 | 
 CXX=g++ | 
 CXX=g++ | 
| 52 | 
 #CXXFLAGS=-Wall -O -fPIC -pthread -g -D'DEBUG=${DEBUG}'  | 
 #CXXFLAGS=-Wall -O -fPIC -pthread -g -D'DEBUG=${DEBUG}' ${PAM_BIT}  | 
| 53 | 
 #CXXFLAGS=-Wall -O -fPIC -pthread -g -D'DEBUG=0' | 
 #CXXFLAGS=-Wall -O -fPIC -pthread -g -D'DEBUG=0' ${PAM_BIT}  | 
| 54 | 
 #CXXFLAGS=-Wall -O -fPIC -pthread -fpermissive | 
 #CXXFLAGS=-Wall -O -fPIC -pthread -fpermissive ${PAM_BIT}  | 
| 55 | 
 CXXFLAGS=-Wall -O -fPIC -pthread | 
 #CXXFLAGS=-Wall -O4 -fPIC -pthread ${PAM_BIT}  | 
| 56 | 
  | 
 CXXFLAGS=-Wall -O3 -funroll-loops -fPIC -pthread ${PAM_BIT}  | 
| 57 | 
  | 
 #CXXFLAGS=-Wall -fPIC -pthread ${PAM_BIT}  | 
| 58 | 
 # ROOTCINT | 
 # ROOTCINT | 
| 59 | 
 ROOTCINT=rootcint | 
 ROOTCINT=rootcint | 
| 60 | 
 # Here the variables definig the local directories | 
 # Here the variables definig the local directories | 
| 86 | 
         ${DIRSRC}/F77/readB.f \ | 
         ${DIRSRC}/F77/readB.f \ | 
| 87 | 
         ${DIRSRC}/F77/interB.f \ | 
         ${DIRSRC}/F77/interB.f \ | 
| 88 | 
         ${DIRSRC}/F77/track.f \ | 
         ${DIRSRC}/F77/track.f \ | 
| 89 | 
         ${DIRSRC}/F77/grkuta.f  | 
         ${DIRSRC}/F77/grkuta.f \ | 
| 90 | 
  | 
         ${DIRSRC}/F77/bdll.f      # ***PP*** | 
| 91 | 
  | 
  | 
| 92 | 
 FOBJS=$(FSRCS:${DIRSRC}/F77/%.f=${DIRLIB}/%.o)  | 
 FOBJS=$(FSRCS:${DIRSRC}/F77/%.f=${DIRLIB}/%.o)  | 
| 93 | 
 #------------------------------------------------- | 
 #------------------------------------------------- | 
| 95 | 
 COBJS=$(CSRCS:${DIRSRC}%.cpp=${DIRLIB}/%.o) | 
 COBJS=$(CSRCS:${DIRSRC}%.cpp=${DIRLIB}/%.o) | 
| 96 | 
 #------------------------------------------------- | 
 #------------------------------------------------- | 
| 97 | 
 # librerie utilizzabili da root (ci deve essere anche il ***LinkDef.h ) | 
 # librerie utilizzabili da root (ci deve essere anche il ***LinkDef.h ) | 
| 98 | 
 LIBROOTSRCS=    ${DIRSRC}/TrkLevel2.cpp  \ | 
 LIBROOTSRCS=${DIRSRC}/TrkParams.cpp \ | 
| 99 | 
                 ${DIRSRC}/TrkLevel1.cpp \ | 
         ${DIRSRC}/TrkLevel2.cpp  \ | 
| 100 | 
                 ${DIRSRC}/TrkHough.cpp \ | 
         ${DIRSRC}/TrkLevel1.cpp \ | 
| 101 | 
                 ${DIRSRC}/TrkCalib.cpp  | 
         ${DIRSRC}/TrkLevel0.cpp \ | 
| 102 | 
  | 
         ${DIRSRC}/TrkHough.cpp \ | 
| 103 | 
  | 
         ${DIRSRC}/TrkCalib.cpp  | 
| 104 | 
  | 
  | 
| 105 | 
 #LIBROOTSRCS=    | 
 #LIBROOTSRCS=    | 
| 106 | 
 LIBROOTLIBS=$(LIBROOTSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so) | 
 LIBROOTLIBS=$(LIBROOTSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so) | 
| 107 | 
 LIBROOTOBJS=${DIRLIB}/readB.o ${DIRLIB}/interB.o ${DIRLIB}/track.o ${DIRLIB}/grkuta.o ${DIRLIB}/functionspfa.o ${DIRLIB}/readallparam.o ${DIRLIB}/functions.o ${DIRLIB}/mini.o ${DIRLIB}/tricircle.o | 
 LIBROOTOBJS=${DIRLIB}/readB.o \ | 
| 108 | 
 LIBROOTCLIBS=libTrkLevel2 libTrkLevel1 libTrkHough libTrkCalib | 
         ${DIRLIB}/interB.o \ | 
| 109 | 
  | 
         ${DIRLIB}/track.o \ | 
| 110 | 
  | 
         ${DIRLIB}/grkuta.o \ | 
| 111 | 
  | 
         ${DIRLIB}/bdll.o \ | 
| 112 | 
  | 
         ${DIRLIB}/functionspfa.o \ | 
| 113 | 
  | 
         ${DIRLIB}/readallparam.o \ | 
| 114 | 
  | 
         ${DIRLIB}/functions.o  \ | 
| 115 | 
  | 
         ${DIRLIB}/mini.o  \ | 
| 116 | 
  | 
         ${DIRLIB}/tricircle.o  \ | 
| 117 | 
  | 
         ${DIRLIB}/analysisflight.o  \ | 
| 118 | 
  | 
         ${DIRLIB}/analysissubroutines.o  \ | 
| 119 | 
  | 
         ${DIRLIB}/fillpedsig.o  \ | 
| 120 | 
  | 
         ${DIRLIB}/cncomp.o  \ | 
| 121 | 
  | 
         ${DIRLIB}/filladc.o  \ | 
| 122 | 
  | 
         ${DIRLIB}/reductionflight.o | 
| 123 | 
  | 
 LIBROOTCLIBS= libTrkParams libTrkLevel2 libTrkLevel1 libTrkLevel0 libTrkHough libTrkCalib  | 
| 124 | 
  | 
  | 
| 125 | 
 #LIBROOTCLIBS=  | 
 #LIBROOTCLIBS=  | 
| 126 | 
 FULLROOTCLIBS=$(LIBROOTCLIBS:%=${DIRLIB}/%_${VER}.so) | 
 FULLROOTCLIBS=$(LIBROOTCLIBS:%=${DIRLIB}/%_${VER}.so) | 
| 128 | 
 # librerie C++ NON utilizzabili da root | 
 # librerie C++ NON utilizzabili da root | 
| 129 | 
 #LIBCPPSRCS=  ${DIRSRC}/TrkLevel2.cpp \ | 
 #LIBCPPSRCS=  ${DIRSRC}/TrkLevel2.cpp \ | 
| 130 | 
 #               ${DIRSRC}/TrkLevel0.cpp  | 
 #               ${DIRSRC}/TrkLevel0.cpp  | 
| 131 | 
 LIBCPPSRCS=${DIRSRC}/TrkLevel0.cpp \ | 
 LIBCPPSRCS=${DIRSRC}/TrkStruct.cpp \ | 
 | 
            ${DIRSRC}/TrkStruct.cpp \ | 
  | 
| 132 | 
            ${DIRSRC}/TrkProcess.cpp \ | 
            ${DIRSRC}/TrkProcess.cpp \ | 
| 133 | 
            ${DIRSRC}/TrkVerl2.cpp \ | 
            ${DIRSRC}/TrkVerl2.cpp \ | 
| 134 | 
            ${DIRSRC}/TrkCore.cpp   | 
            ${DIRSRC}/TrkCore.cpp \ | 
| 135 | 
  | 
 #          ${DIRSRC}/TrkLevel0.cpp | 
| 136 | 
  | 
   | 
| 137 | 
 LIBCPPLIBS=$(LIBCPPSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so) | 
 LIBCPPLIBS=$(LIBCPPSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so) | 
| 138 | 
 #LIBCPPCLIBS=libTrkLevel2 libTrkLevel0  | 
 #LIBCPPCLIBS=libTrkLevel2 libTrkLevel0  | 
| 139 | 
 LIBCPPCLIBS=libTrkLevel0 libTrkStruct libTrkProcess libTrkCore libTrkVerl2 | 
 LIBCPPCLIBS= libTrkStruct libTrkProcess libTrkCore libTrkVerl2 #libTrkLevel0 | 
| 140 | 
 FULLCPPCLIBS=$(LIBCPPCLIBS:%=${DIRLIB}/%_${VER}.so) | 
 FULLCPPCLIBS=$(LIBCPPCLIBS:%=${DIRLIB}/%_${VER}.so) | 
| 141 | 
 #------------------------------------------------- | 
 #------------------------------------------------- | 
| 142 | 
 # librerie F77 NON utilizzabili da root | 
 # librerie F77 NON utilizzabili da root | 
| 154 | 
 CXXEXEOBJS=$(CXXEXESRCS:${DIRSRC}%.cpp=${DIRLIB}%.o) | 
 CXXEXEOBJS=$(CXXEXESRCS:${DIRSRC}%.cpp=${DIRLIB}%.o) | 
| 155 | 
 CXXEXELIBS:=TrackerLevel2 | 
 CXXEXELIBS:=TrackerLevel2 | 
| 156 | 
  | 
  | 
| 157 | 
 OTHERLIBS=${PAM_LIB}/libGLTables.so ${DIRLIB}/libRunInfo.so | 
 OTHERLIBS=${PAM_LIB}/libGLTables.so ${DIRLIB}/libRunInfo.so  | 
| 158 | 
 SUBDIR=../RunInfo  | 
 SUBDIR=../RunInfo  | 
| 159 | 
 SUBINC=$(shell for dir in `echo ${SUBDIR}`; do echo -I$${dir}/inc; done) | 
 SUBINC=$(shell for dir in `echo ${SUBDIR}`; do echo -I$${dir}/inc; done) | 
| 160 | 
  | 
  | 
| 167 | 
         ${DIRINC}/TrkLevel0.h \ | 
         ${DIRINC}/TrkLevel0.h \ | 
| 168 | 
         ${DIRINC}/TrkHough.h \ | 
         ${DIRINC}/TrkHough.h \ | 
| 169 | 
         ${DIRINC}/TrkCalib.h \ | 
         ${DIRINC}/TrkCalib.h \ | 
| 170 | 
  | 
         ${DIRINC}/TrkParams.h \ | 
| 171 | 
         ${DIRINC}/TrkStruct.h \ | 
         ${DIRINC}/TrkStruct.h \ | 
| 172 | 
         ${DIRINC}/TrkProcess.h \ | 
         ${DIRINC}/TrkProcess.h \ | 
| 173 | 
         ${DIRINC}/TrkCore.h \ | 
         ${DIRINC}/TrkCore.h \ | 
| 211 | 
  | 
  | 
| 212 | 
 # .so from .o fortran | 
 # .so from .o fortran | 
| 213 | 
 ${LIBF77LIBS}: ${LIBF77OBJS} | 
 ${LIBF77LIBS}: ${LIBF77OBJS} | 
| 214 | 
         @(${EYELLOW} " F77 shared library --------------------------") | 
 #       @(${EYELLOW} " F77 shared library --------------------------") | 
| 215 | 
         @(${EGREEN} "Creating library: "${WHITE} "$@"; ${RESET}) | 
         @(${EGREEN} "Creating library: "${WHITE} "$@"; ${RESET}) | 
| 216 | 
 #       @${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ $^ `cernlib mathlib` /usr/lib/libg2c.so.0 | 
 #       @${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ $^ `cernlib mathlib` /usr/lib/libg2c.so.0 | 
| 217 | 
 ##      @${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ -lg2c $^ `cernlib mathlib`  | 
 ##      @${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ -lg2c $^ `cernlib mathlib`  | 
| 218 | 
         @${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ -lg2c $^  | 
         @${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ -lg2c $^  | 
| 219 | 
  | 
  | 
| 220 | 
 ${LIBROOTLIBS}: ${LIBROOTSRCS} ${FOBJS} | 
 ${LIBROOTLIBS}: ${LIBROOTSRCS} ${FOBJS} | 
| 221 | 
         @(${EYELLOW} " ROOT library ------------------------") | 
 #       @(${EYELLOW} " ROOT library ------------------------") | 
| 222 | 
         @(${EGREEN} "Creating file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp"; ${RESET}) | 
         @(${EGREEN} "Creating file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp"; ${RESET}) | 
| 223 | 
 # | 
 # | 
| 224 | 
 #       Create *Dict.cpp and *Dict.h | 
 #       Create *Dict.cpp and *Dict.h | 
| 225 | 
 # | 
 # | 
| 226 | 
         @${ROOTCINT} -f ${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp -c -I${ROOTINC} -I${PAM_YODA}/include/yoda/ -I${PAM_INC}/ ${DIRINC}/`basename $(@F) _${VER}.so | sed s/lib//`.h ${DIRINC}/`basename $(@F) _${VER}.so | sed s/lib//`LinkDef.h | 
         @${ROOTCINT} -f ${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp -c -I${DIRINC} -I${ROOTINC} -I${PAM_YODA}/include/yoda/ -I${PAM_INC}/ ${DIRINC}/`basename $(@F) _${VER}.so | sed s/lib//`.h ${DIRINC}/`basename $(@F) _${VER}.so | sed s/lib//`LinkDef.h | 
| 227 | 
 # | 
 # | 
| 228 | 
 #       create .o  | 
 #       create .o  | 
| 229 | 
 # | 
 # | 
| 240 | 
         @${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ -lg2c -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_YODA}/include/yoda -I${PAM_INC} ${DIRTOP}/${DIRLIB}/`basename $(@F) _${VER}.so | sed s/lib//`.o ${DIRTOP}/${DIRLIB}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.o ${LIBROOTOBJS} 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}/${DIRLIB}/`basename $(@F) _${VER}.so | sed s/lib//`.o ${DIRTOP}/${DIRLIB}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.o ${LIBROOTOBJS} 1>/dev/null   | 
| 241 | 
 #       ${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ -lg2c -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_YODA}/include/yoda/ ${SUBINC} ${DIRTOP}/${DIRLIB}/`basename $(@F) _${VER}.so | sed s/lib//`.o ${DIRTOP}/${DIRLIB}/`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/ ${SUBINC} ${DIRTOP}/${DIRLIB}/`basename $(@F) _${VER}.so | sed s/lib//`.o ${DIRTOP}/${DIRLIB}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.o 1>/dev/null | 
| 242 | 
         @ln -sf  ${DIRTOP}/${DIRLIB}/$(@F) ${DIRTOP}/${DIRLIB}/$(patsubst %_${VER}.so,%.so,$(@F)) | 
         @ln -sf  ${DIRTOP}/${DIRLIB}/$(@F) ${DIRTOP}/${DIRLIB}/$(patsubst %_${VER}.so,%.so,$(@F)) | 
| 243 | 
         @(${EYELLOW} " -------------------------------------") | 
 #       @(${EYELLOW} " -------------------------------------") | 
| 244 | 
  | 
  | 
| 245 | 
 ${LIBCPPLIBS}: ${LIBCPPSRCS} | 
 ${LIBCPPLIBS}: ${LIBCPPSRCS} | 
| 246 | 
 # | 
 # |