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