1 |
# ToF flight analysis software |
# ToF flight analysis software |
2 |
# SOFTWARE VERSION |
# SOFTWARE VERSION |
3 |
VER= v1r01 |
VER= v4r01 |
4 |
# An almost general purpouse Makefile for PAMELA repository |
# |
5 |
# Let's start with some usefull definition for colorize the echo |
include ../Make.def |
|
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 |
|
|
# 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 |
|
6 |
# Here the variables definig the local directories |
# Here the variables definig the local directories |
7 |
DIRTOP=${shell pwd} |
DIRTOP=${shell pwd} |
8 |
DIRLIB=../lib/${ARCH} |
DIRLIB=../lib/${ARCH} |
36 |
LIBROOTSRCS=${DIRSRC}/ToFLevel2.cpp |
LIBROOTSRCS=${DIRSRC}/ToFLevel2.cpp |
37 |
|
|
38 |
LIBROOTLIBS=$(LIBROOTSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so) |
LIBROOTLIBS=$(LIBROOTSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so) |
39 |
|
LIBROOTOBJS=${FOBJS} |
40 |
LIBROOTCLIBS=libToFLevel2 |
LIBROOTCLIBS=libToFLevel2 |
41 |
FULLROOTCLIBS=$(LIBROOTCLIBS:%=${DIRLIB}/%_${VER}.so) |
FULLROOTCLIBS=$(LIBROOTCLIBS:%=${DIRLIB}/%_${VER}.so) |
42 |
|
|
53 |
CXXEXELIBS:=TimeOfFlightLevel2 |
CXXEXELIBS:=TimeOfFlightLevel2 |
54 |
|
|
55 |
# -- list of tracker objects needed to link |
# -- list of tracker objects needed to link |
56 |
TRKOBJS=${DIRLIB}/libTrkLevel2.so ${DIRLIB}/libGLTables.so ${DIRLIB}/libRunInfo.so |
TRKOBJS=${DIRLIB}/libTrkLevel2.so ${PAM_LIB}/libGLTables.so ${DIRLIB}/libRunInfo.so |
57 |
# -- directory where to find tracker headers needed to compile |
# -- directory where to find tracker headers needed to compile |
58 |
SUBDIR=../TrackerLevel2 ../GLTables ../RunInfo |
SUBDIR=../TrackerLevel2 ../RunInfo ../OrbitalInfo ../TriggerLevel2 |
59 |
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) |
60 |
|
|
61 |
# List of all libraries we want to install |
# List of all libraries we want to install |
64 |
# Other objects to install |
# Other objects to install |
65 |
EXESRCS=${DIRBIN}/TimeOfFlightLevel2 |
EXESRCS=${DIRBIN}/TimeOfFlightLevel2 |
66 |
|
|
67 |
INCSRCS=${DIRINC}/ToFLevel2.h ${DIRINC}/ToFStruct.h |
INCSRCS=${DIRINC}/ToFLevel2.h ${DIRINC}/ToFStruct.h ${DIRINC}/ToFCore.h |
68 |
|
|
69 |
MACROSSRCS= |
MACROSSRCS= |
70 |
|
|
89 |
#all: test mkbindir mklibdir mkverpath ${FOBJS} ${CPPOBJS} ${LIBROOTLIBS} ${LIBCPPLIBS} ${CXXEXELIBS} |
#all: test mkbindir mklibdir mkverpath ${FOBJS} ${CPPOBJS} ${LIBROOTLIBS} ${LIBCPPLIBS} ${CXXEXELIBS} |
90 |
all: prepare libs |
all: prepare libs |
91 |
all: |
all: |
92 |
@echo -e ${GREEN} "" |
# @echo -e ${GREEN} "" |
93 |
@(${EGREEN} " Finished, now you can install the package \n (use: make install or make upgrade or make forceinstall) "; ${RESET}) |
# @(${EGREEN} " Finished, now you can install the package \n (use: make install or make upgrade or make forceinstall) "; ${RESET}) |
94 |
@echo -e ${GREEN} "" |
@echo -e ${GREEN} "" |
95 |
@${RESET} |
@${RESET} |
96 |
|
|
102 |
|
|
103 |
libs: prepare ${LIBROOTLIBS} ${LIBCPPLIBS} |
libs: prepare ${LIBROOTLIBS} ${LIBCPPLIBS} |
104 |
|
|
105 |
# Here some general rules to produce objects in our local dir |
include ../Make.dect |
|
${DIRLIB}/%.o: ${DIRSRC}/%.cpp |
|
|
@(${EGREEN} "Creating CPP object file: "${WHITE} "`basename $@`"; ${RESET}) |
|
|
@${CXX} ${CXXFLAGS} -c -o $@ ${DIRSRC}/`basename ${@} .o`.cpp -I${DIRINC} ${SUBINC} -I${PAM_YODA}/include/yoda/ -I${PAM_YODA}/include/utils/ `root-config --cflags` |
|
|
|
|
|
${DIRLIB}/%.o: ${DIRSRC}/%.c |
|
|
@(${EGREEN} "Creating C object file: "${WHITE} "`basename $@`"; ${RESET}) |
|
|
@${CXX} ${CXXFLAGS} -c -o $@ ${DIRSRC}/`basename ${@} .o`.c -I${DIRINC} ${SUBINC} -I${PAM_YODA}/include/yoda/ -I${PAM_YODA}/include/utils/ `root-config --cflags` |
|
|
|
|
|
${DIRLIB}/%.o: ${DIRSRC}/%.for |
|
|
@(${EGREEN} "Creating F77 object file: "${WHITE} "`basename $@`"; ${RESET}) |
|
|
@${F77} ${F77FLAGS} -c -o $@ ${DIRSRC}/`basename ${@} .o`.for -I${DIRINC} |
|
|
|
|
|
${LIBROOTLIBS}: ${LIBROOTSRCS} |
|
|
@(${EGREEN} "ROOTCINT - creating file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp"; ${RESET}) |
|
|
# |
|
|
# Create *Dict.cpp and *Dict.h |
|
|
# |
|
|
@${ROOTCINT} -f ${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp -c -I${ROOTINC} -I${PAM_YODA}/include/yoda/ -I${PAM_YODA}/include/utils/ ${DIRINC}/`basename $(@F) _${VER}.so | sed s/lib//`.h ${DIRINC}/`basename $(@F) _${VER}.so | sed s/lib//`LinkDef.h |
|
|
# |
|
|
# 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_YODA}/include/utils/ -I${NROOTINC}; |
|
|
@(${EGREEN} "Compiling CPP file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp"; ${RESET}) |
|
|
@${CXX} ${CXXFLAGS} -c ${DIRTOP}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp -o ${DIRTOP}/${DIRLIB}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.o -I${DIRTOP}/${DIRINC} -I${DIRTOP} ${SUBINC} -I${PAM_YODA}/include/yoda/ -I${PAM_YODA}/include/utils/ -I${NROOTINC}; |
|
|
# |
|
|
# 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 |
|
|
@ln -sf ${DIRTOP}/${DIRLIB}/$(@F) ${DIRTOP}/${DIRLIB}/$(patsubst %_${VER}.so,%.so,$(@F)) |
|
|
|
|
|
${LIBCPPLIBS}: ${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_YODA}/include/utils/ -I${NROOTINC}; |
|
|
# |
|
|
# 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_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} |
|
|
@(${EGREEN} "Creating exec file: "${WHITE} "$@"; ${RESET}) |
|
|
@${CXX} ${CXXFLAGS} -o ${DIRBIN}/$@ ${DIRLIB}/$@.o ${FULLROOTCLIBS} ${FULLLIBCPPLIBS} ${TRKOBJS} ${CPPOBJS} ${COBJS} ${FOBJS} ${PAM_YODA}/lib/libyoda.so ${PAM_YODA}/lib/libutils.so -lThread `root-config --cflags --glibs` `cernlib mathlib` |
|
106 |
|
|
107 |
# A small target to check environmental variables |
# A small target to check environmental variables |
108 |
%_env: |
%_env: |
184 |
@${test_and_cp} |
@${test_and_cp} |
185 |
|
|
186 |
mkverpath: |
mkverpath: |
187 |
@echo '#include <TSystem.h>' > ${DIRTOP}/${DIRSRC}/ToFVerl2.cpp; echo ' char *ToFInfo(bool print){ if ( print ) printf("\nToF Level2 flight package version: ${VER}\n\nCompiled on '${TODAY}' with: '${GCCVER}'\n\nOn: '${UNAMEA}'\n\n"); return("${VER}"); }' >> ${DIRTOP}/${DIRSRC}/ToFVerl2.cpp |
@echo '#include <TSystem.h>' > ${DIRTOP}/${DIRSRC}/ToFVerl2.cpp; echo 'const char *ToFInfo(bool print){ if ( print ) printf("\nToF Level2 flight package version: ${VER}\n\nCompiled on '${TODAY}' with: '${GCCVER}'\n\nOn: '${UNAMEA}'\n\n"); return("${VER}"); }' >> ${DIRTOP}/${DIRSRC}/ToFVerl2.cpp |
188 |
@sleep 0.8 |
@sleep 0.8 |
189 |
|
|
190 |
|
|