/[PAMELA software]/PamelaLevel2/Makefile
ViewVC logotype

Diff of /PamelaLevel2/Makefile

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by pam-fi, Fri Jun 16 16:50:01 2006 UTC revision 1.34 by pam-ts, Wed Oct 15 08:51:50 2014 UTC
# Line 1  Line 1 
1  # Calorimeter flight analysis software  # PamelaLevel2 software
2  # SOFTWARE VERSION  # SOFTWARE VERSION
3  VER= v0r01  VER= v11r00
4  # An almost general purpouse Makefile for PAMELA repository  # An almost general purpouse Makefile for PAMELA repository
5  # Let's start with some usefull definition for colorize the echo  # Let's start with some usefull definition for colorize the echo
6  RED='\E[1;31;40m'  RED='\E[1;31;40m'
7  GREEN='\E[1;32;40m'  GREEN='\E[1;32;40m'
8  YELLOW='\E[1;33;40m'  YELLOW='\E[1;33;40m'
9  BLUE='\E[1;34;40m'  BLUE='\E[1;34;40m'
10  WHITE='\E[1;37;40m'  WHITE='\E[1;37;40m'
11  VIOLET='\E[1;35;40m'  VIOLET='\E[1;35;40m'
12  CYAN='\E[1;36;40m'  CYAN='\E[1;36;40m'
13  # Here the echo definition to use them  # Here the echo definition to use them
14  EVIOLET=echo -e ${VIOLET}  EVIOLET=echo -e ${VIOLET}
15  ECYAN=echo -e ${CYAN}  ECYAN=echo -e ${CYAN}
16  ERED=echo -e ${RED}  ERED=echo -e ${RED}
17  EGREEN=echo -e ${GREEN}  EGREEN=echo -e ${GREEN}
18  EYELLOW=echo -e ${YELLOW}  EYELLOW=echo -e ${YELLOW}
19  EBLUE=echo -e ${BLUE}  EBLUE=echo -e ${BLUE}
20  EWHITE=echo -e ${WHITE}  EWHITE=echo -e ${WHITE}
21  # Reset the terminal  # Reset the terminal
22  RESET=tput sgr0  RESET=tput sgr0
23  # Here the variables used to override the standard make flags  # Here the variables used to override the standard make flags
24  # C  # C
25  CC=gcc  CC=gcc
26  CFLAGS=-Wall -O -fPIC -pthread -g  #CFLAGS=-Wall -O -fPIC -pthread -g ${PAM_BIT}
27  #CFLAGS=-Wall -O -fPIC -pthread  CFLAGS=-Wall -O4 -fPIC -pthread ${PAM_BIT}
28  # Enviroment:  # Enviroment:
29  GCCVER=`gcc --version | head -1`  GCCVER=`gcc --version | head -1`
30  UNAMEA=`uname -a`  UNAMEA=`uname -a`
31  TODAY=`date`  TODAY=`date`
32  # F77  ifeq ($(GCC4),)
33  F77=g77  export GCCVERS=$(shell echo `gcc -dumpversion | sed 's/\./\ /g'`)
34  F77FLAGS=  -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -g -extend_source -static -fno-backslash  export GCCVERMAJ=$(word 1,$(GCCVERS))
35  #F77FLAGS=  -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -extend_source -static -fno-backslash  export GCC4=$(shell echo `echo "${GCCVERMAJ} > 3" |bc -l`)
36  # C++  endif
37  CXX=g++  ifeq ($(GCC4),1)
38  CXXFLAGS=-Wall -O -fPIC -pthread -g  F77=gfortran
39  #CXXFLAGS=-Wall -O -fPIC -pthread  LG2C=-lgfortran
40  # ROOTCINT  EXTRAOPT=
41  ROOTCINT=rootcint  else
42  # Here the variables definig the local directories  F77=g77
43  DIRTOP=${shell pwd}  LG2C=-lg2c
44  DIRLIB=lib/${ARCH}/  EXTRAOPT=-Wno-globals -fvxt
45  DIRBIN=bin/${ARCH}/  endif
46  DIRSRC=src  #F77FLAGS=  -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -g -extend_source -static -fno-backslash ${PAM_BIT}
47  DIRINC=inc  F77FLAGS=  -Wall -funroll-loops -fPIC $(EXTRAOPT) -fno-automatic -fbounds-check -extend_source -static -fno-backslash ${PAM_BIT}
48  DIRDOC=doc  # C++
49  DIRMACROS=macros  CXX=g++
50  DIRCALIB=calib  #CXXFLAGS=-Wall -O -fPIC -pthread -g ${PAM_BIT}
51  # Here the  PAMELA environmental variables to be checked  CXXFLAGS=-Wall -O4 -fPIC -pthread ${PAM_BIT}
52  PAM_ENV= PAM_BIN_env PAM_LIB_env PAM_INC_env PAM_DOC_env PAM_CALIB_env PAM_YODA_env  # ROOTCINT
53  # Here the local variables used to build the targets  ROOTCINT=rootcint
54  #-------------------------------------------------  # Here the variables definig the local directories
55  FSRCS=    DIRTOP=${shell pwd}
56  FOBJS=$(FSRCS:${DIRSRC}/F77/%.f=${DIRLIB}/%.o)  DIRLIB=lib/${ARCH}/
57  #-------------------------------------------------  DIRBIN=bin/${ARCH}/
58  CSRCS=    DIRSRC=src
59  COBJS=$(CSRCS:${DIRSRC}%.cpp=${DIRLIB}/%.o)  DIRINC=inc
60  #-------------------------------------------------  DIRDOC=doc
61  # librerie utilizzabili da root (ci deve essere anche il ***LinkDef.h )  DIRMACROS=macros
62  LIBROOTSRCS=${DIRSRC}/PamLevel2.cpp  DIRCALIB=calib
63  LIBROOTLIBS=$(LIBROOTSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so)  # Here the  PAMELA environmental variables to be checked
64  LIBROOTOBJS=  PAM_ENV= PAM_BIN_env PAM_LIB_env PAM_INC_env PAM_DOC_env PAM_CALIB_env PAM_YODA_env
65  LIBROOTCLIBS=libPamLevel2  # Here the local variables used to build the targets
66  FULLROOTCLIBS=$(LIBROOTCLIBS:%=${DIRLIB}/%_${VER}.so)  #-------------------------------------------------
67  #-------------------------------------------------  FSRCS=  
68  # librerie C++ NON utilizzabili da root  FOBJS=$(FSRCS:${DIRSRC}/F77/%.f=${DIRLIB}/%.o)
69  LIBCPPSRCS=#${DIRSRC}/PamLevel2.cpp  #-------------------------------------------------
70  LIBCPPLIBS=$(LIBCPPSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so)  CSRCS=  
71  LIBCPPCLIBS=#libPamLevel2  COBJS=$(CSRCS:${DIRSRC}%.cpp=${DIRLIB}/%.o)
72  FULLCPPCLIBS=$(LIBCPPCLIBS:%=${DIRLIB}/%_${VER}.so)  #-------------------------------------------------
73  #-------------------------------------------------  # librerie utilizzabili da root (ci deve essere anche il ***LinkDef.h )
74  # librerie F77 NON utilizzabili da root  LIBROOTSRCS=${DIRSRC}/PamLevel2.cpp
75  LIBF77SRCS=  LIBROOTLIBS=$(LIBROOTSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so)
76  LIBF77OBJS= $(LIBF77SRCS:${DIRSRC}/F77/%.f=${DIRLIB}/%.o)  LIBROOTOBJS=
77  LIBF77LIBS= $(LIBF77SRCS:${DIRSRC}/F77/%.f=${DIRLIB}/lib%_${VER}.so)  LIBROOTCLIBS=libPamLevel2
78  LIBF77CLIBS=  FULLROOTCLIBS=$(LIBROOTCLIBS:%=${DIRLIB}/%_${VER}.so)
79  FULLF77CLIBS=$(LIBF77CLIBS:%=${DIRLIB}/%_${VER}.so)  #-------------------------------------------------
80  #-------------------------------------------------  # librerie C++ NON utilizzabili da root
81  FULLLIBS=${FULLROOTCLIBS} ${FULLCPPCLIBS} ${FULLF77CLIBS}  LIBCPPSRCS=#${DIRSRC}/PamLevel2.cpp
82    LIBCPPLIBS=$(LIBCPPSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so)
83  #-------------------------------------------------  LIBCPPCLIBS=#libPamLevel2
84  # eseguibile  FULLCPPCLIBS=$(LIBCPPCLIBS:%=${DIRLIB}/%_${VER}.so)
85  CXXEXESRCS=  #-------------------------------------------------
86  CXXEXEOBJS=$(CXXEXESRCS:${DIRSRC}%.cpp=${DIRLIB}%.o)  # librerie F77 NON utilizzabili da root
87  CXXEXELIBS:=  LIBF77SRCS=
88    LIBF77OBJS= $(LIBF77SRCS:${DIRSRC}/F77/%.f=${DIRLIB}/%.o)
89  OTHERLIBS=  LIBF77LIBS= $(LIBF77SRCS:${DIRSRC}/F77/%.f=${DIRLIB}/lib%_${VER}.so)
90  #-------------------------------------------------  LIBF77CLIBS=
91  # variabili per l'installazione  FULLF77CLIBS=$(LIBF77CLIBS:%=${DIRLIB}/%_${VER}.so)
92  EXESRCS=  #-------------------------------------------------
93  INCSRCS=${DIRINC}/PamLevel2.h  FULLLIBS=${FULLROOTCLIBS} ${FULLCPPCLIBS} ${FULLF77CLIBS}
94  MACROSSRCS=  
95  CALIBFILES=  #-------------------------------------------------
96  DOCFILES=  # eseguibile
97  # Here the Variables used for info target  CXXEXESRCS=
98  PACKAGE=Tracker flight software  CXXEXEOBJS=$(CXXEXESRCS:${DIRSRC}%.cpp=${DIRLIB}%.o)
99  EXECUTABLES=${EXESRCS}  CXXEXELIBS:=
100  LIBS= ${FULLLIBS} ${OTHERLIBS}  
101  DOCS=  OTHERLIBS=
102  SRCS=  #-------------------------------------------------
103  MACROS= ${MACROSSRCS}  # variabili per l'installazione
104  INCLUDE= ${INCSRCS}  EXESRCS=
105  #  INCSRCS=${DIRINC}/PamLevel2.h
106  TOBEDEL = junk  MACROSSRCS=
107  ROOTINC=$$${shell root-config --incdir}  CALIBFILES=
108  NROOTINC=${shell root-config --incdir}  DOCFILES=
109  # Let's start  # Here the Variables used for info target
110  all : test mkbindir mklibdir mkverpath ${LIBF77LIBS} ${LIBROOTLIBS} ${LIBCPPLIBS} ${CXXEXELIBS}  PACKAGE=Tracker flight software
111  all:  EXECUTABLES=${EXESRCS}
112          @echo -e ${GREEN} ""  LIBS= ${FULLLIBS} ${OTHERLIBS}
113          @(${EGREEN} " Finished, now you can install the package \n  (use: make install or make upgrade or make forceinstall) "; ${RESET})  DOCS=
114          @echo -e ${GREEN} ""  SRCS=
115          @${RESET}  MACROS= ${MACROSSRCS}
116    INCLUDE= ${INCSRCS}
117  # Here some general rules to produce objects in our local dir  #
118  ${DIRLIB}/%.o: ${DIRSRC}/%.cpp  TOBEDEL = junk
119          @(${EYELLOW} " C++ object ------------------------")  ROOTINC=$$${shell root-config --incdir}
120          @(${EGREEN} "Creating object file: "${WHITE} "$@"; ${RESET})  NROOTINC=${shell root-config --incdir}
121          @${CXX} ${CXXFLAGS} -c -o $@ ${DIRSRC}/`basename ${@} .o`.cpp -I${DIRINC} -I${PAM_INC} -I${PAM_YODA}/include/yoda/  `root-config --cflags`  # Let's start
122    all : test mkbindir mklibdir ${LIBF77LIBS} ${LIBROOTLIBS} ${LIBCPPLIBS} ${CXXEXELIBS}
123  ${DIRLIB}/%.o : ${DIRSRC}/F77/%.f  all:
124          @(${EYELLOW} " F77 object ------------------------")          @echo -e ${GREEN} ""
125          @(${EGREEN} "Creating object file: "${WHITE} "$@"; ${RESET})          @(${EGREEN} " Finished, now you can install the package \n  (use: make install or make upgrade or make forceinstall) "; ${RESET})
126          @${F77} ${F77FLAGS} -c -o $@ ${DIRSRC}/F77/`basename ${@} .o`.f -I${DIRINC}/F77 -I${NROOTINC} -I${PAM_YODA}/include/yoda          @echo -e ${GREEN} ""
127            @${RESET}
128    
129  # .so from .o fortran  # Here some general rules to produce objects in our local dir
130  ${LIBF77LIBS}: ${LIBF77OBJS}  ${DIRLIB}/%.o: ${DIRSRC}/%.cpp
131          @(${EYELLOW} " F77 shared library --------------------------")          @(${EYELLOW} " C++ object ------------------------")
132          @(${EGREEN} "Creating library: "${WHITE} "$@"; ${RESET})          @(${EGREEN} "Creating object file: "${WHITE} "$@"; ${RESET})
133          @${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ $^ -lg2c `cernlib mathlib`          @${CXX} ${CXXFLAGS} -c -o $@ ${DIRSRC}/`basename ${@} .o`.cpp -I${DIRINC} -I${PAM_INC} -I${PAM_YODA}/include/yoda/  `root-config --cflags`
134    
135    ${DIRLIB}/%.o : ${DIRSRC}/F77/%.f
136  ${LIBROOTLIBS}: ${LIBROOTSRCS} ${FOBJS}          @(${EYELLOW} " F77 object ------------------------")
137          @(${EYELLOW} " ROOT library ------------------------")          @(${EGREEN} "Creating object file: "${WHITE} "$@"; ${RESET})
138          @(${EGREEN} "Creating file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp"; ${RESET})          @${F77} ${F77FLAGS} -c -o $@ ${DIRSRC}/F77/`basename ${@} .o`.f -I${DIRINC}/F77 -I${NROOTINC} -I${PAM_YODA}/include/yoda
139  #  
140  #       Create *Dict.cpp and *Dict.h  
141  #  # .so from .o fortran
142          @${ROOTCINT} -f ${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp -c -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  ${LIBF77LIBS}: ${LIBF77OBJS}
143  #          @(${EYELLOW} " F77 shared library --------------------------")
144  #       create .o          @(${EGREEN} "Creating library: "${WHITE} "$@"; ${RESET})
145  #          @${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ $^ $(LG2C) `doc/cernlib_pam mathlib`
146          @(${EGREEN} "Compiling file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`.cpp"; ${RESET})  
147          @cd ${DIRSRC} &>/dev/null && ${CXX} ${CXXFLAGS} -c `basename $(@F) _${VER}.so | sed s/lib//`.cpp -I${DIRTOP}/${DIRINC} -I${DIRTOP}  -I${PAM_INC} -I${PAM_YODA}/include/yoda/ -I${NROOTINC};  
148          @(${EGREEN} "Compiling file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp"; ${RESET})  ${LIBROOTLIBS}: ${LIBROOTSRCS} ${FOBJS}
149          @cd ${DIRSRC} &>/dev/null && ${CXX} ${CXXFLAGS} -c `basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_INC} -I${PAM_YODA}/include/yoda/ -I${NROOTINC};          @(${EYELLOW} " ROOT library ------------------------")
150  #          @(${EGREEN} "Creating file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp"; ${RESET})
151  #       create .so  #
152  #  #       Create *Dict.cpp and *Dict.h
153          @(${EGREEN} "Compiling shared library: "${WHITE} "$@"; ${RESET})  #
154          @${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ -lg2c -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_YODA}/include/yoda -I${PAM_INC} ${DIRTOP}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`.o ${DIRTOP}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.o ${LIBROOTOBJS} `cernlib mathlib` 1>/dev/null          #       @${ROOTCINT} -f ${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp -c -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
155  #       @ln -sf  ${DIRTOP}/${DIRLIB}/$(@F) ${DIRTOP}/${DIRLIB}/$(patsubst %_${VER}.so,%.so,$(@F))          @${ROOTCINT} -f ${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp -c -I${PAM_INC} -I${ROOTINC} -I${PAM_YODA}/include/yoda/ ${DIRINC}/`basename $(@F) _${VER}.so | sed s/lib//`.h  ${DIRINC}/`basename $(@F) _${VER}.so | sed s/lib//`LinkDef.h
156    #
157  ${LIBCPPLIBS}: ${LIBCPPSRCS}  # order of include directories changed since RunInfo.h can be found (with completely different definition) in YODA while we want to load the DV one!
158  #  # should be fixed some time changing names...
159  #       create .o  #
160  #  #       create .o
161          @(${EGREEN} "Compiling file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`.cpp"; ${RESET})  #
162          @cd ${DIRSRC} &>/dev/null && ${CXX} ${CXXFLAGS} -c `basename $(@F) _${VER}.so | sed s/lib//`.cpp -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_YODA}/include/yoda/ -I${NROOTINC} -I${PAM_INC} ;          @(${EGREEN} "Compiling file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`.cpp"; ${RESET})
163  #          @cd ${DIRSRC} &>/dev/null && ${CXX} ${CXXFLAGS} -c `basename $(@F) _${VER}.so | sed s/lib//`.cpp -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_INC} -I${PAM_YODA}/include/yoda/ -I${NROOTINC};
164  #       create .so          @(${EGREEN} "Compiling file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp"; ${RESET})
165  #          @cd ${DIRSRC} &>/dev/null && ${CXX} ${CXXFLAGS} -c `basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_INC} -I${PAM_YODA}/include/yoda/ -I${NROOTINC};
166          @(${EGREEN} "Compiling shared library: "${WHITE} "$@"; ${RESET})  #
167          @${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ -lg2c -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_YODA}/include/yoda/ -I${PAM_INC} ${DIRTOP}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`.o 1>/dev/null  #       create .so
168    #
169            @(${EGREEN} "Compiling shared library: "${WHITE} "$@"; ${RESET})
170  ${CXXEXELIBS}: ${COBJS} ${FOBJS} ${CXXEXEOBJS}          @${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ $(LG2C) -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_YODA}/include/yoda -I${PAM_INC} ${DIRTOP}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`.o ${DIRTOP}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.o ${LIBROOTOBJS} `doc/cernlib_pam mathlib` 1>/dev/null      
171          @(${EVIOLET} "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *")  #       @ln -sf  ${DIRTOP}/${DIRLIB}/$(@F) ${DIRTOP}/${DIRLIB}/$(patsubst %_${VER}.so,%.so,$(@F))
172          @(${EGREEN} "Creating exec file: "${WHITE} "$@"; ${RESET})  
173          @${CXX} ${CXXFLAGS} -o ${DIRBIN}/$@ ${DIRLIB}/$@.o -I${DIRTOP}/${DIRINC} -I${PAM_INC} -I${PAM_YODA}/include/yoda/ ${PAM_YODA}/lib/libyoda.so ${FOBJS} ${COBJS} ${FULLLIBS} ${OTHERLIBS} -lThread `root-config --cflags --glibs` `cernlib mathlib` ;  ${LIBCPPLIBS}: ${LIBCPPSRCS}
174    #
175  # A small target to check environmental variables  #       create .o
176  %_env:  #
177          @${test_env}          @(${EGREEN} "Compiling file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`.cpp"; ${RESET})
178            @cd ${DIRSRC} &>/dev/null && ${CXX} ${CXXFLAGS} -c `basename $(@F) _${VER}.so | sed s/lib//`.cpp -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_YODA}/include/yoda/ -I${NROOTINC} -I${PAM_INC} ;
179  .PHONY: install installdoc installlib installmacros installinc installexe installcmacro  #
180  .PHONY: clean depclean info mkbindir mklibdir testcern testpamenv test  #       create .so
181    #
182  mkbindir: ${DIRBIN}          @(${EGREEN} "Compiling shared library: "${WHITE} "$@"; ${RESET})
183  ${DIRBIN}:          @${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ $(LG2C) -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_YODA}/include/yoda/ -I${PAM_INC} ${DIRTOP}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`.o 1>/dev/null
184          @${test_and_mk}  
185    
186  mklibdir: ${DIRLIB}  ${CXXEXELIBS}: ${COBJS} ${FOBJS} ${CXXEXEOBJS}
187  ${DIRLIB}:          @(${EVIOLET} "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *")
188          @${test_and_mk}          @(${EGREEN} "Creating exec file: "${WHITE} "$@"; ${RESET})
189            @${CXX} ${CXXFLAGS} -o ${DIRBIN}/$@ ${DIRLIB}/$@.o -I${DIRTOP}/${DIRINC} -I${PAM_INC} -I${PAM_YODA}/include/yoda/ ${PAM_YODA}/lib/libyoda.so ${FOBJS} ${COBJS} ${FULLLIBS} ${OTHERLIBS} -lThread `root-config --cflags --glibs` `doc/cernlib_pam mathlib` ;
190  # Here what has to be deleted in clean target  
191  clean: TOBEDEL= ${DIRSRC}/*.o ${DIRSRC}/*Dict.cpp ${DIRSRC}/*Dict.h ${FOBJS} ${FULLLIBS} ${DIRBIN}/${CXXEXELIBS} ${COBJS} ${CXXEXEOBJS} ${DIRSRC}/TrkVerl2.cpp  # A small target to check environmental variables
192  clean:  %_env:
193          @${test_and_rm}          @${test_env}
194    
195  distclean: clean  .PHONY: install installdoc installlib installmacros installinc installexe installcmacro
196  distclean: TOBEDEL= ${DIRBIN} ${DIRLIB}  .PHONY: clean depclean info mkbindir mklibdir testcern testpamenv test
197  distclean:  
198          @${test_and_rm}  mkbindir: ${DIRBIN}
199    ${DIRBIN}:
200  forceinstall: FORCE=-f          @${test_and_mk}
201  forceinstall: install  
202    mklibdir: ${DIRLIB}
203  upgrade: FORCE=-u  ${DIRLIB}:
204  upgrade: install          @${test_and_mk}
205    
206  install: installlib installinc installmacros installcalib installdoc installexe installcmacro  # Here what has to be deleted in clean target
207    clean: TOBEDEL= ${DIRSRC}/*.o ${DIRSRC}/*Dict.cpp ${DIRSRC}/*Dict.h ${FOBJS} ${FULLLIBS} ${DIRBIN}/${CXXEXELIBS} ${COBJS} ${CXXEXEOBJS}
208  installlib: LINK=y  clean:
209  installlib: TOBEMOVED= $(FULLLIBS:${DIRLIB}%=${PAM_LIB}%)          @${test_and_rm}
210  installlib: ORIGIN=${DIRLIB}  
211  installlib:  distclean: clean
212          @${test_and_cp}  distclean: TOBEDEL= ${DIRBIN} ${DIRLIB}
213    distclean:
214  installcmacro: LINK=y          @${test_and_rm}
215  installcmacro: TOBEMOVED= $(FULLMACROCLIBS:${DIRLIB}%=${PAM_LIB}%)  
216  installcmacro: ORIGIN=${DIRLIB}  forceinstall: FORCE=-f
217  installcmacro:  forceinstall: install
218          @${test_and_cp}  
219    upgrade: FORCE=-u
220  installinc: TOBEMOVED= $(INCSRCS:${DIRINC}/%=${PAM_INC}/%)  upgrade: install
221  installinc: ORIGIN=${DIRINC}  
222  installinc:  install: installlib installinc installmacros installcalib installdoc installexe installcmacro
223          @${test_and_cp}  
224    installlib: LINK=y
225  installexe: TOBEMOVED= $(EXESRCS:${DIRBIN}/%=${PAM_BIN}/%)  installlib: TOBEMOVED= $(FULLLIBS:${DIRLIB}%=${PAM_LIB}%)
226  installexe: ORIGIN=${DIRBIN}  installlib: ORIGIN=${DIRLIB}
227  installexe:  installlib:
228          @${test_and_cp}          @${test_and_cp}
229    
230  installmacros: TOBEMOVED= $(MACROSSRCS:${DIRMACROS}/%=${PAM_MACROS}/%)  installcmacro: LINK=y
231  installmacros: ORIGIN=${DIRMACROS}  installcmacro: TOBEMOVED= $(FULLMACROCLIBS:${DIRLIB}%=${PAM_LIB}%)
232  installmacros:  installcmacro: ORIGIN=${DIRLIB}
233          @${test_and_cp}  installcmacro:
234            @${test_and_cp}
235  installcalib: TOBEMOVED= $(CALIBFILES:${DIRCALIB}/%=${PAM_CALIB}/%)  
236  installcalib: ORIGIN=${DIRCALIB}  installinc: TOBEMOVED= $(INCSRCS:${DIRINC}/%=${PAM_INC}/%)
237  installcalib:  installinc: ORIGIN=${DIRINC}
238          @${test_and_cp}  installinc:
239            @${test_and_cp}
240  installdoc: TOBEMOVED= $(DOCFILES:${DIRDOC}/%=${PAM_DOC}/%)  
241  installdoc: ORIGIN=${DIRDOC}  installexe: TOBEMOVED= $(EXESRCS:${DIRBIN}/%=${PAM_BIN}/%)
242  installdoc:  installexe: ORIGIN=${DIRBIN}
243          @${test_and_cp}  installexe:
244            @${test_and_cp}
245  mkverpath:  
246          @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  installmacros: TOBEMOVED= $(MACROSSRCS:${DIRMACROS}/%=${PAM_MACROS}/%)
247          @sleep 0.8  installmacros: ORIGIN=${DIRMACROS}
248    installmacros:
249            @${test_and_cp}
250    
251  info:  installcalib: TOBEMOVED= $(CALIBFILES:${DIRCALIB}/%=${PAM_CALIB}/%)
252          @echo " "  installcalib: ORIGIN=${DIRCALIB}
253          @${EGREEN} "Infos for package :" ${WHITE} ${PACKAGE}  installcalib:
254          @${EGREEN} "          VERSION :" ${WHITE} ${VER}          @${test_and_cp}
255          @${EGREEN} "      EXECUTABLES :" ${WHITE} ${EXECUTABLES}  
256          @${EGREEN} "         INCLUDES :" ${WHITE} ${INCLUDE}  installdoc: TOBEMOVED= $(DOCFILES:${DIRDOC}/%=${PAM_DOC}/%)
257          @${EGREEN} "             LIBS :" ${WHITE} ${LIBS}  installdoc: ORIGIN=${DIRDOC}
258          @${EGREEN} "             DOCS :" ${WHITE} ${DOCS}  installdoc:
259          @${EGREEN} "             SRCS :" ${WHITE} ${SRCS}          @${test_and_cp}
260          @${EGREEN} "           MACROS :" ${WHITE} ${MACROS}  
261          @echo " "  #mkverpath:
262          @${RESET}  #       @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
263    #       @sleep 0.8
264  test: testpamenv  
265    
266  testpamenv: ${PAM_ENV}  
267    info:
268  root-config: OPT=--cflags          @echo " "
269  root-config:          @${EGREEN} "Infos for package :" ${WHITE} ${PACKAGE}
270          @${test_cmd}          @${EGREEN} "          VERSION :" ${WHITE} ${VER}
271            @${EGREEN} "      EXECUTABLES :" ${WHITE} ${EXECUTABLES}
272  # Here follows some usefull macros          @${EGREEN} "         INCLUDES :" ${WHITE} ${INCLUDE}
273  define  test_and_cp          @${EGREEN} "             LIBS :" ${WHITE} ${LIBS}
274  wd=`pwd`;\          @${EGREEN} "             DOCS :" ${WHITE} ${DOCS}
275  for i in ${TOBEMOVED} ; do \          @${EGREEN} "             SRCS :" ${WHITE} ${SRCS}
276  wv=$${i##/*/}; \          @${EGREEN} "           MACROS :" ${WHITE} ${MACROS}
277  dest=$${i/$${wv}/}; \          @echo " "
278  ${EGREEN} "Testing for :" ${WHITE} "$${i}" ; ${RESET}; \          @${RESET}
279  if [ ! "${FORCE}" ] ; then \  
280   if [ ! -f $${i} ]; then  \  test: testpamenv
281    ${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\  
282    ${EGREEN} "      to: "${WHITE} $${i} ; ${RESET}; \  testpamenv: ${PAM_ENV}
283    cp ${ORIGIN}/$${i##/*/} $${i}; \  
284   else \  root-config: OPT=--cflags
285     ${ERED} "File already exist !!!! Please delete it " ${WHITE}; ${RESET}; \  root-config:
286   fi;\          @${test_cmd}
287  else \  
288     if [ "${FORCE}" == "-u" ] ; then \  # Here follows some usefull macros
289       if [ "`basename $${i}`" != "`basename $${i} _${VER}.so`" ]; then \  define  test_and_cp
290         ${EYELLOW} "Removing: "${WHITE} ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so; ${RESET}; \  wd=`pwd`;\
291         rm -f ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so ; \  for i in ${TOBEMOVED} ; do \
292         ${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\  wv=$${i##/*/}; \
293         ${EGREEN} "      to: "${WHITE} $${i} ; ${RESET}; \  dest=$${i/$${wv}/}; \
294         cp ${ORIGIN}/$${i##/*/} $${i}; \  ${EGREEN} "Testing for :" ${WHITE} "$${i}" ; ${RESET}; \
295       else \  if [ ! "${FORCE}" ] ; then \
296         ${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\   if [ ! -f $${i} ]; then  \
297         ${EYELLOW} "          to: "${WHITE} $${i} ; ${RESET}; \    ${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\
298         cp -f ${ORIGIN}/$${i##/*/} $${i}; \    ${EGREEN} "      to: "${WHITE} $${i} ; ${RESET}; \
299       fi; \    cp ${ORIGIN}/$${i##/*/} $${i}; \
300     else \   else \
301       ${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\     ${ERED} "File already exist !!!! Please delete it " ${WHITE}; ${RESET}; \
302       ${EYELLOW} "          to: "${WHITE} $${i} ; ${RESET}; \   fi;\
303       cp ${FORCE} ${ORIGIN}/$${i##/*/} $${i}; \  else \
304     fi;\     if [ "${FORCE}" == "-u" ] ; then \
305  fi ;\       if [ "`basename $${i}`" != "`basename $${i} _${VER}.so`" ]; then \
306  if [ ! -z ${LINK} ] ; then \         ${EYELLOW} "Removing: "${WHITE} ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so; ${RESET}; \
307    ${EGREEN} "Creating symlink from : "${WHITE} $${wv/_${VER}/} ;\         rm -f ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so ; \
308    ${EGREEN} "                   to : "${WHITE} $${i##/*/} ; ${RESET}; \         ${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\
309    cd $${dest}; \         ${EGREEN} "      to: "${WHITE} $${i} ; ${RESET}; \
310    ln -sf $${wv} $${wv/_${VER}/}; \         cp ${ORIGIN}/$${i##/*/} $${i}; \
311    cd $${wd}; \       else \
312  fi \         ${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\
313  done         ${EYELLOW} "          to: "${WHITE} $${i} ; ${RESET}; \
314  endef         cp -f ${ORIGIN}/$${i##/*/} $${i}; \
315         fi; \
316  define  test_and_mk     else \
317  ${EGREEN} "Testing for :" ${WHITE} "$@"; ${RESET}       ${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\
318  test -d "$@" || \       ${EYELLOW} "          to: "${WHITE} $${i} ; ${RESET}; \
319  (${EGREEN} "Creating : "${WHITE} "$@"; ${RESET}; mkdir -p $@)       cp ${FORCE} ${ORIGIN}/$${i##/*/} $${i}; \
320  endef     fi;\
321    fi ;\
322  define  test_env  if [ ! -z ${LINK} ] ; then \
323  ${EGREEN} "Testing for env:" ${WHITE} $(patsubst %_env,%,$@); ${RESET}    ${EGREEN} "Creating symlink from : "${WHITE} $${wv/_${VER}/} ;\
324  printenv $(patsubst %_env,%,$@) 1>/dev/null || \    ${EGREEN} "                   to : "${WHITE} $${i##/*/} ; ${RESET}; \
325  (${ERED} "ERROR, variable : "${WHITE} $(patsubst %_env,%,$@) \    cd $${dest}; \
326  ${RED} "not defined !!! Check your env. settings"; \    ln -sf $${wv} $${wv/_${VER}/}; \
327  ${RESET}; exit 1)    cd $${wd}; \
328  ${EGREEN} " Defined:" ${WHITE} $${$(patsubst %_env,%,$@)}; ${RESET}  fi \
329  endef  done
330    endef
331  define  test_cmd  
332  ${EGREEN} "Testing for cmd:" ${WHITE} $@ ${OPT}; ${RESET}  define  test_and_mk
333  $@ ${OPT} 1>/dev/null 2>&1 || \  ${EGREEN} "Testing for :" ${WHITE} "$@"; ${RESET}
334  (${ERED} "ERROR, command : "${WHITE} $@ ${OPT}\  test -d "$@" || \
335  ${RED} "not found !!! Check your installation"; \  (${EGREEN} "Creating : "${WHITE} "$@"; ${RESET}; mkdir -p $@)
336  ${RESET}; exit 1)  endef
337  ${EGREEN} " Present:" ${WHITE} $@ ${OPT}; ${RESET}  
338  endef  define  test_env
339    ${EGREEN} "Testing for env:" ${WHITE} $(patsubst %_env,%,$@); ${RESET}
340  define  test_and_rm  printenv $(patsubst %_env,%,$@) 1>/dev/null || \
341  for i in ${TOBEDEL}; do \  (${ERED} "ERROR, variable : "${WHITE} $(patsubst %_env,%,$@) \
342  test -d $${i} || (${ERED} "Removing file :"${WHITE} $${i}; ${RESET}; \  ${RED} "not defined !!! Check your env. settings"; \
343  rm -f $${i} ); \  ${RESET}; exit 1)
344  test ! -d $${i} || (${ERED} "Removing dir :"${WHITE} $${i}; ${RESET}; \  ${EGREEN} " Defined:" ${WHITE} $${$(patsubst %_env,%,$@)}; ${RESET}
345  rm -rf $${i} ); \  endef
346  done  
347  endef  define  test_cmd
348    ${EGREEN} "Testing for cmd:" ${WHITE} $@ ${OPT}; ${RESET}
349    $@ ${OPT} 1>/dev/null 2>&1 || \
350    (${ERED} "ERROR, command : "${WHITE} $@ ${OPT}\
351    ${RED} "not found !!! Check your installation"; \
352    ${RESET}; exit 1)
353    ${EGREEN} " Present:" ${WHITE} $@ ${OPT}; ${RESET}
354    endef
355    
356    define  test_and_rm
357    for i in ${TOBEDEL}; do \
358    test -d $${i} || (${ERED} "Removing file :"${WHITE} $${i}; ${RESET}; \
359    rm -f $${i} ); \
360    test ! -d $${i} || (${ERED} "Removing dir :"${WHITE} $${i}; ${RESET}; \
361    rm -rf $${i} ); \
362    done
363    endef

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.34

  ViewVC Help
Powered by ViewVC 1.1.23