1 |
# Calorimeter flight analysis software |
2 |
# SOFTWARE VERSION |
3 |
VER= v4r04 |
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 |
27 |
CFLAGS=-Wall -O4 -fPIC -pthread |
28 |
# Enviroment: |
29 |
GCCVER=`gcc --version | head -1` |
30 |
UNAMEA=`uname -a` |
31 |
TODAY=`date` |
32 |
# F77 |
33 |
F77=g77 |
34 |
#F77FLAGS= -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -g -extend_source -static -fno-backslash |
35 |
F77FLAGS= -Wall -Wno-globals -fPIC -fvxt -fno-automatic -fbounds-check -extend_source -static -fno-backslash |
36 |
# C++ |
37 |
CXX=g++ |
38 |
#CXXFLAGS=-Wall -O -fPIC -pthread -g |
39 |
CXXFLAGS=-Wall -O4 -fPIC -pthread |
40 |
# ROOTCINT |
41 |
ROOTCINT=rootcint |
42 |
# Here the variables definig the local directories |
43 |
DIRTOP=${shell pwd} |
44 |
DIRLIB=../lib/${ARCH} |
45 |
DIRBIN=../bin/${ARCH} |
46 |
#DIRLIB=lib/${ARCH} |
47 |
#DIRBIN=bin/${ARCH} |
48 |
DIRSRC=src |
49 |
DIRINC=inc |
50 |
DIRDOC=doc |
51 |
DIRMACROS=macros |
52 |
DIRCALIB=calib |
53 |
# Here the PAMELA environmental variables to be checked |
54 |
PAM_ENV= PAM_BIN_env PAM_LIB_env PAM_INC_env PAM_DOC_env PAM_YODA_env |
55 |
|
56 |
# Here the local variables used to build the targets |
57 |
# -- F77 - no libraries -- |
58 |
FSRCS=${DIRSRC}/direction.for \ |
59 |
${DIRSRC}/lastriscia.for \ |
60 |
${DIRSRC}/millim.for \ |
61 |
${DIRSRC}/nshower.for \ |
62 |
${DIRSRC}/nointer.for \ |
63 |
${DIRSRC}/elio.for \ |
64 |
${DIRSRC}/nuclei.for \ |
65 |
${DIRSRC}/cluster.for \ |
66 |
${DIRSRC}/cluster2.for \ |
67 |
${DIRSRC}/laterale.for \ |
68 |
${DIRSRC}/baric.for \ |
69 |
${DIRSRC}/selftrig.for \ |
70 |
${DIRSRC}/calol2cm.for \ |
71 |
${DIRSRC}/calol2tr.for |
72 |
FOBJS=$(FSRCS:${DIRSRC}%.for=${DIRLIB}%.o) |
73 |
|
74 |
# -- CPP - no libraries -- |
75 |
CPPSRCS= |
76 |
CPPOBJS=$(CPPSRCS:${DIRSRC}%.cpp=${DIRLIB}%.o) |
77 |
|
78 |
# -- C - no libraries -- |
79 |
CSRCS=${DIRSRC}/delay.c |
80 |
COBJS=$(CSRCS:${DIRSRC}%.c=${DIRLIB}%.o) |
81 |
|
82 |
# -- CPP - ROOT libraries -- |
83 |
LIBROOTSRCS=${DIRSRC}/CaloLevel1.cpp \ |
84 |
${DIRSRC}/CaloLevel2.cpp |
85 |
|
86 |
LIBROOTLIBS=$(LIBROOTSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so) |
87 |
LIBROOTOBJS=${DIRLIB}/millim.o |
88 |
LIBROOTCLIBS=libCaloLevel2 libCaloLevel1 |
89 |
FULLROOTCLIBS=$(LIBROOTCLIBS:%=${DIRLIB}/%_${VER}.so) |
90 |
|
91 |
# -- CPP - NON-ROOT libraries -- |
92 |
LIBCPPSRCS=${DIRSRC}/CaloProcessing.cpp \ |
93 |
${DIRSRC}/CaloCore.cpp \ |
94 |
${DIRSRC}/CaloVerl2.cpp |
95 |
LIBCPPLIBS=$(LIBCPPSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so) |
96 |
LIBCPPCLIBS=libCaloProcessing libCaloCore libCaloVerl2 |
97 |
FULLLIBCPPLIBS=$(LIBCPPCLIBS:%=${DIRLIB}/%_${VER}.so) |
98 |
|
99 |
# -- CPP - Executables -- |
100 |
CXXEXESRCS=${DIRSRC}/CalorimeterLevel2.cpp |
101 |
CXXEXEOBJS=$(CXXEXESRCS:${DIRSRC}%.cpp=${DIRLIB}%.o) |
102 |
CXXEXELIBS:=CalorimeterLevel2 |
103 |
|
104 |
# -- list of tracker objects needed to link |
105 |
TRKOBJS=${DIRLIB}/libTrkLevel2.so ${PAM_LIB}/libGLTables.so ${DIRLIB}/libRunInfo.so |
106 |
|
107 |
# -- directory where to find tracker headers needed to compile |
108 |
SUBDIR=../RunInfo ../TrackerLevel2 |
109 |
SUBINC=$(shell for dir in `echo ${SUBDIR}`; do echo -I$${dir}/inc; done) |
110 |
|
111 |
# List of all libraries we want to install |
112 |
FULLLIBS = ${FULLROOTCLIBS} ${FULLLIBCPPLIBS} |
113 |
|
114 |
# Other objects to install |
115 |
EXESRCS=${DIRBIN}/CalorimeterLevel2 |
116 |
|
117 |
INCSRCS=${DIRINC}/CaloLevel1.h ${DIRINC}/CaloLevel2.h ${DIRINC}/CaloStruct.h ${DIRINC}/CaloProcessing.h ${DIRINC}/CaloCore.h |
118 |
|
119 |
MACROSSRCS= |
120 |
|
121 |
CALIBFILES= |
122 |
|
123 |
DOCFILES= |
124 |
|
125 |
# Here the Variables used for info target |
126 |
PACKAGE=Calorimeter analysis flight software |
127 |
EXECUTABLES= ${EXESRCS} |
128 |
LIBS= ${FULLLIBS} |
129 |
DOCS= |
130 |
SRCS= |
131 |
#SRCS= ${FSRCS} ${CRSCS} ${CXXEXESRCS} ${LIBROOTSRCS} ${LIBCPPSRCS} |
132 |
MACROS= ${MACROSSRCS} |
133 |
INCLUDE= ${INCSRCS} |
134 |
# |
135 |
TOBEDEL = junk |
136 |
ROOTINC=$$${shell root-config --incdir} |
137 |
NROOTINC=${shell root-config --incdir} |
138 |
# Let's start |
139 |
#all: test mkbindir mklibdir mkverpath ${FOBJS} ${CPPOBJS} ${LIBROOTLIBS} ${LIBCPPLIBS} ${CXXEXELIBS} |
140 |
all: prepare libs |
141 |
all: |
142 |
@echo -e ${GREEN} "" |
143 |
@(${EGREEN} " Finished, now you can install the package \n (use: make install or make upgrade or make forceinstall) "; ${RESET}) |
144 |
@echo -e ${GREEN} "" |
145 |
@${RESET} |
146 |
|
147 |
standalone: all exe |
148 |
|
149 |
prepare: test mkbindir mklibdir mkverpath |
150 |
|
151 |
exe: prepare ${CXXEXELIBS} |
152 |
|
153 |
libs: prepare ${LIBROOTLIBS} ${LIBCPPLIBS} |
154 |
|
155 |
# Here some general rules to produce objects in our local dir |
156 |
${DIRLIB}/%.o: ${DIRSRC}/%.cpp |
157 |
@(${EGREEN} "Creating CPP object file: "${WHITE} "`basename $@`"; ${RESET}) |
158 |
@${CXX} ${CXXFLAGS} -c -o $@ ${DIRSRC}/`basename ${@} .o`.cpp -I${DIRINC} ${SUBINC} -I${PAM_YODA}/include/yoda/ -I${PAM_INC}/ `root-config --cflags` |
159 |
|
160 |
${DIRLIB}/%.o: ${DIRSRC}/%.c |
161 |
@(${EGREEN} "Creating C object file: "${WHITE} "`basename $@`"; ${RESET}) |
162 |
@${CXX} ${CXXFLAGS} -c -o $@ ${DIRSRC}/`basename ${@} .o`.c -I${DIRINC} ${SUBINC} -I${PAM_YODA}/include/yoda/ -I${PAM_INC}/ `root-config --cflags` |
163 |
|
164 |
${DIRLIB}/%.o: ${DIRSRC}/%.for |
165 |
@(${EGREEN} "Creating F77 object file: "${WHITE} "`basename $@`"; ${RESET}) |
166 |
@${F77} ${F77FLAGS} -c -o $@ ${DIRSRC}/`basename ${@} .o`.for -I${DIRINC} |
167 |
|
168 |
${LIBROOTLIBS}: ${LIBROOTSRCS} ${FOBJS} |
169 |
@(${EGREEN} "ROOTCINT - creating file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp"; ${RESET}) |
170 |
# |
171 |
# Create *Dict.cpp and *Dict.h |
172 |
# |
173 |
@${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 |
174 |
# |
175 |
# create .o |
176 |
# |
177 |
@(${EGREEN} "Compiling CPP file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`.cpp"; ${RESET}) |
178 |
@${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}; |
179 |
@(${EGREEN} "Compiling CPP file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp"; ${RESET}) |
180 |
@${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}; |
181 |
# |
182 |
# create .so |
183 |
# |
184 |
@(${EGREEN} "Creating shared library: "${WHITE} "`basename $@`"; ${RESET}) |
185 |
@${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 |
186 |
@ln -sf ${DIRTOP}/${DIRLIB}/$(@F) ${DIRTOP}/${DIRLIB}/$(patsubst %_${VER}.so,%.so,$(@F)) |
187 |
|
188 |
${LIBCPPLIBS}: ${LIBSRCS} ${COBJS} ${FOBJS} |
189 |
# |
190 |
# create .o |
191 |
# |
192 |
@(${EGREEN} "Compiling CPP file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`.cpp"; ${RESET}) |
193 |
@${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}; |
194 |
# |
195 |
# create .so |
196 |
# |
197 |
@(${EGREEN} "Creating shared library: "${WHITE} "`basename $@`"; ${RESET}) |
198 |
@${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 |
199 |
@ln -sf ${DIRTOP}/${DIRLIB}/$(@F) ${DIRTOP}/${DIRLIB}/$(patsubst %_${VER}.so,%.so,$(@F)) |
200 |
|
201 |
${CXXEXELIBS}: ${CPPOBJS} ${COBJS} ${CXXEXEOBJS} |
202 |
@(${EGREEN} "Creating exec file: "${WHITE} "$@"; ${RESET}) |
203 |
# @${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` |
204 |
@${CXX} ${CXXFLAGS} -o ${DIRBIN}/$@ ${DIRLIB}/$@.o ${FULLROOTCLIBS} ${FULLLIBCPPLIBS} ${TRKOBJS} ${CPPOBJS} ${COBJS} ${FOBJS} ${PAM_YODA}/lib/libyoda.so -lThread `root-config --cflags --glibs` `cernlib mathlib` |
205 |
|
206 |
# A small target to check environmental variables |
207 |
%_env: |
208 |
@${test_env} |
209 |
|
210 |
.PHONY: install installdoc installlib installmacros installinc installexe installcmacro |
211 |
.PHONY: clean depclean info mkbindir mklibdir testcern testpamenv test |
212 |
|
213 |
mkbindir: ${DIRBIN} |
214 |
${DIRBIN}: |
215 |
@${test_and_mk} |
216 |
|
217 |
mklibdir: ${DIRLIB} |
218 |
${DIRLIB}: |
219 |
@${test_and_mk} |
220 |
|
221 |
# Here what has to be deleted in clean target |
222 |
clean: TOBEDEL= ${DIRSRC}/*.o ${DIRSRC}/*Dict.cpp ${DIRSRC}/*Dict.h ${FOBJS} ${FULLLIBS} ${DIRBIN}/${CXXEXELIBS} ${CPPOBJS} ${CXXEXEOBJS} ${FULLLINKCLIBS} ${FULLMACROCLIBS} ${FULLLINKMACROCLIBS} ${DIRSRC}/CaloVerl2.cpp |
223 |
clean: |
224 |
@${test_and_rm} |
225 |
|
226 |
distclean: clean |
227 |
distclean: TOBEDEL= ${DIRBIN} ${DIRLIB} |
228 |
distclean: |
229 |
@${test_and_rm} |
230 |
|
231 |
forceinstall: FORCE=-f |
232 |
forceinstall: install |
233 |
forceinstallstandalone: FORCE=-f |
234 |
forceinstallstandalone: installstandalone |
235 |
|
236 |
upgrade: FORCE=-u |
237 |
upgrade: install |
238 |
upgradestandalone: FORCE=-u |
239 |
upgradestandalone: installstandalone |
240 |
|
241 |
install: installlib installinc installmacros installcalib installdoc installcmacro |
242 |
|
243 |
installstandalone: install installexe |
244 |
|
245 |
installlib: LINK=y |
246 |
installlib: TOBEMOVED= $(FULLLIBS:${DIRLIB}%=${PAM_LIB}%) |
247 |
installlib: ORIGIN=${DIRLIB} |
248 |
installlib: |
249 |
@${test_and_cp} |
250 |
|
251 |
installcmacro: LINK=y |
252 |
installcmacro: TOBEMOVED= $(FULLMACROCLIBS:${DIRLIB}%=${PAM_LIB}%) |
253 |
installcmacro: ORIGIN=${DIRLIB} |
254 |
installcmacro: |
255 |
@${test_and_cp} |
256 |
|
257 |
installinc: TOBEMOVED= $(INCSRCS:${DIRINC}/%=${PAM_INC}/%) |
258 |
installinc: ORIGIN=${DIRINC} |
259 |
installinc: |
260 |
@${test_and_cp} |
261 |
|
262 |
installexe: TOBEMOVED= $(EXESRCS:${DIRBIN}/%=${PAM_BIN}/%) |
263 |
installexe: ORIGIN=${DIRBIN} |
264 |
installexe: |
265 |
@${test_and_cp} |
266 |
|
267 |
installmacros: TOBEMOVED= $(MACROSSRCS:${DIRMACROS}/%=${PAM_MACROS}/%) |
268 |
installmacros: ORIGIN=${DIRMACROS} |
269 |
installmacros: |
270 |
@${test_and_cp} |
271 |
|
272 |
installcalib: TOBEMOVED= $(CALIBFILES:${DIRCALIB}/%=${PAM_CALIB}/%) |
273 |
installcalib: ORIGIN=${DIRCALIB} |
274 |
installcalib: |
275 |
@${test_and_cp} |
276 |
|
277 |
installdoc: TOBEMOVED= $(DOCFILES:${DIRDOC}/%=${PAM_DOC}/%) |
278 |
installdoc: ORIGIN=${DIRDOC} |
279 |
installdoc: |
280 |
@${test_and_cp} |
281 |
|
282 |
mkverpath: |
283 |
@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 |
284 |
@sleep 0.8 |
285 |
|
286 |
|
287 |
|
288 |
info: |
289 |
@echo " " |
290 |
@${EGREEN} "Infos for package :" ${WHITE} ${PACKAGE} |
291 |
@${EGREEN} " VERSION :" ${WHITE} ${VER} |
292 |
@${EGREEN} " EXECUTABLES :" ${WHITE} ${EXECUTABLES} |
293 |
@${EGREEN} " LIBS :" ${WHITE} ${LIBS} |
294 |
@${EGREEN} " DOCS :" ${WHITE} ${DOCS} |
295 |
@${EGREEN} " SRCS :" ${WHITE} ${SRCS} |
296 |
@${EGREEN} " MACROS :" ${WHITE} ${MACROS} |
297 |
@${EGREEN} " INCLUDE :" ${WHITE} ${INCLUDE} |
298 |
@echo " " |
299 |
@${RESET} |
300 |
|
301 |
test: testpamenv |
302 |
|
303 |
testpamenv: ${PAM_ENV} |
304 |
|
305 |
root-config: OPT=--cflags |
306 |
root-config: |
307 |
@${test_cmd} |
308 |
|
309 |
# Here follows some usefull macros |
310 |
define test_and_cp |
311 |
wd=`pwd`;\ |
312 |
for i in ${TOBEMOVED} ; do \ |
313 |
wv=$${i##/*/}; \ |
314 |
dest=$${i/$${wv}/}; \ |
315 |
${EGREEN} "Testing for :" ${WHITE} "$${i}" ; ${RESET}; \ |
316 |
if [ ! "${FORCE}" ] ; then \ |
317 |
if [ ! -f $${i} ]; then \ |
318 |
${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
319 |
${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \ |
320 |
cp ${ORIGIN}/$${i##/*/} $${i}; \ |
321 |
else \ |
322 |
${ERED} "File already exist !!!! Please delete it " ${WHITE}; ${RESET}; \ |
323 |
fi;\ |
324 |
else \ |
325 |
if [ "${FORCE}" == "-u" ] ; then \ |
326 |
if [ "`basename $${i}`" != "`basename $${i} _${VER}.so`" ]; then \ |
327 |
${EYELLOW} "Removing: "${WHITE} ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so; ${RESET}; \ |
328 |
rm -f ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so ; \ |
329 |
${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
330 |
${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \ |
331 |
cp ${ORIGIN}/$${i##/*/} $${i}; \ |
332 |
else \ |
333 |
${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
334 |
${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \ |
335 |
cp -f ${ORIGIN}/$${i##/*/} $${i}; \ |
336 |
fi; \ |
337 |
else \ |
338 |
${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
339 |
${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \ |
340 |
cp ${FORCE} ${ORIGIN}/$${i##/*/} $${i}; \ |
341 |
fi;\ |
342 |
fi ;\ |
343 |
if [ ! -z ${LINK} ] ; then \ |
344 |
${EGREEN} "Creating symlink from : "${WHITE} $${wv/_${VER}/} ;\ |
345 |
${EGREEN} " to : "${WHITE} $${i##/*/} ; ${RESET}; \ |
346 |
cd $${dest}; \ |
347 |
ln -sf $${wv} $${wv/_${VER}/}; \ |
348 |
cd $${wd}; \ |
349 |
fi \ |
350 |
done |
351 |
endef |
352 |
|
353 |
define test_and_mk |
354 |
${EGREEN} "Testing for :" ${WHITE} "$@"; ${RESET} |
355 |
test -d "$@" || \ |
356 |
(${EGREEN} "Creating : "${WHITE} "$@"; ${RESET}; mkdir -p $@) |
357 |
endef |
358 |
|
359 |
define test_env |
360 |
${EGREEN} "Testing for env:" ${WHITE} $(patsubst %_env,%,$@); ${RESET} |
361 |
printenv $(patsubst %_env,%,$@) 1>/dev/null || \ |
362 |
(${ERED} "ERROR, variable : "${WHITE} $(patsubst %_env,%,$@) \ |
363 |
${RED} "not defined !!! Check your env. settings"; \ |
364 |
${RESET}; exit 1) |
365 |
${EGREEN} " Defined:" ${WHITE} $${$(patsubst %_env,%,$@)}; ${RESET} |
366 |
endef |
367 |
|
368 |
define test_cmd |
369 |
${EGREEN} "Testing for cmd:" ${WHITE} $@ ${OPT}; ${RESET} |
370 |
$@ ${OPT} 1>/dev/null 2>&1 || \ |
371 |
(${ERED} "ERROR, command : "${WHITE} $@ ${OPT}\ |
372 |
${RED} "not found !!! Check your installation"; \ |
373 |
${RESET}; exit 1) |
374 |
${EGREEN} " Present:" ${WHITE} $@ ${OPT}; ${RESET} |
375 |
endef |
376 |
|
377 |
define test_and_rm |
378 |
for i in ${TOBEDEL}; do \ |
379 |
test -d $${i} || (${ERED} "Removing file :"${WHITE} $${i}; ${RESET}; \ |
380 |
rm -f $${i} ); \ |
381 |
test ! -d $${i} || (${ERED} "Removing dir :"${WHITE} $${i}; ${RESET}; \ |
382 |
rm -rf $${i} ); \ |
383 |
done |
384 |
endef |