1 |
mocchiut |
1.1 |
# Flight UTILITIES = FUTILITIES |
2 |
|
|
# SOFTWARE VERSION |
3 |
mocchiut |
1.4 |
VER= v1r03 |
4 |
mocchiut |
1.1 |
# 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 |
mocchiut |
1.6 |
#CFLAGS=-Wall -O -fPIC -pthread -g ${PAM_BIT} |
27 |
|
|
CFLAGS=-Wall -O -fPIC -pthread ${PAM_BIT} |
28 |
mocchiut |
1.1 |
# Enviroment: |
29 |
|
|
GCCVER=`gcc --version | head -1` |
30 |
|
|
UNAMEA=`uname -a` |
31 |
|
|
TODAY=`date` |
32 |
|
|
# F77 |
33 |
|
|
F77=g77 |
34 |
mocchiut |
1.6 |
#F77FLAGS= -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -g -extend_source -static -fno-backslash ${PAM_BIT} |
35 |
|
|
F77FLAGS= -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -extend_source -static -fno-backslash ${PAM_BIT} |
36 |
mocchiut |
1.1 |
# C++ |
37 |
|
|
CXX=g++ |
38 |
mocchiut |
1.6 |
#CXXFLAGS=-Wall -O -fPIC -pthread -g ${PAM_BIT} |
39 |
|
|
CXXFLAGS=-Wall -O -fPIC -pthread ${PAM_BIT} |
40 |
mocchiut |
1.1 |
# 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_MACROS_env PAM_CALIB_env PAM_YODA_env |
53 |
|
|
# Here the local variables used to build the targets |
54 |
|
|
|
55 |
|
|
MACROSRCS=${DIRMACROS}/FUTpathtoc.cxx \ |
56 |
|
|
${DIRMACROS}/caloclasses.cxx \ |
57 |
mocchiut |
1.3 |
${DIRMACROS}/FCaloCHECKCRC.cxx \ |
58 |
mocchiut |
1.1 |
${DIRMACROS}/FCaloFUNCTIONS.cxx \ |
59 |
|
|
${DIRMACROS}/FCaloLEVEL1.cxx \ |
60 |
|
|
${DIRMACROS}/FCaloMIP.cxx \ |
61 |
|
|
${DIRMACROS}/FCaloMATRA.cxx \ |
62 |
|
|
${DIRMACROS}/FCaloPLANES.cxx \ |
63 |
|
|
${DIRMACROS}/FCaloPULSE.cxx \ |
64 |
|
|
${DIRMACROS}/FCaloCALIBSCAN.cxx \ |
65 |
|
|
${DIRMACROS}/FCaloFINDCALIBS.cxx \ |
66 |
|
|
${DIRMACROS}/FCaloADC2MIP.cxx |
67 |
|
|
# ${DIRMACROS}/FCaloTRKCALOALIG.cxx |
68 |
|
|
|
69 |
|
|
MACROSLIBS=$(MACROSRCS:${DIRMACROS}/%.cxx=${DIRLIB}/lib%_${VER}.so) |
70 |
mocchiut |
1.3 |
MACROCLIBS=libFUTpathtoc libcaloclasses libFCaloCHECKCRC libFCaloFUNCTIONS libFCaloLEVEL1 libFCaloMIP libFCaloMATRA libFCaloPLANES libFCaloPULSE libFCaloCALIBSCAN libFCaloFINDCALIBS libFCaloADC2MIP |
71 |
mocchiut |
1.1 |
#libFCaloTRKCALOALIG |
72 |
|
|
FULLMACROCLIBS=$(MACROCLIBS:%=${DIRLIB}/%_${VER}.so) |
73 |
|
|
FULLLINKMACROCLIBS=$(MACROCLIBS:%=${DIRLIB}/%.so) |
74 |
|
|
|
75 |
mocchiut |
1.3 |
CXXEXESRCS=${DIRSRC}/FCaloCHECKCRC.cc \ |
76 |
|
|
${DIRSRC}/FCaloLEVEL1.cc \ |
77 |
mocchiut |
1.1 |
${DIRSRC}/FCaloMIP.cc \ |
78 |
|
|
${DIRSRC}/FCaloMATRA.cc \ |
79 |
|
|
${DIRSRC}/FCaloPLANES.cc \ |
80 |
|
|
${DIRSRC}/FCaloPULSE.cc \ |
81 |
|
|
${DIRSRC}/FCaloCALIBSCAN.cc \ |
82 |
|
|
${DIRSRC}/FCaloFINDCALIBS.cc \ |
83 |
|
|
${DIRSRC}/FCaloADC2MIP.cc |
84 |
|
|
# ${DIRSRC}/FCaloTRKCALOALIG.cc |
85 |
|
|
CXXEXEOBJS=$(CXXEXESRCS:${DIRSRC}%.cc=${DIRBIN}%.o) |
86 |
mocchiut |
1.3 |
CXXEXELIBS:=FCaloCHECKCRC FCaloLEVEL1 FCaloMIP FCaloMATRA FCaloPLANES FCaloPULSE FCaloCALIBSCAN FCaloFINDCALIBS FCaloADC2MIP |
87 |
mocchiut |
1.1 |
#FCaloTRKCALOALIG |
88 |
mocchiut |
1.3 |
EXESRCS=${DIRBIN}/FCaloCHECKCRC ${DIRBIN}/FCaloLEVEL1 ${DIRBIN}/FCaloMIP ${DIRBIN}/FCaloMATRA ${DIRBIN}/FCaloPLANES ${DIRBIN}/FCaloPULSE ${DIRBIN}/FCaloCALIBSCAN ${DIRBIN}/FCaloFINDCALIBS ${DIRBIN}/FCaloADC2MIP |
89 |
mocchiut |
1.1 |
#${DIRBIN}/FCaloTRKCALOALIG |
90 |
mocchiut |
1.5 |
INCSRCS= ${DIRINC}/caloclassesfun.h ${DIRINC}/fcalostructs.h |
91 |
mocchiut |
1.1 |
|
92 |
mocchiut |
1.3 |
MACROSSRCS= ${DIRMACROS}/rootlogon.C ${DIRMACROS}/FCaloCHECKCRC.C ${DIRMACROS}/FCaloLEVEL1.C ${DIRMACROS}/FCaloMIP.C ${DIRMACROS}/FCaloMATRA.C ${DIRMACROS}/FCaloPLANES.C ${DIRMACROS}/FCaloPULSE.C ${DIRMACROS}/FCaloCALIBSCAN.C ${DIRMACROS}/FCaloFINDCALIBS.C ${DIRMACROS}/FCaloADC2MIP.C |
93 |
mocchiut |
1.1 |
#${DIRMACROS}/FCaloTRKCALOALIG.C |
94 |
|
|
CALIBFILES= |
95 |
|
|
|
96 |
|
|
DOCFILES= |
97 |
|
|
|
98 |
|
|
# Here the Variables used for info target |
99 |
|
|
PACKAGE=Calorimeter flight quick look software |
100 |
|
|
EXECUTABLES= |
101 |
|
|
LIBS= ${FLIBS} ${FOBJS} ${CLIBS} ${COBJS} ${CXXEXEOBJS} |
102 |
|
|
DOCS= |
103 |
|
|
SRCS= ${FSRCS} ${CRSCS} ${CXXEXESRCS} |
104 |
|
|
MACROS= ${MACROSSRCS} |
105 |
|
|
# |
106 |
|
|
TOBEDEL = junk |
107 |
|
|
ROOTINC=$$${shell root-config --incdir} |
108 |
|
|
NROOTINC=${shell root-config --incdir} |
109 |
|
|
# Let's start |
110 |
|
|
all : test mkbindir mklibdir mkpathtoc ${MACROSLIBS} ${CXXEXELIBS} |
111 |
|
|
all: |
112 |
|
|
@echo -e ${GREEN} "" |
113 |
|
|
@(${EGREEN} " Finished, now you can install the package \n (use: make install or make upgrade or make forceinstall) "; ${RESET}) |
114 |
|
|
@echo -e ${GREEN} "" |
115 |
|
|
@${RESET} |
116 |
|
|
|
117 |
|
|
# Here some general rules to produce objects in our local dir |
118 |
|
|
${DIRBIN}/%.o: ${DIRSRC}/%.cc |
119 |
|
|
@(${EGREEN} "Creating object file: "${WHITE} "$@"; ${RESET}) |
120 |
|
|
@${CXX} ${CXXFLAGS} -c -o $@ ${DIRSRC}/`basename ${@} .o`.cc -I${DIRINC} -I${PAM_INC} -I${PAM_YODA}/include/yoda/ `root-config --cflags` |
121 |
|
|
|
122 |
|
|
${MACROSLIBS}: ${MACROSRCS} |
123 |
|
|
@(${EGREEN} "Creating file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`Dict.cxx"; ${RESET}) |
124 |
|
|
# |
125 |
|
|
# Create *Dict.cxx and *Dict.h |
126 |
|
|
# |
127 |
|
|
@${ROOTCINT} -f ${DIRMACROS}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.cxx -c -I${ROOTINC} ${DIRINC}/`basename $(@F) _${VER}.so | sed s/lib//`fun.h ${DIRINC}/`basename $(@F) _${VER}.so | sed s/lib//`LinkDef.h |
128 |
|
|
# |
129 |
|
|
# create .o |
130 |
|
|
# |
131 |
|
|
@(${EGREEN} "Compiling file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`.cxx"; ${RESET}) |
132 |
|
|
@cd ${DIRMACROS} &>/dev/null && ${CXX} ${CXXFLAGS} -c `basename $(@F) _${VER}.so | sed s/lib//`.cxx -I${PAM_INC} -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_YODA}/include/yoda/ -I${NROOTINC}; |
133 |
|
|
@(${EGREEN} "Compiling file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`Dict.cxx"; ${RESET}) |
134 |
|
|
@cd ${DIRMACROS} &>/dev/null && ${CXX} ${CXXFLAGS} -c `basename $(@F) _${VER}.so | sed s/lib//`Dict.cxx -I${PAM_INC} -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_YODA}/include/yoda/ -I${NROOTINC}; |
135 |
|
|
# |
136 |
|
|
# create .so |
137 |
|
|
# |
138 |
|
|
@(${EGREEN} "Compiling shared library: "${WHITE} "$@"; ${RESET}) |
139 |
|
|
@${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ -lg2c -I${PAM_INC} -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_YODA}/include/yoda/ ${DIRTOP}/${DIRMACROS}/`basename $(@F) _${VER}.so | sed s/lib//`.o ${DIRTOP}/${DIRMACROS}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.o 1>/dev/null |
140 |
|
|
|
141 |
|
|
${CXXEXELIBS}: ${CXXEXEOBJS} |
142 |
|
|
@(${EGREEN} "Creating exec file: "${WHITE} "$@"; ${RESET}) |
143 |
|
|
@${CXX} ${CXXFLAGS} -o ${DIRBIN}/$@ ${DIRBIN}/$@.o -I${DIRINC} -I${PAM_INC} -I${PAM_YODA}/include/yoda/ ${PAM_YODA}/lib/libyoda.so ${DIRTOP}/${DIRLIB}/libFUTpathtoc_${VER}.so ${DIRTOP}/${DIRLIB}/libcaloclasses_${VER}.so ${DIRTOP}/${DIRLIB}/libFCaloFUNCTIONS_${VER}.so ${DIRTOP}/${DIRLIB}/lib$@_${VER}.so -lThread `root-config --cflags --glibs`; |
144 |
|
|
|
145 |
|
|
# A small target to check environmental variables |
146 |
|
|
%_env: |
147 |
|
|
@${test_env} |
148 |
|
|
|
149 |
|
|
.PHONY: install installdoc installlib installmacros installinc installexe installcmacro |
150 |
|
|
.PHONY: clean depclean info mkbindir mklibdir testcern testpamenv test |
151 |
|
|
|
152 |
|
|
mkbindir: ${DIRBIN} |
153 |
|
|
${DIRBIN}: |
154 |
|
|
@${test_and_mk} |
155 |
|
|
|
156 |
|
|
mklibdir: ${DIRLIB} |
157 |
|
|
${DIRLIB}: |
158 |
|
|
@${test_and_mk} |
159 |
|
|
|
160 |
|
|
# Here what has to be deleted in clean target |
161 |
|
|
clean: TOBEDEL= ${DIRMACROS}/*.o ${DIRMACROS}/*Dict.cxx ${DIRMACROS}/*Dict.h ${FOBJS} ${FULLLIBS} ${DIRBIN}/${CXXEXELIBS} ${COBJS} ${CXXEXEOBJS} ${FULLLINKFLIBS} ${FULLLINKCLIBS} ${FULLMACROCLIBS} ${FULLLINKMACROCLIBS} |
162 |
|
|
clean: |
163 |
|
|
@${test_and_rm} |
164 |
|
|
|
165 |
|
|
distclean: clean |
166 |
|
|
distclean: TOBEDEL= ${DIRBIN} ${DIRLIB} |
167 |
|
|
distclean: |
168 |
|
|
@${test_and_rm} |
169 |
|
|
|
170 |
|
|
forceinstall: FORCE=-f |
171 |
|
|
forceinstall: install |
172 |
|
|
|
173 |
|
|
upgrade: FORCE=-u |
174 |
|
|
upgrade: install |
175 |
|
|
|
176 |
|
|
install: installlib installinc installmacros installcalib installdoc installexe installcmacro |
177 |
|
|
|
178 |
|
|
installlib: LINK=y |
179 |
|
|
installlib: TOBEMOVED= $(FULLLIBS:${DIRLIB}%=${PAM_LIB}%) |
180 |
|
|
installlib: ORIGIN=${DIRLIB} |
181 |
|
|
installlib: |
182 |
|
|
@${test_and_cp} |
183 |
|
|
|
184 |
|
|
installcmacro: LINK=y |
185 |
|
|
installcmacro: TOBEMOVED= $(FULLMACROCLIBS:${DIRLIB}%=${PAM_LIB}%) |
186 |
|
|
installcmacro: ORIGIN=${DIRLIB} |
187 |
|
|
installcmacro: |
188 |
|
|
@${test_and_cp} |
189 |
|
|
|
190 |
|
|
installinc: TOBEMOVED= $(INCSRCS:${DIRINC}/%=${PAM_INC}/%) |
191 |
|
|
installinc: ORIGIN=${DIRINC} |
192 |
|
|
installinc: |
193 |
|
|
@${test_and_cp} |
194 |
|
|
|
195 |
|
|
installexe: TOBEMOVED= $(EXESRCS:${DIRBIN}/%=${PAM_BIN}/%) |
196 |
|
|
installexe: ORIGIN=${DIRBIN} |
197 |
|
|
installexe: |
198 |
|
|
@${test_and_cp} |
199 |
|
|
|
200 |
|
|
installmacros: TOBEMOVED= $(MACROSSRCS:${DIRMACROS}/%=${PAM_MACROS}/%) |
201 |
|
|
installmacros: ORIGIN=${DIRMACROS} |
202 |
|
|
installmacros: |
203 |
|
|
@${test_and_cp} |
204 |
|
|
|
205 |
|
|
installcalib: TOBEMOVED= $(CALIBFILES:${DIRCALIB}/%=${PAM_CALIB}/%) |
206 |
|
|
installcalib: ORIGIN=${DIRCALIB} |
207 |
|
|
installcalib: |
208 |
|
|
@${test_and_cp} |
209 |
|
|
|
210 |
|
|
installdoc: TOBEMOVED= $(DOCFILES:${DIRDOC}/%=${PAM_DOC}/%) |
211 |
|
|
installdoc: ORIGIN=${DIRDOC} |
212 |
|
|
installdoc: |
213 |
|
|
@${test_and_cp} |
214 |
|
|
|
215 |
|
|
mkpathtoc: |
216 |
|
|
@if [ "${PAM_CCO}" == "" ]; then echo '#include <TSystem.h>' > ${DIRTOP}/${DIRMACROS}/FUTpathtoc.cxx; echo ' const char *pathtocalibration(){ return((const char*)gSystem->Getenv("PAM_CALIB"));}' >> ${DIRTOP}/${DIRMACROS}/FUTpathtoc.cxx; echo ' void info(){ printf("\nUTILITIES flight package version: ${VER}\n\nCompiled on '${TODAY}' with: '${GCCVER}'\n\nOn: '${UNAMEA}'\n\n"); }' >> ${DIRTOP}/${DIRMACROS}/FUTpathtoc.cxx; fi |
217 |
|
|
@if [ "${PAM_CCO}" != "" ]; then echo '#include <TSystem.h>' > ${DIRTOP}/${DIRMACROS}/FUTpathtoc.cxx; echo ' const char *pathtocalibration(){ return((const char*)"'${PAM_CALIB}'/");}' >> ${DIRTOP}/${DIRMACROS}/FUTpathtoc.cxx; echo ' void info(){ printf("\nUTILITIES flight package version: ${VER}\n\nCompiled on '${TODAY}' with: '${GCCVER}'\n\nOn: '${UNAMEA}'\n\n"); }' >> ${DIRTOP}/${DIRMACROS}/FUTpathtoc.cxx; fi |
218 |
|
|
@sleep 0.8 |
219 |
|
|
|
220 |
|
|
|
221 |
|
|
info: |
222 |
|
|
@echo " " |
223 |
|
|
@${EGREEN} "Infos for package :" ${WHITE} ${PACKAGE} |
224 |
|
|
@${EGREEN} " VERSION :" ${WHITE} ${VER} |
225 |
|
|
@${EGREEN} " EXECUTABLES :" ${WHITE} ${EXECUTABLES} |
226 |
|
|
@${EGREEN} " LIBS :" ${WHITE} ${LIBS} |
227 |
|
|
@${EGREEN} " DOCS :" ${WHITE} ${DOCS} |
228 |
|
|
@${EGREEN} " SRCS :" ${WHITE} ${SRCS} |
229 |
|
|
@${EGREEN} " MACROS :" ${WHITE} ${MACROS} |
230 |
|
|
@echo " " |
231 |
|
|
@${RESET} |
232 |
|
|
|
233 |
|
|
test: testpamenv |
234 |
|
|
|
235 |
|
|
testpamenv: ${PAM_ENV} |
236 |
|
|
|
237 |
|
|
root-config: OPT=--cflags |
238 |
|
|
root-config: |
239 |
|
|
@${test_cmd} |
240 |
|
|
|
241 |
|
|
# Here follows some usefull macros |
242 |
|
|
define test_and_cp |
243 |
|
|
wd=`pwd`;\ |
244 |
|
|
for i in ${TOBEMOVED} ; do \ |
245 |
|
|
wv=$${i##/*/}; \ |
246 |
|
|
dest=$${i/$${wv}/}; \ |
247 |
|
|
${EGREEN} "Testing for :" ${WHITE} "$${i}" ; ${RESET}; \ |
248 |
|
|
if [ ! "${FORCE}" ] ; then \ |
249 |
|
|
if [ ! -f $${i} ]; then \ |
250 |
|
|
${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
251 |
|
|
${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \ |
252 |
|
|
cp ${ORIGIN}/$${i##/*/} $${i}; \ |
253 |
|
|
else \ |
254 |
|
|
${ERED} "File already exist !!!! Please delete it " ${WHITE}; ${RESET}; \ |
255 |
|
|
fi;\ |
256 |
|
|
else \ |
257 |
|
|
if [ "${FORCE}" == "-u" ] ; then \ |
258 |
|
|
if [ "`basename $${i}`" != "`basename $${i} _${VER}.so`" ]; then \ |
259 |
|
|
${EYELLOW} "Removing: "${WHITE} ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so; ${RESET}; \ |
260 |
|
|
rm -f ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so ; \ |
261 |
|
|
${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
262 |
|
|
${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \ |
263 |
|
|
cp ${ORIGIN}/$${i##/*/} $${i}; \ |
264 |
|
|
else \ |
265 |
|
|
${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
266 |
|
|
${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \ |
267 |
|
|
cp -f ${ORIGIN}/$${i##/*/} $${i}; \ |
268 |
|
|
fi; \ |
269 |
|
|
else \ |
270 |
|
|
${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
271 |
|
|
${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \ |
272 |
|
|
cp ${FORCE} ${ORIGIN}/$${i##/*/} $${i}; \ |
273 |
|
|
fi;\ |
274 |
|
|
fi ;\ |
275 |
|
|
if [ ! -z ${LINK} ] ; then \ |
276 |
|
|
${EGREEN} "Creating symlink from : "${WHITE} $${wv/_${VER}/} ;\ |
277 |
|
|
${EGREEN} " to : "${WHITE} $${i##/*/} ; ${RESET}; \ |
278 |
|
|
cd $${dest}; \ |
279 |
|
|
ln -sf $${wv} $${wv/_${VER}/}; \ |
280 |
|
|
cd $${wd}; \ |
281 |
|
|
fi \ |
282 |
|
|
done |
283 |
|
|
endef |
284 |
|
|
|
285 |
|
|
define test_and_mk |
286 |
|
|
${EGREEN} "Testing for :" ${WHITE} "$@"; ${RESET} |
287 |
|
|
test -d "$@" || \ |
288 |
|
|
(${EGREEN} "Creating : "${WHITE} "$@"; ${RESET}; mkdir -p $@) |
289 |
|
|
endef |
290 |
|
|
|
291 |
|
|
define test_env |
292 |
|
|
${EGREEN} "Testing for env:" ${WHITE} $(patsubst %_env,%,$@); ${RESET} |
293 |
|
|
printenv $(patsubst %_env,%,$@) 1>/dev/null || \ |
294 |
|
|
(${ERED} "ERROR, variable : "${WHITE} $(patsubst %_env,%,$@) \ |
295 |
|
|
${RED} "not defined !!! Check your env. settings"; \ |
296 |
|
|
${RESET}; exit 1) |
297 |
|
|
${EGREEN} " Defined:" ${WHITE} $${$(patsubst %_env,%,$@)}; ${RESET} |
298 |
|
|
endef |
299 |
|
|
|
300 |
|
|
define test_cmd |
301 |
|
|
${EGREEN} "Testing for cmd:" ${WHITE} $@ ${OPT}; ${RESET} |
302 |
|
|
$@ ${OPT} 1>/dev/null 2>&1 || \ |
303 |
|
|
(${ERED} "ERROR, command : "${WHITE} $@ ${OPT}\ |
304 |
|
|
${RED} "not found !!! Check your installation"; \ |
305 |
|
|
${RESET}; exit 1) |
306 |
|
|
${EGREEN} " Present:" ${WHITE} $@ ${OPT}; ${RESET} |
307 |
|
|
endef |
308 |
|
|
|
309 |
|
|
define test_and_rm |
310 |
|
|
for i in ${TOBEDEL}; do \ |
311 |
|
|
test -d $${i} || (${ERED} "Removing file :"${WHITE} $${i}; ${RESET}; \ |
312 |
|
|
rm -f $${i} ); \ |
313 |
|
|
test ! -d $${i} || (${ERED} "Removing dir :"${WHITE} $${i}; ${RESET}; \ |
314 |
|
|
rm -rf $${i} ); \ |
315 |
|
|
done |
316 |
|
|
endef |