1 |
# Calorimeter flight analysis software |
2 |
# SOFTWARE VERSION |
3 |
VER= v6r00 |
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 |
# C |
25 |
CC=gcc |
26 |
#CFLAGS=-Wall -O -fPIC -pthread -g ${PAM_BIT} |
27 |
CFLAGS=-Wall -O3 -funroll-loops -fPIC -pthread ${PAM_BIT} |
28 |
#CFLAGS=-Wall -O4 -fPIC -pthread ${PAM_BIT} |
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 ${PAM_BIT} |
36 |
#F77FLAGS= -fforce-addr -funroll-all-loops -ffinite-math-only -Wall -funroll-loops -Wno-globals -fPIC -fvxt -fno-automatic -fbounds-check -extend_source -static -fno-backslash ${PAM_BIT} |
37 |
F77FLAGS= -O1 -fforce-addr -funroll-all-loops -ffinite-math-only -Wall -funroll-loops -Wno-globals -fPIC -fvxt -fno-automatic -fbounds-check -extend_source -static -fno-backslash ${PAM_BIT} |
38 |
#F77FLAGS= -g -fforce-addr -funroll-all-loops -ffinite-math-only -Wall -funroll-loops -Wno-globals -fPIC -fvxt -fno-automatic -fbounds-check -extend_source -static -fno-backslash ${PAM_BIT} |
39 |
#F77FLAGS= -Wall -Wno-globals -fPIC -fvxt -fno-automatic -fbounds-check -extend_source -static -fno-backslash ${PAM_BIT} |
40 |
# C++ |
41 |
CXX=g++ |
42 |
#CXXFLAGS=-Wall -O -fPIC -pthread -g ${PAM_BIT} |
43 |
CXXFLAGS=-Wall -O3 -funroll-loops -fPIC -pthread ${PAM_BIT} |
44 |
#CXXFLAGS=-Wall -g -funroll-loops -fPIC -pthread ${PAM_BIT} |
45 |
#CXXFLAGS=-Wall -fPIC -pthread ${PAM_BIT} |
46 |
# ROOTCINT |
47 |
ROOTCINT=rootcint |
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=calib |
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_YODA_env |
61 |
|
62 |
# Here the local variables used to build the targets |
63 |
# -- F77 - no libraries -- |
64 |
FSRCS=${DIRSRC}/direction.for \ |
65 |
${DIRSRC}/lastriscia.for \ |
66 |
${DIRSRC}/millim.for \ |
67 |
${DIRSRC}/nshower.for \ |
68 |
${DIRSRC}/nointer.for \ |
69 |
${DIRSRC}/elio.for \ |
70 |
${DIRSRC}/nuclei.for \ |
71 |
${DIRSRC}/cluster.for \ |
72 |
${DIRSRC}/cluster2.for \ |
73 |
${DIRSRC}/cluster4.for \ |
74 |
${DIRSRC}/laterale.for \ |
75 |
${DIRSRC}/baric.for \ |
76 |
${DIRSRC}/selftrig.for \ |
77 |
${DIRSRC}/calol2cm.for \ |
78 |
${DIRSRC}/calol2tr.for |
79 |
FOBJS=$(FSRCS:${DIRSRC}%.for=${DIRLIB}%.o) |
80 |
|
81 |
# -- CPP - no libraries -- |
82 |
CPPSRCS= |
83 |
CPPOBJS=$(CPPSRCS:${DIRSRC}%.cpp=${DIRLIB}%.o) |
84 |
|
85 |
# -- C - no libraries -- |
86 |
CSRCS=${DIRSRC}/delay.c |
87 |
COBJS=$(CSRCS:${DIRSRC}%.c=${DIRLIB}%.o) |
88 |
|
89 |
# -- CPP - ROOT libraries -- |
90 |
LIBROOTSRCS=${DIRSRC}/CaloLevel0.cpp \ |
91 |
${DIRSRC}/CaloLevel1.cpp \ |
92 |
${DIRSRC}/CaloLevel2.cpp |
93 |
|
94 |
LIBROOTLIBS=$(LIBROOTSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so) |
95 |
#LIBROOTOBJS=${DIRLIB}/millim.o |
96 |
LIBROOTOBJS=${FOBJS} ${COBJS} |
97 |
LIBROOTCLIBS=libCaloLevel2 libCaloLevel1 libCaloLevel0 |
98 |
FULLROOTCLIBS=$(LIBROOTCLIBS:%=${DIRLIB}/%_${VER}.so) |
99 |
|
100 |
# -- CPP - NON-ROOT libraries -- |
101 |
LIBCPPSRCS=${DIRSRC}/CaloCore.cpp \ |
102 |
${DIRSRC}/CaloVerl2.cpp |
103 |
LIBCPPLIBS=$(LIBCPPSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so) |
104 |
LIBCPPCLIBS=libCaloCore libCaloVerl2 |
105 |
FULLLIBCPPLIBS=$(LIBCPPCLIBS:%=${DIRLIB}/%_${VER}.so) |
106 |
|
107 |
# -- CPP - Executables -- |
108 |
CXXEXESRCS=${DIRSRC}/CalorimeterLevel2.cpp |
109 |
CXXEXEOBJS=$(CXXEXESRCS:${DIRSRC}%.cpp=${DIRLIB}%.o) |
110 |
CXXEXELIBS:=CalorimeterLevel2 |
111 |
|
112 |
# -- list of tracker objects needed to link |
113 |
TRKOBJS=${DIRLIB}/libTrkLevel2.so ${PAM_LIB}/libGLTables.so ${DIRLIB}/libRunInfo.so |
114 |
|
115 |
# -- directory where to find tracker headers needed to compile |
116 |
SUBDIR=../RunInfo ../TrackerLevel2 |
117 |
SUBINC=$(shell for dir in `echo ${SUBDIR}`; do echo -I$${dir}/inc; done) |
118 |
|
119 |
# List of all libraries we want to install |
120 |
FULLLIBS = ${FULLROOTCLIBS} ${FULLLIBCPPLIBS} |
121 |
|
122 |
# Other objects to install |
123 |
EXESRCS=${DIRBIN}/CalorimeterLevel2 |
124 |
|
125 |
INCSRCS=${DIRINC}/CaloLevel0.h ${DIRINC}/CaloLevel1.h ${DIRINC}/CaloLevel2.h ${DIRINC}/CaloStruct.h ${DIRINC}/CaloCore.h ${DIRINC}/INTEST.TXT |
126 |
|
127 |
MACROSSRCS= |
128 |
|
129 |
CALIBFILES= |
130 |
|
131 |
DOCFILES= |
132 |
|
133 |
# Here the Variables used for info target |
134 |
PACKAGE=Calorimeter analysis flight software |
135 |
EXECUTABLES= ${EXESRCS} |
136 |
LIBS= ${FULLLIBS} |
137 |
DOCS= |
138 |
SRCS= |
139 |
#SRCS= ${FSRCS} ${CRSCS} ${CXXEXESRCS} ${LIBROOTSRCS} ${LIBCPPSRCS} |
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 ${FOBJS} ${CPPOBJS} ${LIBROOTLIBS} ${LIBCPPLIBS} ${CXXEXELIBS} |
148 |
all: prepare libs |
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 exe |
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} ${SUBINC} -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} ${COBJS} ${FOBJS} |
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${DIRINC} -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 |
@${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${PAM_INC}/ -I${NROOTINC}; |
187 |
@(${EGREEN} "Compiling CPP 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} ${SUBINC} -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/ ${SUBINC} -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} 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 |
@${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${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} ${SUBINC} -I${PAM_YODA}/include/yoda/ -I${PAM_INC}/ ${DIRTOP}/${DIRLIB}/`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 |
@(${EGREEN} "Creating exec file: "${WHITE} "$@"; ${RESET}) |
211 |
# @${CXX} ${CXXFLAGS} -o ${DIRBIN}/$@ ${DIRLIB}/$@.o ${FULLROOTCLIBS} ${FULLLIBCPPLIBS} ${CPPOBJS} ${FOBJS} ${TRKOBJS} ${PAM_YODA}/lib/libyoda.so -I${DIRINC} ${SUBINC} -I${PAM_YODA}/include/yoda/ -lThread `root-config --cflags --glibs` `cernlib mathlib` |
212 |
@${CXX} ${CXXFLAGS} -o ${DIRBIN}/$@ ${DIRLIB}/$@.o ${FULLROOTCLIBS} ${FULLLIBCPPLIBS} ${TRKOBJS} ${CPPOBJS} ${COBJS} ${FOBJS} ${PAM_YODA}/lib/libyoda.so -lThread `root-config --cflags --glibs` `cernlib mathlib` |
213 |
|
214 |
# A small target to check environmental variables |
215 |
%_env: |
216 |
@${test_env} |
217 |
|
218 |
.PHONY: install installdoc installlib installmacros installinc installexe installcmacro |
219 |
.PHONY: clean depclean info mkbindir mklibdir testcern testpamenv test |
220 |
|
221 |
mkbindir: ${DIRBIN} |
222 |
${DIRBIN}: |
223 |
@${test_and_mk} |
224 |
|
225 |
mklibdir: ${DIRLIB} |
226 |
${DIRLIB}: |
227 |
@${test_and_mk} |
228 |
|
229 |
# Here what has to be deleted in clean target |
230 |
clean: TOBEDEL= ${DIRSRC}/*.o ${DIRSRC}/*Dict.cpp ${DIRSRC}/*Dict.h ${FOBJS} ${FULLLIBS} ${DIRBIN}/${CXXEXELIBS} ${CPPOBJS} ${CXXEXEOBJS} ${FULLLINKCLIBS} ${FULLMACROCLIBS} ${FULLLINKMACROCLIBS} ${DIRSRC}/CaloVerl2.cpp |
231 |
clean: |
232 |
@${test_and_rm} |
233 |
|
234 |
distclean: clean |
235 |
distclean: TOBEDEL= ${DIRBIN} ${DIRLIB} |
236 |
distclean: |
237 |
@${test_and_rm} |
238 |
|
239 |
forceinstall: FORCE=-f |
240 |
forceinstall: install |
241 |
forceinstallstandalone: FORCE=-f |
242 |
forceinstallstandalone: installstandalone |
243 |
|
244 |
upgrade: FORCE=-u |
245 |
upgrade: install |
246 |
upgradestandalone: FORCE=-u |
247 |
upgradestandalone: installstandalone |
248 |
|
249 |
install: installlib installinc installmacros installcalib installdoc installcmacro |
250 |
|
251 |
installstandalone: install installexe |
252 |
|
253 |
installlib: LINK=y |
254 |
installlib: TOBEMOVED= $(FULLLIBS:${DIRLIB}%=${PAM_LIB}%) |
255 |
installlib: ORIGIN=${DIRLIB} |
256 |
installlib: |
257 |
@${test_and_cp} |
258 |
|
259 |
installcmacro: LINK=y |
260 |
installcmacro: TOBEMOVED= $(FULLMACROCLIBS:${DIRLIB}%=${PAM_LIB}%) |
261 |
installcmacro: ORIGIN=${DIRLIB} |
262 |
installcmacro: |
263 |
@${test_and_cp} |
264 |
|
265 |
installinc: TOBEMOVED= $(INCSRCS:${DIRINC}/%=${PAM_INC}/%) |
266 |
installinc: ORIGIN=${DIRINC} |
267 |
installinc: |
268 |
@${test_and_cp} |
269 |
|
270 |
installexe: TOBEMOVED= $(EXESRCS:${DIRBIN}/%=${PAM_BIN}/%) |
271 |
installexe: ORIGIN=${DIRBIN} |
272 |
installexe: |
273 |
@${test_and_cp} |
274 |
|
275 |
installmacros: TOBEMOVED= $(MACROSSRCS:${DIRMACROS}/%=${PAM_MACROS}/%) |
276 |
installmacros: ORIGIN=${DIRMACROS} |
277 |
installmacros: |
278 |
@${test_and_cp} |
279 |
|
280 |
installcalib: TOBEMOVED= $(CALIBFILES:${DIRCALIB}/%=${PAM_CALIB}/%) |
281 |
installcalib: ORIGIN=${DIRCALIB} |
282 |
installcalib: |
283 |
@${test_and_cp} |
284 |
|
285 |
installdoc: TOBEMOVED= $(DOCFILES:${DIRDOC}/%=${PAM_DOC}/%) |
286 |
installdoc: ORIGIN=${DIRDOC} |
287 |
installdoc: |
288 |
@${test_and_cp} |
289 |
|
290 |
mkverpath: |
291 |
@echo '#include <TSystem.h>' > ${DIRTOP}/${DIRSRC}/CaloVerl2.cpp; echo ' char *CaloInfo(bool print){ if ( print ) printf("\nCalorimeter Level2 flight package version: ${VER}\n\nCompiled on '${TODAY}' with: '${GCCVER}'\n\nOn: '${UNAMEA}'\n\n"); return("${VER}"); }' >> ${DIRTOP}/${DIRSRC}/CaloVerl2.cpp |
292 |
@sleep 0.8 |
293 |
|
294 |
|
295 |
|
296 |
info: |
297 |
@echo " " |
298 |
@${EGREEN} "Infos for package :" ${WHITE} ${PACKAGE} |
299 |
@${EGREEN} " VERSION :" ${WHITE} ${VER} |
300 |
@${EGREEN} " EXECUTABLES :" ${WHITE} ${EXECUTABLES} |
301 |
@${EGREEN} " LIBS :" ${WHITE} ${LIBS} |
302 |
@${EGREEN} " DOCS :" ${WHITE} ${DOCS} |
303 |
@${EGREEN} " SRCS :" ${WHITE} ${SRCS} |
304 |
@${EGREEN} " MACROS :" ${WHITE} ${MACROS} |
305 |
@${EGREEN} " INCLUDE :" ${WHITE} ${INCLUDE} |
306 |
@echo " " |
307 |
@${RESET} |
308 |
|
309 |
test: testpamenv |
310 |
|
311 |
testpamenv: ${PAM_ENV} |
312 |
|
313 |
root-config: OPT=--cflags |
314 |
root-config: |
315 |
@${test_cmd} |
316 |
|
317 |
# Here follows some usefull macros |
318 |
define test_and_cp |
319 |
wd=`pwd`;\ |
320 |
for i in ${TOBEMOVED} ; do \ |
321 |
wv=$${i##/*/}; \ |
322 |
dest=$${i/$${wv}/}; \ |
323 |
${EGREEN} "Testing for :" ${WHITE} "$${i}" ; ${RESET}; \ |
324 |
if [ ! "${FORCE}" ] ; then \ |
325 |
if [ ! -f $${i} ]; then \ |
326 |
${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
327 |
${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \ |
328 |
cp ${ORIGIN}/$${i##/*/} $${i}; \ |
329 |
else \ |
330 |
${ERED} "File already exist !!!! Please delete it " ${WHITE}; ${RESET}; \ |
331 |
fi;\ |
332 |
else \ |
333 |
if [ "${FORCE}" == "-u" ] ; then \ |
334 |
if [ "`basename $${i}`" != "`basename $${i} _${VER}.so`" ]; then \ |
335 |
${EYELLOW} "Removing: "${WHITE} ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so; ${RESET}; \ |
336 |
rm -f ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so ; \ |
337 |
${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
338 |
${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \ |
339 |
cp ${ORIGIN}/$${i##/*/} $${i}; \ |
340 |
else \ |
341 |
${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
342 |
${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \ |
343 |
cp -f ${ORIGIN}/$${i##/*/} $${i}; \ |
344 |
fi; \ |
345 |
else \ |
346 |
${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
347 |
${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \ |
348 |
cp ${FORCE} ${ORIGIN}/$${i##/*/} $${i}; \ |
349 |
fi;\ |
350 |
fi ;\ |
351 |
if [ ! -z ${LINK} ] ; then \ |
352 |
${EGREEN} "Creating symlink from : "${WHITE} $${wv/_${VER}/} ;\ |
353 |
${EGREEN} " to : "${WHITE} $${i##/*/} ; ${RESET}; \ |
354 |
cd $${dest}; \ |
355 |
ln -sf $${wv} $${wv/_${VER}/}; \ |
356 |
cd $${wd}; \ |
357 |
fi \ |
358 |
done |
359 |
endef |
360 |
|
361 |
define test_and_mk |
362 |
${EGREEN} "Testing for :" ${WHITE} "$@"; ${RESET} |
363 |
test -d "$@" || \ |
364 |
(${EGREEN} "Creating : "${WHITE} "$@"; ${RESET}; mkdir -p $@) |
365 |
endef |
366 |
|
367 |
define test_env |
368 |
${EGREEN} "Testing for env:" ${WHITE} $(patsubst %_env,%,$@); ${RESET} |
369 |
printenv $(patsubst %_env,%,$@) 1>/dev/null || \ |
370 |
(${ERED} "ERROR, variable : "${WHITE} $(patsubst %_env,%,$@) \ |
371 |
${RED} "not defined !!! Check your env. settings"; \ |
372 |
${RESET}; exit 1) |
373 |
${EGREEN} " Defined:" ${WHITE} $${$(patsubst %_env,%,$@)}; ${RESET} |
374 |
endef |
375 |
|
376 |
define test_cmd |
377 |
${EGREEN} "Testing for cmd:" ${WHITE} $@ ${OPT}; ${RESET} |
378 |
$@ ${OPT} 1>/dev/null 2>&1 || \ |
379 |
(${ERED} "ERROR, command : "${WHITE} $@ ${OPT}\ |
380 |
${RED} "not found !!! Check your installation"; \ |
381 |
${RESET}; exit 1) |
382 |
${EGREEN} " Present:" ${WHITE} $@ ${OPT}; ${RESET} |
383 |
endef |
384 |
|
385 |
define test_and_rm |
386 |
for i in ${TOBEDEL}; do \ |
387 |
test -d $${i} || (${ERED} "Removing file :"${WHITE} $${i}; ${RESET}; \ |
388 |
rm -f $${i} ); \ |
389 |
test ! -d $${i} || (${ERED} "Removing dir :"${WHITE} $${i}; ${RESET}; \ |
390 |
rm -rf $${i} ); \ |
391 |
done |
392 |
endef |