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