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