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