1 |
mocchiut |
1.1 |
# DarthVader flight analysis software |
2 |
mocchiut |
1.15 |
# SOFTWARE VERSION IS |
3 |
mocchiut |
1.12 |
VER= v2r00 |
4 |
mocchiut |
1.1 |
# An almost general purpouse Makefile for PAMELA repository |
5 |
|
|
# Let's start with some usefull definition for colorize the echo |
6 |
|
|
RED='\E[1;31;40m' |
7 |
|
|
GREEN='\E[1;32;40m' |
8 |
|
|
YELLOW='\E[1;33;40m' |
9 |
|
|
BLUE='\E[1;34;40m' |
10 |
|
|
WHITE='\E[1;37;40m' |
11 |
|
|
VIOLET='\E[1;35;40m' |
12 |
|
|
CYAN='\E[1;36;40m' |
13 |
|
|
# Here the echo definition to use them |
14 |
|
|
EVIOLET=echo -e ${VIOLET} |
15 |
|
|
ECYAN=echo -e ${CYAN} |
16 |
|
|
ERED=echo -e ${RED} |
17 |
|
|
EGREEN=echo -e ${GREEN} |
18 |
|
|
EYELLOW=echo -e ${YELLOW} |
19 |
|
|
EBLUE=echo -e ${BLUE} |
20 |
|
|
EWHITE=echo -e ${WHITE} |
21 |
|
|
# Reset the terminal |
22 |
|
|
RESET=tput sgr0 |
23 |
|
|
# Here the variables used to override the standard make flags |
24 |
|
|
#MAKE |
25 |
|
|
MAKE=make |
26 |
|
|
# C |
27 |
|
|
CC=gcc |
28 |
|
|
#CFLAGS=-Wall -O -fPIC -pthread -g |
29 |
|
|
CFLAGS=-Wall -O -fPIC -pthread |
30 |
|
|
# Enviroment: |
31 |
|
|
GCCVER=`gcc --version | head -1` |
32 |
|
|
UNAMEA=`uname -a` |
33 |
|
|
TODAY=`date` |
34 |
|
|
# F77 |
35 |
|
|
F77=g77 |
36 |
|
|
#F77FLAGS= -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -g -extend_source -static -fno-backslash |
37 |
|
|
F77FLAGS= -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -extend_source -static -fno-backslash |
38 |
|
|
# C++ |
39 |
|
|
CXX=g++ |
40 |
|
|
#CXXFLAGS=-Wall -O -fPIC -pthread -g |
41 |
|
|
CXXFLAGS=-Wall -O -fPIC -pthread |
42 |
|
|
# ROOTCINT |
43 |
|
|
ROOTCINT=rootcint |
44 |
|
|
# Here the variables definig the local directories |
45 |
|
|
DIRTOP=${shell pwd} |
46 |
|
|
#DIRLIB=../lib/${ARCH} |
47 |
|
|
#DIRBIN=../bin/${ARCH} |
48 |
|
|
DIRLIB=lib/${ARCH} |
49 |
|
|
DIRBIN=bin/${ARCH} |
50 |
|
|
DIRSRC=src |
51 |
|
|
DIRINC=inc |
52 |
|
|
DIRDOC=doc |
53 |
|
|
DIRMACROS=macros |
54 |
|
|
DIRCALIB=param |
55 |
|
|
# Here the PAMELA environmental variables to be checked |
56 |
|
|
PAM_ENV= PAM_BIN_env PAM_LIB_env PAM_INC_env PAM_DOC_env PAM_CALIB_env PAM_YODA_env |
57 |
|
|
|
58 |
|
|
# Here the local variables used to build the targets |
59 |
|
|
# -- F77 - no libraries -- |
60 |
|
|
FSRCS= |
61 |
|
|
FOBJS=$(FSRCS:${DIRSRC}%.for=${DIRLIB}%.o) |
62 |
|
|
|
63 |
|
|
# -- CPP - no libraries -- |
64 |
|
|
CPPSRCS=${DIRSRC}/DarthVaderVerl2.cpp |
65 |
|
|
CPPOBJS=$(CPPSRCS:${DIRSRC}%.cpp=${DIRLIB}%.o) |
66 |
|
|
|
67 |
|
|
# -- C - no libraries -- |
68 |
|
|
CSRCS= |
69 |
|
|
COBJS=$(CSRCS:${DIRSRC}%.c=${DIRLIB}%.o) |
70 |
|
|
|
71 |
|
|
# -- CPP - ROOT libraries -- |
72 |
|
|
LIBROOTSRCS= |
73 |
|
|
|
74 |
|
|
LIBROOTLIBS=$(LIBROOTSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so) |
75 |
|
|
LIBROOTCLIBS= |
76 |
|
|
FULLROOTCLIBS=$(LIBROOTCLIBS:%=${DIRLIB}/%_${VER}.so) |
77 |
|
|
|
78 |
|
|
# -- CPP - NON-ROOT libraries -- |
79 |
|
|
LIBCPPSRCS= |
80 |
|
|
LIBCPPLIBS=$(LIBCPPSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so) |
81 |
|
|
LIBCPPCLIBS= |
82 |
|
|
FULLLIBCPPLIBS=$(LIBCPPCLIBS:%=${DIRLIB}/%_${VER}.so) |
83 |
|
|
|
84 |
|
|
# -- CPP - Executables -- |
85 |
mocchiut |
1.18 |
CXXEXESRCS=${DIRSRC}/DarthVader.cpp |
86 |
mocchiut |
1.1 |
CXXEXEOBJS=$(CXXEXESRCS:${DIRSRC}%.cpp=${DIRLIB}%.o) |
87 |
mocchiut |
1.18 |
CXXEXELIBS:=DarthVader |
88 |
mocchiut |
1.1 |
|
89 |
mocchiut |
1.19 |
# -- list of objects needed to link |
90 |
|
|
##OBJS=$(shell cd ${DIRLIB}&>/dev/null;for file in `ls *.*`; do if [ $${file} != "" ] && [ $${file} != "DarthVader.o" ] && [ $${file} != "R2-D2.o" ]; then echo ${DIRLIB}/$${file}; fi; done) |
91 |
|
|
OBJS=$(shell cd ${DIRLIB}&>/dev/null;for file in `ls lib*.so`; do if [ $${file} != "" ]; then echo ${DIRLIB}/$${file}; fi; done) ${CPPOBJS} |
92 |
mocchiut |
1.8 |
DARTHVLIB=${DIRLIB}/libDarthVader_${VER}.so |
93 |
mocchiut |
1.1 |
|
94 |
|
|
# -- directory where to find tracker headers needed to compile |
95 |
|
|
#TRKHEAD=${DIRTOP}/../tracker/inc |
96 |
|
|
#TRKHEAD=-I${PAM_INC} -ITrackerLevel2/inc/ -IRunInfo/inc/ -IGLTables/inc/ |
97 |
|
|
|
98 |
|
|
# |
99 |
mocchiut |
1.11 |
SUBDIR=./RunInfo ./S4Level2 ./NDLevel2 ./TrackerLevel2 ./TriggerLevel2 ./ToFLevel2 ./CalorimeterLevel2 ./AnticounterLevel2 ./OrbitalInfo |
100 |
mocchiut |
1.1 |
SUBINC=$(shell for dir in `echo ${SUBDIR}`; do echo -I$${dir}/inc; done) |
101 |
|
|
|
102 |
|
|
# List of all libraries we want to install |
103 |
mocchiut |
1.8 |
FULLLIBS = ${FULLROOTCLIBS} ${FULLLIBCPPLIBS} ${DARTHVLIB} |
104 |
mocchiut |
1.1 |
|
105 |
|
|
# Other objects to install |
106 |
mocchiut |
1.18 |
EXESRCS=${DIRBIN}/DarthVader |
107 |
mocchiut |
1.1 |
|
108 |
|
|
INCSRCS= |
109 |
|
|
|
110 |
|
|
MACROSSRCS= |
111 |
|
|
|
112 |
|
|
CALIBFILES=${DIRCALIB}/trk-param ${DIRCALIB}/cal-param ${DIRCALIB}/tof-param |
113 |
|
|
|
114 |
|
|
DOCFILES= |
115 |
|
|
|
116 |
|
|
# Here the Variables used for info target |
117 |
|
|
PACKAGE=PAMELA analysis flight software |
118 |
|
|
EXECUTABLES= ${EXESRCS} |
119 |
|
|
LIBS= ${FULLLIBS} |
120 |
|
|
DOCS= |
121 |
|
|
SRCS= |
122 |
|
|
#SRCS= ${FSRCS} ${CRSCS} ${CXXEXESRCS} ${LIBROOTSRCS} ${LIBCPPSRCS} |
123 |
|
|
MACROS= ${MACROSSRCS} |
124 |
|
|
INCLUDE= ${INCSRCS} |
125 |
|
|
# |
126 |
|
|
TOBEDEL = junk |
127 |
|
|
ROOTINC=$$${shell root-config --incdir} |
128 |
|
|
NROOTINC=${shell root-config --incdir} |
129 |
|
|
# Directories where you place detectors software |
130 |
|
|
#SUBDIR=./GLTables ./RunInfo ./TrackerLevel2 ./CalorimeterLevel2 |
131 |
|
|
|
132 |
|
|
# Let's start |
133 |
|
|
#all: test mkbindir mklibdir mkverpath ${FOBJS} ${CPPOBJS} ${LIBROOTLIBS} ${LIBCPPLIBS} ${CXXEXELIBS} |
134 |
|
|
|
135 |
|
|
all: |
136 |
|
|
@for dir in `echo ${SUBDIR}`; do \ |
137 |
|
|
echo "Making all in $${dir}"; \ |
138 |
|
|
(cd $${dir} && ${MAKE} all); \ |
139 |
|
|
done; make locall |
140 |
|
|
|
141 |
|
|
locall: prepare libs exe |
142 |
|
|
locall: |
143 |
|
|
@echo -e ${GREEN} "" |
144 |
|
|
@(${EGREEN} " Finished, now you can install the package \n (use: make install or make upgrade or make forceinstall) "; ${RESET}) |
145 |
|
|
@echo -e ${GREEN} "" |
146 |
|
|
@${RESET} |
147 |
|
|
|
148 |
|
|
#subdir: |
149 |
|
|
# @for dir in `echo ${SUBDIR}`; do \ |
150 |
|
|
# echo "Making ${target} in $${dir}"; \ |
151 |
|
|
# (cd $${dir} && ${MAKE} ${target}); \ |
152 |
|
|
# done; |
153 |
|
|
|
154 |
|
|
prepare: test mkbindir mklibdir mkverpath |
155 |
|
|
|
156 |
|
|
exe: prepare ${CXXEXELIBS} |
157 |
|
|
|
158 |
|
|
libs: prepare ${LIBROOTLIBS} ${LIBCPPLIBS} |
159 |
|
|
|
160 |
|
|
# Here some general rules to produce objects in our local dir |
161 |
|
|
${DIRLIB}/%.o: ${DIRSRC}/%.cpp |
162 |
|
|
@(${EGREEN} "Creating CPP object file: "${WHITE} "`basename $@`"; ${RESET}) |
163 |
mocchiut |
1.11 |
@${CXX} ${CXXFLAGS} -c -o $@ ${DIRSRC}/`basename ${@} .o`.cpp -I${DIRINC} ${SUBINC} -I${PAM_YODA}/include/yoda/ -I${PAM_INC}/ `root-config --cflags` |
164 |
mocchiut |
1.1 |
|
165 |
|
|
${DIRLIB}/%.o: ${DIRSRC}/%.c |
166 |
|
|
@(${EGREEN} "Creating C object file: "${WHITE} "`basename $@`"; ${RESET}) |
167 |
mocchiut |
1.11 |
@${CXX} ${CXXFLAGS} -c -o $@ ${DIRSRC}/`basename ${@} .o`.c -I${DIRINC} -I${PAM_YODA}/include/yoda/ -I${PAM_INC}/ `root-config --cflags` |
168 |
mocchiut |
1.1 |
|
169 |
|
|
${DIRLIB}/%.o: ${DIRSRC}/%.for |
170 |
|
|
@(${EGREEN} "Creating F77 object file: "${WHITE} "`basename $@`"; ${RESET}) |
171 |
|
|
@${F77} ${F77FLAGS} -c -o $@ ${DIRSRC}/`basename ${@} .o`.for -I${DIRINC} |
172 |
|
|
|
173 |
|
|
${LIBROOTLIBS}: ${LIBROOTSRCS} |
174 |
|
|
@(${EGREEN} "ROOTCINT - creating file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp"; ${RESET}) |
175 |
|
|
# |
176 |
|
|
# Create *Dict.cpp and *Dict.h |
177 |
|
|
# |
178 |
mocchiut |
1.11 |
@${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 |
179 |
mocchiut |
1.1 |
# |
180 |
|
|
# create .o |
181 |
|
|
# |
182 |
|
|
@(${EGREEN} "Compiling CPP file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`.cpp"; ${RESET}) |
183 |
mocchiut |
1.11 |
@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${PAM_INC}/ -I${NROOTINC}; |
184 |
mocchiut |
1.1 |
@(${EGREEN} "Compiling CPP file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp"; ${RESET}) |
185 |
mocchiut |
1.11 |
@cd ${DIRSRC} &>/dev/null && ${CXX} ${CXXFLAGS} -c `basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_YODA}/include/yoda/ -I${PAM_INC}/ -I${NROOTINC}; |
186 |
mocchiut |
1.1 |
# |
187 |
|
|
# create .so |
188 |
|
|
# |
189 |
|
|
@(${EGREEN} "Creating shared library: "${WHITE} "`basename $@`"; ${RESET}) |
190 |
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}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`.o ${DIRTOP}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.o 1>/dev/null |
191 |
mocchiut |
1.1 |
@ln -sf ${DIRTOP}/${DIRLIB}/$(@F) ${DIRTOP}/${DIRLIB}/$(patsubst %_${VER}.so,%.so,$(@F)) |
192 |
|
|
|
193 |
|
|
${LIBCPPLIBS}: ${LIBSRCS} ${COBJS} ${FOBJS} |
194 |
|
|
# |
195 |
|
|
# create .o |
196 |
|
|
# |
197 |
|
|
@(${EGREEN} "Compiling CPP file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`.cpp"; ${RESET}) |
198 |
mocchiut |
1.11 |
@cd ${DIRSRC} &>/dev/null && ${CXX} ${CXXFLAGS} -c `basename $(@F) _${VER}.so | sed s/lib//`.cpp -I${DIRTOP}/${DIRINC} -I${DIRTOP} ${SUBINC} -I${PAM_YODA}/include/yoda/ -I${PAM_INC}/ -I${NROOTINC}; |
199 |
mocchiut |
1.1 |
# |
200 |
|
|
# create .so |
201 |
|
|
# |
202 |
|
|
@(${EGREEN} "Creating shared library: "${WHITE} "`basename $@`"; ${RESET}) |
203 |
mocchiut |
1.11 |
@${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ -lg2c -I${DIRTOP}/${DIRINC} -I${DIRTOP} ${SUBINC} -I${PAM_YODA}/include/yoda/ -I${PAM_INC}/ ${DIRTOP}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`.o ${FOBJS} ${COBJS} 1>/dev/null |
204 |
mocchiut |
1.1 |
@ln -sf ${DIRTOP}/${DIRLIB}/$(@F) ${DIRTOP}/${DIRLIB}/$(patsubst %_${VER}.so,%.so,$(@F)) |
205 |
|
|
|
206 |
|
|
${CXXEXELIBS}: ${CPPOBJS} ${COBJS} ${CXXEXEOBJS} |
207 |
mocchiut |
1.19 |
@(${EGREEN} "Creating exec file: "${WHITE} "$@"; ${RESET}) |
208 |
|
|
@${CXX} ${CXXFLAGS} -o ${DIRBIN}/$@ ${DIRTOP}/${DIRLIB}/$@.o ${OBJS} ${PAM_LIB}/libGLTables.so ${PAM_LIB}/libsgp4.so ${PAM_YODA}/lib/libyoda.so ${PAM_LIB}/libshift.so -lThread `root-config --cflags --glibs` `cernlib_noshift mathlib` |
209 |
mocchiut |
1.17 |
@${CXX} ${CXXFLAGS} -Xlinker -soname=libDarthVader_${VER}.so -shared -o ${DIRTOP}/${DIRLIB}/libDarthVader_${VER}.so -lg2c ${DIRTOP}/${DIRLIB}/libAcLevel2.so ${DIRTOP}/${DIRLIB}/libCaloLevel2.so ${PAM_LIB}/libsgp4.so ${DIRTOP}/${DIRLIB}/libNDLevel2.so ${DIRTOP}/${DIRLIB}/libS4Level2.so ${DIRTOP}/${DIRLIB}/libToFLevel2.so ${DIRTOP}/${DIRLIB}/libTrigLevel2.so ${DIRTOP}/${DIRLIB}/libTrkLevel2.so ${DIRTOP}/${DIRLIB}/libTrkLevel1.so ${PAM_LIB}/libGLTables.so ${DIRTOP}/${DIRLIB}/libRunInfo.so ${DIRTOP}/${DIRLIB}/libOrbitalInfo.so |
210 |
mocchiut |
1.8 |
# @${CXX} ${CXXFLAGS} -o ${DIRBIN}/$@ ${DIRTOP}/${DIRLIB}/$@.o ${OBJS} ${PAM_YODA}/lib/libyoda.so ${PAM_YODA}/lib/libutils.so -lThread `root-config --cflags --glibs` `cernlib mathlib` |
211 |
mocchiut |
1.1 |
|
212 |
|
|
# A small target to check environmental variables |
213 |
|
|
%_env: |
214 |
|
|
@${test_env} |
215 |
|
|
|
216 |
|
|
.PHONY: install installdoc installlib installmacros installinc installexe installcmacro |
217 |
|
|
.PHONY: clean depclean info mkbindir mklibdir testcern testpamenv test |
218 |
|
|
|
219 |
|
|
mkbindir: ${DIRBIN} |
220 |
|
|
${DIRBIN}: |
221 |
|
|
@${test_and_mk} |
222 |
|
|
|
223 |
|
|
mklibdir: ${DIRLIB} |
224 |
|
|
${DIRLIB}: |
225 |
|
|
@${test_and_mk} |
226 |
|
|
|
227 |
|
|
# Here what has to be deleted in clean target |
228 |
|
|
clean: |
229 |
|
|
@for dir in `echo ${SUBDIR}`; do \ |
230 |
|
|
echo "Making clean in $${dir}"; \ |
231 |
|
|
(cd $${dir} && ${MAKE} clean); \ |
232 |
|
|
done; make locclean |
233 |
|
|
|
234 |
|
|
locclean: TOBEDEL= ${DIRSRC}/*.o ${DIRSRC}/*Dict.cpp ${DIRSRC}/*Dict.h ${FOBJS} ${FULLLIBS} ${DIRBIN}/${CXXEXELIBS} ${CPPOBJS} ${CXXEXEOBJS} ${FULLLINKCLIBS} ${FULLMACROCLIBS} ${FULLLINKMACROCLIBS} ${DIRSRC}/DarthVaderVerl2.cpp |
235 |
|
|
locclean: |
236 |
|
|
@${test_and_rm} |
237 |
|
|
|
238 |
|
|
distclean: |
239 |
|
|
@for dir in `echo ${SUBDIR}`; do \ |
240 |
|
|
echo "Making distclean in $${dir}"; \ |
241 |
|
|
(cd $${dir} && ${MAKE} distclean); \ |
242 |
|
|
done; make locdistclean |
243 |
|
|
|
244 |
|
|
locdistclean: clean |
245 |
|
|
locdistclean: TOBEDEL= ${DIRBIN} ${DIRLIB} |
246 |
|
|
locdistclean: |
247 |
|
|
@${test_and_rm} |
248 |
|
|
|
249 |
|
|
|
250 |
|
|
forceinstall: |
251 |
|
|
@for dir in `echo ${SUBDIR}`; do \ |
252 |
|
|
echo "Making forceinstall in $${dir}"; \ |
253 |
|
|
(cd $${dir} && ${MAKE} forceinstall); \ |
254 |
|
|
done; make locforceinstall |
255 |
|
|
|
256 |
|
|
locforceinstall: FORCE=-f |
257 |
|
|
locforceinstall: install |
258 |
|
|
|
259 |
|
|
upgrade: |
260 |
|
|
@for dir in `echo ${SUBDIR}`; do \ |
261 |
|
|
echo "Making upgrade in $${dir}"; \ |
262 |
|
|
(cd $${dir} && ${MAKE} upgrade); \ |
263 |
|
|
done; make locupgrade |
264 |
|
|
|
265 |
|
|
locupgrade: FORCE=-u |
266 |
|
|
locupgrade: locinstall |
267 |
|
|
|
268 |
|
|
install: |
269 |
|
|
@for dir in `echo ${SUBDIR}`; do \ |
270 |
|
|
echo "Making install in $${dir}"; \ |
271 |
|
|
(cd $${dir} && ${MAKE} install); \ |
272 |
|
|
done; make locinstall |
273 |
|
|
|
274 |
|
|
locinstall: installlib installinc installmacros installcalib installdoc installexe installcmacro |
275 |
|
|
|
276 |
|
|
installlib: LINK=y |
277 |
|
|
installlib: TOBEMOVED= $(FULLLIBS:${DIRLIB}%=${PAM_LIB}%) |
278 |
|
|
installlib: ORIGIN=${DIRLIB} |
279 |
|
|
installlib: |
280 |
|
|
@${test_and_cp} |
281 |
|
|
|
282 |
|
|
installcmacro: LINK=y |
283 |
|
|
installcmacro: TOBEMOVED= $(FULLMACROCLIBS:${DIRLIB}%=${PAM_LIB}%) |
284 |
|
|
installcmacro: ORIGIN=${DIRLIB} |
285 |
|
|
installcmacro: |
286 |
|
|
@${test_and_cp} |
287 |
|
|
|
288 |
|
|
installinc: TOBEMOVED= $(INCSRCS:${DIRINC}/%=${PAM_INC}/%) |
289 |
|
|
installinc: ORIGIN=${DIRINC} |
290 |
|
|
installinc: |
291 |
|
|
@${test_and_cp} |
292 |
|
|
|
293 |
|
|
installexe: TOBEMOVED= $(EXESRCS:${DIRBIN}/%=${PAM_BIN}/%) |
294 |
|
|
installexe: ORIGIN=${DIRBIN} |
295 |
|
|
installexe: |
296 |
|
|
@${test_and_cp} |
297 |
|
|
|
298 |
|
|
installmacros: TOBEMOVED= $(MACROSSRCS:${DIRMACROS}/%=${PAM_MACROS}/%) |
299 |
|
|
installmacros: ORIGIN=${DIRMACROS} |
300 |
|
|
installmacros: |
301 |
|
|
@${test_and_cp} |
302 |
|
|
|
303 |
|
|
installcalib: TOBEMOVED= $(CALIBFILES:${DIRCALIB}/%=${PAM_CALIB}/%) |
304 |
|
|
installcalib: ORIGIN=${DIRCALIB} |
305 |
|
|
installcalib: |
306 |
|
|
@${cp_dir} |
307 |
|
|
|
308 |
|
|
installdoc: TOBEMOVED= $(DOCFILES:${DIRDOC}/%=${PAM_DOC}/%) |
309 |
|
|
installdoc: ORIGIN=${DIRDOC} |
310 |
|
|
installdoc: |
311 |
|
|
@${test_and_cp} |
312 |
|
|
|
313 |
|
|
mkverpath: |
314 |
|
|
@echo '#include <TSystem.h>' > ${DIRTOP}/${DIRSRC}/DarthVaderVerl2.cpp; echo ' char *DarthVaderInfo(bool print){ if ( print ) printf("\nPAMELA Level2 flight package version: ${VER}\n\nCompiled on '${TODAY}' with: '${GCCVER}'\n\nOn: '${UNAMEA}'\n\n"); return("${VER}"); }' >> ${DIRTOP}/${DIRSRC}/DarthVaderVerl2.cpp |
315 |
|
|
@sleep 0.8 |
316 |
|
|
|
317 |
|
|
|
318 |
|
|
|
319 |
|
|
info: |
320 |
|
|
@echo " " |
321 |
|
|
@${EGREEN} "Infos for package :" ${WHITE} ${PACKAGE} |
322 |
|
|
@${EGREEN} " VERSION :" ${WHITE} ${VER} |
323 |
|
|
@${EGREEN} " EXECUTABLES :" ${WHITE} ${EXECUTABLES} |
324 |
|
|
@${EGREEN} " LIBS :" ${WHITE} ${LIBS} |
325 |
|
|
@${EGREEN} " DOCS :" ${WHITE} ${DOCS} |
326 |
|
|
@${EGREEN} " SRCS :" ${WHITE} ${SRCS} |
327 |
|
|
@${EGREEN} " MACROS :" ${WHITE} ${MACROS} |
328 |
|
|
@${EGREEN} " INCLUDE :" ${WHITE} ${INCLUDE} |
329 |
|
|
@echo " " |
330 |
|
|
@${RESET} |
331 |
|
|
|
332 |
|
|
test: testpamenv |
333 |
|
|
|
334 |
|
|
testpamenv: ${PAM_ENV} |
335 |
|
|
|
336 |
|
|
root-config: OPT=--cflags |
337 |
|
|
root-config: |
338 |
|
|
@${test_cmd} |
339 |
|
|
|
340 |
|
|
# Here follows some usefull macros |
341 |
|
|
define test_and_cp |
342 |
|
|
wd=`pwd`;\ |
343 |
|
|
for i in ${TOBEMOVED} ; do \ |
344 |
|
|
wv=$${i##/*/}; \ |
345 |
|
|
dest=$${i/$${wv}/}; \ |
346 |
|
|
${EGREEN} "Testing for :" ${WHITE} "$${i}" ; ${RESET}; \ |
347 |
|
|
if [ ! "${FORCE}" ] ; then \ |
348 |
|
|
if [ ! -f $${i} ]; then \ |
349 |
|
|
${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
350 |
|
|
${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \ |
351 |
|
|
cp ${ORIGIN}/$${i##/*/} $${i}; \ |
352 |
|
|
else \ |
353 |
|
|
${ERED} "File already exist !!!! Please delete it " ${WHITE}; ${RESET}; \ |
354 |
|
|
fi;\ |
355 |
|
|
else \ |
356 |
|
|
if [ "${FORCE}" == "-u" ] ; then \ |
357 |
|
|
if [ "`basename $${i}`" != "`basename $${i} _${VER}.so`" ]; then \ |
358 |
|
|
${EYELLOW} "Removing: "${WHITE} ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so; ${RESET}; \ |
359 |
|
|
rm -f ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so ; \ |
360 |
|
|
${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
361 |
|
|
${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \ |
362 |
|
|
cp ${ORIGIN}/$${i##/*/} $${i}; \ |
363 |
|
|
else \ |
364 |
|
|
${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
365 |
|
|
${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \ |
366 |
|
|
cp -f ${ORIGIN}/$${i##/*/} $${i}; \ |
367 |
|
|
fi; \ |
368 |
|
|
else \ |
369 |
|
|
${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
370 |
|
|
${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \ |
371 |
|
|
cp ${FORCE} ${ORIGIN}/$${i##/*/} $${i}; \ |
372 |
|
|
fi;\ |
373 |
|
|
fi ;\ |
374 |
|
|
if [ ! -z ${LINK} ] ; then \ |
375 |
|
|
${EGREEN} "Creating symlink from : "${WHITE} $${wv/_${VER}/} ;\ |
376 |
|
|
${EGREEN} " to : "${WHITE} $${i##/*/} ; ${RESET}; \ |
377 |
|
|
cd $${dest}; \ |
378 |
|
|
ln -sf $${wv} $${wv/_${VER}/}; \ |
379 |
|
|
cd $${wd}; \ |
380 |
|
|
fi \ |
381 |
|
|
done |
382 |
|
|
endef |
383 |
|
|
|
384 |
|
|
define cp_dir |
385 |
|
|
wd=`pwd`;\ |
386 |
|
|
for i in ${TOBEMOVED} ; do \ |
387 |
|
|
wv=$${i##/*/}; \ |
388 |
|
|
dest=$${i/$${wv}/}; \ |
389 |
|
|
${EYELLOW} " Copying directory: "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
390 |
mocchiut |
1.3 |
${EYELLOW} " to: "${WHITE} ${PAM_CALIB} ; ${RESET}; \ |
391 |
|
|
cp -rf ${ORIGIN}/$${i##/*/} ${PAM_CALIB}; \ |
392 |
mocchiut |
1.1 |
done |
393 |
|
|
endef |
394 |
|
|
|
395 |
|
|
define test_and_mk |
396 |
|
|
${EGREEN} "Testing for :" ${WHITE} "$@"; ${RESET} |
397 |
|
|
test -d "$@" || \ |
398 |
|
|
(${EGREEN} "Creating : "${WHITE} "$@"; ${RESET}; mkdir -p $@) |
399 |
|
|
endef |
400 |
|
|
|
401 |
|
|
define test_env |
402 |
|
|
${EGREEN} "Testing for env:" ${WHITE} $(patsubst %_env,%,$@); ${RESET} |
403 |
|
|
printenv $(patsubst %_env,%,$@) 1>/dev/null || \ |
404 |
|
|
(${ERED} "ERROR, variable : "${WHITE} $(patsubst %_env,%,$@) \ |
405 |
|
|
${RED} "not defined !!! Check your env. settings"; \ |
406 |
|
|
${RESET}; exit 1) |
407 |
|
|
${EGREEN} " Defined:" ${WHITE} $${$(patsubst %_env,%,$@)}; ${RESET} |
408 |
|
|
endef |
409 |
|
|
|
410 |
|
|
define test_cmd |
411 |
|
|
${EGREEN} "Testing for cmd:" ${WHITE} $@ ${OPT}; ${RESET} |
412 |
|
|
$@ ${OPT} 1>/dev/null 2>&1 || \ |
413 |
|
|
(${ERED} "ERROR, command : "${WHITE} $@ ${OPT}\ |
414 |
|
|
${RED} "not found !!! Check your installation"; \ |
415 |
|
|
${RESET}; exit 1) |
416 |
|
|
${EGREEN} " Present:" ${WHITE} $@ ${OPT}; ${RESET} |
417 |
|
|
endef |
418 |
|
|
|
419 |
|
|
define test_and_rm |
420 |
|
|
for i in ${TOBEDEL}; do \ |
421 |
|
|
test -d $${i} || (${ERED} "Removing file :"${WHITE} $${i}; ${RESET}; \ |
422 |
|
|
rm -f $${i} ); \ |
423 |
|
|
test ! -d $${i} || (${ERED} "Removing dir :"${WHITE} $${i}; ${RESET}; \ |
424 |
|
|
rm -rf $${i} ); \ |
425 |
|
|
done |
426 |
|
|
endef |