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