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

Contents of /DarthVader/TrackerLevel2/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.50 - (show annotations) (download)
Wed Mar 6 14:20:14 2013 UTC (11 years, 8 months ago) by mocchiut
Branch: MAIN
Changes since 1.49: +2 -1 lines
Simulation flag (Valerio's style) added for Tracker

1 # Tracker flight analysis software
2 # SOFTWARE VERSION
3 VER= v6r06
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 LIBCPPLIBS=$(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} ${LIBCPPLIBS}
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 # A small target to check environmental variables
174 %_env:
175 @${test_env}
176
177 .PHONY: install installdoc installlib installmacros installinc installexe installcmacro
178 .PHONY: clean depclean info mkbindir mklibdir testcern testpamenv test
179
180 mkbindir: ${DIRBIN}
181 ${DIRBIN}:
182 @${test_and_mk}
183
184 mklibdir: ${DIRLIB}
185 ${DIRLIB}:
186 @${test_and_mk}
187
188 # Here what has to be deleted in clean target
189 clean: TOBEDEL= ${DIRSRC}/*.o ${DIRSRC}/*Dict.cpp ${DIRSRC}/*Dict.h ${FOBJS} ${FULLLIBS} ${DIRBIN}/${CXXEXELIBS} ${COBJS} ${CXXEXEOBJS} ${DIRSRC}/TrkVerl2.cpp
190 clean:
191 @${test_and_rm}
192
193 distclean: clean
194 distclean: TOBEDEL= ${DIRBIN} ${DIRLIB}
195 distclean:
196 @${test_and_rm}
197
198 forceinstall: FORCE=-f
199 forceinstall: install
200
201 upgrade: FORCE=-u
202 upgrade: install
203 upgradestandalone: FORCE=-u
204 upgradestandalone: installstandalone
205
206 install: installlib installinc installmacros installcalib installdoc installcmacro
207 installstandalone: install installexe
208
209 installlib: LINK=y
210 installlib: TOBEMOVED= $(FULLLIBS:${DIRLIB}%=${PAM_LIB}%)
211 installlib: ORIGIN=${DIRLIB}
212 installlib:
213 @${test_and_cp}
214
215 installcmacro: LINK=y
216 installcmacro: TOBEMOVED= $(FULLMACROCLIBS:${DIRLIB}%=${PAM_LIB}%)
217 installcmacro: ORIGIN=${DIRLIB}
218 installcmacro:
219 @${test_and_cp}
220
221 installinc: TOBEMOVED= $(INCSRCS:${DIRINC}/%=${PAM_INC}/%)
222 installinc: ORIGIN=${DIRINC}
223 installinc:
224 @${test_and_cp}
225
226 installexe: TOBEMOVED= $(EXESRCS:${DIRBIN}/%=${PAM_BIN}/%)
227 installexe: ORIGIN=${DIRBIN}
228 installexe:
229 @${test_and_cp}
230
231 installmacros: TOBEMOVED= $(MACROSSRCS:${DIRMACROS}/%=${PAM_MACROS}/%)
232 installmacros: ORIGIN=${DIRMACROS}
233 installmacros:
234 @${test_and_cp}
235
236 installcalib: TOBEMOVED= $(CALIBFILES:${DIRCALIB}/%=${PAM_CALIB}/%)
237 installcalib: ORIGIN=${DIRCALIB}
238 installcalib:
239 @${test_and_cp}
240
241 installdoc: TOBEMOVED= $(DOCFILES:${DIRDOC}/%=${PAM_DOC}/%)
242 installdoc: ORIGIN=${DIRDOC}
243 installdoc:
244 @${test_and_cp}
245
246 mkverpath:
247 # @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
248 @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
249 @sleep 0.8
250
251
252
253 info:
254 @echo " "
255 @${EGREEN} "Infos for package :" ${WHITE} ${PACKAGE}
256 @${EGREEN} " VERSION :" ${WHITE} ${VER}
257 @${EGREEN} " EXECUTABLES :" ${WHITE} ${EXECUTABLES}
258 @${EGREEN} " INCLUDES :" ${WHITE} ${INCLUDE}
259 @${EGREEN} " LIBS :" ${WHITE} ${LIBS}
260 @${EGREEN} " DOCS :" ${WHITE} ${DOCS}
261 @${EGREEN} " SRCS :" ${WHITE} ${SRCS}
262 @${EGREEN} " MACROS :" ${WHITE} ${MACROS}
263 @echo " "
264 @${RESET}
265
266 test: testpamenv
267
268 testpamenv: ${PAM_ENV}
269
270 root-config: OPT=--cflags
271 root-config:
272 @${test_cmd}
273
274 # Here follows some usefull macros
275 define test_and_cp
276 wd=`pwd`;\
277 for i in ${TOBEMOVED} ; do \
278 wv=$${i##/*/}; \
279 dest=$${i/$${wv}/}; \
280 ${EGREEN} "Testing for :" ${WHITE} "$${i}" ; ${RESET}; \
281 if [ ! "${FORCE}" ] ; then \
282 if [ ! -f $${i} ]; then \
283 ${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\
284 ${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \
285 cp ${ORIGIN}/$${i##/*/} $${i}; \
286 else \
287 ${ERED} "File already exist !!!! Please delete it " ${WHITE}; ${RESET}; \
288 fi;\
289 else \
290 if [ "${FORCE}" == "-u" ] ; then \
291 if [ "`basename $${i}`" != "`basename $${i} _${VER}.so`" ]; then \
292 ${EYELLOW} "Removing: "${WHITE} ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so; ${RESET}; \
293 rm -f ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so ; \
294 ${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\
295 ${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \
296 cp ${ORIGIN}/$${i##/*/} $${i}; \
297 else \
298 ${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\
299 ${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \
300 cp -f ${ORIGIN}/$${i##/*/} $${i}; \
301 fi; \
302 else \
303 ${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\
304 ${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \
305 cp ${FORCE} ${ORIGIN}/$${i##/*/} $${i}; \
306 fi;\
307 fi ;\
308 if [ ! -z ${LINK} ] ; then \
309 ${EGREEN} "Creating symlink from : "${WHITE} $${wv/_${VER}/} ;\
310 ${EGREEN} " to : "${WHITE} $${i##/*/} ; ${RESET}; \
311 cd $${dest}; \
312 ln -sf $${wv} $${wv/_${VER}/}; \
313 cd $${wd}; \
314 fi \
315 done
316 endef
317
318 define test_and_mk
319 ${EGREEN} "Testing for :" ${WHITE} "$@"; ${RESET}
320 test -d "$@" || \
321 (${EGREEN} "Creating : "${WHITE} "$@"; ${RESET}; mkdir -p $@)
322 endef
323
324 define test_env
325 ${EGREEN} "Testing for env:" ${WHITE} $(patsubst %_env,%,$@); ${RESET}
326 printenv $(patsubst %_env,%,$@) 1>/dev/null || \
327 (${ERED} "ERROR, variable : "${WHITE} $(patsubst %_env,%,$@) \
328 ${RED} "not defined !!! Check your env. settings"; \
329 ${RESET}; exit 1)
330 ${EGREEN} " Defined:" ${WHITE} $${$(patsubst %_env,%,$@)}; ${RESET}
331 endef
332
333 define test_cmd
334 ${EGREEN} "Testing for cmd:" ${WHITE} $@ ${OPT}; ${RESET}
335 $@ ${OPT} 1>/dev/null 2>&1 || \
336 (${ERED} "ERROR, command : "${WHITE} $@ ${OPT}\
337 ${RED} "not found !!! Check your installation"; \
338 ${RESET}; exit 1)
339 ${EGREEN} " Present:" ${WHITE} $@ ${OPT}; ${RESET}
340 endef
341
342 define test_and_rm
343 for i in ${TOBEDEL}; do \
344 test -d $${i} || (${ERED} "Removing file :"${WHITE} $${i}; ${RESET}; \
345 rm -f $${i} ); \
346 test ! -d $${i} || (${ERED} "Removing dir :"${WHITE} $${i}; ${RESET}; \
347 rm -rf $${i} ); \
348 done
349 endef

  ViewVC Help
Powered by ViewVC 1.1.23