1 |
# Flight Event Viewer software |
# Flight Event Viewer software |
2 |
# SOFTWARE VERSION |
# SOFTWARE VERSION |
3 |
VER= v2r00 |
VER= v10r04 |
4 |
# An almost general purpouse Makefile for PAMELA repository |
# An almost general purpouse Makefile for PAMELA repository |
5 |
# Let's start with some usefull definition for colorize the echo |
# Let's start with some usefull definition for colorize the echo |
6 |
RED='\E[1;31;40m' |
RED='\E[1;31;40m' |
23 |
# Here the variables used to override the standard make flags |
# Here the variables used to override the standard make flags |
24 |
# C |
# C |
25 |
CC=gcc |
CC=gcc |
26 |
CFLAGS=-Wall -O -fPIC -pthread -g |
#CFLAGS=-Wall -O -fPIC -pthread -g ${PAM_BIT} |
27 |
#CFLAGS=-Wall -O -fPIC -pthread |
CFLAGS=-Wall -O -fPIC -pthread ${PAM_BIT} |
28 |
# Enviroment: |
# Enviroment: |
29 |
GCCVER=`gcc --version | head -1` |
GCCVER=`gcc --version | head -1` |
30 |
UNAMEA=`uname -a` |
UNAMEA=`uname -a` |
31 |
TODAY=`date` |
TODAY=`date` |
32 |
# F77 |
ifeq ($(GCC4),) |
33 |
|
export GCCVERS=$(shell echo `gcc -dumpversion | sed 's/\./\ /g'`) |
34 |
|
export GCCVERMAJ=$(word 1,$(GCCVERS)) |
35 |
|
export GCC4=$(shell echo `echo "${GCCVERMAJ} > 3" |bc -l`) |
36 |
|
endif |
37 |
|
ifeq ($(GCC4),1) |
38 |
|
F77=gfortran |
39 |
|
LG2C=-lgfortran |
40 |
|
EXTRAOPT= |
41 |
|
else |
42 |
F77=g77 |
F77=g77 |
43 |
F77FLAGS= -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -g -extend_source -static -fno-backslash |
LG2C=-lg2c |
44 |
#F77FLAGS= -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -extend_source -static -fno-backslash |
EXTRAOPT=-Wno-globals -fvxt |
45 |
|
endif |
46 |
|
#F77FLAGS= -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -g -extend_source -static -fno-backslash ${PAM_BIT} |
47 |
|
F77FLAGS= -Wall -funroll-loops -fPIC $(EXTRAOPT) -fno-automatic -fbounds-check -extend_source -static -fno-backslash ${PAM_BIT} |
48 |
# C++ |
# C++ |
49 |
CXX=g++ |
CXX=g++ |
50 |
CXXFLAGS=-Wall -O -fPIC -pthread -g |
#CXXFLAGS=-Wall -O -fPIC -pthread -g ${PAM_BIT} |
51 |
#CXXFLAGS=-Wall -O -fPIC -pthread |
CXXFLAGS=-Wall -O -fPIC -pthread ${PAM_BIT} |
52 |
# ROOTCINT |
# ROOTCINT |
53 |
ROOTCINT=rootcint |
ROOTCINT=rootcint |
54 |
# Here the variables definig the local directories |
# Here the variables definig the local directories |
85 |
FULLROOTCLIBS=$(LIBROOTCLIBS:%=${DIRLIB}/%_${VER}.so) |
FULLROOTCLIBS=$(LIBROOTCLIBS:%=${DIRLIB}/%_${VER}.so) |
86 |
|
|
87 |
# -- CPP - NON-ROOT libraries -- |
# -- CPP - NON-ROOT libraries -- |
88 |
LIBCPPSRCS=${DIRSRC}/FEVdetector.cpp |
LIBCPPSRCS=${DIRSRC}/color.cpp \ |
89 |
|
${DIRSRC}/FEVdetector.cpp |
90 |
LIBCPPLIBS=$(LIBCPPSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so) |
LIBCPPLIBS=$(LIBCPPSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so) |
91 |
LIBCPPCLIBS=libFEVdetector |
LIBCPPCLIBS=libcolor libFEVdetector |
92 |
FULLLIBCPPLIBS=$(LIBCPPCLIBS:%=${DIRLIB}/%_${VER}.so) |
FULLLIBCPPLIBS=$(LIBCPPCLIBS:%=${DIRLIB}/%_${VER}.so) |
93 |
|
|
94 |
# -- CPP - Executables -- |
# -- CPP - Executables -- |
97 |
CXXEXELIBS:=FEventViewer |
CXXEXELIBS:=FEventViewer |
98 |
|
|
99 |
# -- list of tracker objects needed to link |
# -- list of tracker objects needed to link |
100 |
TRKOBJS=${PAM_LIB}/libTrkLevel2.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 |
101 |
|
#${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 |
102 |
# -- directory where to find tracker headers needed to compile |
# -- directory where to find tracker headers needed to compile |
103 |
SUBDIR= |
SUBDIR= |
104 |
SUBINC=-I${PAM_INC} |
SUBINC=-I${PAM_INC} |
110 |
# Other objects to install |
# Other objects to install |
111 |
EXESRCS=${DIRBIN}/FEventViewer |
EXESRCS=${DIRBIN}/FEventViewer |
112 |
|
|
113 |
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 |
114 |
|
|
115 |
MACROSSRCS= |
MACROSSRCS= |
116 |
|
|
176 |
# create .so |
# create .so |
177 |
# |
# |
178 |
@(${EGREEN} "Creating shared library: "${WHITE} "`basename $@`"; ${RESET}) |
@(${EGREEN} "Creating shared library: "${WHITE} "`basename $@`"; ${RESET}) |
179 |
@${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 |
180 |
@ln -sf ${DIRTOP}/${DIRLIB}/$(@F) ${DIRTOP}/${DIRLIB}/$(patsubst %_${VER}.so,%.so,$(@F)) |
@ln -sf ${DIRTOP}/${DIRLIB}/$(@F) ${DIRTOP}/${DIRLIB}/$(patsubst %_${VER}.so,%.so,$(@F)) |
181 |
|
|
182 |
${LIBCPPLIBS}: ${LIBSRCS} ${COBJS} ${FOBJS} |
${LIBCPPLIBS}: ${LIBCPPSRCS} ${LIBSRCS} ${COBJS} ${FOBJS} |
183 |
# |
# |
184 |
# create .o |
# create .o |
185 |
# |
# |
189 |
# create .so |
# create .so |
190 |
# |
# |
191 |
@(${EGREEN} "Creating shared library: "${WHITE} "`basename $@`"; ${RESET}) |
@(${EGREEN} "Creating shared library: "${WHITE} "`basename $@`"; ${RESET}) |
192 |
@${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 |
193 |
@ln -sf ${DIRTOP}/${DIRLIB}/$(@F) ${DIRTOP}/${DIRLIB}/$(patsubst %_${VER}.so,%.so,$(@F)) |
@ln -sf ${DIRTOP}/${DIRLIB}/$(@F) ${DIRTOP}/${DIRLIB}/$(patsubst %_${VER}.so,%.so,$(@F)) |
194 |
|
|
195 |
${CXXEXELIBS}: ${CPPOBJS} ${COBJS} ${CXXEXEOBJS} |
${CXXEXELIBS}: ${LIBROOTSRCS} ${CPPOBJS} ${COBJS} ${CXXEXEOBJS} |
196 |
@(${EGREEN} "Creating exec file: "${WHITE} "$@"; ${RESET}) |
@(${EGREEN} "Creating exec file: "${WHITE} "$@"; ${RESET}) |
197 |
# @${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} ${CPPOBJS} ${FOBJS} ${TRKOBJS} ${PAM_YODA}/lib/libyoda.so -I${DIRINC} ${SUBINC} -I${PAM_YODA}/include/yoda/ -lThread `root-config --cflags --glibs` `cernlib mathlib` |
198 |
@${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` |
199 |
|
# echo 'nuclei is ${NUCLEI}' |
200 |
|
@${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`; |
201 |
|
|
202 |
# A small target to check environmental variables |
# A small target to check environmental variables |
203 |
%_env: |
%_env: |
230 |
upgrade: FORCE=-u |
upgrade: FORCE=-u |
231 |
upgrade: install |
upgrade: install |
232 |
|
|
233 |
install: installlib installinc installmacros installcalib installdoc installcmacro installexe |
install: installlib installinc installmacros installcalib installdoc installcmacro installexe installplugins |
234 |
|
|
235 |
installlib: LINK=y |
installlib: LINK=y |
236 |
installlib: TOBEMOVED= $(FULLLIBS:${DIRLIB}%=${PAM_LIB}%) |
installlib: TOBEMOVED= $(FULLLIBS:${DIRLIB}%=${PAM_LIB}%) |
269 |
installdoc: |
installdoc: |
270 |
@${test_and_cp} |
@${test_and_cp} |
271 |
|
|
272 |
|
installplugins: |
273 |
|
@if [ "${FEV_PLUGIN}" != "" ]; then cd ${FEV_PLUGIN}; ln -sf ${PAM_LIB}/libCaloViewer.so ./; ln -sf ${PAM_LIB}/libCaloEnergy.so ./; ln -sf ${PAM_LIB}/libCaloProfile.so ./; ln -sf ${PAM_LIB}/libCaloPreSampler.so ./; ln -sf ${PAM_LIB}/libCaloNuclei.so ./; ln -sf ${PAM_LIB}/libCaloFranzini.so ./; ln -sf ${PAM_LIB}/libCaloDoubleShower.so ./; ln -sf ${PAM_LIB}/libCaloAxis.so ./; ln -sf ${PAM_LIB}/libTrkNuclei.so; ln -sf ${PAM_LIB}/libToFNuclei.so; fi |
274 |
|
|
275 |
mkverpath: |
mkverpath: |
276 |
@echo '#include <TSystem.h>' > ${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 <TSystem.h>' > ${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 |
277 |
@sleep 0.8 |
@sleep 0.8 |
278 |
|
|
279 |
mkpathtoc: |
mkpathtoc: |
302 |
|
|
303 |
testpamenv: ${PAM_ENV} |
testpamenv: ${PAM_ENV} |
304 |
|
|
305 |
|
|
306 |
root-config: OPT=--cflags |
root-config: OPT=--cflags |
307 |
root-config: |
root-config: |
308 |
@${test_cmd} |
@${test_cmd} |