/[PAMELA software]/DarthVader/TrackerLevel2/Makefile
ViewVC logotype

Annotation of /DarthVader/TrackerLevel2/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.27 - (hide annotations) (download)
Mon May 14 11:03:51 2007 UTC (17 years, 7 months ago) by pam-fi
Branch: MAIN
CVS Tags: v3r05, v3r06
Changes since 1.26: +1 -1 lines
v3r02

1 mocchiut 1.10 # Tracker flight analysis software
2     # SOFTWARE VERSION
3 pam-fi 1.27 VER= v3r02
4 mocchiut 1.10 DEBUG=0
5     # An almost general purpouse Makefile for PAMELA repository
6     # Let's start with some usefull definition for colorize the echo
7     RED='\E[1;31;40m'
8     GREEN='\E[1;32;40m'
9     YELLOW='\E[1;33;40m'
10     BLUE='\E[1;34;40m'
11     WHITE='\E[1;37;40m'
12     VIOLET='\E[1;35;40m'
13     CYAN='\E[1;36;40m'
14     # Here the echo definition to use them
15     EVIOLET=echo -e ${VIOLET}
16     ECYAN=echo -e ${CYAN}
17     ERED=echo -e ${RED}
18     EGREEN=echo -e ${GREEN}
19     EYELLOW=echo -e ${YELLOW}
20     EBLUE=echo -e ${BLUE}
21     EWHITE=echo -e ${WHITE}
22     # Reset the terminal
23     RESET=tput sgr0
24     # Here the variables used to override the standard make flags
25     # C
26     CC=gcc
27     #CFLAGS=-Wall -O -fPIC -pthread -g
28     CFLAGS=-Wall -O -fPIC -pthread
29     # Enviroment:
30     GCCVER=`gcc --version | head -1`
31     UNAMEA=`uname -a`
32     TODAY=`date`
33     # F77
34     F77=g77
35     #F77FLAGS= -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -g -extend_source -static -fno-backslash
36 pam-fi 1.14 F77FLAGS= -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -extend_source -static -fno-backslash -fPIC
37 mocchiut 1.10 # C++
38     CXX=g++
39     #CXXFLAGS=-Wall -O -fPIC -pthread -g -D'DEBUG=${DEBUG}'
40     #CXXFLAGS=-Wall -O -fPIC -pthread -g -D'DEBUG=0'
41     #CXXFLAGS=-Wall -O -fPIC -pthread -fpermissive
42 mocchiut 1.20 CXXFLAGS=-Wall -O4 -fPIC -pthread
43 mocchiut 1.10 # ROOTCINT
44     ROOTCINT=rootcint
45     # Here the variables definig the local directories
46     DIRTOP=${shell pwd}
47     #DIRLIB=lib/${ARCH}/
48     #DIRBIN=bin/${ARCH}/
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_YODA_env
58     # Here the local variables used to build the targets
59     #-------------------------------------------------
60     FSRCS=${DIRSRC}/F77/fillpedsig.f \
61     ${DIRSRC}/F77/readallparam.f \
62     ${DIRSRC}/F77/functions.f \
63     ${DIRSRC}/F77/cncomp.f \
64     ${DIRSRC}/F77/filladc.f \
65     ${DIRSRC}/F77/reductionflight.f \
66     ${DIRSRC}/F77/functionspfa.f \
67     ${DIRSRC}/F77/mini.f \
68     ${DIRSRC}/F77/tricircle.f \
69     ${DIRSRC}/F77/analysissubroutines.f \
70     ${DIRSRC}/F77/analysisflight.f \
71     ${DIRSRC}/F77/readB.f \
72     ${DIRSRC}/F77/interB.f \
73     ${DIRSRC}/F77/track.f \
74 pam-fi 1.24 ${DIRSRC}/F77/grkuta.f \
75     ${DIRSRC}/F77/bdll.f # ***PP***
76 mocchiut 1.10
77     FOBJS=$(FSRCS:${DIRSRC}/F77/%.f=${DIRLIB}/%.o)
78     #-------------------------------------------------
79     CSRCS=
80     COBJS=$(CSRCS:${DIRSRC}%.cpp=${DIRLIB}/%.o)
81     #-------------------------------------------------
82     # librerie utilizzabili da root (ci deve essere anche il ***LinkDef.h )
83 pam-fi 1.22 LIBROOTSRCS=${DIRSRC}/TrkParams.cpp \
84     ${DIRSRC}/TrkLevel2.cpp \
85     ${DIRSRC}/TrkLevel1.cpp \
86     ${DIRSRC}/TrkLevel0.cpp \
87     ${DIRSRC}/TrkHough.cpp \
88     ${DIRSRC}/TrkCalib.cpp
89 pam-fi 1.16
90 mocchiut 1.10 #LIBROOTSRCS=
91     LIBROOTLIBS=$(LIBROOTSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so)
92 pam-fi 1.22 LIBROOTOBJS=${DIRLIB}/readB.o \
93     ${DIRLIB}/interB.o \
94     ${DIRLIB}/track.o \
95     ${DIRLIB}/grkuta.o \
96 pam-fi 1.24 ${DIRLIB}/bdll.o \
97 pam-fi 1.22 ${DIRLIB}/functionspfa.o \
98     ${DIRLIB}/readallparam.o \
99     ${DIRLIB}/functions.o \
100     ${DIRLIB}/mini.o \
101     ${DIRLIB}/tricircle.o \
102     ${DIRLIB}/analysisflight.o \
103     ${DIRLIB}/analysissubroutines.o \
104     ${DIRLIB}/fillpedsig.o \
105     ${DIRLIB}/cncomp.o \
106     ${DIRLIB}/filladc.o \
107     ${DIRLIB}/reductionflight.o
108     LIBROOTCLIBS= libTrkParams libTrkLevel2 libTrkLevel1 libTrkLevel0 libTrkHough libTrkCalib
109 pam-fi 1.13
110 mocchiut 1.10 #LIBROOTCLIBS=
111     FULLROOTCLIBS=$(LIBROOTCLIBS:%=${DIRLIB}/%_${VER}.so)
112     #-------------------------------------------------
113     # librerie C++ NON utilizzabili da root
114     #LIBCPPSRCS= ${DIRSRC}/TrkLevel2.cpp \
115     # ${DIRSRC}/TrkLevel0.cpp
116 pam-fi 1.22 LIBCPPSRCS=${DIRSRC}/TrkStruct.cpp \
117 mocchiut 1.10 ${DIRSRC}/TrkProcess.cpp \
118     ${DIRSRC}/TrkVerl2.cpp \
119 pam-fi 1.22 ${DIRSRC}/TrkCore.cpp \
120     # ${DIRSRC}/TrkLevel0.cpp
121    
122 mocchiut 1.10 LIBCPPLIBS=$(LIBCPPSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so)
123     #LIBCPPCLIBS=libTrkLevel2 libTrkLevel0
124 pam-fi 1.22 LIBCPPCLIBS= libTrkStruct libTrkProcess libTrkCore libTrkVerl2 #libTrkLevel0
125 mocchiut 1.10 FULLCPPCLIBS=$(LIBCPPCLIBS:%=${DIRLIB}/%_${VER}.so)
126     #-------------------------------------------------
127     # librerie F77 NON utilizzabili da root
128     LIBF77SRCS=
129     LIBF77OBJS= $(LIBF77SRCS:${DIRSRC}/F77/%.f=${DIRLIB}/%.o)
130     LIBF77LIBS= $(LIBF77SRCS:${DIRSRC}/F77/%.f=${DIRLIB}/lib%_${VER}.so)
131     LIBF77CLIBS=
132     FULLF77CLIBS=$(LIBF77CLIBS:%=${DIRLIB}/%_${VER}.so)
133     #-------------------------------------------------
134     FULLLIBS=${FULLROOTCLIBS} ${FULLCPPCLIBS} ${FULLF77CLIBS}
135    
136     #-------------------------------------------------
137     # eseguibile
138     CXXEXESRCS=${DIRSRC}/TrackerLevel2.cpp
139     CXXEXEOBJS=$(CXXEXESRCS:${DIRSRC}%.cpp=${DIRLIB}%.o)
140     CXXEXELIBS:=TrackerLevel2
141    
142     OTHERLIBS=${PAM_LIB}/libGLTables.so ${DIRLIB}/libRunInfo.so
143     SUBDIR=../RunInfo
144     SUBINC=$(shell for dir in `echo ${SUBDIR}`; do echo -I$${dir}/inc; done)
145    
146     #-------------------------------------------------
147     # variabili per l'installazione
148     EXESRCS=${DIRBIN}/TrackerLevel2
149     INCSRCS= \
150     ${DIRINC}/TrkLevel2.h \
151     ${DIRINC}/TrkLevel1.h \
152     ${DIRINC}/TrkLevel0.h \
153 pam-fi 1.13 ${DIRINC}/TrkHough.h \
154 pam-fi 1.16 ${DIRINC}/TrkCalib.h \
155 pam-fi 1.22 ${DIRINC}/TrkParams.h \
156 mocchiut 1.10 ${DIRINC}/TrkStruct.h \
157     ${DIRINC}/TrkProcess.h \
158     ${DIRINC}/TrkCore.h \
159     ${DIRINC}/TrkVerl2.h
160     MACROSSRCS=
161     CALIBFILES=
162     DOCFILES=
163     # Here the Variables used for info target
164     PACKAGE=Tracker flight software
165     EXECUTABLES=${EXESRCS}
166     LIBS= ${FULLLIBS} ${OTHERLIBS}
167     DOCS=
168     SRCS=
169     MACROS= ${MACROSSRCS}
170     INCLUDE= ${INCSRCS}
171     #
172     TOBEDEL = junk
173     ROOTINC=$$${shell root-config --incdir}
174     NROOTINC=${shell root-config --incdir}
175     # Let's start
176     #all : test mkbindir mklibdir mkverpath ${LIBF77LIBS} ${LIBROOTLIBS} ${LIBCPPLIBS} ${FOBJS} ${COBJS} ${CXXEXELIBS}
177     all : test mkbindir mklibdir mkverpath ${LIBF77LIBS} ${LIBROOTLIBS} ${LIBCPPLIBS}
178     all:
179     @echo -e ${GREEN} ""
180     @(${EGREEN} " Finished, now you can install the package \n (use: make install or make upgrade or make forceinstall) "; ${RESET})
181     @echo -e ${GREEN} ""
182     @${RESET}
183    
184     standalone: all ${CXXEXELIBS}
185    
186     # Here some general rules to produce objects in our local dir
187     ${DIRLIB}/%.o: ${DIRSRC}/%.cpp
188     # @(${EYELLOW} " C++ object ------------------------")
189     @(${EGREEN} "Creating C++ object file: "${WHITE} "$@"; ${RESET})
190     @${CXX} ${CXXFLAGS} -c -o $@ ${DIRSRC}/`basename ${@} .o`.cpp -I${DIRTOP}/${DIRINC} ${SUBINC} -I${PAM_YODA}/include/yoda/ -I${PAM_INC}/ `root-config --cflags`
191    
192     ${DIRLIB}/%.o : ${DIRSRC}/F77/%.f
193     # @(${EYELLOW} " F77 object ------------------------")
194     @(${EGREEN} "Creating F77 object file: "${WHITE} "$@"; ${RESET})
195     @${F77} ${F77FLAGS} -c -o $@ ${DIRSRC}/F77/`basename ${@} .o`.f -I${DIRTOP}/${DIRINC}/F77 -I${NROOTINC} ${SUBINC} -I${PAM_YODA}/include/yoda -I${PAM_INC}/
196    
197     # .so from .o fortran
198     ${LIBF77LIBS}: ${LIBF77OBJS}
199     @(${EYELLOW} " F77 shared library --------------------------")
200     @(${EGREEN} "Creating library: "${WHITE} "$@"; ${RESET})
201     # @${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ $^ `cernlib mathlib` /usr/lib/libg2c.so.0
202     ## @${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ -lg2c $^ `cernlib mathlib`
203     @${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ -lg2c $^
204    
205     ${LIBROOTLIBS}: ${LIBROOTSRCS} ${FOBJS}
206     @(${EYELLOW} " ROOT library ------------------------")
207     @(${EGREEN} "Creating file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp"; ${RESET})
208     #
209     # Create *Dict.cpp and *Dict.h
210     #
211 mocchiut 1.21 @${ROOTCINT} -f ${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp -c -I${DIRINC} -I${ROOTINC} -I${PAM_YODA}/include/yoda/ -I${PAM_INC}/ ${DIRINC}/`basename $(@F) _${VER}.so | sed s/lib//`.h ${DIRINC}/`basename $(@F) _${VER}.so | sed s/lib//`LinkDef.h
212 mocchiut 1.10 #
213     # create .o
214     #
215     @(${EGREEN} "Compiling file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`.cpp"; ${RESET})
216     @${CXX} ${CXXFLAGS} -c ${DIRTOP}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`.cpp -o ${DIRTOP}/${DIRLIB}/`basename $(@F) _${VER}.so | sed s/lib//`.o -I${DIRTOP}/${DIRINC} -I${DIRTOP} ${SUBINC} -I${PAM_YODA}/include/yoda/ -I${PAM_INC}/ -I${NROOTINC};
217     @(${EGREEN} "Compiling file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp"; ${RESET})
218     @${CXX} ${CXXFLAGS} -c ${DIRTOP}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp -o ${DIRTOP}/${DIRLIB}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.o -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_INC} -I${PAM_YODA}/include/yoda/ -I${NROOTINC};
219     @ln -sf ${DIRTOP}/${DIRLIB}/$(@F) ${DIRTOP}/${DIRLIB}/$(patsubst %_${VER}.so,%.so,$(@F))
220     #
221     # create .so
222     #
223     @(${EGREEN} "Compiling shared library: "${WHITE} "$@"; ${RESET})
224     ## @${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ -lg2c -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_YODA}/include/yoda -I${PAM_INC} ${DIRTOP}/${DIRLIB}/`basename $(@F) _${VER}.so | sed s/lib//`.o ${DIRTOP}/${DIRLIB}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.o ${LIBROOTOBJS} `cernlib mathlib` 1>/dev/null
225 mocchiut 1.11 @${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ -lg2c -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_YODA}/include/yoda -I${PAM_INC} ${DIRTOP}/${DIRLIB}/`basename $(@F) _${VER}.so | sed s/lib//`.o ${DIRTOP}/${DIRLIB}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.o ${LIBROOTOBJS} 1>/dev/null
226 mocchiut 1.10 # ${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ -lg2c -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_YODA}/include/yoda/ ${SUBINC} ${DIRTOP}/${DIRLIB}/`basename $(@F) _${VER}.so | sed s/lib//`.o ${DIRTOP}/${DIRLIB}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.o 1>/dev/null
227     @ln -sf ${DIRTOP}/${DIRLIB}/$(@F) ${DIRTOP}/${DIRLIB}/$(patsubst %_${VER}.so,%.so,$(@F))
228     @(${EYELLOW} " -------------------------------------")
229    
230     ${LIBCPPLIBS}: ${LIBCPPSRCS}
231     #
232     # create .o
233     #
234     @(${EGREEN} "Compiling file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`.cpp"; ${RESET})
235     @${CXX} ${CXXFLAGS} -c ${DIRTOP}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`.cpp -o ${DIRTOP}/${DIRLIB}/`basename $(@F) _${VER}.so | sed s/lib//`.o -I${DIRTOP}/${DIRINC} ${SUBINC} -I${PAM_YODA}/include/yoda/ -I${PAM_INC}/ -I${NROOTINC};
236     #
237     # create .so
238     #
239     @(${EGREEN} "Compiling shared library: "${WHITE} "$@"; ${RESET})
240     @${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ -lg2c -I${DIRTOP}/${DIRINC} ${SUBINC} -I${PAM_YODA}/include/yoda/ -I${PAM_INC}/ ${DIRTOP}/${DIRLIB}/`basename $(@F) _${VER}.so | sed s/lib//`.o ${OTHERLIBS} ${FOBJS} 1>/dev/null
241     @ln -sf ${DIRTOP}/${DIRLIB}/$(@F) ${DIRTOP}/${DIRLIB}/$(patsubst %_${VER}.so,%.so,$(@F))
242    
243    
244     ${CXXEXELIBS}: ${COBJS} ${FOBJS} ${CXXEXEOBJS}
245     @(${EVIOLET} "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *")
246     @(${EGREEN} "Creating exec file: "${WHITE} "$@"; ${RESET})
247     # @${CXX} ${CXXFLAGS} -o ${DIRBIN}/$@ ${DIRLIB}/$@.o -I${DIRTOP}/${DIRINC} ${SUBINC} -I${PAM_YODA}/include/yoda/ -I${PAM_YODA}/include/utils/ ${PAM_YODA}/lib/libyoda.so ${PAM_YODA}/lib/libutils.so ${FOBJS} ${COBJS} ${FULLLIBS} ${OTHERLIBS} -lThread `root-config --cflags --glibs` `cernlib mathlib` /usr/lib/libg2c.so.0;
248 mocchiut 1.12 @${CXX} ${CXXFLAGS} -o ${DIRBIN}/$@ ${DIRLIB}/$@.o -I${DIRTOP}/${DIRINC} ${SUBINC} -I${PAM_YODA}/include/yoda/ -I${PAM_INC}/ ${PAM_YODA}/lib/libyoda.so ${FOBJS} ${COBJS} ${FULLLIBS} ${OTHERLIBS} -lThread -lg2c `root-config --cflags --glibs` `cernlib_noshift mathlib`;
249 mocchiut 1.10
250    
251     # A small target to check environmental variables
252     %_env:
253     @${test_env}
254    
255     .PHONY: install installdoc installlib installmacros installinc installexe installcmacro
256     .PHONY: clean depclean info mkbindir mklibdir testcern testpamenv test
257    
258     mkbindir: ${DIRBIN}
259     ${DIRBIN}:
260     @${test_and_mk}
261    
262     mklibdir: ${DIRLIB}
263     ${DIRLIB}:
264     @${test_and_mk}
265    
266     # Here what has to be deleted in clean target
267     clean: TOBEDEL= ${DIRSRC}/*.o ${DIRSRC}/*Dict.cpp ${DIRSRC}/*Dict.h ${FOBJS} ${FULLLIBS} ${DIRBIN}/${CXXEXELIBS} ${COBJS} ${CXXEXEOBJS} ${DIRSRC}/TrkVerl2.cpp
268     clean:
269     @${test_and_rm}
270    
271     distclean: clean
272     distclean: TOBEDEL= ${DIRBIN} ${DIRLIB}
273     distclean:
274     @${test_and_rm}
275    
276     forceinstall: FORCE=-f
277     forceinstall: install
278    
279     upgrade: FORCE=-u
280     upgrade: install
281     upgradestandalone: FORCE=-u
282     upgradestandalone: installstandalone
283    
284     install: installlib installinc installmacros installcalib installdoc installcmacro
285     installstandalone: install installexe
286    
287     installlib: LINK=y
288     installlib: TOBEMOVED= $(FULLLIBS:${DIRLIB}%=${PAM_LIB}%)
289     installlib: ORIGIN=${DIRLIB}
290     installlib:
291     @${test_and_cp}
292    
293     installcmacro: LINK=y
294     installcmacro: TOBEMOVED= $(FULLMACROCLIBS:${DIRLIB}%=${PAM_LIB}%)
295     installcmacro: ORIGIN=${DIRLIB}
296     installcmacro:
297     @${test_and_cp}
298    
299     installinc: TOBEMOVED= $(INCSRCS:${DIRINC}/%=${PAM_INC}/%)
300     installinc: ORIGIN=${DIRINC}
301     installinc:
302     @${test_and_cp}
303    
304     installexe: TOBEMOVED= $(EXESRCS:${DIRBIN}/%=${PAM_BIN}/%)
305     installexe: ORIGIN=${DIRBIN}
306     installexe:
307     @${test_and_cp}
308    
309     installmacros: TOBEMOVED= $(MACROSSRCS:${DIRMACROS}/%=${PAM_MACROS}/%)
310     installmacros: ORIGIN=${DIRMACROS}
311     installmacros:
312     @${test_and_cp}
313    
314     installcalib: TOBEMOVED= $(CALIBFILES:${DIRCALIB}/%=${PAM_CALIB}/%)
315     installcalib: ORIGIN=${DIRCALIB}
316     installcalib:
317     @${test_and_cp}
318    
319     installdoc: TOBEMOVED= $(DOCFILES:${DIRDOC}/%=${PAM_DOC}/%)
320     installdoc: ORIGIN=${DIRDOC}
321     installdoc:
322     @${test_and_cp}
323    
324     mkverpath:
325     # @echo '#include <TSystem.h>' > ${DIRTOP}/${DIRSRC}/TrkVerl2.cpp; echo ' void info(){ printf("\nTracker Level2 flight package version: ${VER}\n\nCompiled on '${TODAY}' with: '${GCCVER}'\n\nOn: '${UNAMEA}'\n\n"); }' >> ${DIRTOP}/${DIRSRC}/TrkVerl2.cpp
326     @echo '#include <TSystem.h>' > ${DIRTOP}/${DIRSRC}/TrkVerl2.cpp; echo ' char *TrkInfo(bool print){ if ( print ) printf("\nTracker Level2 flight package version: ${VER}\n\nCompiled on '${TODAY}' with: '${GCCVER}'\n\nOn: '${UNAMEA}'\n\n"); return("${VER}"); }' >> ${DIRTOP}/${DIRSRC}/TrkVerl2.cpp
327     @sleep 0.8
328    
329    
330    
331     info:
332     @echo " "
333     @${EGREEN} "Infos for package :" ${WHITE} ${PACKAGE}
334     @${EGREEN} " VERSION :" ${WHITE} ${VER}
335     @${EGREEN} " EXECUTABLES :" ${WHITE} ${EXECUTABLES}
336     @${EGREEN} " INCLUDES :" ${WHITE} ${INCLUDE}
337     @${EGREEN} " LIBS :" ${WHITE} ${LIBS}
338     @${EGREEN} " DOCS :" ${WHITE} ${DOCS}
339     @${EGREEN} " SRCS :" ${WHITE} ${SRCS}
340     @${EGREEN} " MACROS :" ${WHITE} ${MACROS}
341     @echo " "
342     @${RESET}
343    
344     test: testpamenv
345    
346     testpamenv: ${PAM_ENV}
347    
348     root-config: OPT=--cflags
349     root-config:
350     @${test_cmd}
351    
352     # Here follows some usefull macros
353     define test_and_cp
354     wd=`pwd`;\
355     for i in ${TOBEMOVED} ; do \
356     wv=$${i##/*/}; \
357     dest=$${i/$${wv}/}; \
358     ${EGREEN} "Testing for :" ${WHITE} "$${i}" ; ${RESET}; \
359     if [ ! "${FORCE}" ] ; then \
360     if [ ! -f $${i} ]; then \
361     ${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\
362     ${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \
363     cp ${ORIGIN}/$${i##/*/} $${i}; \
364     else \
365     ${ERED} "File already exist !!!! Please delete it " ${WHITE}; ${RESET}; \
366     fi;\
367     else \
368     if [ "${FORCE}" == "-u" ] ; then \
369     if [ "`basename $${i}`" != "`basename $${i} _${VER}.so`" ]; then \
370     ${EYELLOW} "Removing: "${WHITE} ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so; ${RESET}; \
371     rm -f ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so ; \
372     ${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\
373     ${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \
374     cp ${ORIGIN}/$${i##/*/} $${i}; \
375     else \
376     ${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\
377     ${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \
378     cp -f ${ORIGIN}/$${i##/*/} $${i}; \
379     fi; \
380     else \
381     ${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\
382     ${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \
383     cp ${FORCE} ${ORIGIN}/$${i##/*/} $${i}; \
384     fi;\
385     fi ;\
386     if [ ! -z ${LINK} ] ; then \
387     ${EGREEN} "Creating symlink from : "${WHITE} $${wv/_${VER}/} ;\
388     ${EGREEN} " to : "${WHITE} $${i##/*/} ; ${RESET}; \
389     cd $${dest}; \
390     ln -sf $${wv} $${wv/_${VER}/}; \
391     cd $${wd}; \
392     fi \
393     done
394     endef
395    
396     define test_and_mk
397     ${EGREEN} "Testing for :" ${WHITE} "$@"; ${RESET}
398     test -d "$@" || \
399     (${EGREEN} "Creating : "${WHITE} "$@"; ${RESET}; mkdir -p $@)
400     endef
401    
402     define test_env
403     ${EGREEN} "Testing for env:" ${WHITE} $(patsubst %_env,%,$@); ${RESET}
404     printenv $(patsubst %_env,%,$@) 1>/dev/null || \
405     (${ERED} "ERROR, variable : "${WHITE} $(patsubst %_env,%,$@) \
406     ${RED} "not defined !!! Check your env. settings"; \
407     ${RESET}; exit 1)
408     ${EGREEN} " Defined:" ${WHITE} $${$(patsubst %_env,%,$@)}; ${RESET}
409     endef
410    
411     define test_cmd
412     ${EGREEN} "Testing for cmd:" ${WHITE} $@ ${OPT}; ${RESET}
413     $@ ${OPT} 1>/dev/null 2>&1 || \
414     (${ERED} "ERROR, command : "${WHITE} $@ ${OPT}\
415     ${RED} "not found !!! Check your installation"; \
416     ${RESET}; exit 1)
417     ${EGREEN} " Present:" ${WHITE} $@ ${OPT}; ${RESET}
418     endef
419    
420     define test_and_rm
421     for i in ${TOBEDEL}; do \
422     test -d $${i} || (${ERED} "Removing file :"${WHITE} $${i}; ${RESET}; \
423     rm -f $${i} ); \
424     test ! -d $${i} || (${ERED} "Removing dir :"${WHITE} $${i}; ${RESET}; \
425     rm -rf $${i} ); \
426     done
427     endef

  ViewVC Help
Powered by ViewVC 1.1.23