/[PAMELA software]/DarthVader/TrackerLevel2/Makefile
ViewVC logotype

Contents of /DarthVader/TrackerLevel2/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.66 - (show annotations) (download)
Mon Oct 13 14:49:47 2014 UTC (10 years, 2 months ago) by mocchiut
Branch: MAIN
Changes since 1.65: +1 -1 lines
10RED: sync lost between CAL/TOF and TRK fixed

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

  ViewVC Help
Powered by ViewVC 1.1.23