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

Contents of /DarthVader/TrackerLevel2/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.38 - (show annotations) (download)
Fri Dec 5 08:26:43 2008 UTC (16 years ago) by pam-fi
Branch: MAIN
Changes since 1.37: +1 -1 lines
new tracking algorithm

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

  ViewVC Help
Powered by ViewVC 1.1.23