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