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