--- eventviewer/flight/Makefile 2006/10/24 13:18:21 1.6 +++ eventviewer/flight/Makefile 2009/08/11 13:03:41 1.18 @@ -1,6 +1,6 @@ # Flight Event Viewer software # SOFTWARE VERSION -VER= v2r00 +VER= v4r00 # An almost general purpouse Makefile for PAMELA repository # Let's start with some usefull definition for colorize the echo RED='\E[1;31;40m' @@ -23,20 +23,32 @@ # Here the variables used to override the standard make flags # C CC=gcc -CFLAGS=-Wall -O -fPIC -pthread -g -#CFLAGS=-Wall -O -fPIC -pthread +#CFLAGS=-Wall -O -fPIC -pthread -g ${PAM_BIT} +CFLAGS=-Wall -O -fPIC -pthread ${PAM_BIT} # Enviroment: GCCVER=`gcc --version | head -1` UNAMEA=`uname -a` TODAY=`date` -# F77 +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 +ifeq ($(GCC4),1) +F77=gfortran +LG2C=-lgfortran +EXTRAOPT= +else 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 +LG2C=-lg2c +EXTRAOPT=-Wno-globals -fvxt +endif +#F77FLAGS= -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -g -extend_source -static -fno-backslash ${PAM_BIT} +F77FLAGS= -Wall -funroll-loops -fPIC $(EXTRAOPT) -fno-automatic -fbounds-check -extend_source -static -fno-backslash ${PAM_BIT} # C++ CXX=g++ -CXXFLAGS=-Wall -O -fPIC -pthread -g -#CXXFLAGS=-Wall -O -fPIC -pthread +#CXXFLAGS=-Wall -O -fPIC -pthread -g ${PAM_BIT} +CXXFLAGS=-Wall -O -fPIC -pthread ${PAM_BIT} # ROOTCINT ROOTCINT=rootcint # Here the variables definig the local directories @@ -73,9 +85,10 @@ FULLROOTCLIBS=$(LIBROOTCLIBS:%=${DIRLIB}/%_${VER}.so) # -- CPP - NON-ROOT libraries -- -LIBCPPSRCS=${DIRSRC}/FEVdetector.cpp +LIBCPPSRCS=${DIRSRC}/color.cpp \ + ${DIRSRC}/FEVdetector.cpp LIBCPPLIBS=$(LIBCPPSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so) -LIBCPPCLIBS=libFEVdetector +LIBCPPCLIBS=libcolor libFEVdetector FULLLIBCPPLIBS=$(LIBCPPCLIBS:%=${DIRLIB}/%_${VER}.so) # -- CPP - Executables -- @@ -84,7 +97,8 @@ CXXEXELIBS:=FEventViewer # -- list of tracker objects needed to link -TRKOBJS=${PAM_LIB}/libTrkLevel2.so ${PAM_LIB}/libTrkLevel1.so ${PAM_LIB}/libGLTables.so ${PAM_LIB}/libRunInfo.so ${PAM_LIB}/libNDLevel2.so ${PAM_LIB}/libAcLevel2.so ${PAM_LIB}/libToFLevel2.so ${PAM_LIB}/libS4Level2.so ${PAM_LIB}/libCaloLevel2.so ${PAM_LIB}/libOrbitalInfo.so ${PAM_LIB}/libTrigLevel2.so +TRKOBJS=${PAM_LIB}/libDarthVader.so ${PAM_LIB}/libGLTables.so ${PAM_LIB}/libsgp4.so +#${PAM_LIB}/libTrkLevel2.so ${PAM_LIB}/libTrkLevel1.so ${PAM_LIB}/libGLTables.so ${PAM_LIB}/libRunInfo.so ${PAM_LIB}/libNDLevel2.so ${PAM_LIB}/libAcLevel2.so ${PAM_LIB}/libToFLevel2.so ${PAM_LIB}/libS4Level2.so ${PAM_LIB}/libCaloLevel2.so ${PAM_LIB}/libOrbitalInfo.so ${PAM_LIB}/libTrigLevel2.so # -- directory where to find tracker headers needed to compile SUBDIR= SUBINC=-I${PAM_INC} @@ -96,7 +110,7 @@ # Other objects to install EXESRCS=${DIRBIN}/FEventViewer -INCSRCS=${DIRINC}/FEventViewer.h ${DIRINC}/FEVpamevcontrol.h ${DIRINC}/FEVpathtoc.h ${DIRINC}/feventvstruct.h +INCSRCS=${DIRINC}/FEventViewer.h ${DIRINC}/FEVpamevcontrol.h ${DIRINC}/FEVpathtoc.h ${DIRINC}/feventvstruct.h ${DIRINC}/color.h MACROSSRCS= @@ -162,10 +176,10 @@ # 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_YODA}/include/utils/ ${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/ -I${PAM_YODA}/include/utils/ ${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 @ln -sf ${DIRTOP}/${DIRLIB}/$(@F) ${DIRTOP}/${DIRLIB}/$(patsubst %_${VER}.so,%.so,$(@F)) -${LIBCPPLIBS}: ${LIBSRCS} ${COBJS} ${FOBJS} +${LIBCPPLIBS}: ${LIBCPPSRCS} ${LIBSRCS} ${COBJS} ${FOBJS} # # create .o # @@ -175,13 +189,15 @@ # create .so # @(${EGREEN} "Creating shared library: "${WHITE} "`basename $@`"; ${RESET}) - @${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ -lg2c -I${DIRTOP}/${DIRINC} -I${DIRTOP} ${SUBINC} ${SUBINC} -I${PAM_YODA}/include/yoda/ -I${PAM_YODA}/include/utils/ ${DIRTOP}/${DIRLIB}/`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} ${SUBINC} -I${PAM_YODA}/include/yoda/ -I${PAM_YODA}/include/utils/ ${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)) -${CXXEXELIBS}: ${CPPOBJS} ${COBJS} ${CXXEXEOBJS} +${CXXEXELIBS}: ${LIBROOTSRCS} ${CPPOBJS} ${COBJS} ${CXXEXEOBJS} @(${EGREEN} "Creating exec file: "${WHITE} "$@"; ${RESET}) # @${CXX} ${CXXFLAGS} -o ${DIRBIN}/$@ ${DIRLIB}/$@.o ${FULLROOTCLIBS} ${FULLLIBCPPLIBS} ${CPPOBJS} ${FOBJS} ${TRKOBJS} ${PAM_YODA}/lib/libyoda.so -I${DIRINC} ${SUBINC} -I${PAM_YODA}/include/yoda/ -lThread `root-config --cflags --glibs` `cernlib mathlib` - @${CXX} ${CXXFLAGS} -o ${DIRBIN}/$@ ${DIRLIB}/$@.o ${FULLROOTCLIBS} ${FULLLIBCPPLIBS} ${TRKOBJS} ${CPPOBJS} ${COBJS} ${FOBJS} ${PAM_YODA}/lib/libyoda.so ${PAM_YODA}/lib/libutils.so ${PAM_LIB}/libPamLevel2.so -lThread `root-config --cflags --glibs` +## @${CXX} ${CXXFLAGS} -o ${DIRBIN}/$@ ${DIRLIB}/$@.o ${FULLROOTCLIBS} ${FULLLIBCPPLIBS} ${TRKOBJS} ${CPPOBJS} ${COBJS} ${FOBJS} ${PAM_YODA}/lib/libyoda.so ${PAM_YODA}/lib/libutils.so ${PAM_LIB}/libPamLevel2.so -lThread `root-config --cflags --glibs` `cernlib mathlib` +# echo 'nuclei is ${NUCLEI}' + @${CXX} ${CXXFLAGS} -o ${DIRBIN}/$@ ${DIRLIB}/$@.o ${FULLROOTCLIBS} ${FULLLIBCPPLIBS} ${TRKOBJS} ${CPPOBJS} ${COBJS} ${FOBJS} ${PAM_YODA}/lib/libyoda.so ${PAM_LIB}/libPamLevel2.so -lThread `root-config --cflags --glibs` `doc/cernlib_pam mathlib`; # A small target to check environmental variables %_env: @@ -254,7 +270,7 @@ @${test_and_cp} mkverpath: - @echo '#include ' > ${DIRTOP}/${DIRSRC}/FEVVerl2.cpp; echo ' char *FEVInfo(bool print){ if ( print ) printf("\nEvent Viewer flight package version: ${VER}\n\nCompiled on '${TODAY}' with: '${GCCVER}'\n\nOn: '${UNAMEA}'\n\n"); return("${VER}"); }' >> ${DIRTOP}/${DIRSRC}/FEVVerl2.cpp + @echo '#include ' > ${DIRTOP}/${DIRSRC}/FEVVerl2.cpp; echo ' const char *FEVInfo(bool print){ if ( print ) printf("\nEvent Viewer flight package version: ${VER}\n\nCompiled on '${TODAY}' with: '${GCCVER}'\n\nOn: '${UNAMEA}'\n\n"); return("${VER}"); }' >> ${DIRTOP}/${DIRSRC}/FEVVerl2.cpp @sleep 0.8 mkpathtoc: @@ -283,6 +299,7 @@ testpamenv: ${PAM_ENV} + root-config: OPT=--cflags root-config: @${test_cmd}