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