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