1 |
mocchiut |
1.1 |
# |
2 |
|
|
# CaloUTILITIES package |
3 |
|
|
# |
4 |
|
|
# SOFTWARE VERSION |
5 |
|
|
VER= v2r00 |
6 |
|
|
# REQUIRES CALOCOMMON version |
7 |
|
|
COMMONVER=v1r06 |
8 |
|
|
# installed calocommon version |
9 |
|
|
COMPCOMVER=`echo ${COMMONVER} | tr -d [a-z:A-Z]` |
10 |
|
|
INSTCOMVER=`${PAM_BIN}/calocommon |head -2 |tail -1 | tr -d [a-z:A-Z]` |
11 |
|
|
# An almost general purpouse Makefile for PAMELA repository |
12 |
|
|
# Let's start with some usefull definition for colorize the echo |
13 |
|
|
RED='\E[1;31;40m' |
14 |
|
|
GREEN='\E[1;32;40m' |
15 |
|
|
YELLOW='\E[1;33;40m' |
16 |
|
|
BLUE='\E[1;34;40m' |
17 |
|
|
WHITE='\E[1;37;40m' |
18 |
|
|
VIOLET='\E[1;35;40m' |
19 |
|
|
CYAN='\E[1;36;40m' |
20 |
|
|
# Here the echo definition to use them |
21 |
|
|
EVIOLET=echo -e ${VIOLET} |
22 |
|
|
ECYAN=echo -e ${CYAN} |
23 |
|
|
ERED=echo -e ${RED} |
24 |
|
|
EGREEN=echo -e ${GREEN} |
25 |
|
|
EYELLOW=echo -e ${YELLOW} |
26 |
|
|
EBLUE=echo -e ${BLUE} |
27 |
|
|
EWHITE=echo -e ${WHITE} |
28 |
|
|
# Reset the terminal |
29 |
|
|
RESET=tput sgr0 |
30 |
|
|
# Here the variables used to override the standard make flags |
31 |
|
|
# C |
32 |
|
|
CC=gcc |
33 |
|
|
CFLAGS=-Wall |
34 |
|
|
# Enviroment: |
35 |
|
|
GCCVER=`gcc --version | head -1` |
36 |
|
|
UNAMEA=`uname -a` |
37 |
|
|
# F77 |
38 |
|
|
F77=g77 |
39 |
|
|
#F77FLAGS= -Wall -fbounds-check -g -extend_source -static -fno-backslash |
40 |
|
|
F77FLAGS= -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -g -extend_source -static -fno-backslash |
41 |
|
|
# C++ |
42 |
|
|
CXX=g++ |
43 |
|
|
CXXFLAGS=-Wall |
44 |
|
|
# Here the variables definig the local directories |
45 |
|
|
DIRTOP=${shell pwd} |
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_MACROS_env PAM_CALIB_env PAM_YODA_env |
55 |
|
|
# Here the local variables used to build the targets |
56 |
|
|
FSRCS= |
57 |
|
|
|
58 |
|
|
FOBJS=$(FSRCS:${DIRSRC}%.for=${DIRBIN}%.o) |
59 |
|
|
FLIBS= |
60 |
|
|
FULLFLIBS=$(FLIBS:%=${DIRLIB}/lib%_${VER}.so) |
61 |
|
|
FULLLINKFLIBS=$(FLIBS:%=${DIRLIB}/lib%.so) |
62 |
|
|
|
63 |
|
|
CSRCS= |
64 |
|
|
|
65 |
|
|
MACROSRCS=${DIRMACROS}/UTpathtoc.c \ |
66 |
|
|
${DIRMACROS}/CaloTRKCALOALIG.c \ |
67 |
|
|
${DIRMACROS}/CaloCALIBSCAN.c \ |
68 |
|
|
${DIRMACROS}/CaloADC2MIP.c |
69 |
|
|
|
70 |
|
|
MACROSLIBS=$(MACROSRCS:${DIRMACROS}/%.c=${DIRLIB}/%_c_${VER}.so) |
71 |
|
|
MACROCLIBS=UTpathtoc_c CaloTRKCALOALIG_c CaloCALIBSCAN_c CaloADC2MIP_c |
72 |
|
|
FULLMACROCLIBS=$(MACROCLIBS:%=${DIRLIB}/%_${VER}.so) |
73 |
|
|
FULLLINKMACROCLIBS=$(MACROCLIBS:%=${DIRLIB}/%.so) |
74 |
|
|
|
75 |
|
|
|
76 |
|
|
COBJS=$(CSRCS:${DIRSRC}%.c=${DIRBIN}%.o) |
77 |
|
|
CLIBS= |
78 |
|
|
FULLCLIBS=$(CLIBS:%=${DIRLIB}/lib%_${VER}.so) |
79 |
|
|
FULLLINKCLIBS=$(CLIBS:%=${DIRLIB}/lib%.so) |
80 |
|
|
|
81 |
|
|
CXXSRCS= |
82 |
|
|
|
83 |
|
|
FULLCXXLIBS=$(CXXSRCS:${DIRSRC}/%.C=${DIRLIB}/%_C_${VER}.so) |
84 |
|
|
|
85 |
|
|
CXXEXESRCS=${DIRSRC}/CaloTRKCALOALIG.cc \ |
86 |
|
|
${DIRSRC}/CaloADC2MIP.cc \ |
87 |
|
|
${DIRSRC}/caloutilities.cc |
88 |
|
|
|
89 |
|
|
CXXEXEOBJS=$(CXXEXESRCS:${DIRSRC}%.cc=${DIRBIN}%.o) |
90 |
|
|
CXXEXELIBS:=CaloTRKCALOALIG CaloADC2MIP caloutilities |
91 |
|
|
|
92 |
|
|
#FULLLIBS=$(sort ${FULLFLIBS} ${FULLCXXLIBS} ) |
93 |
|
|
FULLLIBS=${FULLFLIBS} ${FULLCXXLIBS} ${FULLCLIBS} |
94 |
|
|
|
95 |
|
|
EXESRCS= ${DIRBIN}/CaloTRKCALOALIG \ |
96 |
|
|
${DIRBIN}/CaloADC2MIP \ |
97 |
|
|
${DIRBIN}/caloutilities |
98 |
|
|
INCSRCS= |
99 |
|
|
|
100 |
|
|
MACROSSRCS=${DIRMACROS}/CaloADC2MIP.c ${DIRMACROS}/CaloCALIBSCAN.c ${DIRMACROS}/CaloTRKCALOALIG.c ${DIRMACROS}/CaloTRKCALOALIG.C ${DIRMACROS}/CaloCALIBSCAN.C ${DIRMACROS}/CaloADC2MIP.C |
101 |
|
|
|
102 |
|
|
CALIBFILES=${DIRCALIB}/CaloADC2MIPf.root ${DIRCALIB}/CaloCALIBdata.root |
103 |
|
|
|
104 |
|
|
DOCFILES=${DIRDOC}/caloUTILITIES.README.pdf |
105 |
|
|
|
106 |
|
|
# Here the Variables used for info target |
107 |
|
|
PACKAGE=Calorimeter ground software utility files and libraries |
108 |
|
|
EXECUTABLES=caloutilities |
109 |
|
|
LIBS= ${FLIBS} ${FOBJS} ${CLIBS} ${COBJS} ${CXXEXEOBJS} |
110 |
|
|
DOCS= |
111 |
|
|
SRCS= ${FSRCS} ${CRSCS} ${CXXEXESRCS} |
112 |
|
|
MACROS= ${MACROSSRCS} |
113 |
|
|
# |
114 |
|
|
TOBEDEL = junk |
115 |
|
|
|
116 |
|
|
# Let's start |
117 |
|
|
all : test mkbindir mklibdir mkpathtoc ${FULLFLIBS} ${FULLCXXLIBS} ${MACROSLIBS} ${CXXEXELIBS} |
118 |
|
|
all: |
119 |
|
|
@echo -e ${GREEN} "" |
120 |
|
|
@(${EGREEN} " Finished, now you can install the package \n (use: make install or make upgrade or make forceinstall) "; ${RESET}) |
121 |
|
|
@echo -e ${GREEN} "" |
122 |
|
|
@${RESET} |
123 |
|
|
|
124 |
|
|
# Here some general rules to produce objects in our local dir |
125 |
|
|
# .o from fortran |
126 |
|
|
${DIRBIN}/%.o : ${DIRSRC}/%.for |
127 |
|
|
@(${EGREEN} "Creating object file: "${WHITE} "$@"; ${RESET}) |
128 |
|
|
@${F77} ${F77FLAGS} -c -o $@ $< -I${DIRINC} |
129 |
|
|
|
130 |
|
|
|
131 |
|
|
${DIRBIN}/%.o: ${DIRSRC}/%.cc |
132 |
|
|
@(${EGREEN} "Creating object file: "${WHITE} "$@"; ${RESET}) |
133 |
|
|
@cat ${DIRSRC}/`basename ${@} .o`.cc > ${DIRSRC}/temp.cc; |
134 |
|
|
@echo ' ' >> ${DIRSRC}/temp.cc |
135 |
|
|
@echo 'void info(){ printf("\nCaloUTILITIES package version: ${VER}\n\nCompiled on '${TODAY}' with: '${GCCVER}'\n\nOn: '${UNAMEA}'\n\n"); }' >> ${DIRSRC}/temp.cc |
136 |
|
|
@${CXX} ${CXXFLAGS} -c -o $@ ${DIRSRC}/temp.cc -I${DIRINC} -I${PAM_INC} -I${PAM_YODA}/include/yoda/ `root-config --cflags` |
137 |
|
|
|
138 |
|
|
# .o from C |
139 |
|
|
${DIRBIN}/%.o : ${DIRSRC}/%.c |
140 |
|
|
@(${EGREEN} "Creating object file: "${WHITE} "$@"; ${RESET}) |
141 |
|
|
@${CC} ${CFLAGS} -c -o $@ $< -I${DIRINC} |
142 |
|
|
|
143 |
|
|
|
144 |
|
|
# .so from .o fortran |
145 |
|
|
${FULLFLIBS}: ${FOBJS} |
146 |
|
|
@(${EGREEN} "Creating library: "${WHITE} "$@"; ${RESET}) |
147 |
|
|
@${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ $^ -lg2c `cernlib mathlib` |
148 |
|
|
@(${EGREEN} "Creating symlink from : "${WHITE} "$@"; ${RESET}) |
149 |
|
|
@(${EGREEN} " to : "${WHITE} "${DIRLIB}/`basename $@ _${VER}.so`.so"; ${RESET}) |
150 |
|
|
@ln -sf `basename $@` ${DIRLIB}/`basename $@ _${VER}.so`.so |
151 |
|
|
|
152 |
|
|
# .so from .o c |
153 |
|
|
${FULLCLIBS}: ${COBJS} |
154 |
|
|
@(${EGREEN} "Creating library: "${WHITE} "$@"; ${RESET}) |
155 |
|
|
@${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ $^ -lg2c `mysql_config --cflags --libs` |
156 |
|
|
@(${EGREEN} "Creating symlink from : "${WHITE} "$@"; ${RESET}) |
157 |
|
|
@(${EGREEN} " to : "${WHITE} "${DIRLIB}/`basename $@ _${VER}.so`.so"; ${RESET}) |
158 |
|
|
@ln -sf `basename $@` ${DIRLIB}/`basename $@ _${VER}.so`.so |
159 |
|
|
|
160 |
|
|
${FULLCXXLIBS}: ${FULLCLIBS} ${FULLFLIBS} ${CXXSRCS} |
161 |
|
|
@(${EGREEN} "Creating Root sharable lib: "${WHITE} "$@"; ${RESET}) |
162 |
|
|
@echo '.include ${DIRTOP}/${DIRINC}' > build_so.txt |
163 |
|
|
@echo 'TString *junk=new TString();' >> build_so.txt |
164 |
|
|
@echo '*junk=gSystem->GetDynamicPath();' >> build_so.txt |
165 |
|
|
@echo ' // cout << junk->Data() << endl;' >> build_so.txt |
166 |
|
|
@echo '*junk+=":${DIRLIB}";' >> build_so.txt |
167 |
|
|
@echo 'gSystem->SetDynamicPath(junk.Data());' >> build_so.txt |
168 |
|
|
@echo 'gSystem->Load("${DIRLIB}/'`basename $@ _C_${VER}.so`'.so")' >> build_so.txt |
169 |
|
|
@echo 'gSystem->cd("'${DIRSRC}'");' >> build_so.txt |
170 |
|
|
@echo '.L $(patsubst %_C_${VER}.so,%.C++O,$(@F))' >> build_so.txt |
171 |
|
|
@echo '.q' >> build_so.txt |
172 |
|
|
@root -l -b &>/dev/null < build_so.txt |
173 |
|
|
@mv -f ${DIRSRC}/$(patsubst %_C_${VER}.so,%_C.so,$(@F)) ${DIRLIB}/$(@F) |
174 |
|
|
@rm -f build_so.txt |
175 |
|
|
|
176 |
|
|
${MACROSLIBS}: ${MACROSRCS} |
177 |
|
|
@(${EGREEN} "Compiling macro: "${WHITE} "$@"; ${RESET}) |
178 |
|
|
@echo '.include ${DIRTOP}/${DIRINC}' > build_so.txt |
179 |
|
|
@echo '.include ${PAM_INC}' >> build_so.txt |
180 |
|
|
@echo 'TString *junk=new TString();' >> build_so.txt |
181 |
|
|
@echo '*junk=gSystem->GetDynamicPath();' >> build_so.txt |
182 |
|
|
@echo '*junk+=":${DIRLIB}";' >> build_so.txt |
183 |
|
|
@echo 'gSystem->SetDynamicPath(junk.Data());' >> build_so.txt |
184 |
|
|
@echo 'char *lmac = gSystem->ExpandPathName("$$PAM_INC");'>>build_so.txt |
185 |
|
|
@echo 'gInterpreter->AddIncludePath(lmac);'>>build_so.txt |
186 |
|
|
@echo 'char *pamyoda = gSystem->ExpandPathName("$$PAM_YODA");' >>build_so.txt |
187 |
|
|
@echo 'stringstream incy;' >>build_so.txt |
188 |
|
|
@echo 'incy.str("");' >>build_so.txt |
189 |
|
|
@echo 'incy << pamyoda << "/include/yoda/";' >>build_so.txt |
190 |
|
|
@echo 'gInterpreter->AddIncludePath(incy.str().c_str());' >>build_so.txt |
191 |
|
|
@echo 'stringstream oss;' >>build_so.txt |
192 |
|
|
@echo 'oss.str("");' >> build_so.txt |
193 |
|
|
@echo 'oss << pamyoda << "/event/";' >>build_so.txt |
194 |
|
|
@echo 'gInterpreter->AddIncludePath(oss.str().c_str());' >> build_so.txt |
195 |
|
|
@echo 'oss.str("");' >> build_so.txt |
196 |
|
|
@echo 'gSystem->cd("'${DIRMACROS}'");' >> build_so.txt |
197 |
|
|
@echo 'char *pamyodalib = gSystem->ExpandPathName("$$PAM_YODA");' >>build_so.txt |
198 |
|
|
@echo 'char *libYODA;'>>build_so.txt |
199 |
|
|
@echo 'oss << pamyodalib << "/lib/libyoda.so";' >>build_so.txt |
200 |
|
|
@echo 'gSystem->Load(oss.str().c_str());'>>build_so.txt |
201 |
|
|
@echo 'char *pamlib = gSystem->ExpandPathName("$$PAM_LIB");'>>build_so.txt |
202 |
|
|
@if [ "$@" == "${DIRLIB}/CaloTRKCALOALIG_c_"${VER}".so" ]; then \ |
203 |
|
|
echo 'oss.str("");' >>build_so.txt;\ |
204 |
|
|
echo 'oss << "'${DIRTOP}/${DIRLIB}'/UTpathtoc_c_'${VER}'.so";'>>build_so.txt;\ |
205 |
|
|
echo 'gSystem->Load(oss.str().c_str());'>>build_so.txt;\ |
206 |
|
|
echo 'oss.str("");' >> build_so.txt; \ |
207 |
|
|
echo 'oss << pamlib << "/libtrack";' >>build_so.txt; \ |
208 |
|
|
echo 'gSystem->Load(oss.str().c_str());'>>build_so.txt; \ |
209 |
|
|
echo 'oss.str("");' >> build_so.txt; \ |
210 |
|
|
echo 'oss << pamlib << "/libtrack_C";' >>build_so.txt; \ |
211 |
|
|
echo 'gSystem->Load(oss.str().c_str());'>>build_so.txt; \ |
212 |
|
|
echo 'oss.str("");' >> build_so.txt; \ |
213 |
|
|
echo 'oss << pamlib << "/libreadb2maps";' >>build_so.txt; \ |
214 |
|
|
echo 'gSystem->Load(oss.str().c_str());'>>build_so.txt; \ |
215 |
|
|
echo 'oss.str("");' >> build_so.txt; \ |
216 |
|
|
echo 'oss << pamlib << "/libreadb2maps_C";' >>build_so.txt; \ |
217 |
|
|
echo 'gSystem->Load(oss.str().c_str());'>>build_so.txt; \ |
218 |
|
|
fi |
219 |
|
|
@echo 'oss.str("");' >> build_so.txt |
220 |
|
|
@echo 'oss << pamlib << "/caloclasses_h";' >>build_so.txt |
221 |
|
|
@echo 'gSystem->Load(oss.str().c_str());'>>build_so.txt |
222 |
|
|
@echo '.L $(patsubst %_c_${VER}.so,%.c++,$(@F))' >> build_so.txt |
223 |
|
|
@echo '.q' >> build_so.txt |
224 |
|
|
@root -l -b &>/dev/null < build_so.txt |
225 |
|
|
@mv -f ${DIRMACROS}/$(patsubst %_c_${VER}.so,%_c.so,$(@F)) ${DIRLIB}/$(@F) |
226 |
|
|
@rm -f build_so.txt |
227 |
|
|
|
228 |
|
|
|
229 |
|
|
${CXXEXELIBS}: ${CXXEXEOBJS} |
230 |
|
|
@(${EGREEN} "Creating exec file: "${WHITE} "$@"; ${RESET}) |
231 |
|
|
@if [ "$@" == "caloutilities" ]; then ${CXX} ${CXXFLAGS} -o ${DIRBIN}/$@ ${DIRBIN}/$@.o -I${DIRINC} -I${PAM_INC} -I${PAM_YODA}/include/yoda/; else ${CXX} ${CXXFLAGS} -o ${DIRBIN}/$@ ${DIRBIN}/$@.o -I${DIRINC} -I${PAM_INC} -I${PAM_YODA}/include/yoda/ ${DIRTOP}/${DIRLIB}/UTpathtoc_c_${VER}.so ${PAM_LIB}/caloclasses_h.so ${PAM_YODA}/lib/libyoda.so ${PAM_LIB}/libtrack.so ${PAM_LIB}/libtrack_C.so ${PAM_LIB}/libreadb2maps.so ${PAM_LIB}/libreadb2maps_C.so ${DIRTOP}/${DIRLIB}/$@_c_${VER}.so `root-config --cflags --glibs` ; fi; |
232 |
|
|
@rm -f ${DIRSRC}/temp.cc |
233 |
|
|
|
234 |
|
|
# A small target to check environmental variables |
235 |
|
|
%_env: |
236 |
|
|
@${test_env} |
237 |
|
|
|
238 |
|
|
.PHONY: install installdoc installlib installmacros installinc installexe installcmacro |
239 |
|
|
.PHONY: clean depclean info mkbindir mklibdir testcern testpamenv test |
240 |
|
|
|
241 |
|
|
mkbindir: ${DIRBIN} |
242 |
|
|
${DIRBIN}: |
243 |
|
|
@${test_and_mk} |
244 |
|
|
|
245 |
|
|
mklibdir: ${DIRLIB} |
246 |
|
|
${DIRLIB}: |
247 |
|
|
@${test_and_mk} |
248 |
|
|
|
249 |
|
|
# Here what has to be deleted in clean target |
250 |
|
|
clean: TOBEDEL= ${FOBJS} ${FULLLIBS} ${DIRBIN}/${CXXEXELIBS} ${COBJS} ${CXXEXEOBJS} ${FULLLINKFLIBS} ${FULLLINKCLIBS} ${FULLMACROCLIBS} ${FULLLINKMACROCLIBS} |
251 |
|
|
clean: |
252 |
|
|
@${test_and_rm} |
253 |
|
|
|
254 |
|
|
distclean: clean |
255 |
|
|
distclean: TOBEDEL= ${DIRBIN} ${DIRLIB} |
256 |
|
|
distclean: |
257 |
|
|
@${test_and_rm} |
258 |
|
|
|
259 |
|
|
forceinstall: FORCE=-f |
260 |
|
|
forceinstall: install |
261 |
|
|
|
262 |
|
|
upgrade: FORCE=-u |
263 |
|
|
upgrade: install |
264 |
|
|
|
265 |
|
|
install: installlib installinc installmacros installcalib installdoc installexe installcmacro |
266 |
|
|
|
267 |
|
|
installlib: LINK=y |
268 |
|
|
installlib: TOBEMOVED= $(FULLLIBS:${DIRLIB}%=${PAM_LIB}%) |
269 |
|
|
installlib: ORIGIN=${DIRLIB} |
270 |
|
|
installlib: |
271 |
|
|
@${test_and_cp} |
272 |
|
|
|
273 |
|
|
installinc: TOBEMOVED= $(INCSRCS:${DIRINC}/%=${PAM_INC}/%) |
274 |
|
|
installinc: ORIGIN=${DIRINC} |
275 |
|
|
installinc: |
276 |
|
|
@${test_and_cp} |
277 |
|
|
|
278 |
|
|
installexe: TOBEMOVED= $(EXESRCS:${DIRBIN}/%=${PAM_BIN}/%) |
279 |
|
|
installexe: ORIGIN=${DIRBIN} |
280 |
|
|
installexe: |
281 |
|
|
@${test_and_cp} |
282 |
|
|
|
283 |
|
|
installmacros: TOBEMOVED= $(MACROSSRCS:${DIRMACROS}/%=${PAM_MACROS}/%) |
284 |
|
|
installmacros: ORIGIN=${DIRMACROS} |
285 |
|
|
installmacros: |
286 |
|
|
@${test_and_cp} |
287 |
|
|
|
288 |
|
|
installcmacro: LINK=y |
289 |
|
|
installcmacro: TOBEMOVED= $(FULLMACROCLIBS:${DIRLIB}%=${PAM_LIB}%) |
290 |
|
|
installcmacro: ORIGIN=${DIRLIB} |
291 |
|
|
installcmacro: |
292 |
|
|
@${test_and_cp} |
293 |
|
|
|
294 |
|
|
installcalib: TOBEMOVED= $(CALIBFILES:${DIRCALIB}/%=${PAM_CALIB}/%) |
295 |
|
|
installcalib: ORIGIN=${DIRCALIB} |
296 |
|
|
installcalib: |
297 |
|
|
@${test_and_cp} |
298 |
|
|
|
299 |
|
|
installdoc: TOBEMOVED= $(DOCFILES:${DIRDOC}/%=${PAM_DOC}/%) |
300 |
|
|
installdoc: ORIGIN=${DIRDOC} |
301 |
|
|
installdoc: |
302 |
|
|
@${test_and_cp} |
303 |
|
|
|
304 |
|
|
info: |
305 |
|
|
@echo " " |
306 |
|
|
@${EGREEN} "Infos for package :" ${WHITE} ${PACKAGE} |
307 |
|
|
@${EGREEN} " VERSION :" ${WHITE} ${VER} |
308 |
|
|
@${EGREEN} " EXECUTABLES :" ${WHITE} ${EXECUTABLES} |
309 |
|
|
@${EGREEN} " LIBS :" ${WHITE} ${LIBS} |
310 |
|
|
@${EGREEN} " DOCS :" ${WHITE} ${DOCS} |
311 |
|
|
@${EGREEN} " SRCS :" ${WHITE} ${SRCS} |
312 |
|
|
@${EGREEN} " MACROS :" ${WHITE} ${MACROS} |
313 |
|
|
@echo " " |
314 |
|
|
@${RESET} |
315 |
|
|
|
316 |
|
|
test: testpamenv testcernlib testmysql testcalocommon testlibtrack testlibreadb2maps testccal2struct |
317 |
|
|
|
318 |
|
|
testpamenv: ${PAM_ENV} |
319 |
|
|
|
320 |
|
|
testcalocommon: '${PAM_BIN}'/calocommon |
321 |
|
|
@if [ ${INSTCOMVER} -lt ${COMPCOMVER} ]; then ${ERED} " ERROR: CALOUTILITIES ${VER} requires package CALOCOMMON version ${COMMONVER} "; ${RESET} ; exit 1; fi |
322 |
|
|
|
323 |
|
|
testcernlib: cernlib root-config |
324 |
|
|
|
325 |
|
|
testmysql: mysql_config |
326 |
|
|
|
327 |
|
|
testlibtrack: '${PAM_LIB}'/libtrack.so |
328 |
|
|
|
329 |
|
|
testlibreadb2maps: '${PAM_LIB}'/libreadb2maps.so |
330 |
|
|
|
331 |
|
|
testccal2struct: '${PAM_INC}'/ccal2struct.h |
332 |
|
|
|
333 |
|
|
'${PAM_INC}'/ccal2struct.h: |
334 |
|
|
@$(test_exist) |
335 |
|
|
|
336 |
|
|
'${PAM_LIB}'/libtrack.so: |
337 |
|
|
@$(test_exist) |
338 |
|
|
|
339 |
|
|
'${PAM_LIB}'/libreadb2maps.so: |
340 |
|
|
@$(test_exist) |
341 |
|
|
|
342 |
|
|
mysql_config: OPT=--cflags |
343 |
|
|
mysql_config: |
344 |
|
|
@$(test_cmd) |
345 |
|
|
|
346 |
|
|
mkpathtoc: |
347 |
|
|
@if [ "${PAM_CCO}" == "" ]; then echo '#include <TSystem.h>' > ${DIRTOP}/${DIRMACROS}/UTpathtoc.c; echo ' const char *pathtocalibration(){ return((const char*)gSystem->Getenv("PAM_CALIB"));}' >> ${DIRTOP}/${DIRMACROS}/UTpathtoc.c; fi |
348 |
|
|
@if [ "${PAM_CCO}" != "" ]; then echo '#include <TSystem.h>' > ${DIRTOP}/${DIRMACROS}/UTpathtoc.c; echo ' const char *pathtocalibration(){ return((const char*)"'${PAM_CALIB}'/");}' >> ${DIRTOP}/${DIRMACROS}/UTpathtoc.c; fi |
349 |
|
|
@sleep 0.8 |
350 |
|
|
|
351 |
|
|
cernlib: |
352 |
|
|
@${test_cmd} |
353 |
|
|
|
354 |
|
|
root-config: OPT=--cflags |
355 |
|
|
root-config: |
356 |
|
|
@${test_cmd} |
357 |
|
|
|
358 |
|
|
'${PAM_BIN}'/calocommon: |
359 |
|
|
@$(test_cmd) |
360 |
|
|
|
361 |
|
|
# Here follows some usefull macros |
362 |
|
|
define test_and_cp |
363 |
|
|
wd=`pwd`;\ |
364 |
|
|
for i in ${TOBEMOVED} ; do \ |
365 |
|
|
wv=$${i##/*/}; \ |
366 |
|
|
dest=$${i/$${wv}/}; \ |
367 |
|
|
${EGREEN} "Testing for :" ${WHITE} "$${i}" ; ${RESET}; \ |
368 |
|
|
if [ ! "${FORCE}" ] ; then \ |
369 |
|
|
if [ ! -f $${i} ]; then \ |
370 |
|
|
${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
371 |
|
|
${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \ |
372 |
|
|
cp ${ORIGIN}/$${i##/*/} $${i}; \ |
373 |
|
|
else \ |
374 |
|
|
${ERED} "File already exist !!!! Please delete it " ${WHITE}; ${RESET}; \ |
375 |
|
|
fi;\ |
376 |
|
|
else \ |
377 |
|
|
if [ "${FORCE}" == "-u" ] ; then \ |
378 |
|
|
if [ "`basename $${i}`" != "`basename $${i} _${VER}.so`" ]; then \ |
379 |
|
|
${EYELLOW} "Removing: "${WHITE} ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so; ${RESET}; \ |
380 |
|
|
rm -f ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so ; \ |
381 |
|
|
${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
382 |
|
|
${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \ |
383 |
|
|
cp ${ORIGIN}/$${i##/*/} $${i}; \ |
384 |
|
|
else \ |
385 |
|
|
${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
386 |
|
|
${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \ |
387 |
|
|
cp -f ${ORIGIN}/$${i##/*/} $${i}; \ |
388 |
|
|
fi; \ |
389 |
|
|
else \ |
390 |
|
|
${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
391 |
|
|
${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \ |
392 |
|
|
cp ${FORCE} ${ORIGIN}/$${i##/*/} $${i}; \ |
393 |
|
|
fi;\ |
394 |
|
|
fi ;\ |
395 |
|
|
if [ ! -z ${LINK} ] ; then \ |
396 |
|
|
${EGREEN} "Creating symlink from : "${WHITE} $${wv/_${VER}/} ;\ |
397 |
|
|
${EGREEN} " to : "${WHITE} $${i##/*/} ; ${RESET}; \ |
398 |
|
|
cd $${dest}; \ |
399 |
|
|
ln -sf $${wv} $${wv/_${VER}/}; \ |
400 |
|
|
cd $${wd}; \ |
401 |
|
|
fi \ |
402 |
|
|
done |
403 |
|
|
endef |
404 |
|
|
|
405 |
|
|
define test_and_mk |
406 |
|
|
${EGREEN} "Testing for :" ${WHITE} "$@"; ${RESET} |
407 |
|
|
test -d "$@" || \ |
408 |
|
|
(${EGREEN} "Creating : "${WHITE} "$@"; ${RESET}; mkdir -p $@) |
409 |
|
|
endef |
410 |
|
|
|
411 |
|
|
define test_env |
412 |
|
|
${EGREEN} "Testing for env:" ${WHITE} $(patsubst %_env,%,$@); ${RESET} |
413 |
|
|
printenv $(patsubst %_env,%,$@) 1>/dev/null || \ |
414 |
|
|
(${ERED} "ERROR, variable : "${WHITE} $(patsubst %_env,%,$@) \ |
415 |
|
|
${RED} "not defined !!! Check your env. settings"; \ |
416 |
|
|
${RESET}; exit 1) |
417 |
|
|
${EGREEN} " Defined:" ${WHITE} $${$(patsubst %_env,%,$@)}; ${RESET} |
418 |
|
|
endef |
419 |
|
|
|
420 |
|
|
define test_cmd |
421 |
|
|
${EGREEN} "Testing for cmd:" ${WHITE} $@ ${OPT}; ${RESET} |
422 |
|
|
$@ ${OPT} 1>/dev/null 2>&1 || \ |
423 |
|
|
(${ERED} "ERROR, command : "${WHITE} $@ ${OPT}\ |
424 |
|
|
${RED} "not found !!! Check your installation"; \ |
425 |
|
|
${RESET}; exit 1) |
426 |
|
|
${EGREEN} " Present:" ${WHITE} $@ ${OPT}; ${RESET} |
427 |
|
|
endef |
428 |
|
|
|
429 |
|
|
define test_and_rm |
430 |
|
|
for i in ${TOBEDEL}; do \ |
431 |
|
|
test -d $${i} || (${ERED} "Removing file :"${WHITE} $${i}; ${RESET}; \ |
432 |
|
|
rm -f $${i} ); \ |
433 |
|
|
test ! -d $${i} || (${ERED} "Removing dir :"${WHITE} $${i}; ${RESET}; \ |
434 |
|
|
rm -rf $${i} ); \ |
435 |
|
|
done |
436 |
|
|
endef |
437 |
|
|
|
438 |
|
|
define test_exist |
439 |
|
|
${EGREEN} "Testing for library:" ${WHITE} $@ ${OPT}; ${RESET} |
440 |
|
|
ls $@ 1>/dev/null 2>&1 || \ |
441 |
|
|
(${ERED} "ERROR, library : "${WHITE} $@ ${OPT}\ |
442 |
|
|
${RED} " Not found !!! Check your installation"; \ |
443 |
|
|
${RESET}; exit 1) |
444 |
|
|
${EGREEN} " Present:" ${WHITE} $@ ${OPT}; ${RESET} |
445 |
|
|
endef |