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

Annotation of /DarthVader/TrackerLevel2/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.34 - (hide annotations) (download)
Mon Sep 22 19:48:57 2008 UTC (16 years, 2 months ago) by mocchiut
Branch: MAIN
Changes since 1.33: +10 -10 lines
Added -m32 flag for cross compilation on 64bit machines

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

  ViewVC Help
Powered by ViewVC 1.1.23