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

Contents of /DarthVader/TrackerLevel2/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.45 - (show annotations) (download)
Tue Aug 4 14:56:58 2009 UTC (15 years, 4 months ago) by mocchiut
Branch: MAIN
Changes since 1.44: +2 -2 lines
Compilation bugs fixed

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

  ViewVC Help
Powered by ViewVC 1.1.23