1 |
# DarthVader flight analysis software |
2 |
# SOFTWARE VERSION IS |
3 |
VER= v10r03 |
4 |
# |
5 |
include Make.def |
6 |
#CERNLIB |
7 |
CERNLIB=./docs/cernlib_pam |
8 |
#CERNLIB=cernlib |
9 |
|
10 |
# Here the variables definig the local directories |
11 |
DIRTOP=${shell pwd} |
12 |
#DIRLIB=../lib/${ARCH} |
13 |
#DIRBIN=../bin/${ARCH} |
14 |
DIRLIB=lib/${ARCH} |
15 |
DIRBIN=bin/${ARCH} |
16 |
DIRSRC=src |
17 |
DIRINC=inc |
18 |
DIRDOC=doc |
19 |
DIRMACROS=macros |
20 |
DIRCALIB=param |
21 |
# Here the PAMELA environmental variables to be checked |
22 |
PAM_ENV= PAM_BIN_env PAM_LIB_env PAM_INC_env PAM_DOC_env PAM_CALIB_env PAM_YODA_env |
23 |
|
24 |
# Here the local variables used to build the targets |
25 |
# -- F77 - no libraries -- |
26 |
FSRCS= |
27 |
FOBJS=$(FSRCS:${DIRSRC}%.for=${DIRLIB}%.o) |
28 |
|
29 |
# -- CPP - no libraries -- |
30 |
CPPSRCS=${DIRSRC}/DarthVaderVerl2.cpp |
31 |
CPPOBJS=$(CPPSRCS:${DIRSRC}%.cpp=${DIRLIB}%.o) |
32 |
|
33 |
# -- C - no libraries -- |
34 |
CSRCS= |
35 |
COBJS=$(CSRCS:${DIRSRC}%.c=${DIRLIB}%.o) |
36 |
|
37 |
# -- CPP - ROOT libraries -- |
38 |
LIBROOTSRCS= |
39 |
|
40 |
LIBROOTLIBS=$(LIBROOTSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so) |
41 |
LIBROOTCLIBS= |
42 |
FULLROOTCLIBS=$(LIBROOTCLIBS:%=${DIRLIB}/%_${VER}.so) |
43 |
|
44 |
# -- CPP - NON-ROOT libraries -- |
45 |
LIBCPPSRCS= |
46 |
LIBCPPLIBS=$(LIBCPPSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so) |
47 |
LIBCPPCLIBS= |
48 |
FULLLIBCPPLIBS=$(LIBCPPCLIBS:%=${DIRLIB}/%_${VER}.so) |
49 |
|
50 |
# -- CPP - Executables -- |
51 |
CXXEXESRCS=${DIRSRC}/DarthVader.cpp |
52 |
CXXEXEOBJS=$(CXXEXESRCS:${DIRSRC}%.cpp=${DIRLIB}%.o) |
53 |
CXXEXELIBS:=DarthVader |
54 |
|
55 |
# -- list of objects needed to link |
56 |
##OBJS=$(shell cd ${DIRLIB}&>/dev/null;for file in `ls *.*`; do if [ $${file} != "" ] && [ $${file} != "DarthVader.o" ] && [ $${file} != "R2-D2.o" ]; then echo ${DIRLIB}/$${file}; fi; done) |
57 |
OBJS=$(shell cd ${DIRLIB}&>/dev/null;for file in `ls lib*.so`; do if [ $${file} != "" ]; then echo ${DIRLIB}/$${file}; fi; done) ${CPPOBJS} |
58 |
DARTHVLIB=${DIRLIB}/libDarthVader_${VER}.so |
59 |
|
60 |
# -- directory where to find tracker headers needed to compile |
61 |
#TRKHEAD=${DIRTOP}/../tracker/inc |
62 |
#TRKHEAD=-I${PAM_INC} -ITrackerLevel2/inc/ -IRunInfo/inc/ -IGLTables/inc/ |
63 |
|
64 |
# |
65 |
SUBDIR=./RunInfo ./S4Level2 ./NDLevel2 ./TrackerLevel2 ./TriggerLevel2 ./ToFLevel2 ./CalorimeterLevel2 ./AnticounterLevel2 ./OrbitalInfo |
66 |
SUBINC=$(shell for dir in `echo ${SUBDIR}`; do echo -I$${dir}/inc; done) |
67 |
|
68 |
# List of all libraries we want to install |
69 |
FULLLIBS = ${FULLROOTCLIBS} ${FULLLIBCPPLIBS} ${DARTHVLIB} |
70 |
|
71 |
# Other objects to install |
72 |
EXESRCS=${DIRBIN}/DarthVader |
73 |
|
74 |
INCSRCS= |
75 |
|
76 |
MACROSSRCS= |
77 |
|
78 |
CALIBFILES=${DIRCALIB}/trk-param ${DIRCALIB}/cal-param ${DIRCALIB}/tof-param ${DIRCALIB}/orb-param |
79 |
|
80 |
DOCFILES= |
81 |
|
82 |
# Here the Variables used for info target |
83 |
PACKAGE=PAMELA analysis flight software |
84 |
EXECUTABLES= ${EXESRCS} |
85 |
LIBS= ${FULLLIBS} |
86 |
DOCS= |
87 |
SRCS= |
88 |
#SRCS= ${FSRCS} ${CRSCS} ${CXXEXESRCS} ${LIBROOTSRCS} ${LIBCPPSRCS} |
89 |
MACROS= ${MACROSSRCS} |
90 |
INCLUDE= ${INCSRCS} |
91 |
# |
92 |
TOBEDEL = junk |
93 |
ROOTINC=$$${shell root-config --incdir} |
94 |
NROOTINC=${shell root-config --incdir} |
95 |
# Directories where you place detectors software |
96 |
#SUBDIR=./GLTables ./RunInfo ./TrackerLevel2 ./CalorimeterLevel2 |
97 |
|
98 |
# Let's start |
99 |
#all: test mkbindir mklibdir mkverpath ${FOBJS} ${CPPOBJS} ${LIBROOTLIBS} ${LIBCPPLIBS} ${CXXEXELIBS} |
100 |
|
101 |
all: |
102 |
@for dir in `echo ${SUBDIR}`; do (${EBLUE} "Making all in $${dir}"; ${RESET}); (cd $${dir} &>/dev/null && ${MAKE} -s all); done |
103 |
# @for dir in `echo ${SUBDIR}`; do (${EBLUE} "Making all in $${dir}"; ${RESET}); (cd $${dir} && ${MAKE} all); done |
104 |
@make -s locall ; |
105 |
|
106 |
locall: prepare libs exe |
107 |
locall: |
108 |
@echo -e ${GREEN} "" |
109 |
@(${EGREEN} " Finished, now you can install the package \n (use: make install or make upgrade or make forceinstall) "; ${RESET}) |
110 |
@echo -e ${GREEN} "" |
111 |
@${RESET} |
112 |
|
113 |
#subdir: |
114 |
# @for dir in `echo ${SUBDIR}`; do \ |
115 |
# echo "Making ${target} in $${dir}"; \ |
116 |
# (cd $${dir} && ${MAKE} ${target}); \ |
117 |
# done; |
118 |
|
119 |
prepare: test mkbindir mklibdir mkverpath |
120 |
|
121 |
exe: prepare ${CXXEXELIBS} |
122 |
|
123 |
libs: prepare ${LIBROOTLIBS} ${LIBCPPLIBS} |
124 |
|
125 |
# Here some general rules to produce objects in our local dir |
126 |
${DIRLIB}/%.o: ${DIRSRC}/%.cpp |
127 |
@(${EGREEN} "Creating CPP object file: "${WHITE} "`basename $@`"; ${RESET}) |
128 |
@${CXX} ${CXXFLAGS} -c -o $@ ${DIRSRC}/`basename ${@} .o`.cpp -I${DIRINC} ${SUBINC} -I${PAM_YODA}/include/yoda/ -I${PAM_INC}/ `root-config --cflags` |
129 |
|
130 |
${DIRLIB}/%.o: ${DIRSRC}/%.c |
131 |
@(${EGREEN} "Creating C object file: "${WHITE} "`basename $@`"; ${RESET}) |
132 |
@${CXX} ${CXXFLAGS} -c -o $@ ${DIRSRC}/`basename ${@} .o`.c -I${DIRINC} -I${PAM_YODA}/include/yoda/ -I${PAM_INC}/ `root-config --cflags` |
133 |
|
134 |
${DIRLIB}/%.o: ${DIRSRC}/%.for |
135 |
@(${EGREEN} "Creating F77 object file: "${WHITE} "`basename $@`"; ${RESET}) |
136 |
@${F77} ${F77FLAGS} -c -o $@ ${DIRSRC}/`basename ${@} .o`.for -I${DIRINC} |
137 |
|
138 |
${LIBROOTLIBS}: ${LIBROOTSRCS} |
139 |
@(${EGREEN} "ROOTCINT - creating file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp"; ${RESET}) |
140 |
# |
141 |
# Create *Dict.cpp and *Dict.h |
142 |
# |
143 |
@${ROOTCINT} -f ${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp -c -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 |
144 |
# |
145 |
# create .o |
146 |
# |
147 |
@(${EGREEN} "Compiling CPP file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`.cpp"; ${RESET}) |
148 |
@cd ${DIRSRC} &>/dev/null && ${CXX} ${CXXFLAGS} -c `basename $(@F) _${VER}.so | sed s/lib//`.cpp -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_YODA}/include/yoda/ -I${PAM_INC}/ -I${NROOTINC}; |
149 |
@(${EGREEN} "Compiling CPP file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp"; ${RESET}) |
150 |
@cd ${DIRSRC} &>/dev/null && ${CXX} ${CXXFLAGS} -c `basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_YODA}/include/yoda/ -I${PAM_INC}/ -I${NROOTINC}; |
151 |
# |
152 |
# create .so |
153 |
# |
154 |
@(${EGREEN} "Creating shared library: "${WHITE} "`basename $@`"; ${RESET}) |
155 |
@${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ $(LG2C) -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_YODA}/include/yoda/ -I${PAM_INC}/ ${DIRTOP}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`.o ${DIRTOP}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.o 1>/dev/null |
156 |
@ln -sf ${DIRTOP}/${DIRLIB}/$(@F) ${DIRTOP}/${DIRLIB}/$(patsubst %_${VER}.so,%.so,$(@F)) |
157 |
|
158 |
${LIBCPPLIBS}: ${LIBSRCS} ${COBJS} ${FOBJS} |
159 |
# |
160 |
# create .o |
161 |
# |
162 |
@(${EGREEN} "Compiling CPP file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`.cpp"; ${RESET}) |
163 |
@cd ${DIRSRC} &>/dev/null && ${CXX} ${CXXFLAGS} -c `basename $(@F) _${VER}.so | sed s/lib//`.cpp -I${DIRTOP}/${DIRINC} -I${DIRTOP} ${SUBINC} -I${PAM_YODA}/include/yoda/ -I${PAM_INC}/ -I${NROOTINC}; |
164 |
# |
165 |
# create .so |
166 |
# |
167 |
@(${EGREEN} "Creating shared library: "${WHITE} "`basename $@`"; ${RESET}) |
168 |
@${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ $(LG2C) -I${DIRTOP}/${DIRINC} -I${DIRTOP} ${SUBINC} -I${PAM_YODA}/include/yoda/ -I${PAM_INC}/ ${DIRTOP}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`.o ${FOBJS} ${COBJS} 1>/dev/null |
169 |
@ln -sf ${DIRTOP}/${DIRLIB}/$(@F) ${DIRTOP}/${DIRLIB}/$(patsubst %_${VER}.so,%.so,$(@F)) |
170 |
|
171 |
${CXXEXELIBS}: ${CPPOBJS} ${COBJS} ${CXXEXEOBJS} |
172 |
@(${EGREEN} "Creating exec file: "${WHITE} "$@"; ${RESET}) |
173 |
@${CXX} ${CXXFLAGS} -o ${DIRBIN}/$@ ${DIRTOP}/${DIRLIB}/$@.o ${OBJS} ${PAM_LIB}/libGLTables.so ${PAM_LIB}/libsgp4.so ${PAM_YODA}/lib/libyoda.so -lThread `root-config --cflags --glibs` `${CERNLIB} mathlib` |
174 |
@(${EGREEN} "Creating libDarthVader.so library: "${WHITE} "libDarthVader_${VER}.so"; ${RESET}) |
175 |
@${CXX} ${CXXFLAGS} -Xlinker -soname=libDarthVader_${VER}.so -shared -o ${DIRTOP}/${DIRLIB}/libDarthVader_${VER}.so $(LG2C) ${DIRTOP}/${DIRLIB}/libAcLevel2.so ${DIRTOP}/${DIRLIB}/libCaloLevel0.so ${DIRTOP}/${DIRLIB}/libCaloLevel1.so ${DIRTOP}/${DIRLIB}/libCaloLevel2.so ${PAM_LIB}/libsgp4.so ${DIRTOP}/${DIRLIB}/libNDLevel2.so ${DIRTOP}/${DIRLIB}/libS4Level2.so ${DIRTOP}/${DIRLIB}/libToFLevel2.so ${DIRTOP}/${DIRLIB}/libTrigLevel2.so ${DIRTOP}/${DIRLIB}/libTrkLevel2.so ${DIRTOP}/${DIRLIB}/libTrkLevel1.so ${DIRTOP}/${DIRLIB}/libTrkLevel0.so ${DIRTOP}/${DIRLIB}/libTrkHough.so ${DIRTOP}/${DIRLIB}/libTrkCalib.so ${DIRTOP}/${DIRLIB}/libTrkParams.so ${PAM_LIB}/libGLTables.so ${DIRTOP}/${DIRLIB}/libRunInfo.so ${DIRTOP}/${DIRLIB}/libOrbitalInfo.so ${DIRTOP}/${DIRLIB}/libOrientationInfo.so ${DIRTOP}/${DIRLIB}/libInclinationInfo.so `root-config --glibs` `${CERNLIB} mathlib` |
176 |
|
177 |
# @${CXX} ${CXXFLAGS} -o ${DIRBIN}/$@ ${DIRTOP}/${DIRLIB}/$@.o ${OBJS} ${PAM_YODA}/lib/libyoda.so ${PAM_YODA}/lib/libutils.so -lThread `root-config --cflags --glibs` `cernlib mathlib` |
178 |
|
179 |
# A small target to check environmental variables |
180 |
%_env: |
181 |
@${test_env} |
182 |
|
183 |
.PHONY: install installdoc installlib installmacros installinc installexe installcmacro |
184 |
.PHONY: clean depclean info mkbindir mklibdir testcern testpamenv test |
185 |
|
186 |
mkbindir: ${DIRBIN} |
187 |
${DIRBIN}: |
188 |
@${test_and_mk} |
189 |
|
190 |
mklibdir: ${DIRLIB} |
191 |
${DIRLIB}: |
192 |
@${test_and_mk} |
193 |
|
194 |
# Here what has to be deleted in clean target |
195 |
clean: |
196 |
@for dir in `echo ${SUBDIR}`; do \ |
197 |
(${EBLUE} "Making clean in $${dir}"; ${RESET});\ |
198 |
(cd $${dir} &>/dev/null && ${MAKE} -s clean); \ |
199 |
done; make -s locclean |
200 |
|
201 |
locclean: TOBEDEL= ${DIRSRC}/*.o ${DIRSRC}/*Dict.cpp ${DIRSRC}/*Dict.h ${FOBJS} ${FULLLIBS} ${DIRBIN}/${CXXEXELIBS} ${CPPOBJS} ${CXXEXEOBJS} ${FULLLINKCLIBS} ${FULLMACROCLIBS} ${FULLLINKMACROCLIBS} ${DIRSRC}/DarthVaderVerl2.cpp |
202 |
locclean: |
203 |
@${test_and_rm} |
204 |
|
205 |
distclean: |
206 |
@for dir in `echo ${SUBDIR}`; do \ |
207 |
(${EBLUE} "Making distclean in $${dir}"; ${RESET});\ |
208 |
(cd $${dir} &>/dev/null && ${MAKE} -s distclean); \ |
209 |
done; make -s locdistclean |
210 |
|
211 |
locdistclean: clean |
212 |
locdistclean: TOBEDEL= ${DIRBIN} ${DIRLIB} |
213 |
locdistclean: |
214 |
@${test_and_rm} |
215 |
|
216 |
|
217 |
forceinstall: |
218 |
@for dir in `echo ${SUBDIR}`; do \ |
219 |
(${EBLUE} "Making forceinstall in $${dir}"; ${RESET});\ |
220 |
(cd $${dir} &>/dev/null && ${MAKE} -s forceinstall); \ |
221 |
done; make locforceinstall |
222 |
|
223 |
locforceinstall: FORCE=-f |
224 |
locforceinstall: install |
225 |
|
226 |
upgrade: |
227 |
@for dir in `echo ${SUBDIR}`; do \ |
228 |
(${EBLUE} "Making upgrade in $${dir}"; ${RESET});\ |
229 |
(cd $${dir}&>/dev/null && ${MAKE} -s upgrade); \ |
230 |
done; make -s locupgrade |
231 |
|
232 |
locupgrade: FORCE=-u |
233 |
locupgrade: locinstall |
234 |
|
235 |
upgradenc: |
236 |
@for dir in `echo ${SUBDIR}`; do \ |
237 |
(${EBLUE} "Making upgradenc in $${dir}"; ${RESET});\ |
238 |
(cd $${dir}&>/dev/null && ${MAKE} -s upgrade); \ |
239 |
done; make -s locupgradenc |
240 |
|
241 |
locupgradenc: FORCE=-u |
242 |
locupgradenc: locinstallnc |
243 |
|
244 |
install: |
245 |
@for dir in `echo ${SUBDIR}`; do \ |
246 |
(${EBLUE} "Making install in $${dir}"; ${RESET});\ |
247 |
(cd $${dir} &>/dev/null && ${MAKE} -s install); \ |
248 |
done; make -s locinstall |
249 |
|
250 |
locinstall: installlib installinc installmacros installcalib installdoc installexe installcmacro |
251 |
|
252 |
locinstallnc: installlib installinc installmacros installdoc installexe installcmacro |
253 |
|
254 |
installlib: LINK=y |
255 |
installlib: TOBEMOVED= $(FULLLIBS:${DIRLIB}%=${PAM_LIB}%) |
256 |
installlib: ORIGIN=${DIRLIB} |
257 |
installlib: |
258 |
@${test_and_cp} |
259 |
|
260 |
installcmacro: LINK=y |
261 |
installcmacro: TOBEMOVED= $(FULLMACROCLIBS:${DIRLIB}%=${PAM_LIB}%) |
262 |
installcmacro: ORIGIN=${DIRLIB} |
263 |
installcmacro: |
264 |
@${test_and_cp} |
265 |
|
266 |
installinc: TOBEMOVED= $(INCSRCS:${DIRINC}/%=${PAM_INC}/%) |
267 |
installinc: ORIGIN=${DIRINC} |
268 |
installinc: |
269 |
@${test_and_cp} |
270 |
|
271 |
installexe: TOBEMOVED= $(EXESRCS:${DIRBIN}/%=${PAM_BIN}/%) |
272 |
installexe: ORIGIN=${DIRBIN} |
273 |
installexe: |
274 |
@${test_and_cp} |
275 |
|
276 |
installmacros: TOBEMOVED= $(MACROSSRCS:${DIRMACROS}/%=${PAM_MACROS}/%) |
277 |
installmacros: ORIGIN=${DIRMACROS} |
278 |
installmacros: |
279 |
@${test_and_cp} |
280 |
|
281 |
installcalib: TOBEMOVED= $(CALIBFILES:${DIRCALIB}/%=${PAM_CALIB}/%) |
282 |
installcalib: ORIGIN=${DIRCALIB} |
283 |
installcalib: |
284 |
@${cp_dir} |
285 |
|
286 |
installdoc: TOBEMOVED= $(DOCFILES:${DIRDOC}/%=${PAM_DOC}/%) |
287 |
installdoc: ORIGIN=${DIRDOC} |
288 |
installdoc: |
289 |
@${test_and_cp} |
290 |
|
291 |
mkverpath: |
292 |
@echo '#include <TSystem.h>' > ${DIRTOP}/${DIRSRC}/DarthVaderVerl2.cpp; echo 'const char *DarthVaderInfo(bool print){ if ( print ) printf("\nPAMELA Level2 flight package version: ${VER}\n\nCompiled on '${TODAY}' with: '${GCCVER}'\n\nOn: '${UNAMEA}'\n\n"); return("${VER}"); }' >> ${DIRTOP}/${DIRSRC}/DarthVaderVerl2.cpp |
293 |
@sleep 0.8 |
294 |
|
295 |
|
296 |
|
297 |
info: |
298 |
@echo " " |
299 |
@${EGREEN} "Infos for package :" ${WHITE} ${PACKAGE} |
300 |
@${EGREEN} " VERSION :" ${WHITE} ${VER} |
301 |
@${EGREEN} " EXECUTABLES :" ${WHITE} ${EXECUTABLES} |
302 |
@${EGREEN} " LIBS :" ${WHITE} ${LIBS} |
303 |
@${EGREEN} " DOCS :" ${WHITE} ${DOCS} |
304 |
@${EGREEN} " SRCS :" ${WHITE} ${SRCS} |
305 |
@${EGREEN} " MACROS :" ${WHITE} ${MACROS} |
306 |
@${EGREEN} " INCLUDE :" ${WHITE} ${INCLUDE} |
307 |
@echo " " |
308 |
@${RESET} |
309 |
|
310 |
test: testpamenv |
311 |
|
312 |
testpamenv: ${PAM_ENV} |
313 |
|
314 |
root-config: OPT=--cflags |
315 |
root-config: |
316 |
@${test_cmd} |
317 |
|
318 |
# Here follows some usefull macros |
319 |
define test_and_cp |
320 |
wd=`pwd`;\ |
321 |
for i in ${TOBEMOVED} ; do \ |
322 |
wv=$${i##/*/}; \ |
323 |
dest=$${i/$${wv}/}; \ |
324 |
${EGREEN} "Testing for :" ${WHITE} "$${i}" ; ${RESET}; \ |
325 |
if [ ! "${FORCE}" ] ; then \ |
326 |
if [ ! -f $${i} ]; then \ |
327 |
${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
328 |
${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \ |
329 |
cp ${ORIGIN}/$${i##/*/} $${i}; \ |
330 |
else \ |
331 |
${ERED} "File already exist !!!! Please delete it " ${WHITE}; ${RESET}; \ |
332 |
fi;\ |
333 |
else \ |
334 |
if [ "${FORCE}" == "-u" ] ; then \ |
335 |
if [ "`basename $${i}`" != "`basename $${i} _${VER}.so`" ]; then \ |
336 |
${EYELLOW} "Removing: "${WHITE} ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so; ${RESET}; \ |
337 |
rm -f ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so ; \ |
338 |
${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
339 |
${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \ |
340 |
cp ${ORIGIN}/$${i##/*/} $${i}; \ |
341 |
else \ |
342 |
${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
343 |
${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \ |
344 |
cp -f ${ORIGIN}/$${i##/*/} $${i}; \ |
345 |
fi; \ |
346 |
else \ |
347 |
${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
348 |
${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \ |
349 |
cp ${FORCE} ${ORIGIN}/$${i##/*/} $${i}; \ |
350 |
fi;\ |
351 |
fi ;\ |
352 |
if [ ! -z ${LINK} ] ; then \ |
353 |
${EGREEN} "Creating symlink from : "${WHITE} $${wv/_${VER}/} ;\ |
354 |
${EGREEN} " to : "${WHITE} $${i##/*/} ; ${RESET}; \ |
355 |
cd $${dest}; \ |
356 |
ln -sf $${wv} $${wv/_${VER}/}; \ |
357 |
cd $${wd}; \ |
358 |
fi \ |
359 |
done |
360 |
endef |
361 |
|
362 |
define cp_dir |
363 |
wd=`pwd`;\ |
364 |
for i in ${TOBEMOVED} ; do \ |
365 |
wv=$${i##/*/}; \ |
366 |
dest=$${i/$${wv}/}; \ |
367 |
${EYELLOW} " Copying directory: "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
368 |
${EYELLOW} " to: "${WHITE} ${PAM_CALIB} ; ${RESET}; \ |
369 |
cp -rf ${ORIGIN}/$${i##/*/} ${PAM_CALIB}; \ |
370 |
done |
371 |
endef |
372 |
|
373 |
define test_and_mk |
374 |
${EGREEN} "Testing for :" ${WHITE} "$@"; ${RESET} |
375 |
test -d "$@" || \ |
376 |
(${EGREEN} "Creating : "${WHITE} "$@"; ${RESET}; mkdir -p $@) |
377 |
endef |
378 |
|
379 |
define test_env |
380 |
${EGREEN} "Testing for env:" ${WHITE} $(patsubst %_env,%,$@); ${RESET} |
381 |
printenv $(patsubst %_env,%,$@) 1>/dev/null || \ |
382 |
(${ERED} "ERROR, variable : "${WHITE} $(patsubst %_env,%,$@) \ |
383 |
${RED} "not defined !!! Check your env. settings"; \ |
384 |
${RESET}; exit 1) |
385 |
${EGREEN} " Defined:" ${WHITE} $${$(patsubst %_env,%,$@)}; ${RESET} |
386 |
endef |
387 |
|
388 |
define test_cmd |
389 |
${EGREEN} "Testing for cmd:" ${WHITE} $@ ${OPT}; ${RESET} |
390 |
$@ ${OPT} 1>/dev/null 2>&1 || \ |
391 |
(${ERED} "ERROR, command : "${WHITE} $@ ${OPT}\ |
392 |
${RED} "not found !!! Check your installation"; \ |
393 |
${RESET}; exit 1) |
394 |
${EGREEN} " Present:" ${WHITE} $@ ${OPT}; ${RESET} |
395 |
endef |
396 |
|
397 |
define test_and_rm |
398 |
for i in ${TOBEDEL}; do \ |
399 |
test -d $${i} || (${ERED} "Removing file :"${WHITE} $${i}; ${RESET}; \ |
400 |
rm -f $${i} ); \ |
401 |
test ! -d $${i} || (${ERED} "Removing dir :"${WHITE} $${i}; ${RESET}; \ |
402 |
rm -rf $${i} ); \ |
403 |
done |
404 |
endef |