1 |
# Tracker flight analysis software |
2 |
# SOFTWARE VERSION |
3 |
VER= v6r11 |
4 |
DEBUG=0 |
5 |
# |
6 |
include ../Make.def |
7 |
ifeq ($(PAM_BIT),"-m32") |
8 |
MALIGN=-malign-double |
9 |
else |
10 |
MALIGN= |
11 |
endif |
12 |
ifeq ($(GCC4),0) |
13 |
EXTRAOPT=-Wno-globals -fvxt |
14 |
else |
15 |
EXTRAOPT= |
16 |
endif |
17 |
#F77FLAGS= -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -g -extend_source -static -fno-backslash ${PAM_BIT} |
18 |
#F77FLAGS= -malign-double -Wall -funroll-loops -Wno-globals -fvxt -fno-automatic -fbounds-check -extend_source -static -fno-backslash -fPIC ${PAM_BIT} |
19 |
#F77FLAGS= -malign-double -Wall -funroll-loops -Wno-globals -fvxt -fno-automatic -fbounds-check -extend_source -static -fno-backslash -fPIC ${PAM_BIT} |
20 |
export F77FLAGS= -O2 $(MALIGN) -Wall -funroll-loops $(EXTRAOPT) -fno-automatic -fbounds-check -extend_source -static -fno-backslash -fPIC ${PAM_BIT} |
21 |
#F77FLAGS= -malign-double -Wall -funroll-loops -Wno-globals -fvxt -fno-automatic -fbounds-check -extend_source -static -fno-backslash -fPIC ${PAM_BIT} |
22 |
#F77FLAGS= -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -extend_source -static -fno-backslash -fPIC ${PAM_BIT} |
23 |
#F77FLAGS= -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -extend_source -static -fno-backslash -fPIC ${PAM_BIT} |
24 |
ROOTCINT=rootcint |
25 |
# Here the variables definig the local directories |
26 |
DIRTOP=${shell pwd} |
27 |
#DIRLIB=lib/${ARCH}/ |
28 |
#DIRBIN=bin/${ARCH}/ |
29 |
DIRLIB=../lib/${ARCH}/ |
30 |
DIRBIN=../bin/${ARCH}/ |
31 |
DIRSRC=src |
32 |
DIRINC=inc |
33 |
DIRDOC=doc |
34 |
DIRMACROS=macros |
35 |
DIRCALIB=calib |
36 |
|
37 |
# Here the PAMELA environmental variables to be checked |
38 |
PAM_ENV= PAM_BIN_env PAM_LIB_env PAM_INC_env PAM_DOC_env PAM_YODA_env |
39 |
# Here the local variables used to build the targets |
40 |
#------------------------------------------------- |
41 |
FSRCS=${DIRSRC}/F77/fillpedsig.f \ |
42 |
${DIRSRC}/F77/readallparam.f \ |
43 |
${DIRSRC}/F77/functions.f \ |
44 |
${DIRSRC}/F77/cncomp.f \ |
45 |
${DIRSRC}/F77/filladc.f \ |
46 |
${DIRSRC}/F77/reductionflight.f \ |
47 |
${DIRSRC}/F77/functionspfa.f \ |
48 |
${DIRSRC}/F77/mini.f \ |
49 |
${DIRSRC}/F77/tricircle.f \ |
50 |
${DIRSRC}/F77/analysissubroutines.f \ |
51 |
${DIRSRC}/F77/analysisflight.f \ |
52 |
${DIRSRC}/F77/readB.f \ |
53 |
${DIRSRC}/F77/interB.f \ |
54 |
${DIRSRC}/F77/track.f \ |
55 |
${DIRSRC}/F77/grkuta.f \ |
56 |
${DIRSRC}/F77/bdll.f # ***PP*** |
57 |
|
58 |
FOBJS=$(FSRCS:${DIRSRC}/F77/%.f=${DIRLIB}/%.o) |
59 |
#------------------------------------------------- |
60 |
CSRCS= |
61 |
COBJS=$(CSRCS:${DIRSRC}%.cpp=${DIRLIB}/%.o) |
62 |
#------------------------------------------------- |
63 |
# librerie utilizzabili da root (ci deve essere anche il ***LinkDef.h ) |
64 |
LIBROOTSRCS=${DIRSRC}/TrkParams.cpp \ |
65 |
${DIRSRC}/TrkLevel2.cpp \ |
66 |
${DIRSRC}/TrkLevel1.cpp \ |
67 |
${DIRSRC}/TrkLevel0.cpp \ |
68 |
${DIRSRC}/TrkHough.cpp \ |
69 |
${DIRSRC}/TrkCalib.cpp |
70 |
|
71 |
#LIBROOTSRCS= |
72 |
LIBROOTLIBS=$(LIBROOTSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so) |
73 |
LIBROOTOBJS=${DIRLIB}/readB.o \ |
74 |
${DIRLIB}/interB.o \ |
75 |
${DIRLIB}/track.o \ |
76 |
${DIRLIB}/grkuta.o \ |
77 |
${DIRLIB}/bdll.o \ |
78 |
${DIRLIB}/functionspfa.o \ |
79 |
${DIRLIB}/readallparam.o \ |
80 |
${DIRLIB}/functions.o \ |
81 |
${DIRLIB}/mini.o \ |
82 |
${DIRLIB}/tricircle.o \ |
83 |
${DIRLIB}/analysisflight.o \ |
84 |
${DIRLIB}/analysissubroutines.o \ |
85 |
${DIRLIB}/fillpedsig.o \ |
86 |
${DIRLIB}/cncomp.o \ |
87 |
${DIRLIB}/filladc.o \ |
88 |
${DIRLIB}/reductionflight.o |
89 |
LIBROOTCLIBS= libTrkParams libTrkLevel2 libTrkLevel1 libTrkLevel0 libTrkHough libTrkCalib |
90 |
|
91 |
#LIBROOTCLIBS= |
92 |
FULLROOTCLIBS=$(LIBROOTCLIBS:%=${DIRLIB}/%_${VER}.so) |
93 |
#------------------------------------------------- |
94 |
# librerie C++ NON utilizzabili da root |
95 |
#LIBCPPSRCS= ${DIRSRC}/TrkLevel2.cpp \ |
96 |
# ${DIRSRC}/TrkLevel0.cpp |
97 |
LIBCPPSRCS=${DIRSRC}/TrkStruct.cpp \ |
98 |
${DIRSRC}/TrkProcess.cpp \ |
99 |
${DIRSRC}/TrkVerl2.cpp \ |
100 |
${DIRSRC}/TrkCore.cpp \ |
101 |
# ${DIRSRC}/TrkLevel0.cpp |
102 |
|
103 |
LIBCPPLIBSTRK=$(LIBCPPSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so) |
104 |
#LIBCPPCLIBS=libTrkLevel2 libTrkLevel0 |
105 |
LIBCPPCLIBS= libTrkStruct libTrkProcess libTrkCore libTrkVerl2 #libTrkLevel0 |
106 |
FULLCPPCLIBS=$(LIBCPPCLIBS:%=${DIRLIB}/%_${VER}.so) |
107 |
#------------------------------------------------- |
108 |
# librerie F77 NON utilizzabili da root |
109 |
LIBF77SRCS= |
110 |
LIBF77OBJS= $(LIBF77SRCS:${DIRSRC}/F77/%.f=${DIRLIB}/%.o) |
111 |
LIBF77LIBS= $(LIBF77SRCS:${DIRSRC}/F77/%.f=${DIRLIB}/lib%_${VER}.so) |
112 |
LIBF77CLIBS= |
113 |
FULLF77CLIBS=$(LIBF77CLIBS:%=${DIRLIB}/%_${VER}.so) |
114 |
#------------------------------------------------- |
115 |
FULLLIBS=${FULLROOTCLIBS} ${FULLCPPCLIBS} ${FULLF77CLIBS} |
116 |
|
117 |
#------------------------------------------------- |
118 |
# eseguibile |
119 |
CXXEXESRCS=${DIRSRC}/TrackerLevel2.cpp |
120 |
CXXEXEOBJS=$(CXXEXESRCS:${DIRSRC}%.cpp=${DIRLIB}%.o) |
121 |
CXXEXELIBS:=TrackerLevel2 |
122 |
|
123 |
OTHERLIBS=${PAM_LIB}/libGLTables.so ${DIRLIB}/libRunInfo.so |
124 |
SUBDIR=../RunInfo |
125 |
SUBINC=$(shell for dir in `echo ${SUBDIR}`; do echo -I$${dir}/inc; done) |
126 |
|
127 |
#------------------------------------------------- |
128 |
# variabili per l'installazione |
129 |
EXESRCS=${DIRBIN}/TrackerLevel2 |
130 |
INCSRCS= \ |
131 |
${DIRINC}/TrkLevel2.h \ |
132 |
${DIRINC}/TrkLevel1.h \ |
133 |
${DIRINC}/TrkLevel0.h \ |
134 |
${DIRINC}/TrkHough.h \ |
135 |
${DIRINC}/TrkCalib.h \ |
136 |
${DIRINC}/TrkParams.h \ |
137 |
${DIRINC}/TrkStruct.h \ |
138 |
${DIRINC}/TrkProcess.h \ |
139 |
${DIRINC}/TrkCore.h \ |
140 |
${DIRINC}/TrkVerl2.h |
141 |
MACROSSRCS= |
142 |
CALIBFILES= |
143 |
DOCFILES= |
144 |
# Here the Variables used for info target |
145 |
PACKAGE=Tracker flight software |
146 |
EXECUTABLES=${EXESRCS} |
147 |
LIBS= ${FULLLIBS} ${OTHERLIBS} |
148 |
DOCS= |
149 |
SRCS= |
150 |
MACROS= ${MACROSSRCS} |
151 |
INCLUDE= ${INCSRCS} |
152 |
# |
153 |
TOBEDEL = junk |
154 |
ROOTINC=$$${shell root-config --incdir} |
155 |
NROOTINC=${shell root-config --incdir} |
156 |
# Let's start |
157 |
#all : test mkbindir mklibdir mkverpath ${LIBF77LIBS} ${LIBROOTLIBS} ${LIBCPPLIBS} ${FOBJS} ${COBJS} ${CXXEXELIBS} |
158 |
all : test mkbindir mklibdir mkverpath ${LIBF77LIBS} ${LIBROOTLIBS} ${LIBCPPLIBSTRK} |
159 |
all: |
160 |
# @echo -e ${GREEN} "" |
161 |
# @(${EGREEN} " Finished, now you can install the package \n (use: make install or make upgrade or make forceinstall) "; ${RESET}) |
162 |
@echo -e ${GREEN} "" |
163 |
@${RESET} |
164 |
|
165 |
standalone: all ${CXXEXELIBS} |
166 |
|
167 |
include ../Make.dect |
168 |
|
169 |
${DIRLIB}/%.o : ${DIRSRC}/F77/%.f |
170 |
@(${EGREEN} "Creating tracker F77 object file: "${WHITE} "$@"; ${RESET}) |
171 |
@${F77} ${F77FLAGS} -c -o $@ ${DIRSRC}/F77/`basename ${@} .o`.f -I${DIRTOP}/${DIRINC}/F77 -I${NROOTINC} ${SUBINC} -I${PAM_YODA}/include/yoda -I${PAM_INC}/ |
172 |
|
173 |
|
174 |
${LIBCPPLIBSTRK}: ${LIBSRCS} ${COBJS} ${FOBJS} |
175 |
# |
176 |
# create .o |
177 |
# |
178 |
@(${EGREEN} "Compiling CPP file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`.cpp"; ${RESET}) |
179 |
@${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_INC}/ -I${NROOTINC} -I${DIRTOP}/../CalorimeterLevel2/inc -I${DIRTOP}/../ToFLevel2/inc -I${DIRTOP}/../TriggerLevel2/inc -I${DIRTOP}/../OrbitalInfo/inc |
180 |
# |
181 |
# create .so |
182 |
# |
183 |
@(${EGREEN} "Creating shared library: "${WHITE} "`basename $@`"; ${RESET}) |
184 |
@${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ $(LG2C) ${DIRTOP}/${DIRLIB}/`basename $(@F) _${VER}.so | sed s/lib//`.o ${FOBJS} ${COBJS} 1>/dev/null |
185 |
@ln -sf ${DIRTOP}/${DIRLIB}/$(@F) ${DIRTOP}/${DIRLIB}/$(patsubst %_${VER}.so,%.so,$(@F)) |
186 |
|
187 |
# A small target to check environmental variables |
188 |
%_env: |
189 |
@${test_env} |
190 |
|
191 |
.PHONY: install installdoc installlib installmacros installinc installexe installcmacro |
192 |
.PHONY: clean depclean info mkbindir mklibdir testcern testpamenv test |
193 |
|
194 |
mkbindir: ${DIRBIN} |
195 |
${DIRBIN}: |
196 |
@${test_and_mk} |
197 |
|
198 |
mklibdir: ${DIRLIB} |
199 |
${DIRLIB}: |
200 |
@${test_and_mk} |
201 |
|
202 |
# Here what has to be deleted in clean target |
203 |
clean: TOBEDEL= ${DIRSRC}/*.o ${DIRSRC}/*Dict.cpp ${DIRSRC}/*Dict.h ${FOBJS} ${FULLLIBS} ${DIRBIN}/${CXXEXELIBS} ${COBJS} ${CXXEXEOBJS} ${DIRSRC}/TrkVerl2.cpp |
204 |
clean: |
205 |
@${test_and_rm} |
206 |
|
207 |
distclean: clean |
208 |
distclean: TOBEDEL= ${DIRBIN} ${DIRLIB} |
209 |
distclean: |
210 |
@${test_and_rm} |
211 |
|
212 |
forceinstall: FORCE=-f |
213 |
forceinstall: install |
214 |
|
215 |
upgrade: FORCE=-u |
216 |
upgrade: install |
217 |
upgradestandalone: FORCE=-u |
218 |
upgradestandalone: installstandalone |
219 |
|
220 |
install: installlib installinc installmacros installcalib installdoc installcmacro |
221 |
installstandalone: install installexe |
222 |
|
223 |
installlib: LINK=y |
224 |
installlib: TOBEMOVED= $(FULLLIBS:${DIRLIB}%=${PAM_LIB}%) |
225 |
installlib: ORIGIN=${DIRLIB} |
226 |
installlib: |
227 |
@${test_and_cp} |
228 |
|
229 |
installcmacro: LINK=y |
230 |
installcmacro: TOBEMOVED= $(FULLMACROCLIBS:${DIRLIB}%=${PAM_LIB}%) |
231 |
installcmacro: ORIGIN=${DIRLIB} |
232 |
installcmacro: |
233 |
@${test_and_cp} |
234 |
|
235 |
installinc: TOBEMOVED= $(INCSRCS:${DIRINC}/%=${PAM_INC}/%) |
236 |
installinc: ORIGIN=${DIRINC} |
237 |
installinc: |
238 |
@${test_and_cp} |
239 |
|
240 |
installexe: TOBEMOVED= $(EXESRCS:${DIRBIN}/%=${PAM_BIN}/%) |
241 |
installexe: ORIGIN=${DIRBIN} |
242 |
installexe: |
243 |
@${test_and_cp} |
244 |
|
245 |
installmacros: TOBEMOVED= $(MACROSSRCS:${DIRMACROS}/%=${PAM_MACROS}/%) |
246 |
installmacros: ORIGIN=${DIRMACROS} |
247 |
installmacros: |
248 |
@${test_and_cp} |
249 |
|
250 |
installcalib: TOBEMOVED= $(CALIBFILES:${DIRCALIB}/%=${PAM_CALIB}/%) |
251 |
installcalib: ORIGIN=${DIRCALIB} |
252 |
installcalib: |
253 |
@${test_and_cp} |
254 |
|
255 |
installdoc: TOBEMOVED= $(DOCFILES:${DIRDOC}/%=${PAM_DOC}/%) |
256 |
installdoc: ORIGIN=${DIRDOC} |
257 |
installdoc: |
258 |
@${test_and_cp} |
259 |
|
260 |
mkverpath: |
261 |
# @echo '#include <TSystem.h>' > ${DIRTOP}/${DIRSRC}/TrkVerl2.cpp; echo ' void info(){ printf("\nTracker Level2 flight package version: ${VER}\n\nCompiled on '${TODAY}' with: '${GCCVER}'\n\nOn: '${UNAMEA}'\n\n"); }' >> ${DIRTOP}/${DIRSRC}/TrkVerl2.cpp |
262 |
@echo '#include <TSystem.h>' > ${DIRTOP}/${DIRSRC}/TrkVerl2.cpp; echo ' const char *TrkInfo(bool print){ if ( print ) printf("\nTracker Level2 flight package version: ${VER}\n\nCompiled on '${TODAY}' with: '${GCCVER}'\n\nOn: '${UNAMEA}'\n\n"); return("${VER}"); }' >> ${DIRTOP}/${DIRSRC}/TrkVerl2.cpp |
263 |
@sleep 0.8 |
264 |
|
265 |
|
266 |
|
267 |
info: |
268 |
@echo " " |
269 |
@${EGREEN} "Infos for package :" ${WHITE} ${PACKAGE} |
270 |
@${EGREEN} " VERSION :" ${WHITE} ${VER} |
271 |
@${EGREEN} " EXECUTABLES :" ${WHITE} ${EXECUTABLES} |
272 |
@${EGREEN} " INCLUDES :" ${WHITE} ${INCLUDE} |
273 |
@${EGREEN} " LIBS :" ${WHITE} ${LIBS} |
274 |
@${EGREEN} " DOCS :" ${WHITE} ${DOCS} |
275 |
@${EGREEN} " SRCS :" ${WHITE} ${SRCS} |
276 |
@${EGREEN} " MACROS :" ${WHITE} ${MACROS} |
277 |
@echo " " |
278 |
@${RESET} |
279 |
|
280 |
test: testpamenv |
281 |
|
282 |
testpamenv: ${PAM_ENV} |
283 |
|
284 |
root-config: OPT=--cflags |
285 |
root-config: |
286 |
@${test_cmd} |
287 |
|
288 |
# Here follows some usefull macros |
289 |
define test_and_cp |
290 |
wd=`pwd`;\ |
291 |
for i in ${TOBEMOVED} ; do \ |
292 |
wv=$${i##/*/}; \ |
293 |
dest=$${i/$${wv}/}; \ |
294 |
${EGREEN} "Testing for :" ${WHITE} "$${i}" ; ${RESET}; \ |
295 |
if [ ! "${FORCE}" ] ; then \ |
296 |
if [ ! -f $${i} ]; then \ |
297 |
${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
298 |
${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \ |
299 |
cp ${ORIGIN}/$${i##/*/} $${i}; \ |
300 |
else \ |
301 |
${ERED} "File already exist !!!! Please delete it " ${WHITE}; ${RESET}; \ |
302 |
fi;\ |
303 |
else \ |
304 |
if [ "${FORCE}" == "-u" ] ; then \ |
305 |
if [ "`basename $${i}`" != "`basename $${i} _${VER}.so`" ]; then \ |
306 |
${EYELLOW} "Removing: "${WHITE} ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so; ${RESET}; \ |
307 |
rm -f ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so ; \ |
308 |
${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
309 |
${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \ |
310 |
cp ${ORIGIN}/$${i##/*/} $${i}; \ |
311 |
else \ |
312 |
${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
313 |
${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \ |
314 |
cp -f ${ORIGIN}/$${i##/*/} $${i}; \ |
315 |
fi; \ |
316 |
else \ |
317 |
${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
318 |
${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \ |
319 |
cp ${FORCE} ${ORIGIN}/$${i##/*/} $${i}; \ |
320 |
fi;\ |
321 |
fi ;\ |
322 |
if [ ! -z ${LINK} ] ; then \ |
323 |
${EGREEN} "Creating symlink from : "${WHITE} $${wv/_${VER}/} ;\ |
324 |
${EGREEN} " to : "${WHITE} $${i##/*/} ; ${RESET}; \ |
325 |
cd $${dest}; \ |
326 |
ln -sf $${wv} $${wv/_${VER}/}; \ |
327 |
cd $${wd}; \ |
328 |
fi \ |
329 |
done |
330 |
endef |
331 |
|
332 |
define test_and_mk |
333 |
${EGREEN} "Testing for :" ${WHITE} "$@"; ${RESET} |
334 |
test -d "$@" || \ |
335 |
(${EGREEN} "Creating : "${WHITE} "$@"; ${RESET}; mkdir -p $@) |
336 |
endef |
337 |
|
338 |
define test_env |
339 |
${EGREEN} "Testing for env:" ${WHITE} $(patsubst %_env,%,$@); ${RESET} |
340 |
printenv $(patsubst %_env,%,$@) 1>/dev/null || \ |
341 |
(${ERED} "ERROR, variable : "${WHITE} $(patsubst %_env,%,$@) \ |
342 |
${RED} "not defined !!! Check your env. settings"; \ |
343 |
${RESET}; exit 1) |
344 |
${EGREEN} " Defined:" ${WHITE} $${$(patsubst %_env,%,$@)}; ${RESET} |
345 |
endef |
346 |
|
347 |
define test_cmd |
348 |
${EGREEN} "Testing for cmd:" ${WHITE} $@ ${OPT}; ${RESET} |
349 |
$@ ${OPT} 1>/dev/null 2>&1 || \ |
350 |
(${ERED} "ERROR, command : "${WHITE} $@ ${OPT}\ |
351 |
${RED} "not found !!! Check your installation"; \ |
352 |
${RESET}; exit 1) |
353 |
${EGREEN} " Present:" ${WHITE} $@ ${OPT}; ${RESET} |
354 |
endef |
355 |
|
356 |
define test_and_rm |
357 |
for i in ${TOBEDEL}; do \ |
358 |
test -d $${i} || (${ERED} "Removing file :"${WHITE} $${i}; ${RESET}; \ |
359 |
rm -f $${i} ); \ |
360 |
test ! -d $${i} || (${ERED} "Removing dir :"${WHITE} $${i}; ${RESET}; \ |
361 |
rm -rf $${i} ); \ |
362 |
done |
363 |
endef |