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