/[PAMELA software]/eventviewer/ground/Makefile
ViewVC logotype

Annotation of /eventviewer/ground/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (hide annotations) (download) (vendor branch)
Tue Dec 6 10:12:55 2005 UTC (19 years ago) by mocchiut
Branch: EventViewer
CVS Tags: start, v8r00
Changes since 1.1: +0 -0 lines
Imported sources

1 mocchiut 1.1 # EVENT VIEWER
2     # SOFTWARE VERSION
3     VER= v8r00
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
35     # Enviroment:
36     GCCVER=`gcc --version | head -1`
37     UNAMEA=`uname -a`
38     TODAY=`date`
39     # F77
40     F77=g77
41     #F77FLAGS= -Wall -fbounds-check -g -extend_source -static -fno-backslash
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 -g -extend_source -static -fno-backslash
44     # C++
45     CXX=g++
46     CXXFLAGS=-Wall -fPIC -O3
47     # Here the variables definig the local directories
48     DIRTOP=${shell pwd}
49     DIRLIB=lib/${ARCH}
50     DIRBIN=bin/${ARCH}
51     DIRSRC=src
52     DIRINC=inc
53     DIRDOC=doc
54     DIRMACROS=macros
55     DIRCALIB=calib
56     # Here the PAMELA environmental variables to be checked
57     PAM_ENV= PAM_BIN_env PAM_LIB_env PAM_INC_env PAM_DOC_env PAM_MACROS_env PAM_CALIB_env PAM_YODA_env
58     # Here the local variables used to build the targets
59     FSRCS=${DIRSRC}/readb2maps.for \
60     ${DIRSRC}/ptlevel1.for \
61     ${DIRSRC}/track.for
62     # ${DIRSRC}/main_B.for
63    
64     FOBJS=$(FSRCS:${DIRSRC}%.for=${DIRBIN}%.o)
65     FLIBS=readb2maps ptlevel1 track
66     FULLFLIBS=$(FLIBS:%=${DIRLIB}/lib%_${VER}.so)
67     FULLLINKFLIBS=$(FLIBS:%=${DIRLIB}/lib%.so)
68    
69     CSRCS=
70     COBJS=$(CSRCS:${DIRMACROS}%.c=${DIRBIN}%.o)
71     CLIBS=
72     FULLCLIBS=$(CLIBS:%=${DIRLIB}/lib%_${VER}.so)
73     FULLLINKCLIBS=$(CLIBS:%=${DIRLIB}/lib%.so)
74    
75     CXXSRCS=${DIRSRC}/libptlevel1.C \
76     ${DIRSRC}/libtrack.C \
77     ${DIRSRC}/libreadb2maps.C
78    
79     FULLCXXLIBS=$(CXXSRCS:${DIRSRC}/%.C=${DIRLIB}/%_C_${VER}.so)
80    
81     MACROSRCS=${DIRMACROS}/EVpathtoc.c \
82     ${DIRMACROS}/EventViewer.c
83     MACROSLIBS=$(MACROSRCS:${DIRMACROS}/%.c=${DIRLIB}/%_c_${VER}.so)
84     MACROCLIBS=EVpathtoc_c EventViewer_c
85     FULLMACROCLIBS=$(MACROCLIBS:%=${DIRLIB}/%_${VER}.so)
86     FULLLINKMACROCLIBS=$(MACROCLIBS:%=${DIRLIB}/%.so)
87    
88     HSRCS=
89     FULLHLIBS=$(HSRCS:${DIRINC}/%.h=${DIRLIB}/%_h_${VER}.so)
90    
91     CXXEXESRCS=${DIRSRC}/EventViewer.cc
92     CXXEXEOBJS=$(CXXEXESRCS:${DIRSRC}%.cc=${DIRBIN}%.o)
93     CXXEXELIBS:=EventViewer
94    
95     #FULLLIBS=$(sort ${FULLFLIBS} ${FULLCXXLIBS} )
96     FULLLIBS=${FULLFLIBS} ${FULLCXXLIBS} ${FULLCLIBS} ${FULLHLIBS}
97    
98     EXESRCS = ${DIRBIN}/EventViewer
99    
100     INCSRCS= ${DIRINC}/eventviewer.h
101    
102     MACROSSRCS=${DIRMACROS}/EventViewer.c ${DIRMACROS}/filter.c
103    
104     CALIBFILES=${DIRCALIB}/measure_n4_110402_corrected.rz ${DIRCALIB}/measure_n3_290302.rz ${DIRCALIB}/External_top_map_n4_150402.rz
105    
106     DOCFILES=${DIRDOC}/EventViewer.README.pdf ${DIRDOC}/filter.c
107    
108     # Here the Variables used for info target
109     PACKAGE=PAMELA event viewer software
110     EXECUTABLES=EventViewer
111     LIBS= ${FLIBS} ${FOBJS} ${CLIBS} ${COBJS} ${CXXEXEOBJS}
112     DOCS=
113     SRCS= ${FSRCS} ${CRSCS} ${CXXEXESRCS}
114     MACROS= ${MACROSSRCS}
115     #
116     TOBEDEL = junk
117    
118     # Let's start
119     all : test mkbindir mklibdir mkpathtoc ${FULLFLIBS} ${FULLCXXLIBS} ${FULLHLIBS} ${MACROSLIBS} ${CXXEXELIBS}
120     all:
121     @echo -e ${GREEN} ""
122     @(${EGREEN} " Finished, now you can install the package \n (use: make install or make upgrade or make forceinstall) "; ${RESET})
123     @echo -e ${GREEN} ""
124     @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
125     @${RESET}
126    
127     # Here some general rules to produce objects in our local dir
128     # .o from fortran
129     ${DIRBIN}/%.o : ${DIRSRC}/%.for
130     @(${EGREEN} "Creating object file: "${WHITE} "$@"; ${RESET})
131     @${F77} ${F77FLAGS} -c -o $@ $< -I${DIRINC}
132    
133     ${DIRBIN}/%.o: ${DIRSRC}/%.cc
134     @(${EGREEN} "Creating object file: "${WHITE} "$@"; ${RESET})
135     @cat ${DIRSRC}/`basename ${@} .o`.cc > ${DIRSRC}/temp.cc;
136     @echo ' ' >> ${DIRSRC}/temp.cc
137     @echo 'void info(){ printf("\nEventViewer package version: ${VER}\n\nCompiled on '${TODAY}' with: '${GCCVER}'\n\nOn: '${UNAMEA}'\n\n"); }' >> ${DIRSRC}/temp.cc
138     @${CXX} ${CXXFLAGS} -c -o $@ ${DIRSRC}/temp.cc -I${DIRINC} -I${PAM_INC} -I${PAM_YODA}/include/yoda/ `root-config --cflags`
139    
140     # .o from C
141     ${DIRBIN}/%.o : ${DIRSRC}/%.c
142     @(${EGREEN} "Creating object file: "${WHITE} "$@"; ${RESET})
143     @${CC} ${CFLAGS} -c -o $@ $< -I${DIRINC}
144    
145    
146     # .so from .o fortran
147     ${FULLFLIBS}: ${FOBJS}
148     @(${EGREEN} "Creating library: "${WHITE} "$@"; ${RESET})
149     @${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ ${DIRBIN}/$(patsubst lib%_${VER}.so,%.o,$(@F)) -lg2c `cernlib mathlib`
150     @(${EGREEN} "Creating symlink from : "${WHITE} "$@"; ${RESET})
151     @(${EGREEN} " to : "${WHITE} "${DIRLIB}/`basename $@ _${VER}.so`.so"; ${RESET})
152     @ln -sf `basename $@` ${DIRLIB}/`basename $@ _${VER}.so`.so
153    
154     # .so from .o c
155     ${FULLCLIBS}: ${COBJS}
156     @(${EGREEN} "Creating library: "${WHITE} "$@"; ${RESET})
157     @${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ $^ -lg2c `mysql_config --cflags --libs`
158     @(${EGREEN} "Creating symlink from : "${WHITE} "$@"; ${RESET})
159     @(${EGREEN} " to : "${WHITE} "${DIRLIB}/`basename $@ _${VER}.so`.so"; ${RESET})
160     @ln -sf `basename $@` ${DIRLIB}/`basename $@ _${VER}.so`.so
161    
162     ${FULLCXXLIBS}: ${FULLCLIBS} ${FULLFLIBS} ${CXXSRCS}
163     @(${EGREEN} "Creating ROOT sharable lib: "${WHITE} "$@"; ${RESET})
164     @echo '.include ${DIRTOP}/${DIRINC}' > build_so.txt
165     @echo '.include ${PAM_INC}' >> build_so.txt
166     @echo 'TString *junk=new TString();' >> build_so.txt
167     @echo '*junk=gSystem->GetDynamicPath();' >> build_so.txt
168     @echo ' // cout << junk->Data() << endl;' >> build_so.txt
169     @echo '*junk+=":${DIRLIB}";' >> build_so.txt
170     @echo 'gSystem->SetDynamicPath(junk.Data());' >> build_so.txt
171     @echo 'gSystem->Load("${DIRLIB}/'`basename $@ _C_${VER}.so`'.so")' >> build_so.txt
172     @echo 'gSystem->cd("'${DIRSRC}'");' >> build_so.txt
173     @echo '.L $(patsubst %_C_${VER}.so,%.C++,$(@F))' >> build_so.txt
174     @echo '.q' >> build_so.txt
175     @root -l -b &>/dev/null < build_so.txt
176     @mv -f ${DIRSRC}/$(patsubst %_C_${VER}.so,%_C.so,$(@F)) ${DIRLIB}/$(@F)
177     @rm -f build_so.txt
178    
179     ${MACROSLIBS}: ${MACROSRCS}
180     @(${EGREEN} "Compiling macro: "${WHITE} "$@"; ${RESET})
181     @echo '.include ${DIRTOP}/${DIRINC}' > build_so.txt
182     @echo '.include ${PAM_INC}' >> build_so.txt
183     @echo 'TString *junk=new TString();' >> build_so.txt
184     @echo '*junk=gSystem->GetDynamicPath();' >> build_so.txt
185     @echo '*junk+=":${DIRLIB}";' >> build_so.txt
186     @echo 'gSystem->SetDynamicPath(junk.Data());' >> build_so.txt
187     @echo 'char *lmac = gSystem->ExpandPathName("$$PAM_INC");'>>build_so.txt
188     @echo 'gInterpreter->AddIncludePath(lmac);'>>build_so.txt
189     @echo 'char *pamyoda = gSystem->ExpandPathName("$$PAM_YODA");' >>build_so.txt
190     @echo 'stringstream incy;' >>build_so.txt
191     @echo 'incy.str("");' >>build_so.txt
192     @echo 'incy << pamyoda << "/include/yoda/";' >>build_so.txt
193     @echo 'gInterpreter->AddIncludePath(incy.str().c_str());' >>build_so.txt
194     @echo 'incy.str("");' >>build_so.txt
195     @echo 'incy << pamyoda << "/event/";'>>build_so.txt
196     @echo 'gInterpreter->AddIncludePath(incy.str().c_str());'>>build_so.txt
197     @echo 'gSystem->cd("'${DIRMACROS}'");' >> build_so.txt
198     @echo 'char *pamyodalib = gSystem->ExpandPathName("$$PAM_YODA");' >>build_so.txt
199     @echo 'stringstream libYODA;'>>build_so.txt
200     @echo 'libYODA.str("");' >>build_so.txt
201     @echo 'libYODA << pamyodalib << "/lib/libyoda.so";'>>build_so.txt
202     @echo 'gSystem->Load(libYODA.str().c_str());'>>build_so.txt
203     @echo 'libYODA.str("");' >>build_so.txt
204     @echo 'libYODA << "${DIRTOP}/${DIRLIB}/libtrack_${VER}.so";'>>build_so.txt
205     @echo 'gSystem->Load(libYODA.str().c_str());'>>build_so.txt
206     @echo 'libYODA.str("");' >>build_so.txt
207     @echo 'libYODA << "${DIRTOP}/${DIRLIB}/libtrack_C_${VER}.so";'>>build_so.txt
208     @echo 'gSystem->Load(libYODA.str().c_str());'>>build_so.txt
209     @echo 'libYODA.str("");' >>build_so.txt
210     @echo 'libYODA << "${DIRTOP}/${DIRLIB}/libptlevel1_${VER}.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 << "${DIRTOP}/${DIRLIB}/libptlevel1_C_${VER}.so";'>>build_so.txt
214     @echo 'gSystem->Load(libYODA.str().c_str());'>>build_so.txt
215     @echo 'libYODA.str("");' >>build_so.txt
216     @echo 'libYODA << "${DIRTOP}/${DIRLIB}/libreadb2maps_${VER}.so";'>>build_so.txt
217     @echo 'gSystem->Load(libYODA.str().c_str());'>>build_so.txt
218     @echo 'libYODA.str("");' >>build_so.txt
219     @echo 'libYODA << "${DIRTOP}/${DIRLIB}/libreadb2maps_C_${VER}.so";'>>build_so.txt
220     @echo 'gSystem->Load(libYODA.str().c_str());'>>build_so.txt
221     @echo 'libYODA.str("");' >>build_so.txt
222     @echo 'libYODA << "${PAM_LIB}/caloclasses_h.so";'>>build_so.txt
223     @echo 'gSystem->Load(libYODA.str().c_str());'>>build_so.txt
224     @echo 'libYODA.str("");' >>build_so.txt
225     @echo 'libYODA << "${PAM_LIB}/aclev1class_h.so";'>>build_so.txt
226     @echo 'gSystem->Load(libYODA.str().c_str());'>>build_so.txt
227     @if [ "$@" != "${DIRLIB}/EVpathtoc_c_"${VER}".so" ]; then \
228     echo 'libYODA.str("");' >>build_so.txt ; \
229     echo 'libYODA << "'${DIRTOP}/${DIRLIB}'/EVpathtoc_c_'${VER}'.so";'>>build_so.txt ; \
230     echo 'gSystem->Load(libYODA.str().c_str());'>>build_so.txt ; \
231     fi
232     @echo '.L $(patsubst %_c_${VER}.so,%.c++O,$(@F))' >> build_so.txt
233     @echo '.q' >> build_so.txt
234     @root -l -b &>/dev/null < build_so.txt
235     @mv -f ${DIRMACROS}/$(patsubst %_c_${VER}.so,%_c.so,$(@F)) ${DIRLIB}/$(@F)
236     @rm -f build_so.txt
237    
238     ${FULLHLIBS}: ${FULLCLIBS} ${FULLFLIBS} ${CXXSRCS} ${HSRCS}
239     @(${EGREEN} "Creating ROOT sharable lib: "${WHITE} "$@"; ${RESET})
240     @echo '.include ${DIRTOP}/${DIRINC}' > build_so.txt
241     @echo '.include ${PAM_INC}' >> build_so.txt
242     @echo 'TString *junk=new TString();' >> build_so.txt
243     @echo '*junk=gSystem->GetDynamicPath();' >> build_so.txt
244     @echo '*junk+=":${DIRLIB}";' >> build_so.txt
245     @echo 'gSystem->SetDynamicPath(junk.Data());' >> build_so.txt
246     @echo 'gSystem->cd("'${DIRINC}'");' >> build_so.txt
247     @echo '.L $(patsubst %_h_${VER}.so,%.h++O,$(@F))' >> build_so.txt
248     @echo '.q' >> build_so.txt
249     @root -l -b &>/dev/null < build_so.txt
250     @mv -f ${DIRINC}/$(patsubst %_h_${VER}.so,%_h.so,$(@F)) ${DIRLIB}/$(@F)
251     @rm -f build_so.txt
252    
253     ${CXXEXELIBS}: ${CXXEXEOBJS}
254     @(${EGREEN} "Creating exec file: "${WHITE} "$@"; ${RESET})
255     @${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}/EVpathtoc_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`
256     @rm -f ${DIRSRC}/temp.cc
257    
258     # A small target to check environmental variables
259     %_env:
260     @${test_env}
261    
262     .PHONY: install installdoc installlib installmacros installinc
263     .PHONY: clean depclean info mkbindir mklibdir testcern testpamenv test testcalocommon testroot2paw testmysql
264    
265     mkbindir: ${DIRBIN}
266     ${DIRBIN}:
267     @${test_and_mk}
268    
269     mklibdir: ${DIRLIB}
270     ${DIRLIB}:
271     @${test_and_mk}
272    
273     # Here what has to be deleted in clean target
274     clean: TOBEDEL= ${FOBJS} ${FULLLIBS} ${DIRBIN}/${CXXEXELIBS} ${COBJS} ${CXXEXEOBJS} ${FULLLINKFLIBS} ${FULLLINKCLIBS}
275     clean:
276     @${test_and_rm}
277    
278     distclean: clean
279     distclean: TOBEDEL= ${DIRBIN} ${DIRLIB}
280     distclean:
281     @${test_and_rm}
282    
283     forceinstall: FORCE=-f
284     forceinstall: install
285    
286     upgrade: FORCE=-u
287     upgrade: install
288    
289     install: installlib installinc installmacros installcalib installdoc installexe installcmacro
290    
291     installlib: LINK=y
292     installlib: TOBEMOVED= $(FULLLIBS:${DIRLIB}%=${PAM_LIB}%)
293     installlib: ORIGIN=${DIRLIB}
294     installlib:
295     @${test_and_cp}
296    
297     installcmacro: LINK=y
298     installcmacro: TOBEMOVED= $(FULLMACROCLIBS:${DIRLIB}%=${PAM_LIB}%)
299     installcmacro: ORIGIN=${DIRLIB}
300     installcmacro:
301     @${test_and_cp}
302    
303     installinc: TOBEMOVED= $(INCSRCS:${DIRINC}/%=${PAM_INC}/%)
304     installinc: ORIGIN=${DIRINC}
305     installinc:
306     @${test_and_cp}
307    
308     installexe: TOBEMOVED= $(EXESRCS:${DIRBIN}/%=${PAM_BIN}/%)
309     installexe: ORIGIN=${DIRBIN}
310     installexe:
311     @${test_and_cp}
312    
313     installmacros: TOBEMOVED= $(MACROSSRCS:${DIRMACROS}/%=${PAM_MACROS}/%)
314     installmacros: ORIGIN=${DIRMACROS}
315     installmacros:
316     @${test_and_cp}
317    
318     installcalib: TOBEMOVED= $(CALIBFILES:${DIRCALIB}/%=${PAM_CALIB}/%)
319     installcalib: ORIGIN=${DIRCALIB}
320     installcalib:
321     @${test_and_cp}
322    
323     installdoc: TOBEMOVED= $(DOCFILES:${DIRDOC}/%=${PAM_DOC}/%)
324     installdoc: ORIGIN=${DIRDOC}
325     installdoc:
326     @${test_and_cp}
327    
328     info:
329     @echo " "
330     @${EGREEN} "Infos for package :" ${WHITE} ${PACKAGE}
331     @${EGREEN} " VERSION :" ${WHITE} ${VER}
332     @${EGREEN} " EXECUTABLES :" ${WHITE} ${EXECUTABLES}
333     @${EGREEN} " LIBS :" ${WHITE} ${LIBS}
334     @${EGREEN} " DOCS :" ${WHITE} ${DOCS}
335     @${EGREEN} " SRCS :" ${WHITE} ${SRCS}
336     @${EGREEN} " MACROS :" ${WHITE} ${MACROS}
337     @echo " "
338     @${RESET}
339    
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}/EVpathtoc.c; echo ' const char *pathtocalibration(){ return((const char*)gSystem->Getenv("PAM_CALIB"));}' >> ${DIRTOP}/${DIRMACROS}/EVpathtoc.c; fi
360     @if [ "${PAM_CCO}" != "" ]; then echo '#include <TSystem.h>' > ${DIRTOP}/${DIRMACROS}/EVpathtoc.c; echo ' const char *pathtocalibration(){ return((const char*)"'${PAM_CALIB}'/");}' >> ${DIRTOP}/${DIRMACROS}/EVpathtoc.c; fi
361     @sleep 0.2
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

  ViewVC Help
Powered by ViewVC 1.1.23