1 |
# FLIGHT EVENT VIEWER |
2 |
# SOFTWARE VERSION |
3 |
VER= v1r00 |
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}/%_cxx_${VER}.so) |
90 |
MACROCLIBS=FEVpathtoc_cxx FEVpamevcontrol_cxx FEventViewer_cxx |
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 |
|
108 |
MACROSSRCS=${DIRMACROS}/FEventViewer.cxx ${DIRMACROS}/ffilter.cxx |
109 |
|
110 |
CALIBFILES= |
111 |
|
112 |
DOCFILES=${DIRDOC}/FEventViewer.README.pdf ${DIRDOC}/ffilter.cxx |
113 |
|
114 |
# Here the Variables used for info target |
115 |
PACKAGE=PAMELA flight event viewer software |
116 |
EXECUTABLES=FEventViewer |
117 |
LIBS= ${FLIBS} ${FOBJS} ${CLIBS} ${COBJS} ${CXXEXEOBJS} |
118 |
DOCS= |
119 |
SRCS= ${FSRCS} ${CRSCS} ${CXXEXESRCS} |
120 |
MACROS= ${MACROSSRCS} |
121 |
# |
122 |
TOBEDEL = junk |
123 |
ROOTINC=$$${shell root-config --incdir} |
124 |
NROOTINC=${shell root-config --incdir} |
125 |
# Let's start |
126 |
all : test mkbindir mklibdir mkpathtoc ${FULLFLIBS} ${FULLCXXLIBS} ${MACROSLIBS} ${CXXEXELIBS} |
127 |
all: |
128 |
@echo -e ${GREEN} "" |
129 |
@(${EGREEN} " Finished, now you can install the package \n (use: make install or make upgrade or make forceinstall) "; ${RESET}) |
130 |
@echo -e ${GREEN} "" |
131 |
@if [ "$(shell ${PAM_BIN}/CaloLEVEL2 --version 2>/dev/null | grep version | tr -d [a-z:A-Z\ ])" ]; then (${EVIOLET} "WARNING: the installation will break dependencies of CALOLEVEL2"; ${RESET}); (${EVIOLET} "WARNING: re-compile CALOLEVEL2 package after the installation"; ${RESET}); echo -e ${GREEN} ""; fi |
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("\nEventViewer package 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 $@ ${DIRBIN}/$(patsubst lib%_${VER}.so,%.o,$(@F)) -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 |
|
170 |
${MACROSLIBS}: ${MACROSRCS} |
171 |
@(${EGREEN} "Compiling macro: "${WHITE} "$@"; ${RESET}) |
172 |
# |
173 |
# Create *Dict.cxx and *Dict.h |
174 |
# |
175 |
@${ROOTCINT} -f ${DIRMACROS}/`basename $(@F) _cxx_${VER}.so`Dict.cxx -c -I${ROOTINC} ${DIRINC}/`basename $(@F) _cxx_${VER}.so`fun.h ${DIRINC}/`basename $(@F) _cxx_${VER}.so`LinkDef.h |
176 |
# |
177 |
# create .o |
178 |
# |
179 |
@cd ${DIRMACROS} &>/dev/null && ${CXX} ${CXXFLAGS} -c `basename $(@F) _cxx_${VER}.so`.cxx -I${PAM_INC} -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_YODA}/include/yoda/ -I${NROOTINC}; |
180 |
@cd ${DIRMACROS} &>/dev/null && ${CXX} ${CXXFLAGS} -c `basename $(@F) _cxx_${VER}.so`Dict.cxx -I${PAM_INC} -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_YODA}/include/yoda/ -I${NROOTINC}; |
181 |
# |
182 |
# create .so |
183 |
# |
184 |
@if [ "$@" == "${DIRLIB}/FEVpathtoc_cxx_${VER}.so" ] || [ "$@" == "${DIRLIB}/FEVpamevcontrol_cxx_${VER}.so" ]; then ${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) _cxx_${VER}.so`.o ${DIRTOP}/${DIRMACROS}/`basename $(@F) _cxx_${VER}.so`Dict.o `root-config --cflags --glibs` 1>/dev/null; fi |
185 |
# |
186 |
@if [ "$@" == "${DIRLIB}/FEventViewer_cxx_${VER}.so" ]; then ${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) _cxx_${VER}.so`.o ${DIRTOP}/${DIRMACROS}/`basename $(@F) _cxx_${VER}.so`Dict.o ${DIRTOP}/${DIRLIB}/FEVpathtoc_cxx_${VER}.so ${DIRTOP}/${DIRLIB}/FEVpamevcontrol_cxx_${VER}.so `root-config --cflags --glibs` 1>/dev/null; fi |
187 |
|
188 |
|
189 |
#${MACROSLIBS}: ${MACROSRCS} |
190 |
# @(${EGREEN} "Compiling macro: "${WHITE} "$@"; ${RESET}) |
191 |
# @echo '.include ${DIRTOP}/${DIRINC}' > build_so.txt |
192 |
# @echo '.include ${PAM_INC}' >> build_so.txt |
193 |
# @echo 'TString *junk=new TString();' >> build_so.txt |
194 |
# @echo '*junk=gSystem->GetDynamicPath();' >> build_so.txt |
195 |
# @echo '*junk+=":${DIRLIB}";' >> build_so.txt |
196 |
# @echo 'gSystem->SetDynamicPath(junk.Data());' >> build_so.txt |
197 |
# @echo 'char *lmac = gSystem->ExpandPathName("$$PAM_INC");'>>build_so.txt |
198 |
# @echo 'gInterpreter->AddIncludePath(lmac);'>>build_so.txt |
199 |
# @echo 'char *pamyoda = gSystem->ExpandPathName("$$PAM_YODA");' >>build_so.txt |
200 |
# @echo 'stringstream incy;' >>build_so.txt |
201 |
# @echo 'incy.str("");' >>build_so.txt |
202 |
# @echo 'incy << pamyoda << "/include/yoda/";' >>build_so.txt |
203 |
# @echo 'gInterpreter->AddIncludePath(incy.str().c_str());' >>build_so.txt |
204 |
# @echo 'incy.str("");' >>build_so.txt |
205 |
# @echo 'incy << pamyoda << "/event/";'>>build_so.txt |
206 |
# @echo 'gInterpreter->AddIncludePath(incy.str().c_str());'>>build_so.txt |
207 |
# @echo 'gSystem->cd("'${DIRMACROS}'");' >> build_so.txt |
208 |
# @echo 'char *pamyodalib = gSystem->ExpandPathName("$$PAM_YODA");' >>build_so.txt |
209 |
# @echo 'stringstream libYODA;'>>build_so.txt |
210 |
# @echo 'libYODA.str("");' >>build_so.txt |
211 |
# @echo 'libYODA << pamyodalib << "/lib/libyoda.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_${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}/libtrack_C_${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_${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}/libptlevel1_C_${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_${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 << "${DIRTOP}/${DIRLIB}/libreadb2maps_C_${VER}.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}/caloclasses_h.so";'>>build_so.txt |
233 |
## @echo 'gSystem->Load(libYODA.str().c_str());'>>build_so.txt |
234 |
## @echo 'libYODA.str("");' >>build_so.txt |
235 |
## @echo 'libYODA << "${PAM_LIB}/aclev1class_h.so";'>>build_so.txt |
236 |
## @echo 'gSystem->Load(libYODA.str().c_str());'>>build_so.txt |
237 |
# if [ "$@" != "${DIRLIB}/FEVpathtoc_c_"${VER}".so" ]; then \ |
238 |
# echo 'libYODA.str("");' >>build_so.txt ; \ |
239 |
# echo 'libYODA << "'${DIRTOP}/${DIRLIB}'/FEVpathtoc_c_'${VER}'.so";'>>build_so.txt ; \ |
240 |
# echo 'gSystem->Load(libYODA.str().c_str());'>>build_so.txt ; \ |
241 |
# fi; |
242 |
# if [ "$@" != "${DIRLIB}/FEVpathtoc_cxx_"${VER}".so" ]; then \ |
243 |
# ${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; \ |
244 |
# else \ |
245 |
# ${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; \ |
246 |
# fi |
247 |
# @echo '.debug' >> build_so.txt |
248 |
# @echo '.L $(patsubst %_c_${VER}.so,%.c++,$(@F))' >> build_so.txt |
249 |
# @echo '.q' >> build_so.txt |
250 |
# @root -l -b 1>/dev/null < build_so.txt |
251 |
# @mv -f ${DIRMACROS}/$(patsubst %_c_${VER}.so,%_c.so,$(@F)) ${DIRLIB}/$(@F) |
252 |
# @rm -f build_so.txt |
253 |
|
254 |
${CXXEXELIBS}: ${CXXEXEOBJS} |
255 |
@(${EGREEN} "Creating exec file: "${WHITE} "$@"; ${RESET}) |
256 |
@${CXX} ${CXXFLAGS} -o ${DIRBIN}/$@ ${DIRBIN}/$@.o -I${DIRINC} -I${PAM_INC} -I${PAM_YODA}/include/yoda/ ${PAM_YODA}/lib/libyoda.so ${DIRTOP}/${DIRLIB}/FEVpathtoc_cxx_${VER}.so ${DIRTOP}/${DIRLIB}/FEVpamevcontrol_cxx_${VER}.so ${DIRTOP}/${DIRLIB}/$@_cxx_${VER}.so `root-config --cflags --glibs` |
257 |
# @${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` |
258 |
# @rm -f ${DIRSRC}/temp.cc |
259 |
|
260 |
# A small target to check environmental variables |
261 |
%_env: |
262 |
@${test_env} |
263 |
|
264 |
.PHONY: install installdoc installlib installmacros installinc |
265 |
.PHONY: clean depclean info mkbindir mklibdir testcern testpamenv test testcalocommon testroot2paw testmysql |
266 |
|
267 |
mkbindir: ${DIRBIN} |
268 |
${DIRBIN}: |
269 |
@${test_and_mk} |
270 |
|
271 |
mklibdir: ${DIRLIB} |
272 |
${DIRLIB}: |
273 |
@${test_and_mk} |
274 |
|
275 |
# Here what has to be deleted in clean target |
276 |
clean: TOBEDEL=${DIRMACROS}/*.o ${DIRMACROS}/*Dict.cxx ${DIRMACROS}/*Dict.h ${FOBJS} ${FULLLIBS} ${DIRBIN}/${CXXEXELIBS} ${COBJS} ${CXXEXEOBJS} ${FULLLINKFLIBS} ${FULLLINKCLIBS} |
277 |
clean: |
278 |
@${test_and_rm} |
279 |
|
280 |
distclean: clean |
281 |
distclean: TOBEDEL= ${DIRBIN} ${DIRLIB} |
282 |
distclean: |
283 |
@${test_and_rm} |
284 |
|
285 |
forceinstall: FORCE=-f |
286 |
forceinstall: install |
287 |
|
288 |
upgrade: FORCE=-u |
289 |
upgrade: install |
290 |
|
291 |
install: installlib installinc installmacros installcalib installdoc installexe installcmacro |
292 |
|
293 |
installlib: LINK=y |
294 |
installlib: TOBEMOVED= $(FULLLIBS:${DIRLIB}%=${PAM_LIB}%) |
295 |
installlib: ORIGIN=${DIRLIB} |
296 |
installlib: |
297 |
@${test_and_cp} |
298 |
|
299 |
installcmacro: LINK=y |
300 |
installcmacro: TOBEMOVED= $(FULLMACROCLIBS:${DIRLIB}%=${PAM_LIB}%) |
301 |
installcmacro: ORIGIN=${DIRLIB} |
302 |
installcmacro: |
303 |
@${test_and_cp} |
304 |
|
305 |
installinc: TOBEMOVED= $(INCSRCS:${DIRINC}/%=${PAM_INC}/%) |
306 |
installinc: ORIGIN=${DIRINC} |
307 |
installinc: |
308 |
@${test_and_cp} |
309 |
|
310 |
installexe: TOBEMOVED= $(EXESRCS:${DIRBIN}/%=${PAM_BIN}/%) |
311 |
installexe: ORIGIN=${DIRBIN} |
312 |
installexe: |
313 |
@${test_and_cp} |
314 |
|
315 |
installmacros: TOBEMOVED= $(MACROSSRCS:${DIRMACROS}/%=${PAM_MACROS}/%) |
316 |
installmacros: ORIGIN=${DIRMACROS} |
317 |
installmacros: |
318 |
@${test_and_cp} |
319 |
|
320 |
installcalib: TOBEMOVED= $(CALIBFILES:${DIRCALIB}/%=${PAM_CALIB}/%) |
321 |
installcalib: ORIGIN=${DIRCALIB} |
322 |
installcalib: |
323 |
@${test_and_cp} |
324 |
|
325 |
installdoc: TOBEMOVED= $(DOCFILES:${DIRDOC}/%=${PAM_DOC}/%) |
326 |
installdoc: ORIGIN=${DIRDOC} |
327 |
installdoc: |
328 |
@${test_and_cp} |
329 |
|
330 |
info: |
331 |
@echo " " |
332 |
@${EGREEN} "Infos for package :" ${WHITE} ${PACKAGE} |
333 |
@${EGREEN} " VERSION :" ${WHITE} ${VER} |
334 |
@${EGREEN} " EXECUTABLES :" ${WHITE} ${EXECUTABLES} |
335 |
@${EGREEN} " LIBS :" ${WHITE} ${LIBS} |
336 |
@${EGREEN} " DOCS :" ${WHITE} ${DOCS} |
337 |
@${EGREEN} " SRCS :" ${WHITE} ${SRCS} |
338 |
@${EGREEN} " MACROS :" ${WHITE} ${MACROS} |
339 |
@echo " " |
340 |
@${RESET} |
341 |
|
342 |
test: testpamenv |
343 |
#test: testpamenv testcernlib testmysql testcalocommon testroot2paw |
344 |
|
345 |
testpamenv: ${PAM_ENV} |
346 |
|
347 |
testcernlib: cernlib root-config |
348 |
|
349 |
testmysql: mysql_config |
350 |
|
351 |
testcalocommon: '${PAM_BIN}'/calocommon |
352 |
@if [ ${INSTCOMVER} -lt ${COMPCOMVER} ]; then ${ERED} " ERROR: EventViewer ${VER} requires package CALOCOMMON version ${COMMONVER} "; ${RESET} ; exit 1; fi |
353 |
|
354 |
testroot2paw: '${PAM_BIN}'/GroundDataConvert |
355 |
@if [ ${INSTR2PVER} -lt ${COMPR2PVER} ]; then ${ERED} " ERROR: EventViewer ${VER} requires package root2paw version ${R2PVER} "; ${RESET} ; exit 1; fi |
356 |
|
357 |
mysql_config: OPT=--cflags |
358 |
mysql_config: |
359 |
@$(test_cmd) |
360 |
|
361 |
mkpathtoc: |
362 |
@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; fi |
363 |
@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; fi |
364 |
@sleep 0.5 |
365 |
|
366 |
|
367 |
'${PAM_BIN}'/calocommon: |
368 |
@$(test_cmd) |
369 |
|
370 |
'${PAM_BIN}'/GroundDataConvert: OPT=--version |
371 |
'${PAM_BIN}'/GroundDataConvert: |
372 |
@$(test_cmd) |
373 |
|
374 |
cernlib: |
375 |
@${test_cmd} |
376 |
|
377 |
root-config: OPT=--cflags |
378 |
root-config: |
379 |
@${test_cmd} |
380 |
|
381 |
# Here follows some usefull macros |
382 |
define test_and_cp |
383 |
wd=`pwd`;\ |
384 |
for i in ${TOBEMOVED} ; do \ |
385 |
wv=$${i##/*/}; \ |
386 |
dest=$${i/$${wv}/}; \ |
387 |
${EGREEN} "Testing for :" ${WHITE} "$${i}" ; ${RESET}; \ |
388 |
if [ ! "${FORCE}" ] ; then \ |
389 |
if [ ! -f $${i} ]; then \ |
390 |
${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
391 |
${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \ |
392 |
cp ${ORIGIN}/$${i##/*/} $${i}; \ |
393 |
else \ |
394 |
${ERED} "File already exist !!!! Please delete it " ${WHITE}; ${RESET}; \ |
395 |
fi;\ |
396 |
else \ |
397 |
if [ "${FORCE}" == "-u" ] ; then \ |
398 |
if [ "`basename $${i}`" != "`basename $${i} _${VER}.so`" ]; then \ |
399 |
${EYELLOW} "Removing: "${WHITE} ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so; ${RESET}; \ |
400 |
rm -f ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so ; \ |
401 |
${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
402 |
${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \ |
403 |
cp ${ORIGIN}/$${i##/*/} $${i}; \ |
404 |
else \ |
405 |
${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
406 |
${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \ |
407 |
cp -f ${ORIGIN}/$${i##/*/} $${i}; \ |
408 |
fi; \ |
409 |
else \ |
410 |
${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
411 |
${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \ |
412 |
cp ${FORCE} ${ORIGIN}/$${i##/*/} $${i}; \ |
413 |
fi;\ |
414 |
fi ;\ |
415 |
if [ ! -z ${LINK} ] ; then \ |
416 |
${EGREEN} "Creating symlink from : "${WHITE} $${wv/_${VER}/} ;\ |
417 |
${EGREEN} " to : "${WHITE} $${i##/*/} ; ${RESET}; \ |
418 |
cd $${dest}; \ |
419 |
ln -sf $${wv} $${wv/_${VER}/}; \ |
420 |
cd $${wd}; \ |
421 |
fi \ |
422 |
done |
423 |
endef |
424 |
|
425 |
define test_and_mk |
426 |
${EGREEN} "Testing for :" ${WHITE} "$@"; ${RESET} |
427 |
test -d "$@" || \ |
428 |
(${EGREEN} "Creating : "${WHITE} "$@"; ${RESET}; mkdir -p $@) |
429 |
endef |
430 |
|
431 |
define test_env |
432 |
${EGREEN} "Testing for env:" ${WHITE} $(patsubst %_env,%,$@); ${RESET} |
433 |
printenv $(patsubst %_env,%,$@) 1>/dev/null || \ |
434 |
(${ERED} "ERROR, variable : "${WHITE} $(patsubst %_env,%,$@) \ |
435 |
${RED} "not defined !!! Check your env. settings"; \ |
436 |
${RESET}; exit 1) |
437 |
${EGREEN} " Defined:" ${WHITE} $${$(patsubst %_env,%,$@)}; ${RESET} |
438 |
endef |
439 |
|
440 |
define test_cmd |
441 |
${EGREEN} "Testing for cmd:" ${WHITE} $@ ${OPT}; ${RESET} |
442 |
$@ ${OPT} 1>/dev/null 2>&1 || \ |
443 |
(${ERED} "ERROR, command : "${WHITE} $@ ${OPT}\ |
444 |
${RED} "not found !!! Check your installation"; \ |
445 |
${RESET}; exit 1) |
446 |
${EGREEN} " Present:" ${WHITE} $@ ${OPT}; ${RESET} |
447 |
endef |
448 |
|
449 |
define test_and_rm |
450 |
for i in ${TOBEDEL}; do \ |
451 |
test -d $${i} || (${ERED} "Removing file :"${WHITE} $${i}; ${RESET}; \ |
452 |
rm -f $${i} ); \ |
453 |
test ! -d $${i} || (${ERED} "Removing dir :"${WHITE} $${i}; ${RESET}; \ |
454 |
rm -rf $${i} ); \ |
455 |
done |
456 |
endef |