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