/[PAMELA software]/calo/ground/UTILITIES/Makefile
ViewVC logotype

Annotation of /calo/ground/UTILITIES/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations) (download)
Tue Dec 6 11:22:23 2005 UTC (19 years ago) by mocchiut
Branch: MAIN
CVS Tags: v2r01, HEAD
Changes since 1.1: +3 -2 lines
Small changes in the Makefile

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

  ViewVC Help
Powered by ViewVC 1.1.23