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