1 |
# Calo libraries |
2 |
# SOFTWARE VERSION IS |
3 |
VER= v0r00 |
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 ${PAM_BIT} |
29 |
CFLAGS=-Wall -O3 -funroll-loops -fPIC -pthread ${PAM_BIT} |
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 ${PAM_BIT} |
37 |
F77FLAGS= -Wall -funroll-loops -Wno-globals -fPIC -fvxt -fno-automatic -fbounds-check -extend_source -static -fno-backslash ${PAM_BIT} |
38 |
# C++ |
39 |
CXX=g++ |
40 |
#CXXFLAGS=-Wall -O -fPIC -pthread -g ${PAM_BIT} |
41 |
CXXFLAGS=-Wall -O3 -funroll-loops -fPIC -pthread ${PAM_BIT} |
42 |
# ROOTCINT |
43 |
ROOTCINT=rootcint |
44 |
#CERNLIB |
45 |
CERNLIB=./docs/cernlib_pam |
46 |
#CERNLIB=cernlib |
47 |
|
48 |
# Here the variables definig the local directories |
49 |
DIRTOP=${shell pwd} |
50 |
#DIRLIB=../lib/${ARCH} |
51 |
#DIRBIN=../bin/${ARCH} |
52 |
DIRLIB=lib/${ARCH} |
53 |
DIRBIN=bin/${ARCH} |
54 |
DIRSRC=src |
55 |
DIRINC=inc |
56 |
DIRDOC=doc |
57 |
DIRMACROS=macros |
58 |
DIRCALIB=param |
59 |
# Here the PAMELA environmental variables to be checked |
60 |
PAM_ENV= PAM_BIN_env PAM_LIB_env PAM_INC_env PAM_DOC_env PAM_CALIB_env PAM_YODA_env |
61 |
|
62 |
# Here the local variables used to build the targets |
63 |
# -- F77 - no libraries -- |
64 |
FSRCS= |
65 |
FOBJS=$(FSRCS:${DIRSRC}%.for=${DIRLIB}%.o) |
66 |
|
67 |
# -- CPP - no libraries -- |
68 |
CPPSRCS= |
69 |
CPPOBJS=$(CPPSRCS:${DIRSRC}%.cpp=${DIRLIB}%.o) |
70 |
|
71 |
# -- C - no libraries -- |
72 |
CSRCS= |
73 |
COBJS=$(CSRCS:${DIRSRC}%.c=${DIRLIB}%.o) |
74 |
|
75 |
# -- CPP - ROOT libraries -- |
76 |
LIBROOTSRCS= |
77 |
|
78 |
LIBROOTLIBS=$(LIBROOTSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so) |
79 |
LIBROOTCLIBS= |
80 |
FULLROOTCLIBS=$(LIBROOTCLIBS:%=${DIRLIB}/%_${VER}.so) |
81 |
|
82 |
# -- CPP - NON-ROOT libraries -- |
83 |
LIBCPPSRCS= |
84 |
LIBCPPLIBS=$(LIBCPPSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so) |
85 |
LIBCPPCLIBS= |
86 |
FULLLIBCPPLIBS=$(LIBCPPCLIBS:%=${DIRLIB}/%_${VER}.so) |
87 |
|
88 |
# -- CPP - Executables -- |
89 |
CXXEXESRCS= |
90 |
CXXEXEOBJS=$(CXXEXESRCS:${DIRSRC}%.cpp=${DIRLIB}%.o) |
91 |
CXXEXELIBS:= |
92 |
|
93 |
# -- list of objects needed to link |
94 |
##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) |
95 |
|
96 |
# -- directory where to find tracker headers needed to compile |
97 |
#TRKHEAD=${DIRTOP}/../tracker/inc |
98 |
#TRKHEAD=-I${PAM_INC} -ITrackerLevel2/inc/ -IRunInfo/inc/ -IGLTables/inc/ |
99 |
|
100 |
# |
101 |
SUBDIR=./FCaloREPROC/ ./CaloPreSampler/ ./CaloFranzini/ ./CaloBragg/ ./CaloViewer/ ./CaloNuclei/ ./CaloElectron/ ./CaloAxis/ ./FQLOOK/ ./CaloProfile/ ./CaloHK/ ./CaloDoubleShower/ |
102 |
|
103 |
# List of all libraries we want to install |
104 |
FULLLIBS = ${FULLROOTCLIBS} ${FULLLIBCPPLIBS} ${DARTHVLIB} |
105 |
|
106 |
# Other objects to install |
107 |
EXESRCS= |
108 |
|
109 |
INCSRCS= |
110 |
|
111 |
MACROSSRCS= |
112 |
|
113 |
CALIBFILES= |
114 |
|
115 |
DOCFILES= |
116 |
|
117 |
# Here the Variables used for info target |
118 |
PACKAGE=PAMELA analysis flight software |
119 |
EXECUTABLES= ${EXESRCS} |
120 |
LIBS= ${FULLLIBS} |
121 |
DOCS= |
122 |
SRCS= |
123 |
#SRCS= ${FSRCS} ${CRSCS} ${CXXEXESRCS} ${LIBROOTSRCS} ${LIBCPPSRCS} |
124 |
MACROS= ${MACROSSRCS} |
125 |
INCLUDE= ${INCSRCS} |
126 |
# |
127 |
TOBEDEL = junk |
128 |
ROOTINC=$$${shell root-config --incdir} |
129 |
NROOTINC=${shell root-config --incdir} |
130 |
# Directories where you place detectors software |
131 |
#SUBDIR=./GLTables ./RunInfo ./TrackerLevel2 ./CalorimeterLevel2 |
132 |
|
133 |
# Let's start |
134 |
#all: test mkbindir mklibdir mkverpath ${FOBJS} ${CPPOBJS} ${LIBROOTLIBS} ${LIBCPPLIBS} ${CXXEXELIBS} |
135 |
|
136 |
all: |
137 |
@for dir in `echo ${SUBDIR}`; do \ |
138 |
echo "Making all in $${dir}"; \ |
139 |
(cd $${dir} && ${MAKE} all); \ |
140 |
done; |
141 |
|
142 |
locall: prepare libs exe |
143 |
locall: |
144 |
@echo -e ${GREEN} "" |
145 |
@(${EGREEN} " Finished, now you can install the package \n (use: make install or make upgrade or make forceinstall) "; ${RESET}) |
146 |
@echo -e ${GREEN} "" |
147 |
@${RESET} |
148 |
|
149 |
#subdir: |
150 |
# @for dir in `echo ${SUBDIR}`; do \ |
151 |
# echo "Making ${target} in $${dir}"; \ |
152 |
# (cd $${dir} && ${MAKE} ${target}); \ |
153 |
# done; |
154 |
|
155 |
prepare: test mkbindir mklibdir mkverpath |
156 |
|
157 |
exe: prepare ${CXXEXELIBS} |
158 |
|
159 |
libs: prepare ${LIBROOTLIBS} ${LIBCPPLIBS} |
160 |
|
161 |
# Here some general rules to produce objects in our local dir |
162 |
${DIRLIB}/%.o: ${DIRSRC}/%.cpp |
163 |
@(${EGREEN} "Creating CPP object file: "${WHITE} "`basename $@`"; ${RESET}) |
164 |
@${CXX} ${CXXFLAGS} -c -o $@ ${DIRSRC}/`basename ${@} .o`.cpp -I${DIRINC} ${SUBINC} -I${PAM_YODA}/include/yoda/ -I${PAM_INC}/ `root-config --cflags` |
165 |
|
166 |
${DIRLIB}/%.o: ${DIRSRC}/%.c |
167 |
@(${EGREEN} "Creating C object file: "${WHITE} "`basename $@`"; ${RESET}) |
168 |
@${CXX} ${CXXFLAGS} -c -o $@ ${DIRSRC}/`basename ${@} .o`.c -I${DIRINC} -I${PAM_YODA}/include/yoda/ -I${PAM_INC}/ `root-config --cflags` |
169 |
|
170 |
${DIRLIB}/%.o: ${DIRSRC}/%.for |
171 |
@(${EGREEN} "Creating F77 object file: "${WHITE} "`basename $@`"; ${RESET}) |
172 |
@${F77} ${F77FLAGS} -c -o $@ ${DIRSRC}/`basename ${@} .o`.for -I${DIRINC} |
173 |
|
174 |
${LIBROOTLIBS}: ${LIBROOTSRCS} |
175 |
@(${EGREEN} "ROOTCINT - creating file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp"; ${RESET}) |
176 |
# |
177 |
# Create *Dict.cpp and *Dict.h |
178 |
# |
179 |
@${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 |
180 |
# |
181 |
# create .o |
182 |
# |
183 |
@(${EGREEN} "Compiling CPP file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`.cpp"; ${RESET}) |
184 |
@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}; |
185 |
@(${EGREEN} "Compiling CPP file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp"; ${RESET}) |
186 |
@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}; |
187 |
# |
188 |
# create .so |
189 |
# |
190 |
@(${EGREEN} "Creating shared library: "${WHITE} "`basename $@`"; ${RESET}) |
191 |
@${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 |
192 |
@ln -sf ${DIRTOP}/${DIRLIB}/$(@F) ${DIRTOP}/${DIRLIB}/$(patsubst %_${VER}.so,%.so,$(@F)) |
193 |
|
194 |
${LIBCPPLIBS}: ${LIBSRCS} ${COBJS} ${FOBJS} |
195 |
# |
196 |
# create .o |
197 |
# |
198 |
@(${EGREEN} "Compiling CPP file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`.cpp"; ${RESET}) |
199 |
@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}; |
200 |
# |
201 |
# create .so |
202 |
# |
203 |
@(${EGREEN} "Creating shared library: "${WHITE} "`basename $@`"; ${RESET}) |
204 |
@${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 |
205 |
@ln -sf ${DIRTOP}/${DIRLIB}/$(@F) ${DIRTOP}/${DIRLIB}/$(patsubst %_${VER}.so,%.so,$(@F)) |
206 |
|
207 |
${CXXEXELIBS}: ${CPPOBJS} ${COBJS} ${CXXEXEOBJS} |
208 |
@(${EGREEN} "Creating exec file: "${WHITE} "$@"; ${RESET}) |
209 |
@${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` |
210 |
@(${EGREEN} "Creating libDarthVader.so library: "${WHITE} "libDarthVader_${VER}.so"; ${RESET}) |
211 |
@${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` |
212 |
|
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 |
upgradenc: |
272 |
@for dir in `echo ${SUBDIR}`; do \ |
273 |
echo "Making upgrade in $${dir}"; \ |
274 |
(cd $${dir} && ${MAKE} upgrade); \ |
275 |
done; make locupgradenc |
276 |
|
277 |
locupgradenc: FORCE=-u |
278 |
locupgradenc: locinstallnc |
279 |
|
280 |
install: |
281 |
@for dir in `echo ${SUBDIR}`; do \ |
282 |
echo "Making install in $${dir}"; \ |
283 |
(cd $${dir} && ${MAKE} install); \ |
284 |
done; make locinstall |
285 |
|
286 |
locinstall: installlib installinc installmacros installcalib installdoc installexe installcmacro |
287 |
|
288 |
locinstallnc: installlib installinc installmacros installdoc installexe installcmacro |
289 |
|
290 |
installlib: LINK=y |
291 |
installlib: TOBEMOVED= $(FULLLIBS:${DIRLIB}%=${PAM_LIB}%) |
292 |
installlib: ORIGIN=${DIRLIB} |
293 |
installlib: |
294 |
@${test_and_cp} |
295 |
|
296 |
installcmacro: LINK=y |
297 |
installcmacro: TOBEMOVED= $(FULLMACROCLIBS:${DIRLIB}%=${PAM_LIB}%) |
298 |
installcmacro: ORIGIN=${DIRLIB} |
299 |
installcmacro: |
300 |
@${test_and_cp} |
301 |
|
302 |
installinc: TOBEMOVED= $(INCSRCS:${DIRINC}/%=${PAM_INC}/%) |
303 |
installinc: ORIGIN=${DIRINC} |
304 |
installinc: |
305 |
@${test_and_cp} |
306 |
|
307 |
installexe: TOBEMOVED= $(EXESRCS:${DIRBIN}/%=${PAM_BIN}/%) |
308 |
installexe: ORIGIN=${DIRBIN} |
309 |
installexe: |
310 |
@${test_and_cp} |
311 |
|
312 |
installmacros: TOBEMOVED= $(MACROSSRCS:${DIRMACROS}/%=${PAM_MACROS}/%) |
313 |
installmacros: ORIGIN=${DIRMACROS} |
314 |
installmacros: |
315 |
@${test_and_cp} |
316 |
|
317 |
installcalib: TOBEMOVED= $(CALIBFILES:${DIRCALIB}/%=${PAM_CALIB}/%) |
318 |
installcalib: ORIGIN=${DIRCALIB} |
319 |
installcalib: |
320 |
@${cp_dir} |
321 |
|
322 |
installdoc: TOBEMOVED= $(DOCFILES:${DIRDOC}/%=${PAM_DOC}/%) |
323 |
installdoc: ORIGIN=${DIRDOC} |
324 |
installdoc: |
325 |
@${test_and_cp} |
326 |
|
327 |
mkverpath: |
328 |
@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 |
329 |
@sleep 0.8 |
330 |
|
331 |
|
332 |
|
333 |
info: |
334 |
@echo " " |
335 |
@${EGREEN} "Infos for package :" ${WHITE} ${PACKAGE} |
336 |
@${EGREEN} " VERSION :" ${WHITE} ${VER} |
337 |
@${EGREEN} " EXECUTABLES :" ${WHITE} ${EXECUTABLES} |
338 |
@${EGREEN} " LIBS :" ${WHITE} ${LIBS} |
339 |
@${EGREEN} " DOCS :" ${WHITE} ${DOCS} |
340 |
@${EGREEN} " SRCS :" ${WHITE} ${SRCS} |
341 |
@${EGREEN} " MACROS :" ${WHITE} ${MACROS} |
342 |
@${EGREEN} " INCLUDE :" ${WHITE} ${INCLUDE} |
343 |
@echo " " |
344 |
@${RESET} |
345 |
|
346 |
test: testpamenv |
347 |
|
348 |
testpamenv: ${PAM_ENV} |
349 |
|
350 |
root-config: OPT=--cflags |
351 |
root-config: |
352 |
@${test_cmd} |
353 |
|
354 |
# Here follows some usefull macros |
355 |
define test_and_cp |
356 |
wd=`pwd`;\ |
357 |
for i in ${TOBEMOVED} ; do \ |
358 |
wv=$${i##/*/}; \ |
359 |
dest=$${i/$${wv}/}; \ |
360 |
${EGREEN} "Testing for :" ${WHITE} "$${i}" ; ${RESET}; \ |
361 |
if [ ! "${FORCE}" ] ; then \ |
362 |
if [ ! -f $${i} ]; then \ |
363 |
${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
364 |
${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \ |
365 |
cp ${ORIGIN}/$${i##/*/} $${i}; \ |
366 |
else \ |
367 |
${ERED} "File already exist !!!! Please delete it " ${WHITE}; ${RESET}; \ |
368 |
fi;\ |
369 |
else \ |
370 |
if [ "${FORCE}" == "-u" ] ; then \ |
371 |
if [ "`basename $${i}`" != "`basename $${i} _${VER}.so`" ]; then \ |
372 |
${EYELLOW} "Removing: "${WHITE} ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so; ${RESET}; \ |
373 |
rm -f ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so ; \ |
374 |
${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
375 |
${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \ |
376 |
cp ${ORIGIN}/$${i##/*/} $${i}; \ |
377 |
else \ |
378 |
${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
379 |
${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \ |
380 |
cp -f ${ORIGIN}/$${i##/*/} $${i}; \ |
381 |
fi; \ |
382 |
else \ |
383 |
${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
384 |
${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \ |
385 |
cp ${FORCE} ${ORIGIN}/$${i##/*/} $${i}; \ |
386 |
fi;\ |
387 |
fi ;\ |
388 |
if [ ! -z ${LINK} ] ; then \ |
389 |
${EGREEN} "Creating symlink from : "${WHITE} $${wv/_${VER}/} ;\ |
390 |
${EGREEN} " to : "${WHITE} $${i##/*/} ; ${RESET}; \ |
391 |
cd $${dest}; \ |
392 |
ln -sf $${wv} $${wv/_${VER}/}; \ |
393 |
cd $${wd}; \ |
394 |
fi \ |
395 |
done |
396 |
endef |
397 |
|
398 |
define cp_dir |
399 |
wd=`pwd`;\ |
400 |
for i in ${TOBEMOVED} ; do \ |
401 |
wv=$${i##/*/}; \ |
402 |
dest=$${i/$${wv}/}; \ |
403 |
${EYELLOW} " Copying directory: "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
404 |
${EYELLOW} " to: "${WHITE} ${PAM_CALIB} ; ${RESET}; \ |
405 |
cp -rf ${ORIGIN}/$${i##/*/} ${PAM_CALIB}; \ |
406 |
done |
407 |
endef |
408 |
|
409 |
define test_and_mk |
410 |
${EGREEN} "Testing for :" ${WHITE} "$@"; ${RESET} |
411 |
test -d "$@" || \ |
412 |
(${EGREEN} "Creating : "${WHITE} "$@"; ${RESET}; mkdir -p $@) |
413 |
endef |
414 |
|
415 |
define test_env |
416 |
${EGREEN} "Testing for env:" ${WHITE} $(patsubst %_env,%,$@); ${RESET} |
417 |
printenv $(patsubst %_env,%,$@) 1>/dev/null || \ |
418 |
(${ERED} "ERROR, variable : "${WHITE} $(patsubst %_env,%,$@) \ |
419 |
${RED} "not defined !!! Check your env. settings"; \ |
420 |
${RESET}; exit 1) |
421 |
${EGREEN} " Defined:" ${WHITE} $${$(patsubst %_env,%,$@)}; ${RESET} |
422 |
endef |
423 |
|
424 |
define test_cmd |
425 |
${EGREEN} "Testing for cmd:" ${WHITE} $@ ${OPT}; ${RESET} |
426 |
$@ ${OPT} 1>/dev/null 2>&1 || \ |
427 |
(${ERED} "ERROR, command : "${WHITE} $@ ${OPT}\ |
428 |
${RED} "not found !!! Check your installation"; \ |
429 |
${RESET}; exit 1) |
430 |
${EGREEN} " Present:" ${WHITE} $@ ${OPT}; ${RESET} |
431 |
endef |
432 |
|
433 |
define test_and_rm |
434 |
for i in ${TOBEDEL}; do \ |
435 |
test -d $${i} || (${ERED} "Removing file :"${WHITE} $${i}; ${RESET}; \ |
436 |
rm -f $${i} ); \ |
437 |
test ! -d $${i} || (${ERED} "Removing dir :"${WHITE} $${i}; ${RESET}; \ |
438 |
rm -rf $${i} ); \ |
439 |
done |
440 |
endef |