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

Annotation of /DarthVader/TrackerLevel2/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.43 - (hide annotations) (download)
Thu Jul 30 08:38:40 2009 UTC (15 years, 4 months ago) by mocchiut
Branch: MAIN
Changes since 1.42: +10 -4 lines
64 bit compilation bug fixed

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

  ViewVC Help
Powered by ViewVC 1.1.23