1 |
jerse |
1.1 |
# Calorimeter nuclei plugin |
2 |
|
|
# SOFTWARE VERSION |
3 |
mocchiut |
1.7 |
VER= v1r03 |
4 |
jerse |
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.4 |
#CFLAGS=-Wall -O -fPIC -pthread -g ${PAM_BIT} |
27 |
|
|
CFLAGS=-Wall -O -fPIC -pthread ${PAM_BIT} |
28 |
jerse |
1.1 |
# Enviroment: |
29 |
|
|
GCCVER=`gcc --version | head -1` |
30 |
|
|
UNAMEA=`uname -a` |
31 |
|
|
TODAY=`date` |
32 |
|
|
# F77 |
33 |
mocchiut |
1.5 |
ifeq ($(GCC4),) |
34 |
|
|
export GCCVERS=$(shell echo `gcc -dumpversion | sed 's/\./\ /g'`) |
35 |
|
|
export GCCVERMAJ=$(word 1,$(GCCVERS)) |
36 |
|
|
export GCC4=$(shell echo `echo "${GCCVERMAJ} > 3" |bc -l`) |
37 |
|
|
endif |
38 |
|
|
ifeq ($(GCC4),1) |
39 |
|
|
F77=gfortran |
40 |
|
|
LG2C=-lgfortran |
41 |
|
|
EXTRAOPT= |
42 |
|
|
else |
43 |
jerse |
1.1 |
F77=g77 |
44 |
mocchiut |
1.5 |
LG2C=-lg2c |
45 |
|
|
EXTRAOPT=-Wno-globals -fvxt |
46 |
|
|
endif |
47 |
mocchiut |
1.4 |
#F77FLAGS= -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -g -extend_source -static -fno-backslash ${PAM_BIT} |
48 |
mocchiut |
1.5 |
F77FLAGS= -Wall -funroll-loops -fPIC $(EXTRAOPT) -fno-automatic -fbounds-check -extend_source -static -fno-backslash ${PAM_BIT} |
49 |
jerse |
1.1 |
# C++ |
50 |
|
|
CXX=g++ |
51 |
mocchiut |
1.4 |
#CXXFLAGS=-Wall -O -fPIC -pthread -g ${PAM_BIT} |
52 |
|
|
CXXFLAGS=-Wall -O -fPIC -pthread ${PAM_BIT} |
53 |
jerse |
1.1 |
# ROOTCINT |
54 |
|
|
ROOTCINT=rootcint |
55 |
|
|
# Here the variables definig the local directories |
56 |
|
|
DIRTOP=${shell pwd} |
57 |
|
|
DIRLIB=lib/${ARCH}/ |
58 |
|
|
DIRBIN=bin/${ARCH}/ |
59 |
|
|
DIRSRC=src |
60 |
|
|
DIRINC=inc |
61 |
|
|
DIRDOC=doc |
62 |
|
|
DIRMACROS=macros |
63 |
|
|
DIRCALIB=calib |
64 |
|
|
# Here the PAMELA environmental variables to be checked |
65 |
|
|
PAM_ENV= PAM_BIN_env PAM_LIB_env PAM_INC_env PAM_DOC_env PAM_CALIB_env PAM_YODA_env |
66 |
|
|
# Here the local variables used to build the targets |
67 |
|
|
#------------------------------------------------- |
68 |
|
|
FSRCS= |
69 |
|
|
FOBJS=$(FSRCS:${DIRSRC}/F77/%.f=${DIRLIB}/%.o) |
70 |
|
|
#------------------------------------------------- |
71 |
|
|
CSRCS=${DIRSRC}/qcalcore.cpp \ |
72 |
|
|
${DIRSRC}/version.cpp |
73 |
|
|
COBJS=$(CSRCS:${DIRSRC}%.cpp=${DIRLIB}/%.o) |
74 |
|
|
#------------------------------------------------- |
75 |
|
|
# librerie utilizzabili da root (ci deve essere anche il ***LinkDef.h ) |
76 |
|
|
LIBROOTSRCS= |
77 |
|
|
LIBROOTLIBS=$(LIBROOTSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so) |
78 |
|
|
LIBROOTOBJS= |
79 |
|
|
LIBROOTCLIBS= |
80 |
|
|
FULLROOTCLIBS=$(LIBROOTCLIBS:%=${DIRLIB}/%_${VER}.so) |
81 |
|
|
#------------------------------------------------- |
82 |
|
|
# librerie C++ NON utilizzabili da root |
83 |
|
|
LIBCPPSRCS=#${DIRSRC}/PamLevel2.cpp |
84 |
|
|
LIBCPPLIBS=$(LIBCPPSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so) |
85 |
|
|
LIBCPPCLIBS=#libPamLevel2 |
86 |
|
|
FULLCPPCLIBS=$(LIBCPPCLIBS:%=${DIRLIB}/%_${VER}.so) |
87 |
|
|
#------------------------------------------------- |
88 |
|
|
# librerie F77 NON utilizzabili da root |
89 |
|
|
LIBF77SRCS= |
90 |
|
|
LIBF77OBJS= $(LIBF77SRCS:${DIRSRC}/F77/%.f=${DIRLIB}/%.o) |
91 |
|
|
LIBF77LIBS= $(LIBF77SRCS:${DIRSRC}/F77/%.f=${DIRLIB}/lib%_${VER}.so) |
92 |
|
|
LIBF77CLIBS= |
93 |
|
|
FULLF77CLIBS=$(LIBF77CLIBS:%=${DIRLIB}/%_${VER}.so) |
94 |
|
|
#------------------------------------------------- |
95 |
|
|
FULLLIBS=${FULLROOTCLIBS} ${FULLCPPCLIBS} ${FULLF77CLIBS} |
96 |
|
|
|
97 |
|
|
#------------------------------------------------- |
98 |
|
|
# eseguibile |
99 |
|
|
CXXEXESRCS=${DIRSRC}/CaloHK.cpp |
100 |
|
|
CXXEXEOBJS=$(CXXEXESRCS:${DIRSRC}%.cpp=${DIRLIB}%.o) |
101 |
|
|
CXXEXELIBS:=CaloHK |
102 |
|
|
|
103 |
|
|
OTHERLIBS= |
104 |
|
|
#------------------------------------------------- |
105 |
|
|
# variabili per l'installazione |
106 |
|
|
EXESRCS= ${DIRBIN}/CaloHK |
107 |
|
|
INCSRCS= |
108 |
|
|
MACROSSRCS= |
109 |
|
|
CALIBFILES= |
110 |
|
|
DOCFILES= |
111 |
|
|
# Here the Variables used for info target |
112 |
|
|
PACKAGE= |
113 |
|
|
EXECUTABLES=${EXESRCS} |
114 |
|
|
LIBS= ${FULLLIBS} ${OTHERLIBS} |
115 |
|
|
DOCS= |
116 |
|
|
SRCS= |
117 |
|
|
MACROS= ${MACROSSRCS} |
118 |
|
|
INCLUDE= ${INCSRCS} |
119 |
|
|
# |
120 |
|
|
TOBEDEL = junk |
121 |
|
|
ROOTINC=$$${shell root-config --incdir} |
122 |
|
|
NROOTINC=${shell root-config --incdir} |
123 |
|
|
# Let's start |
124 |
|
|
all : test mkverpath mkbindir mklibdir ${LIBF77LIBS} ${LIBROOTLIBS} ${LIBCPPLIBS} ${CXXEXELIBS} |
125 |
|
|
all: |
126 |
|
|
@echo -e ${GREEN} "" |
127 |
|
|
@(${EGREEN} " Finished, now you can install the package \n (use: make install or make upgrade or make forceinstall) "; ${RESET}) |
128 |
|
|
@echo -e ${GREEN} "" |
129 |
|
|
@${RESET} |
130 |
|
|
|
131 |
|
|
# Here some general rules to produce objects in our local dir |
132 |
|
|
${DIRLIB}/%.o: ${DIRSRC}/%.cpp |
133 |
|
|
@(${EYELLOW} " C++ object ------------------------") |
134 |
|
|
@(${EGREEN} "Creating object file: "${WHITE} "$@"; ${RESET}) |
135 |
|
|
@${CXX} ${CXXFLAGS} -c -o $@ ${DIRSRC}/`basename ${@} .o`.cpp -I${DIRINC} -I${PAM_INC} -I${PAM_YODA}/include/yoda/endrun/ -I${PAM_YODA}/include/yoda/ `root-config --cflags` |
136 |
|
|
|
137 |
|
|
${DIRLIB}/%.o : ${DIRSRC}/F77/%.f |
138 |
|
|
@(${EYELLOW} " F77 object ------------------------") |
139 |
|
|
@(${EGREEN} "Creating object file: "${WHITE} "$@"; ${RESET}) |
140 |
|
|
@${F77} ${F77FLAGS} -c -o $@ ${DIRSRC}/F77/`basename ${@} .o`.f -I${DIRINC}/F77 -I${NROOTINC} -I${PAM_YODA}/include/yoda |
141 |
|
|
|
142 |
|
|
|
143 |
|
|
# .so from .o fortran |
144 |
|
|
${LIBF77LIBS}: ${LIBF77OBJS} |
145 |
|
|
@(${EYELLOW} " F77 shared library --------------------------") |
146 |
|
|
@(${EGREEN} "Creating library: "${WHITE} "$@"; ${RESET}) |
147 |
mocchiut |
1.5 |
@${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ $^ $(LG2C) `doc/cernlib_pam mathlib` |
148 |
jerse |
1.1 |
|
149 |
|
|
|
150 |
|
|
${LIBROOTLIBS}: ${LIBROOTSRCS} ${FOBJS} |
151 |
|
|
@(${EYELLOW} " ROOT library ------------------------") |
152 |
|
|
@(${EGREEN} "Creating file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp"; ${RESET}) |
153 |
|
|
# |
154 |
|
|
# Create *Dict.cpp and *Dict.h |
155 |
|
|
# |
156 |
|
|
# @${ROOTCINT} -f ${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp -c -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 |
157 |
|
|
@${ROOTCINT} -f ${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp -c -I${PAM_INC} -I${ROOTINC} -I${PAM_YODA}/include/yoda/ ${DIRINC}/`basename $(@F) _${VER}.so | sed s/lib//`.h ${DIRINC}/`basename $(@F) _${VER}.so | sed s/lib//`LinkDef.h |
158 |
|
|
# |
159 |
|
|
# order of include directories changed since RunInfo.h can be found (with completely different definition) in YODA while we want to load the DV one! |
160 |
|
|
# should be fixed some time changing names... |
161 |
|
|
# |
162 |
|
|
# create .o |
163 |
|
|
# |
164 |
|
|
@(${EGREEN} "Compiling file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`.cpp"; ${RESET}) |
165 |
|
|
@cd ${DIRSRC} &>/dev/null && ${CXX} ${CXXFLAGS} -c `basename $(@F) _${VER}.so | sed s/lib//`.cpp -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_INC} -I${PAM_YODA}/include/yoda/ -I${NROOTINC}; |
166 |
|
|
@(${EGREEN} "Compiling file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp"; ${RESET}) |
167 |
|
|
@cd ${DIRSRC} &>/dev/null && ${CXX} ${CXXFLAGS} -c `basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_INC} -I${PAM_YODA}/include/yoda/ -I${NROOTINC}; |
168 |
|
|
# |
169 |
|
|
# create .so |
170 |
|
|
# |
171 |
|
|
@(${EGREEN} "Compiling shared library: "${WHITE} "$@"; ${RESET}) |
172 |
mocchiut |
1.5 |
@${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ $(LG2C) -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_YODA}/include/yoda -I${PAM_INC} ${DIRTOP}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`.o ${DIRTOP}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.o ${LIBROOTOBJS} `doc/cernlib_pam mathlib` 1>/dev/null |
173 |
jerse |
1.1 |
# @ln -sf ${DIRTOP}/${DIRLIB}/$(@F) ${DIRTOP}/${DIRLIB}/$(patsubst %_${VER}.so,%.so,$(@F)) |
174 |
|
|
|
175 |
|
|
${LIBCPPLIBS}: ${LIBCPPSRCS} |
176 |
|
|
# |
177 |
|
|
# create .o |
178 |
|
|
# |
179 |
|
|
@(${EGREEN} "Compiling file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`.cpp"; ${RESET}) |
180 |
|
|
@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} ; |
181 |
|
|
# |
182 |
|
|
# create .so |
183 |
|
|
# |
184 |
|
|
@(${EGREEN} "Compiling shared library: "${WHITE} "$@"; ${RESET}) |
185 |
mocchiut |
1.5 |
@${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ $(LG2C) -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_YODA}/include/yoda/ -I${PAM_INC} ${DIRTOP}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`.o 1>/dev/null |
186 |
jerse |
1.1 |
|
187 |
|
|
|
188 |
|
|
${CXXEXELIBS}: ${COBJS} ${FOBJS} ${CXXEXEOBJS} |
189 |
|
|
@(${EVIOLET} "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *") |
190 |
|
|
@(${EGREEN} "Creating exec file: "${WHITE} "$@"; ${RESET}) |
191 |
|
|
@${CXX} ${CXXFLAGS} -o ${DIRBIN}/$@ ${DIRLIB}/$@.o -I${DIRTOP}/${DIRINC} -I${PAM_INC} -I${PAM_YODA}/include/yoda/ ${PAM_YODA}/lib/libyoda.so ${FOBJS} ${COBJS} ${FULLLIBS} ${OTHERLIBS} -lThread `root-config --cflags --glibs` `doc/cernlib_pam mathlib` ; |
192 |
|
|
|
193 |
|
|
# A small target to check environmental variables |
194 |
|
|
%_env: |
195 |
|
|
@${test_env} |
196 |
|
|
|
197 |
|
|
.PHONY: install installdoc installlib installmacros installinc installexe installcmacro |
198 |
|
|
.PHONY: clean depclean info mkbindir mklibdir testcern testpamenv test |
199 |
|
|
|
200 |
|
|
mkbindir: ${DIRBIN} |
201 |
|
|
${DIRBIN}: |
202 |
|
|
@${test_and_mk} |
203 |
|
|
|
204 |
|
|
mklibdir: ${DIRLIB} |
205 |
|
|
${DIRLIB}: |
206 |
|
|
@${test_and_mk} |
207 |
|
|
|
208 |
|
|
# Here what has to be deleted in clean target |
209 |
|
|
clean: TOBEDEL= ${DIRSRC}/*.o ${DIRSRC}/*Dict.cpp ${DIRSRC}/*Dict.h ${FOBJS} ${FULLLIBS} ${DIRBIN}/${CXXEXELIBS} ${COBJS} ${CXXEXEOBJS} ${DIRSRC}/version.cpp |
210 |
|
|
clean: |
211 |
|
|
@${test_and_rm} |
212 |
|
|
|
213 |
|
|
distclean: clean |
214 |
|
|
distclean: TOBEDEL= ${DIRBIN} ${DIRLIB} |
215 |
|
|
distclean: |
216 |
|
|
@${test_and_rm} |
217 |
|
|
|
218 |
|
|
forceinstall: FORCE=-f |
219 |
|
|
forceinstall: install |
220 |
|
|
|
221 |
|
|
upgrade: FORCE=-u |
222 |
|
|
upgrade: install |
223 |
|
|
|
224 |
|
|
install: installlib installinc installmacros installcalib installdoc installexe installcmacro |
225 |
|
|
|
226 |
|
|
installlib: LINK=y |
227 |
|
|
installlib: TOBEMOVED= $(FULLLIBS:${DIRLIB}%=${PAM_LIB}%) |
228 |
|
|
installlib: ORIGIN=${DIRLIB} |
229 |
|
|
installlib: |
230 |
|
|
@${test_and_cp} |
231 |
|
|
|
232 |
|
|
installcmacro: LINK=y |
233 |
|
|
installcmacro: TOBEMOVED= $(FULLMACROCLIBS:${DIRLIB}%=${PAM_LIB}%) |
234 |
|
|
installcmacro: ORIGIN=${DIRLIB} |
235 |
|
|
installcmacro: |
236 |
|
|
@${test_and_cp} |
237 |
|
|
|
238 |
|
|
installinc: TOBEMOVED= $(INCSRCS:${DIRINC}/%=${PAM_INC}/%) |
239 |
|
|
installinc: ORIGIN=${DIRINC} |
240 |
|
|
installinc: |
241 |
|
|
@${test_and_cp} |
242 |
|
|
|
243 |
|
|
installexe: TOBEMOVED= $(EXESRCS:${DIRBIN}/%=${PAM_BIN}/%) |
244 |
|
|
installexe: ORIGIN=${DIRBIN} |
245 |
|
|
installexe: |
246 |
|
|
@${test_and_cp} |
247 |
|
|
|
248 |
|
|
installmacros: TOBEMOVED= $(MACROSSRCS:${DIRMACROS}/%=${PAM_MACROS}/%) |
249 |
|
|
installmacros: ORIGIN=${DIRMACROS} |
250 |
|
|
installmacros: |
251 |
|
|
@${test_and_cp} |
252 |
|
|
|
253 |
|
|
installcalib: TOBEMOVED= $(CALIBFILES:${DIRCALIB}/%=${PAM_CALIB}/%) |
254 |
|
|
installcalib: ORIGIN=${DIRCALIB} |
255 |
|
|
installcalib: |
256 |
|
|
@${test_and_cp} |
257 |
|
|
|
258 |
|
|
installdoc: TOBEMOVED= $(DOCFILES:${DIRDOC}/%=${PAM_DOC}/%) |
259 |
|
|
installdoc: ORIGIN=${DIRDOC} |
260 |
|
|
installdoc: |
261 |
|
|
@${test_and_cp} |
262 |
|
|
|
263 |
|
|
mkverpath: |
264 |
|
|
@echo '#include <TSystem.h>' > ${DIRTOP}/${DIRSRC}/version.cpp; echo ' void info(){ printf("\nCalorimeter example version: ${VER}\n\nCompiled on '${TODAY}' with: '${GCCVER}'\n\nOn: '${UNAMEA}'\n\n"); }' >> ${DIRTOP}/${DIRSRC}/version.cpp |
265 |
|
|
@sleep 0.8 |
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} " INCLUDES :" ${WHITE} ${INCLUDE} |
275 |
|
|
@${EGREEN} " LIBS :" ${WHITE} ${LIBS} |
276 |
|
|
@${EGREEN} " DOCS :" ${WHITE} ${DOCS} |
277 |
|
|
@${EGREEN} " SRCS :" ${WHITE} ${SRCS} |
278 |
|
|
@${EGREEN} " MACROS :" ${WHITE} ${MACROS} |
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 |