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