1 |
# Tracker flight analysis software |
2 |
# SOFTWARE VERSION |
3 |
VER= v0r01 |
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 |
28 |
CFLAGS=-Wall -O -fPIC -pthread |
29 |
# Enviroment: |
30 |
GCCVER=`gcc --version | head -1` |
31 |
UNAMEA=`uname -a` |
32 |
TODAY=`date` |
33 |
# F77 |
34 |
F77=g77 |
35 |
#F77FLAGS= -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -g -extend_source -static -fno-backslash |
36 |
F77FLAGS= -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -extend_source -static -fno-backslash |
37 |
# C++ |
38 |
CXX=g++ |
39 |
#CXXFLAGS=-Wall -O -fPIC -pthread -g -D'DEBUG=${DEBUG}' |
40 |
#CXXFLAGS=-Wall -O -fPIC -pthread -g -D'DEBUG=0' |
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=calib |
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_YODA_env |
57 |
# Here the local variables used to build the targets |
58 |
#------------------------------------------------- |
59 |
FSRCS=${DIRSRC}/F77/fillpedsig.f \ |
60 |
${DIRSRC}/F77/readallparam.f \ |
61 |
${DIRSRC}/F77/functions.f \ |
62 |
${DIRSRC}/F77/cncomp.f \ |
63 |
${DIRSRC}/F77/filladc.f \ |
64 |
${DIRSRC}/F77/reductionflight.f \ |
65 |
${DIRSRC}/F77/functionspfa.f \ |
66 |
${DIRSRC}/F77/mini.f \ |
67 |
${DIRSRC}/F77/tricircle.f \ |
68 |
${DIRSRC}/F77/analysissubroutines.f \ |
69 |
${DIRSRC}/F77/analysisflight.f \ |
70 |
${DIRSRC}/F77/readB.f \ |
71 |
${DIRSRC}/F77/interB.f \ |
72 |
${DIRSRC}/F77/track.f \ |
73 |
${DIRSRC}/F77/grkuta.f |
74 |
|
75 |
FOBJS=$(FSRCS:${DIRSRC}/F77/%.f=${DIRLIB}/%.o) |
76 |
#------------------------------------------------- |
77 |
CSRCS= |
78 |
COBJS=$(CSRCS:${DIRSRC}%.cpp=${DIRLIB}/%.o) |
79 |
#------------------------------------------------- |
80 |
# librerie utilizzabili da root (ci deve essere anche il ***LinkDef.h ) |
81 |
LIBROOTSRCS= ${DIRSRC}/TrkLevel2.cpp |
82 |
#LIBROOTSRCS= |
83 |
LIBROOTLIBS=$(LIBROOTSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so) |
84 |
LIBROOTOBJS=${DIRLIB}/readB.o ${DIRLIB}/interB.o ${DIRLIB}/track.o ${DIRLIB}/grkuta.o |
85 |
LIBROOTCLIBS=libTrkLevel2 |
86 |
#LIBROOTCLIBS= |
87 |
FULLROOTCLIBS=$(LIBROOTCLIBS:%=${DIRLIB}/%_${VER}.so) |
88 |
#------------------------------------------------- |
89 |
# librerie C++ NON utilizzabili da root |
90 |
#LIBCPPSRCS= ${DIRSRC}/TrkLevel2.cpp \ |
91 |
# ${DIRSRC}/TrkLevel0.cpp |
92 |
LIBCPPSRCS=${DIRSRC}/TrkLevel0.cpp \ |
93 |
${DIRSRC}/TrkStruct.cpp \ |
94 |
${DIRSRC}/TrkProcess.cpp \ |
95 |
${DIRSRC}/TrkVerl2.cpp \ |
96 |
${DIRSRC}/TrkCore.cpp |
97 |
LIBCPPLIBS=$(LIBCPPSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so) |
98 |
#LIBCPPCLIBS=libTrkLevel2 libTrkLevel0 |
99 |
LIBCPPCLIBS=libTrkLevel0 libTrkStruct libTrkProcess libTrkCore libTrkVerl2 |
100 |
FULLCPPCLIBS=$(LIBCPPCLIBS:%=${DIRLIB}/%_${VER}.so) |
101 |
#------------------------------------------------- |
102 |
# librerie F77 NON utilizzabili da root |
103 |
LIBF77SRCS= |
104 |
LIBF77OBJS= $(LIBF77SRCS:${DIRSRC}/F77/%.f=${DIRLIB}/%.o) |
105 |
LIBF77LIBS= $(LIBF77SRCS:${DIRSRC}/F77/%.f=${DIRLIB}/lib%_${VER}.so) |
106 |
LIBF77CLIBS= |
107 |
FULLF77CLIBS=$(LIBF77CLIBS:%=${DIRLIB}/%_${VER}.so) |
108 |
#------------------------------------------------- |
109 |
FULLLIBS=${FULLROOTCLIBS} ${FULLCPPCLIBS} ${FULLF77CLIBS} |
110 |
|
111 |
#------------------------------------------------- |
112 |
# eseguibile |
113 |
CXXEXESRCS=${DIRSRC}/TrackerLevel2.cpp |
114 |
CXXEXEOBJS=$(CXXEXESRCS:${DIRSRC}%.cpp=${DIRLIB}%.o) |
115 |
CXXEXELIBS:=TrackerLevel2 |
116 |
|
117 |
OTHERLIBS=${DIRLIB}/libGLTables.so ${DIRLIB}/libRunInfo.so |
118 |
SUBDIR=../GLTables ../RunInfo |
119 |
SUBINC=$(shell for dir in `echo ${SUBDIR}`; do echo -I$${dir}/inc; done) |
120 |
|
121 |
#------------------------------------------------- |
122 |
# variabili per l'installazione |
123 |
EXESRCS=${DIRBIN}/TrackerLevel2 |
124 |
INCSRCS= \ |
125 |
${DIRINC}/TrkLevel2.h \ |
126 |
${DIRINC}/TrkLevel0.h \ |
127 |
${DIRINC}/TrkStruct.h \ |
128 |
${DIRINC}/TrkProcess.h \ |
129 |
${DIRINC}/TrkCore.h \ |
130 |
${DIRINC}/TrkVerl2.h |
131 |
MACROSSRCS= |
132 |
CALIBFILES= |
133 |
DOCFILES= |
134 |
# Here the Variables used for info target |
135 |
PACKAGE=Tracker flight software |
136 |
EXECUTABLES=${EXESRCS} |
137 |
LIBS= ${FULLLIBS} ${OTHERLIBS} |
138 |
DOCS= |
139 |
SRCS= |
140 |
MACROS= ${MACROSSRCS} |
141 |
INCLUDE= ${INCSRCS} |
142 |
# |
143 |
TOBEDEL = junk |
144 |
ROOTINC=$$${shell root-config --incdir} |
145 |
NROOTINC=${shell root-config --incdir} |
146 |
# Let's start |
147 |
#all : test mkbindir mklibdir mkverpath ${LIBF77LIBS} ${LIBROOTLIBS} ${LIBCPPLIBS} ${FOBJS} ${COBJS} ${CXXEXELIBS} |
148 |
all : test mkbindir mklibdir mkverpath ${LIBF77LIBS} ${LIBROOTLIBS} ${LIBCPPLIBS} |
149 |
all: |
150 |
@echo -e ${GREEN} "" |
151 |
@(${EGREEN} " Finished, now you can install the package \n (use: make install or make upgrade or make forceinstall) "; ${RESET}) |
152 |
@echo -e ${GREEN} "" |
153 |
@${RESET} |
154 |
|
155 |
standalone: all ${CXXEXELIBS} |
156 |
|
157 |
# Here some general rules to produce objects in our local dir |
158 |
${DIRLIB}/%.o: ${DIRSRC}/%.cpp |
159 |
# @(${EYELLOW} " C++ object ------------------------") |
160 |
@(${EGREEN} "Creating C++ object file: "${WHITE} "$@"; ${RESET}) |
161 |
@${CXX} ${CXXFLAGS} -c -o $@ ${DIRSRC}/`basename ${@} .o`.cpp -I${DIRTOP}/${DIRINC} -I${SUBINC} -I${PAM_YODA}/include/yoda/ `root-config --cflags` |
162 |
|
163 |
${DIRLIB}/%.o : ${DIRSRC}/F77/%.f |
164 |
# @(${EYELLOW} " F77 object ------------------------") |
165 |
@(${EGREEN} "Creating F77 object file: "${WHITE} "$@"; ${RESET}) |
166 |
@${F77} ${F77FLAGS} -c -o $@ ${DIRSRC}/F77/`basename ${@} .o`.f -I${DIRTOP}/${DIRINC}/F77 -I${NROOTINC} -I${PAM_YODA}/include/yoda -I${SUBINC} |
167 |
|
168 |
# .so from .o fortran |
169 |
${LIBF77LIBS}: ${LIBF77OBJS} |
170 |
@(${EYELLOW} " F77 shared library --------------------------") |
171 |
@(${EGREEN} "Creating library: "${WHITE} "$@"; ${RESET}) |
172 |
@${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ $^ -lg2c `cernlib mathlib` |
173 |
|
174 |
${LIBROOTLIBS}: ${LIBROOTSRCS} ${FOBJS} |
175 |
@(${EYELLOW} " ROOT library ------------------------") |
176 |
@(${EGREEN} "Creating file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp"; ${RESET}) |
177 |
# |
178 |
# Create *Dict.cpp and *Dict.h |
179 |
# |
180 |
@${ROOTCINT} -f ${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp -c -I${ROOTINC} -I${PAM_YODA}/include/yoda/ ${DIRINC}/`basename $(@F) _${VER}.so | sed s/lib//`.h ${DIRINC}/`basename $(@F) _${VER}.so | sed s/lib//`LinkDef.h |
181 |
# |
182 |
# create .o |
183 |
# |
184 |
@(${EGREEN} "Compiling file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`.cpp"; ${RESET}) |
185 |
@${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${NROOTINC}; |
186 |
@(${EGREEN} "Compiling file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp"; ${RESET}) |
187 |
@${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}; |
188 |
@ln -sf ${DIRTOP}/${DIRLIB}/$(@F) ${DIRTOP}/${DIRLIB}/$(patsubst %_${VER}.so,%.so,$(@F)) |
189 |
# |
190 |
# create .so |
191 |
# |
192 |
@(${EGREEN} "Compiling shared library: "${WHITE} "$@"; ${RESET}) |
193 |
@${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 |
194 |
# ${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 |
195 |
@ln -sf ${DIRTOP}/${DIRLIB}/$(@F) ${DIRTOP}/${DIRLIB}/$(patsubst %_${VER}.so,%.so,$(@F)) |
196 |
@(${EYELLOW} " -------------------------------------") |
197 |
|
198 |
${LIBCPPLIBS}: ${LIBCPPSRCS} |
199 |
# |
200 |
# create .o |
201 |
# |
202 |
@(${EGREEN} "Compiling file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`.cpp"; ${RESET}) |
203 |
@${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${NROOTINC}; |
204 |
# |
205 |
# create .so |
206 |
# |
207 |
@(${EGREEN} "Compiling shared library: "${WHITE} "$@"; ${RESET}) |
208 |
@${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ -lg2c -I${DIRTOP}/${DIRINC} -I${PAM_YODA}/include/yoda/ -I${SUBINC} ${DIRTOP}/${DIRLIB}/`basename $(@F) _${VER}.so | sed s/lib//`.o ${OTHERLIBS} 1>/dev/null |
209 |
@ln -sf ${DIRTOP}/${DIRLIB}/$(@F) ${DIRTOP}/${DIRLIB}/$(patsubst %_${VER}.so,%.so,$(@F)) |
210 |
|
211 |
|
212 |
${CXXEXELIBS}: ${COBJS} ${FOBJS} ${CXXEXEOBJS} |
213 |
@(${EVIOLET} "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *") |
214 |
@(${EGREEN} "Creating exec file: "${WHITE} "$@"; ${RESET}) |
215 |
@${CXX} ${CXXFLAGS} -o ${DIRBIN}/$@ ${DIRLIB}/$@.o -I${DIRTOP}/${DIRINC} ${SUBINC} -I${PAM_YODA}/include/yoda/ ${PAM_YODA}/lib/libyoda.so ${FOBJS} ${COBJS} ${FULLLIBS} ${OTHERLIBS} -lThread `root-config --cflags --glibs` `cernlib mathlib` ; |
216 |
|
217 |
|
218 |
# A small target to check environmental variables |
219 |
%_env: |
220 |
@${test_env} |
221 |
|
222 |
.PHONY: install installdoc installlib installmacros installinc installexe installcmacro |
223 |
.PHONY: clean depclean info mkbindir mklibdir testcern testpamenv test |
224 |
|
225 |
mkbindir: ${DIRBIN} |
226 |
${DIRBIN}: |
227 |
@${test_and_mk} |
228 |
|
229 |
mklibdir: ${DIRLIB} |
230 |
${DIRLIB}: |
231 |
@${test_and_mk} |
232 |
|
233 |
# Here what has to be deleted in clean target |
234 |
clean: TOBEDEL= ${DIRSRC}/*.o ${DIRSRC}/*Dict.cpp ${DIRSRC}/*Dict.h ${FOBJS} ${FULLLIBS} ${DIRBIN}/${CXXEXELIBS} ${COBJS} ${CXXEXEOBJS} ${DIRSRC}/TrkVerl2.cpp |
235 |
clean: |
236 |
@${test_and_rm} |
237 |
|
238 |
distclean: clean |
239 |
distclean: TOBEDEL= ${DIRBIN} ${DIRLIB} |
240 |
distclean: |
241 |
@${test_and_rm} |
242 |
|
243 |
forceinstall: FORCE=-f |
244 |
forceinstall: install |
245 |
|
246 |
upgrade: FORCE=-u |
247 |
upgrade: install |
248 |
upgradestandalone: FORCE=-u |
249 |
upgradestandalone: installstandalone |
250 |
|
251 |
install: installlib installinc installmacros installcalib installdoc installcmacro |
252 |
installstandalone: install installexe |
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 |
@${test_and_cp} |
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}/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 |
293 |
@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 |
294 |
@sleep 0.8 |
295 |
|
296 |
|
297 |
|
298 |
info: |
299 |
@echo " " |
300 |
@${EGREEN} "Infos for package :" ${WHITE} ${PACKAGE} |
301 |
@${EGREEN} " VERSION :" ${WHITE} ${VER} |
302 |
@${EGREEN} " EXECUTABLES :" ${WHITE} ${EXECUTABLES} |
303 |
@${EGREEN} " INCLUDES :" ${WHITE} ${INCLUDE} |
304 |
@${EGREEN} " LIBS :" ${WHITE} ${LIBS} |
305 |
@${EGREEN} " DOCS :" ${WHITE} ${DOCS} |
306 |
@${EGREEN} " SRCS :" ${WHITE} ${SRCS} |
307 |
@${EGREEN} " MACROS :" ${WHITE} ${MACROS} |
308 |
@echo " " |
309 |
@${RESET} |
310 |
|
311 |
test: testpamenv |
312 |
|
313 |
testpamenv: ${PAM_ENV} |
314 |
|
315 |
root-config: OPT=--cflags |
316 |
root-config: |
317 |
@${test_cmd} |
318 |
|
319 |
# Here follows some usefull macros |
320 |
define test_and_cp |
321 |
wd=`pwd`;\ |
322 |
for i in ${TOBEMOVED} ; do \ |
323 |
wv=$${i##/*/}; \ |
324 |
dest=$${i/$${wv}/}; \ |
325 |
${EGREEN} "Testing for :" ${WHITE} "$${i}" ; ${RESET}; \ |
326 |
if [ ! "${FORCE}" ] ; then \ |
327 |
if [ ! -f $${i} ]; then \ |
328 |
${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
329 |
${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \ |
330 |
cp ${ORIGIN}/$${i##/*/} $${i}; \ |
331 |
else \ |
332 |
${ERED} "File already exist !!!! Please delete it " ${WHITE}; ${RESET}; \ |
333 |
fi;\ |
334 |
else \ |
335 |
if [ "${FORCE}" == "-u" ] ; then \ |
336 |
if [ "`basename $${i}`" != "`basename $${i} _${VER}.so`" ]; then \ |
337 |
${EYELLOW} "Removing: "${WHITE} ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so; ${RESET}; \ |
338 |
rm -f ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so ; \ |
339 |
${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
340 |
${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \ |
341 |
cp ${ORIGIN}/$${i##/*/} $${i}; \ |
342 |
else \ |
343 |
${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
344 |
${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \ |
345 |
cp -f ${ORIGIN}/$${i##/*/} $${i}; \ |
346 |
fi; \ |
347 |
else \ |
348 |
${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
349 |
${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \ |
350 |
cp ${FORCE} ${ORIGIN}/$${i##/*/} $${i}; \ |
351 |
fi;\ |
352 |
fi ;\ |
353 |
if [ ! -z ${LINK} ] ; then \ |
354 |
${EGREEN} "Creating symlink from : "${WHITE} $${wv/_${VER}/} ;\ |
355 |
${EGREEN} " to : "${WHITE} $${i##/*/} ; ${RESET}; \ |
356 |
cd $${dest}; \ |
357 |
ln -sf $${wv} $${wv/_${VER}/}; \ |
358 |
cd $${wd}; \ |
359 |
fi \ |
360 |
done |
361 |
endef |
362 |
|
363 |
define test_and_mk |
364 |
${EGREEN} "Testing for :" ${WHITE} "$@"; ${RESET} |
365 |
test -d "$@" || \ |
366 |
(${EGREEN} "Creating : "${WHITE} "$@"; ${RESET}; mkdir -p $@) |
367 |
endef |
368 |
|
369 |
define test_env |
370 |
${EGREEN} "Testing for env:" ${WHITE} $(patsubst %_env,%,$@); ${RESET} |
371 |
printenv $(patsubst %_env,%,$@) 1>/dev/null || \ |
372 |
(${ERED} "ERROR, variable : "${WHITE} $(patsubst %_env,%,$@) \ |
373 |
${RED} "not defined !!! Check your env. settings"; \ |
374 |
${RESET}; exit 1) |
375 |
${EGREEN} " Defined:" ${WHITE} $${$(patsubst %_env,%,$@)}; ${RESET} |
376 |
endef |
377 |
|
378 |
define test_cmd |
379 |
${EGREEN} "Testing for cmd:" ${WHITE} $@ ${OPT}; ${RESET} |
380 |
$@ ${OPT} 1>/dev/null 2>&1 || \ |
381 |
(${ERED} "ERROR, command : "${WHITE} $@ ${OPT}\ |
382 |
${RED} "not found !!! Check your installation"; \ |
383 |
${RESET}; exit 1) |
384 |
${EGREEN} " Present:" ${WHITE} $@ ${OPT}; ${RESET} |
385 |
endef |
386 |
|
387 |
define test_and_rm |
388 |
for i in ${TOBEDEL}; do \ |
389 |
test -d $${i} || (${ERED} "Removing file :"${WHITE} $${i}; ${RESET}; \ |
390 |
rm -f $${i} ); \ |
391 |
test ! -d $${i} || (${ERED} "Removing dir :"${WHITE} $${i}; ${RESET}; \ |
392 |
rm -rf $${i} ); \ |
393 |
done |
394 |
endef |