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