1 |
mocchiut |
1.1 |
# Calorimeter double shower plugin |
2 |
|
|
# SOFTWARE VERSION |
3 |
|
|
VER= v1r00 |
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 |
mocchiut |
1.3 |
#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 |
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 |
mocchiut |
1.1 |
F77=g77 |
44 |
mocchiut |
1.5 |
LG2C=-lg2c |
45 |
|
|
EXTRAOPT=-Wno-globals -fvxt |
46 |
|
|
endif |
47 |
mocchiut |
1.3 |
#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 |
mocchiut |
1.1 |
# C++ |
50 |
|
|
CXX=g++ |
51 |
mocchiut |
1.3 |
#CXXFLAGS=-Wall -O -fPIC -pthread -g ${PAM_BIT} |
52 |
|
|
CXXFLAGS=-Wall -O -fPIC -pthread ${PAM_BIT} |
53 |
mocchiut |
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=${DIRSRC}/getdblsh.for \ |
69 |
|
|
${DIRSRC}/dblsc.for \ |
70 |
|
|
${DIRSRC}/dubsc.for |
71 |
|
|
FOBJS=$(FSRCS:${DIRSRC}/%.for=${DIRLIB}/%.o) |
72 |
|
|
#------------------------------------------------- |
73 |
|
|
CSRCS= |
74 |
|
|
COBJS=$(CSRCS:${DIRSRC}%.cpp=${DIRLIB}/%.o) |
75 |
|
|
#------------------------------------------------- |
76 |
|
|
# librerie utilizzabili da root (ci deve essere anche il ***LinkDef.h ) |
77 |
|
|
LIBROOTSRCS=${DIRSRC}/CaloDoubleShower.cpp |
78 |
|
|
LIBROOTLIBS=$(LIBROOTSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so) |
79 |
|
|
LIBROOTOBJS=${FOBJS} |
80 |
|
|
LIBROOTCLIBS=libCaloDoubleShower |
81 |
|
|
FULLROOTCLIBS=$(LIBROOTCLIBS:%=${DIRLIB}/%_${VER}.so) |
82 |
|
|
#------------------------------------------------- |
83 |
|
|
# librerie C++ NON utilizzabili da root |
84 |
|
|
LIBCPPSRCS=#${DIRSRC}/PamLevel2.cpp |
85 |
|
|
LIBCPPLIBS=$(LIBCPPSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so) |
86 |
|
|
LIBCPPCLIBS=#libPamLevel2 |
87 |
|
|
FULLCPPCLIBS=$(LIBCPPCLIBS:%=${DIRLIB}/%_${VER}.so) |
88 |
|
|
#------------------------------------------------- |
89 |
|
|
# librerie F77 NON utilizzabili da root |
90 |
|
|
LIBF77SRCS= |
91 |
|
|
LIBF77OBJS= $(LIBF77SRCS:${DIRSRC}/%.for=${DIRLIB}/%.o) |
92 |
|
|
LIBF77LIBS= $(LIBF77SRCS:${DIRSRC}/%.for=${DIRLIB}/lib%_${VER}.so) |
93 |
|
|
LIBF77CLIBS= |
94 |
|
|
FULLF77CLIBS=$(LIBF77CLIBS:%=${DIRLIB}/%_${VER}.so) |
95 |
|
|
#------------------------------------------------- |
96 |
|
|
FULLLIBS=${FULLROOTCLIBS} ${FULLCPPCLIBS} ${FULLF77CLIBS} |
97 |
|
|
|
98 |
|
|
#------------------------------------------------- |
99 |
|
|
# eseguibile |
100 |
|
|
CXXEXESRCS= |
101 |
|
|
CXXEXEOBJS=$(CXXEXESRCS:${DIRSRC}%.cpp=${DIRLIB}%.o) |
102 |
|
|
CXXEXELIBS:= |
103 |
|
|
|
104 |
|
|
OTHERLIBS=${PAM_LIB}/libCaloLevel0.so ${PAM_LIB}/libCaloLevel1.so ${PAM_LIB}/libCaloLevel2.so ${PAM_LIB}/libCaloCore.so ${PAM_LIB}/libcaloclasses.so |
105 |
|
|
#------------------------------------------------- |
106 |
|
|
# variabili per l'installazione |
107 |
|
|
EXESRCS= |
108 |
|
|
INCSRCS=${DIRINC}/CaloDoubleShower.h |
109 |
|
|
MACROSSRCS= |
110 |
|
|
CALIBFILES= |
111 |
|
|
DOCFILES= |
112 |
|
|
# Here the Variables used for info target |
113 |
|
|
PACKAGE=Tracker flight software |
114 |
|
|
EXECUTABLES=${EXESRCS} |
115 |
|
|
LIBS= ${FULLLIBS} ${OTHERLIBS} |
116 |
|
|
DOCS= |
117 |
|
|
SRCS= |
118 |
|
|
MACROS= ${MACROSSRCS} |
119 |
|
|
INCLUDE= ${INCSRCS} |
120 |
|
|
# |
121 |
|
|
TOBEDEL = junk |
122 |
|
|
ROOTINC=$$${shell root-config --incdir} |
123 |
|
|
NROOTINC=${shell root-config --incdir} |
124 |
|
|
# Let's start |
125 |
|
|
all : test mkbindir mklibdir ${LIBF77LIBS} ${LIBROOTLIBS} ${LIBCPPLIBS} ${CXXEXELIBS} |
126 |
|
|
all: |
127 |
|
|
@echo -e ${GREEN} "" |
128 |
|
|
@(${EGREEN} " Finished, now you can install the package \n (use: make install or make upgrade or make forceinstall) "; ${RESET}) |
129 |
|
|
@echo -e ${GREEN} "" |
130 |
|
|
@${RESET} |
131 |
|
|
|
132 |
|
|
# Here some general rules to produce objects in our local dir |
133 |
|
|
${DIRLIB}/%.o: ${DIRSRC}/%.cpp |
134 |
|
|
@(${EYELLOW} " C++ object ------------------------") |
135 |
|
|
@(${EGREEN} "Creating object file: "${WHITE} "$@"; ${RESET}) |
136 |
|
|
@${CXX} ${CXXFLAGS} -c -o $@ ${DIRSRC}/`basename ${@} .o`.cpp -I${DIRINC} -I${PAM_INC} -I${PAM_YODA}/include/yoda/ `root-config --cflags` |
137 |
|
|
|
138 |
|
|
${DIRLIB}/%.o : ${DIRSRC}/%.for |
139 |
|
|
@(${EYELLOW} " F77 object ------------------------") |
140 |
|
|
@(${EGREEN} "Creating object file: "${WHITE} "$@"; ${RESET}) |
141 |
|
|
@${F77} ${F77FLAGS} -c -o $@ ${DIRSRC}/`basename ${@} .o`.for -I${DIRINC} -I${NROOTINC} -I${PAM_INC} -I${PAM_YODA}/include/yoda |
142 |
|
|
|
143 |
|
|
|
144 |
|
|
# .so from .o fortran |
145 |
|
|
${LIBF77LIBS}: ${LIBF77OBJS} |
146 |
|
|
@(${EYELLOW} " F77 shared library --------------------------") |
147 |
|
|
@(${EGREEN} "Creating library: "${WHITE} "$@"; ${RESET}) |
148 |
mocchiut |
1.5 |
@${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ $^ $(LG2C) `doc/cernlib_pam mathlib` |
149 |
mocchiut |
1.1 |
|
150 |
|
|
|
151 |
|
|
${LIBROOTLIBS}: ${FOBJS} ${LIBROOTSRCS} |
152 |
|
|
@(${EYELLOW} " ROOT library ------------------------") |
153 |
|
|
@(${EGREEN} "Creating file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp"; ${RESET}) |
154 |
|
|
# |
155 |
|
|
# Create *Dict.cpp and *Dict.h |
156 |
|
|
# |
157 |
|
|
# @${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 |
158 |
|
|
@${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 |
159 |
|
|
# |
160 |
|
|
# 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! |
161 |
|
|
# should be fixed some time changing names... |
162 |
|
|
# |
163 |
|
|
# create .o |
164 |
|
|
# |
165 |
|
|
@(${EGREEN} "Compiling file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`.cpp"; ${RESET}) |
166 |
|
|
@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}; |
167 |
|
|
@(${EGREEN} "Compiling file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp"; ${RESET}) |
168 |
|
|
@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}; |
169 |
|
|
# |
170 |
|
|
# create .so |
171 |
|
|
# |
172 |
|
|
@(${EGREEN} "Compiling shared library: "${WHITE} "$@"; ${RESET}) |
173 |
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 |
174 |
mocchiut |
1.1 |
# @ln -sf ${DIRTOP}/${DIRLIB}/$(@F) ${DIRTOP}/${DIRLIB}/$(patsubst %_${VER}.so,%.so,$(@F)) |
175 |
|
|
|
176 |
|
|
${LIBCPPLIBS}: ${LIBCPPSRCS} |
177 |
|
|
# |
178 |
|
|
# create .o |
179 |
|
|
# |
180 |
|
|
@(${EGREEN} "Compiling file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`.cpp"; ${RESET}) |
181 |
|
|
@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} ; |
182 |
|
|
# |
183 |
|
|
# create .so |
184 |
|
|
# |
185 |
|
|
@(${EGREEN} "Compiling shared library: "${WHITE} "$@"; ${RESET}) |
186 |
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 |
187 |
mocchiut |
1.1 |
|
188 |
|
|
|
189 |
|
|
${CXXEXELIBS}: ${COBJS} ${FOBJS} ${CXXEXEOBJS} |
190 |
|
|
@(${EVIOLET} "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *") |
191 |
|
|
@(${EGREEN} "Creating exec file: "${WHITE} "$@"; ${RESET}) |
192 |
|
|
@${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` ; |
193 |
|
|
|
194 |
|
|
# A small target to check environmental variables |
195 |
|
|
%_env: |
196 |
|
|
@${test_env} |
197 |
|
|
|
198 |
|
|
.PHONY: install installdoc installlib installmacros installinc installexe installcmacro |
199 |
|
|
.PHONY: clean depclean info mkbindir mklibdir testcern testpamenv test |
200 |
|
|
|
201 |
|
|
mkbindir: ${DIRBIN} |
202 |
|
|
${DIRBIN}: |
203 |
|
|
@${test_and_mk} |
204 |
|
|
|
205 |
|
|
mklibdir: ${DIRLIB} |
206 |
|
|
${DIRLIB}: |
207 |
|
|
@${test_and_mk} |
208 |
|
|
|
209 |
|
|
# Here what has to be deleted in clean target |
210 |
|
|
clean: TOBEDEL= ${DIRSRC}/*.o ${DIRSRC}/*Dict.cpp ${DIRSRC}/*Dict.h ${FOBJS} ${FULLLIBS} ${DIRBIN}/${CXXEXELIBS} ${COBJS} ${CXXEXEOBJS} |
211 |
|
|
clean: |
212 |
|
|
@${test_and_rm} |
213 |
|
|
|
214 |
|
|
distclean: clean |
215 |
|
|
distclean: TOBEDEL= ${DIRBIN} ${DIRLIB} |
216 |
|
|
distclean: |
217 |
|
|
@${test_and_rm} |
218 |
|
|
|
219 |
|
|
forceinstall: FORCE=-f |
220 |
|
|
forceinstall: install |
221 |
|
|
|
222 |
|
|
upgrade: FORCE=-u |
223 |
|
|
upgrade: install |
224 |
|
|
|
225 |
|
|
install: installlib installinc installmacros installcalib installdoc installexe installcmacro |
226 |
|
|
|
227 |
|
|
installlib: LINK=y |
228 |
|
|
installlib: TOBEMOVED= $(FULLLIBS:${DIRLIB}%=${PAM_LIB}%) |
229 |
|
|
installlib: ORIGIN=${DIRLIB} |
230 |
|
|
installlib: |
231 |
|
|
@${test_and_cp} |
232 |
|
|
|
233 |
|
|
installcmacro: LINK=y |
234 |
|
|
installcmacro: TOBEMOVED= $(FULLMACROCLIBS:${DIRLIB}%=${PAM_LIB}%) |
235 |
|
|
installcmacro: ORIGIN=${DIRLIB} |
236 |
|
|
installcmacro: |
237 |
|
|
@${test_and_cp} |
238 |
|
|
|
239 |
|
|
installinc: TOBEMOVED= $(INCSRCS:${DIRINC}/%=${PAM_INC}/%) |
240 |
|
|
installinc: ORIGIN=${DIRINC} |
241 |
|
|
installinc: |
242 |
|
|
@${test_and_cp} |
243 |
|
|
|
244 |
|
|
installexe: TOBEMOVED= $(EXESRCS:${DIRBIN}/%=${PAM_BIN}/%) |
245 |
|
|
installexe: ORIGIN=${DIRBIN} |
246 |
|
|
installexe: |
247 |
|
|
@${test_and_cp} |
248 |
|
|
|
249 |
|
|
installmacros: TOBEMOVED= $(MACROSSRCS:${DIRMACROS}/%=${PAM_MACROS}/%) |
250 |
|
|
installmacros: ORIGIN=${DIRMACROS} |
251 |
|
|
installmacros: |
252 |
|
|
@${test_and_cp} |
253 |
|
|
|
254 |
|
|
installcalib: TOBEMOVED= $(CALIBFILES:${DIRCALIB}/%=${PAM_CALIB}/%) |
255 |
|
|
installcalib: ORIGIN=${DIRCALIB} |
256 |
|
|
installcalib: |
257 |
|
|
@${test_and_cp} |
258 |
|
|
|
259 |
|
|
installdoc: TOBEMOVED= $(DOCFILES:${DIRDOC}/%=${PAM_DOC}/%) |
260 |
|
|
installdoc: ORIGIN=${DIRDOC} |
261 |
|
|
installdoc: |
262 |
|
|
@${test_and_cp} |
263 |
|
|
|
264 |
|
|
#mkverpath: |
265 |
|
|
# @echo '#include <TSystem.h>' > ${DIRTOP}/${DIRSRC}/TrkVerl2.cpp; echo ' void info(){ printf("\nTracker Level2 flight package version: ${VER}\n\nCompiled on '${TODAY}' with: '${GCCVER}'\n\nOn: '${UNAMEA}'\n\n"); }' >> ${DIRTOP}/${DIRSRC}/TrkVerl2.cpp |
266 |
|
|
# @sleep 0.8 |
267 |
|
|
|
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} " INCLUDES :" ${WHITE} ${INCLUDE} |
276 |
|
|
@${EGREEN} " LIBS :" ${WHITE} ${LIBS} |
277 |
|
|
@${EGREEN} " DOCS :" ${WHITE} ${DOCS} |
278 |
|
|
@${EGREEN} " SRCS :" ${WHITE} ${SRCS} |
279 |
|
|
@${EGREEN} " MACROS :" ${WHITE} ${MACROS} |
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 |