1 |
# DarthVader flight analysis software |
# DarthVader flight analysis software |
2 |
# SOFTWARE VERSION IS |
# SOFTWARE VERSION IS |
3 |
VER= v2r00 |
VER= v6r01 |
4 |
# An almost general purpouse Makefile for PAMELA repository |
# |
5 |
# Let's start with some usefull definition for colorize the echo |
include Make.def |
6 |
RED='\E[1;31;40m' |
#CERNLIB |
7 |
GREEN='\E[1;32;40m' |
CERNLIB=./docs/cernlib_pam |
8 |
YELLOW='\E[1;33;40m' |
#CERNLIB=cernlib |
9 |
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 |
|
|
#MAKE |
|
|
MAKE=make |
|
|
# 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 |
|
10 |
# Here the variables definig the local directories |
# Here the variables definig the local directories |
11 |
DIRTOP=${shell pwd} |
DIRTOP=${shell pwd} |
12 |
#DIRLIB=../lib/${ARCH} |
#DIRLIB=../lib/${ARCH} |
48 |
FULLLIBCPPLIBS=$(LIBCPPCLIBS:%=${DIRLIB}/%_${VER}.so) |
FULLLIBCPPLIBS=$(LIBCPPCLIBS:%=${DIRLIB}/%_${VER}.so) |
49 |
|
|
50 |
# -- CPP - Executables -- |
# -- CPP - Executables -- |
51 |
CXXEXESRCS=${DIRSRC}/DarthVader.cpp \ |
CXXEXESRCS=${DIRSRC}/DarthVader.cpp |
|
${DIRSRC}/R2-D2.cpp |
|
52 |
CXXEXEOBJS=$(CXXEXESRCS:${DIRSRC}%.cpp=${DIRLIB}%.o) |
CXXEXEOBJS=$(CXXEXESRCS:${DIRSRC}%.cpp=${DIRLIB}%.o) |
53 |
CXXEXELIBS:=DarthVader R2-D2 |
CXXEXELIBS:=DarthVader |
54 |
|
|
55 |
# -- list of tracker objects needed to link |
# -- list of objects needed to link |
56 |
#TRKOBJS=${DIRTOP}/../lib2/libTrkLevel2.so ${DIRTOP}/../lib2/libtrack.so |
##OBJS=$(shell cd ${DIRLIB}&>/dev/null;for file in `ls *.*`; do if [ $${file} != "" ] && [ $${file} != "DarthVader.o" ] && [ $${file} != "R2-D2.o" ]; then echo ${DIRLIB}/$${file}; fi; done) |
57 |
#TRKOBJS=$(shell for lib in `ls ${DIRLIB}`; do echo ${lib}; done) |
OBJS=$(shell cd ${DIRLIB}&>/dev/null;for file in `ls lib*.so`; do if [ $${file} != "" ]; then echo ${DIRLIB}/$${file}; fi; done) ${CPPOBJS} |
|
#OBJS=${DIRLIB}/*.* |
|
|
OBJS=$(shell cd ${DIRLIB}&>/dev/null;for file in `ls *.*`; do if [ $${file} != "" ] && [ $${file} != "DarthVader.o" ] && [ $${file} != "R2-D2.o" ]; then echo ${DIRLIB}/$${file}; fi; done) |
|
|
#TRKOBJS= |
|
58 |
DARTHVLIB=${DIRLIB}/libDarthVader_${VER}.so |
DARTHVLIB=${DIRLIB}/libDarthVader_${VER}.so |
59 |
|
|
60 |
# -- directory where to find tracker headers needed to compile |
# -- directory where to find tracker headers needed to compile |
69 |
FULLLIBS = ${FULLROOTCLIBS} ${FULLLIBCPPLIBS} ${DARTHVLIB} |
FULLLIBS = ${FULLROOTCLIBS} ${FULLLIBCPPLIBS} ${DARTHVLIB} |
70 |
|
|
71 |
# Other objects to install |
# Other objects to install |
72 |
EXESRCS=${DIRBIN}/DarthVader ${DIRBIN}/R2-D2 |
EXESRCS=${DIRBIN}/DarthVader |
73 |
|
|
74 |
INCSRCS= |
INCSRCS= |
75 |
|
|
76 |
MACROSSRCS= |
MACROSSRCS= |
77 |
|
|
78 |
CALIBFILES=${DIRCALIB}/trk-param ${DIRCALIB}/cal-param ${DIRCALIB}/tof-param |
CALIBFILES=${DIRCALIB}/trk-param ${DIRCALIB}/cal-param ${DIRCALIB}/tof-param ${DIRCALIB}/orb-param |
79 |
|
|
80 |
DOCFILES= |
DOCFILES= |
81 |
|
|
100 |
|
|
101 |
all: |
all: |
102 |
@for dir in `echo ${SUBDIR}`; do \ |
@for dir in `echo ${SUBDIR}`; do \ |
103 |
echo "Making all in $${dir}"; \ |
(${EBLUE} "Making all in $${dir}"; ${RESET});\ |
104 |
(cd $${dir} && ${MAKE} all); \ |
(cd $${dir} &>/dev/null && ${MAKE} -s all); \ |
105 |
|
# (cd $${dir} &>/dev/null && ${MAKE} all); \ |
106 |
done; make locall |
done; make locall |
107 |
|
|
108 |
locall: prepare libs exe |
locall: prepare libs exe |
154 |
# create .so |
# create .so |
155 |
# |
# |
156 |
@(${EGREEN} "Creating shared library: "${WHITE} "`basename $@`"; ${RESET}) |
@(${EGREEN} "Creating shared library: "${WHITE} "`basename $@`"; ${RESET}) |
157 |
@${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ -lg2c -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_YODA}/include/yoda/ -I${PAM_INC}/ ${DIRTOP}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`.o ${DIRTOP}/${DIRSRC}/`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_INC}/ ${DIRTOP}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`.o ${DIRTOP}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.o 1>/dev/null |
158 |
@ln -sf ${DIRTOP}/${DIRLIB}/$(@F) ${DIRTOP}/${DIRLIB}/$(patsubst %_${VER}.so,%.so,$(@F)) |
@ln -sf ${DIRTOP}/${DIRLIB}/$(@F) ${DIRTOP}/${DIRLIB}/$(patsubst %_${VER}.so,%.so,$(@F)) |
159 |
|
|
160 |
${LIBCPPLIBS}: ${LIBSRCS} ${COBJS} ${FOBJS} |
${LIBCPPLIBS}: ${LIBSRCS} ${COBJS} ${FOBJS} |
167 |
# create .so |
# create .so |
168 |
# |
# |
169 |
@(${EGREEN} "Creating shared library: "${WHITE} "`basename $@`"; ${RESET}) |
@(${EGREEN} "Creating shared library: "${WHITE} "`basename $@`"; ${RESET}) |
170 |
@${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ -lg2c -I${DIRTOP}/${DIRINC} -I${DIRTOP} ${SUBINC} -I${PAM_YODA}/include/yoda/ -I${PAM_INC}/ ${DIRTOP}/${DIRSRC}/`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} -I${PAM_YODA}/include/yoda/ -I${PAM_INC}/ ${DIRTOP}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`.o ${FOBJS} ${COBJS} 1>/dev/null |
171 |
@ln -sf ${DIRTOP}/${DIRLIB}/$(@F) ${DIRTOP}/${DIRLIB}/$(patsubst %_${VER}.so,%.so,$(@F)) |
@ln -sf ${DIRTOP}/${DIRLIB}/$(@F) ${DIRTOP}/${DIRLIB}/$(patsubst %_${VER}.so,%.so,$(@F)) |
172 |
|
|
173 |
${CXXEXELIBS}: ${CPPOBJS} ${COBJS} ${CXXEXEOBJS} |
${CXXEXELIBS}: ${CPPOBJS} ${COBJS} ${CXXEXEOBJS} |
|
@${CXX} ${CXXFLAGS} -Xlinker -soname=libDarthVader_${VER}.so -shared -o ${DIRTOP}/${DIRLIB}/libDarthVader_${VER}.so -lg2c ${DIRTOP}/${DIRLIB}/libAcLevel2.so ${DIRTOP}/${DIRLIB}/libCaloLevel2.so ${DIRTOP}/${DIRLIB}/libNDLevel2.so ${DIRTOP}/${DIRLIB}/libS4Level2.so ${DIRTOP}/${DIRLIB}/libToFLevel2.so ${DIRTOP}/${DIRLIB}/libTrigLevel2.so ${DIRTOP}/${DIRLIB}/libTrkLevel2.so ${PAM_LIB}/libGLTables.so ${DIRTOP}/${DIRLIB}/libRunInfo.so ${DIRTOP}/${DIRLIB}/libOrbitalInfo.so |
|
174 |
@(${EGREEN} "Creating exec file: "${WHITE} "$@"; ${RESET}) |
@(${EGREEN} "Creating exec file: "${WHITE} "$@"; ${RESET}) |
175 |
@${CXX} ${CXXFLAGS} -o ${DIRBIN}/$@ ${DIRTOP}/${DIRLIB}/$@.o ${OBJS} ${PAM_LIB}/libGLTables.so ${PAM_YODA}/lib/libyoda.so -lThread `root-config --cflags --glibs` `cernlib mathlib` |
@${CXX} ${CXXFLAGS} -o ${DIRBIN}/$@ ${DIRTOP}/${DIRLIB}/$@.o ${OBJS} ${PAM_LIB}/libGLTables.so ${PAM_LIB}/libsgp4.so ${PAM_YODA}/lib/libyoda.so -lThread `root-config --cflags --glibs` `${CERNLIB} mathlib` |
176 |
|
@(${EGREEN} "Creating libDarthVader.so library: "${WHITE} "libDarthVader_${VER}.so"; ${RESET}) |
177 |
|
@${CXX} ${CXXFLAGS} -Xlinker -soname=libDarthVader_${VER}.so -shared -o ${DIRTOP}/${DIRLIB}/libDarthVader_${VER}.so $(LG2C) ${DIRTOP}/${DIRLIB}/libAcLevel2.so ${DIRTOP}/${DIRLIB}/libCaloLevel0.so ${DIRTOP}/${DIRLIB}/libCaloLevel1.so ${DIRTOP}/${DIRLIB}/libCaloLevel2.so ${PAM_LIB}/libsgp4.so ${DIRTOP}/${DIRLIB}/libNDLevel2.so ${DIRTOP}/${DIRLIB}/libS4Level2.so ${DIRTOP}/${DIRLIB}/libToFLevel2.so ${DIRTOP}/${DIRLIB}/libTrigLevel2.so ${DIRTOP}/${DIRLIB}/libTrkLevel2.so ${DIRTOP}/${DIRLIB}/libTrkLevel1.so ${DIRTOP}/${DIRLIB}/libTrkLevel0.so ${DIRTOP}/${DIRLIB}/libTrkHough.so ${DIRTOP}/${DIRLIB}/libTrkCalib.so ${DIRTOP}/${DIRLIB}/libTrkParams.so ${PAM_LIB}/libGLTables.so ${DIRTOP}/${DIRLIB}/libRunInfo.so ${DIRTOP}/${DIRLIB}/libOrbitalInfo.so ${DIRTOP}/${DIRLIB}/libOrientationInfo.so ${DIRTOP}/${DIRLIB}/libInclinationInfo.so `root-config --glibs` `${CERNLIB} mathlib` |
178 |
|
|
179 |
# @${CXX} ${CXXFLAGS} -o ${DIRBIN}/$@ ${DIRTOP}/${DIRLIB}/$@.o ${OBJS} ${PAM_YODA}/lib/libyoda.so ${PAM_YODA}/lib/libutils.so -lThread `root-config --cflags --glibs` `cernlib mathlib` |
# @${CXX} ${CXXFLAGS} -o ${DIRBIN}/$@ ${DIRTOP}/${DIRLIB}/$@.o ${OBJS} ${PAM_YODA}/lib/libyoda.so ${PAM_YODA}/lib/libutils.so -lThread `root-config --cflags --glibs` `cernlib mathlib` |
180 |
|
|
181 |
# A small target to check environmental variables |
# A small target to check environmental variables |
196 |
# Here what has to be deleted in clean target |
# Here what has to be deleted in clean target |
197 |
clean: |
clean: |
198 |
@for dir in `echo ${SUBDIR}`; do \ |
@for dir in `echo ${SUBDIR}`; do \ |
199 |
echo "Making clean in $${dir}"; \ |
(${EBLUE} "Making clean in $${dir}"; ${RESET});\ |
200 |
(cd $${dir} && ${MAKE} clean); \ |
(cd $${dir} &>/dev/null && ${MAKE} -s clean); \ |
201 |
done; make locclean |
done; make -s locclean |
202 |
|
|
203 |
locclean: TOBEDEL= ${DIRSRC}/*.o ${DIRSRC}/*Dict.cpp ${DIRSRC}/*Dict.h ${FOBJS} ${FULLLIBS} ${DIRBIN}/${CXXEXELIBS} ${CPPOBJS} ${CXXEXEOBJS} ${FULLLINKCLIBS} ${FULLMACROCLIBS} ${FULLLINKMACROCLIBS} ${DIRSRC}/DarthVaderVerl2.cpp |
locclean: TOBEDEL= ${DIRSRC}/*.o ${DIRSRC}/*Dict.cpp ${DIRSRC}/*Dict.h ${FOBJS} ${FULLLIBS} ${DIRBIN}/${CXXEXELIBS} ${CPPOBJS} ${CXXEXEOBJS} ${FULLLINKCLIBS} ${FULLMACROCLIBS} ${FULLLINKMACROCLIBS} ${DIRSRC}/DarthVaderVerl2.cpp |
204 |
locclean: |
locclean: |
206 |
|
|
207 |
distclean: |
distclean: |
208 |
@for dir in `echo ${SUBDIR}`; do \ |
@for dir in `echo ${SUBDIR}`; do \ |
209 |
echo "Making distclean in $${dir}"; \ |
(${EBLUE} "Making distclean in $${dir}"; ${RESET});\ |
210 |
(cd $${dir} && ${MAKE} distclean); \ |
(cd $${dir} &>/dev/null && ${MAKE} -s distclean); \ |
211 |
done; make locdistclean |
done; make -s locdistclean |
212 |
|
|
213 |
locdistclean: clean |
locdistclean: clean |
214 |
locdistclean: TOBEDEL= ${DIRBIN} ${DIRLIB} |
locdistclean: TOBEDEL= ${DIRBIN} ${DIRLIB} |
218 |
|
|
219 |
forceinstall: |
forceinstall: |
220 |
@for dir in `echo ${SUBDIR}`; do \ |
@for dir in `echo ${SUBDIR}`; do \ |
221 |
echo "Making forceinstall in $${dir}"; \ |
(${EBLUE} "Making forceinstall in $${dir}"; ${RESET});\ |
222 |
(cd $${dir} && ${MAKE} forceinstall); \ |
(cd $${dir} &>/dev/null && ${MAKE} -s forceinstall); \ |
223 |
done; make locforceinstall |
done; make locforceinstall |
224 |
|
|
225 |
locforceinstall: FORCE=-f |
locforceinstall: FORCE=-f |
227 |
|
|
228 |
upgrade: |
upgrade: |
229 |
@for dir in `echo ${SUBDIR}`; do \ |
@for dir in `echo ${SUBDIR}`; do \ |
230 |
echo "Making upgrade in $${dir}"; \ |
(${EBLUE} "Making upgrade in $${dir}"; ${RESET});\ |
231 |
(cd $${dir} && ${MAKE} upgrade); \ |
(cd $${dir}&>/dev/null && ${MAKE} -s upgrade); \ |
232 |
done; make locupgrade |
done; make -s locupgrade |
233 |
|
|
234 |
locupgrade: FORCE=-u |
locupgrade: FORCE=-u |
235 |
locupgrade: locinstall |
locupgrade: locinstall |
236 |
|
|
237 |
|
upgradenc: |
238 |
|
@for dir in `echo ${SUBDIR}`; do \ |
239 |
|
(${EBLUE} "Making upgradenc in $${dir}"; ${RESET});\ |
240 |
|
(cd $${dir}&>/dev/null && ${MAKE} -s upgrade); \ |
241 |
|
done; make -s locupgradenc |
242 |
|
|
243 |
|
locupgradenc: FORCE=-u |
244 |
|
locupgradenc: locinstallnc |
245 |
|
|
246 |
install: |
install: |
247 |
@for dir in `echo ${SUBDIR}`; do \ |
@for dir in `echo ${SUBDIR}`; do \ |
248 |
echo "Making install in $${dir}"; \ |
(${EBLUE} "Making install in $${dir}"; ${RESET});\ |
249 |
(cd $${dir} && ${MAKE} install); \ |
(cd $${dir} &>/dev/null && ${MAKE} -s install); \ |
250 |
done; make locinstall |
done; make -s locinstall |
251 |
|
|
252 |
locinstall: installlib installinc installmacros installcalib installdoc installexe installcmacro |
locinstall: installlib installinc installmacros installcalib installdoc installexe installcmacro |
253 |
|
|
254 |
|
locinstallnc: installlib installinc installmacros installdoc installexe installcmacro |
255 |
|
|
256 |
installlib: LINK=y |
installlib: LINK=y |
257 |
installlib: TOBEMOVED= $(FULLLIBS:${DIRLIB}%=${PAM_LIB}%) |
installlib: TOBEMOVED= $(FULLLIBS:${DIRLIB}%=${PAM_LIB}%) |
258 |
installlib: ORIGIN=${DIRLIB} |
installlib: ORIGIN=${DIRLIB} |