--- quicklook/tracker/flight/Makefile 2006/03/22 15:55:14 1.1 +++ quicklook/tracker/flight/Makefile 2006/07/20 11:09:33 1.7 @@ -1,6 +1,6 @@ -# Flight quick look - FQLOOK +# Tracker Flight quick look # SOFTWARE VERSION -VER= v1r00 +VER= v1r07 # An almost general purpouse Makefile for PAMELA repository # Let's start with some usefull definition for colorize the echo RED='\E[1;31;40m' @@ -21,26 +21,56 @@ # Reset the terminal RESET=tput sgr0 # Here the variables used to override the standard make flags +# C +CC=gcc +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 # C++ CXX=g++ -CXXFLAGS=-Wall +CXXFLAGS=-Wall -O -fPIC -pthread +# ROOTCINT +ROOTCINT=rootcint # Here the variables definig the local directories DIRTOP=${shell pwd} DIRLIB=lib DIRBIN=bin DIRSRC=src +DIRINC=inc DIRDOC=doc DIRMACROS=macros # Here the PAMELA environmental variables to be checked -PAM_ENV= PAM_BIN_env PAM_LIB_env PAM_INC_env PAM_DOC_env PAM_MACROS_env PAM_CALIB_env PAM_YODA_env +PAM_ENV= PAM_BIN_env PAM_LIB_env PAM_INC_env PAM_DOC_env PAM_MACROS_env PAM_YODA_env # Here the local variables used to build the targets -CXXEXESRCS=${DIRSRC}/TrackerQLookBasic.cpp \ - ${DIRSRC}/TrackerQLookExpert.cpp \ - ${DIRSRC}/TrkCalibQLookBasic.cpp \ - ${DIRSRC}/TrkCalibQLookExpert.cpp -CXXEXELIBS=$(CXXEXESRCS:${DIRSRC}/%.cpp=%) -EXESRCS= ${DIRBIN}/TrackerQLookBasic ${DIRBIN}/TrackerQLookExpert ${DIRBIN}/TrkCalibQLookBasic ${DIRBIN}/TrkCalibQLookExpert +MACROSRCS=${DIRMACROS}/FTrkQLook_BASIC.cxx \ + ${DIRMACROS}/FTrkQLook_EXPERT.cxx \ + ${DIRMACROS}/FTrkCalibQLook_BASIC.cxx \ + ${DIRMACROS}/FTrkCalibQLook_EXPERT.cxx \ + ${DIRMACROS}/FTrkScanQLook_EXPERT.cxx +MACROSLIBS=$(MACROSRCS:${DIRMACROS}/%.cxx=${DIRLIB}/lib%_${VER}.so) +MACROCLIBS=libFTrkQLook_BASIC libFTrkQLook_EXPERT libFTrkCalibQLook_BASIC libFTrkCalibQLook_EXPERT libFTrkScanQLook_EXPERT +FULLMACROCLIBS=$(MACROCLIBS:%=${DIRLIB}/%_${VER}.so) +FULLLINKMACROCLIBS=$(MACROCLIBS:%=${DIRLIB}/%.so) + +CXXEXESRCS=${DIRSRC}/FTrkQLook_BASIC.cc \ + ${DIRSRC}/FTrkQLook_EXPERT.cc \ + ${DIRSRC}/FTrkCalibQLook_BASIC.cc \ + ${DIRSRC}/FTrkCalibQLook_EXPERT.cc \ + ${DIRSRC}/FTrkScanQLook_EXPERT.cc +CXXEXEOBJS=$(CXXEXESRCS:${DIRSRC}%.cc=${DIRBIN}%.o) +CXXEXELIBS:=FTrkQLook_BASIC FTrkQLook_EXPERT FTrkCalibQLook_BASIC FTrkCalibQLook_EXPERT FTrkScanQLook_EXPERT + +EXESRCS= ${DIRBIN}/FTrkQLook_BASIC ${DIRBIN}/FTrkQLook_EXPERT ${DIRBIN}/FTrkCalibQLook_BASIC ${DIRBIN}/FTrkCalibQLook_EXPERT ${DIRBIN}/FTrkScanQLook_EXPERT + +INCSRCS= + +MACROSSRCS=${DIRMACROS}/FTrkQLook_BASIC.C ${DIRMACROS}/FTrkQLook_EXPERT.C ${DIRMACROS}/FTrkCalibQLook_BASIC.C ${DIRMACROS}/FTrkCalibQLook_EXPERT.C ${DIRMACROS}/FTrkScanQLook_EXPERT.C DOCFILES=${DIRDOC}/FlightTrkQLook-OperatorManual.doc ${DIRDOC}/FlightTrkQLook-OperatorManual.pdf @@ -51,11 +81,11 @@ DOCS= SRCS= ${FSRCS} ${CRSCS} ${CXXEXESRCS} MACROS= ${MACROSSRCS} -NROOTINC=${shell root-config --incdir} # -TOBEDEL = +TOBEDEL = junk +ROOTINC=$$${shell root-config --incdir} # Let's start -all : test mkbindir mklibdir ${CXXEXELIBS} +all : test mkbindir mklibdir ${MACROSLIBS} ${CXXEXELIBS} all: @echo -e ${GREEN} "" @(${EGREEN} " Finished, now you can install the package \n (use: make install or make upgrade or make forceinstall) "; ${RESET}) @@ -63,17 +93,30 @@ @${RESET} # Here some general rules to produce objects in our local dir -${CXXEXELIBS}: ${CXXEXESRCS} + ${DIRBIN}/%.o: ${DIRSRC}/%.cc + @(${EGREEN} "Creating object file: "${WHITE} "$@"; ${RESET}) + @cat ${DIRSRC}/`basename ${@} .o`.cc > ${DIRSRC}/temp.cc; + @echo ' ' >> ${DIRSRC}/temp.cc + @echo 'void info(){ printf("\nQLOOK flight package version: ${VER}\n\nCompiled on '${TODAY}' with: '${GCCVER}'\n\nOn: '${UNAMEA}'\n\n"); }' >> ${DIRSRC}/temp.cc + @${CXX} ${CXXFLAGS} -c -o $@ ${DIRSRC}/temp.cc -I${DIRINC} -I${PAM_INC} -I${PAM_YODA}/include/yoda `root-config --cflags` + + +${MACROSLIBS}: ${MACROSRCS} + @(${EGREEN} "Compiling macro: "${WHITE} "$@"; ${RESET}) + @${ROOTCINT} -f ${DIRMACROS}/`basename $(@F) _${VER}.so | sed s/lib//`link.cxx -c -I${ROOTINC} ${DIRINC}/`basename $(@F) _${VER}.so | sed s/lib//`func.h ${DIRINC}/`basename $(@F) _${VER}.so | sed s/lib//`LinkDef.h + @${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ ${DIRMACROS}/`basename $(@F) _${VER}.so | sed s/lib//`.cxx ${DIRMACROS}/`basename $(@F) _${VER}.so | sed s/lib//`link.cxx -lg2c -I${PAM_INC} -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_YODA}/include/yoda ${PAM_YODA}/lib/libyoda.so `root-config --cflags --glibs` 1>/dev/null + +${CXXEXELIBS}: ${CXXEXEOBJS} @(${EGREEN} "Creating exec file: "${WHITE} "$@"; ${RESET}) - ${CXX} ${CXXFLAGS} -c ${DIRSRC}/$@.cpp -o ${DIRLIB}/$@.o -I${PAM_YODAINC} -I${PAM_YODASRC} -I${NROOTINC}; - ${CXX} ${CXXFLAGS} -o ${DIRBIN}/$@ ${DIRLIB}/$@.o -I${PAM_YODAINC} -I${PAM_YODASRC} ${PAM_YODA}/lib/libyoda.so `root-config --cflags --glibs`; + @${CXX} ${CXXFLAGS} -o ${DIRBIN}/$@ ${DIRBIN}/$@.o -I${DIRINC} -I${PAM_INC} -I${PAM_YODA}/include/yoda ${PAM_YODA}/lib/libyoda.so ${DIRTOP}/${DIRLIB}/lib$@_${VER}.so `root-config --cflags --glibs`; + @rm -f ${DIRSRC}/temp.cc # A small target to check environmental variables %_env: @${test_env} -.PHONY: install installdoc installexe -.PHONY: clean depclean info mklibdir testcern testpamenv test +.PHONY: install installdoc installlib installmacros installinc installexe installcmacro +.PHONY: clean depclean info mkbindir mklibdir testcern testpamenv test mkbindir: ${DIRBIN} ${DIRBIN}: @@ -84,7 +127,7 @@ @${test_and_mk} # Here what has to be deleted in clean target -clean: TOBEDEL= ${DIRBIN} +clean: TOBEDEL= ${DIRMACROS}/*link.cxx ${DIRMACROS}/*link.h ${FOBJS} ${FULLLIBS} ${DIRBIN}/${CXXEXELIBS} ${DIRBIN}/${EXESRCS} ${COBJS} ${CXXEXEOBJS} ${FULLLINKFLIBS} ${FULLLINKCLIBS} ${FULLMACROCLIBS} ${FULLLINKMACROCLIBS} clean: @${test_and_rm} @@ -99,13 +142,35 @@ upgrade: FORCE=-u upgrade: install -install: installdoc installexe +install: installlib installinc installmacros installdoc installexe installcmacro + +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} + installdoc: TOBEMOVED= $(DOCFILES:${DIRDOC}/%=${PAM_DOC}/%) installdoc: ORIGIN=${DIRDOC} installdoc: