/[PAMELA software]/root2paw/Makefile
ViewVC logotype

Annotation of /root2paw/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download)
Mon Dec 5 16:17:37 2005 UTC (19 years ago) by mocchiut
Branch: MAIN
Branch point for: GroundDataConvert
Initial revision

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

  ViewVC Help
Powered by ViewVC 1.1.23