1 |
mocchiut |
1.1 |
# RunInfo software |
2 |
|
|
# SOFTWARE VERSION |
3 |
mocchiut |
1.16 |
VER= v2r02 |
4 |
mocchiut |
1.14 |
# |
5 |
|
|
include ../Make.def |
6 |
mocchiut |
1.1 |
# Here the variables definig the local directories |
7 |
|
|
DIRTOP=${shell pwd} |
8 |
|
|
DIRLIB=../lib/${ARCH} |
9 |
|
|
DIRBIN=../bin/${ARCH} |
10 |
|
|
DIRSRC=src |
11 |
|
|
DIRINC=inc |
12 |
|
|
DIRDOC=doc |
13 |
|
|
DIRMACROS=macros |
14 |
|
|
DIRCALIB=calib |
15 |
|
|
# Here the PAMELA environmental variables to be checked |
16 |
|
|
PAM_ENV= PAM_BIN_env PAM_LIB_env PAM_INC_env PAM_DOC_env |
17 |
|
|
# |
18 |
mocchiut |
1.4 |
SUBDIR= |
19 |
|
|
SUBINC=-I${PAM_YODA}/include/yoda/ -I${PAM_INC}/ |
20 |
|
|
#SUBINC=$(shell for dir in `echo ${SUBDIR}`; do echo -I$${dir}/inc; done) |
21 |
mocchiut |
1.1 |
|
22 |
|
|
# Here the local variables used to build the targets |
23 |
|
|
# -- F77 - no libraries -- |
24 |
|
|
FSRCS= |
25 |
|
|
FOBJS=$(FSRCS:${DIRSRC}%.for=${DIRLIB}%.o) |
26 |
|
|
|
27 |
|
|
# -- CPP - no libraries -- |
28 |
|
|
CPPSRCS=${DIRSRC}/RunInfoVerl2.cpp |
29 |
|
|
CPPOBJS=$(CPPSRCS:${DIRSRC}%.cpp=${DIRLIB}%.o) |
30 |
|
|
|
31 |
|
|
# -- C - no libraries -- |
32 |
|
|
CSRCS= |
33 |
|
|
COBJS=$(CSRCS:${DIRSRC}%.c=${DIRLIB}%.o) |
34 |
|
|
|
35 |
|
|
# -- CPP - ROOT libraries -- |
36 |
|
|
LIBROOTSRCS=${DIRSRC}/RunInfo.cpp |
37 |
|
|
LIBROOTLIBS=$(LIBROOTSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so) |
38 |
|
|
LIBROOTCLIBS=libRunInfo |
39 |
|
|
FULLROOTCLIBS=$(LIBROOTCLIBS:%=${DIRLIB}/%_${VER}.so) |
40 |
|
|
|
41 |
|
|
# -- CPP - NON-ROOT libraries -- |
42 |
|
|
#LIBCPPSRCS= |
43 |
|
|
LIBCPPSRCS=${DIRSRC}/RunInfoCore.cpp |
44 |
|
|
|
45 |
|
|
LIBCPPLIBS=$(LIBCPPSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so) |
46 |
|
|
LIBCPPCLIBS=libRunInfoCore |
47 |
|
|
#LIBCPPCLIBS= |
48 |
|
|
FULLLIBCPPLIBS=$(LIBCPPCLIBS:%=${DIRLIB}/%_${VER}.so) |
49 |
|
|
|
50 |
|
|
# -- CPP - Executables -- |
51 |
|
|
CXXEXESRCS=${DIRSRC}/RunInfoLevel2.cpp |
52 |
|
|
CXXEXEOBJS=$(CXXEXESRCS:${DIRSRC}%.cpp=${DIRLIB}%.o) |
53 |
|
|
CXXEXELIBS=RunInfoLevel2 |
54 |
|
|
|
55 |
|
|
# Other needed libraries |
56 |
mocchiut |
1.4 |
OTHOBJS = ${PAM_LIB}/libGLTables.so |
57 |
mocchiut |
1.1 |
|
58 |
|
|
# List of all libraries we want to install |
59 |
|
|
FULLLIBS = ${FULLROOTCLIBS} ${FULLLIBCPPLIBS} |
60 |
|
|
|
61 |
|
|
# Other objects to install |
62 |
mocchiut |
1.2 |
EXESRCS=${DIRBIN}/RunInfoLevel2 |
63 |
mocchiut |
1.1 |
|
64 |
pam-fi |
1.3 |
INCSRCS=${DIRINC}/RunInfo.h ${DIRINC}/RunInfoCore.h ${DIRINC}/RunInfoStruct.h |
65 |
mocchiut |
1.1 |
|
66 |
|
|
MACROSSRCS= |
67 |
|
|
|
68 |
|
|
CALIBFILES= |
69 |
|
|
|
70 |
|
|
DOCFILES= |
71 |
|
|
|
72 |
|
|
# Here the Variables used for info target |
73 |
|
|
PACKAGE=RunInfo flight software |
74 |
|
|
EXECUTABLES= ${EXESRCS} |
75 |
|
|
LIBS= ${FULLLIBS} |
76 |
|
|
DOCS= |
77 |
|
|
SRCS= |
78 |
|
|
#SRCS= ${FSRCS} ${CRSCS} ${CXXEXESRCS} ${LIBROOTSRCS} ${LIBCPPSRCS} |
79 |
|
|
MACROS= ${MACROSSRCS} |
80 |
|
|
INCLUDE= ${INCSRCS} |
81 |
|
|
# |
82 |
|
|
TOBEDEL = junk |
83 |
|
|
ROOTINC=$$${shell root-config --incdir} |
84 |
|
|
NROOTINC=${shell root-config --incdir} |
85 |
|
|
# Let's start |
86 |
|
|
#all: test mkbindir mklibdir ${FOBJS} ${CPPOBJS} ${LIBROOTLIBS} ${LIBCPPLIBS} ${CXXEXELIBS} |
87 |
|
|
all: prepare libs |
88 |
|
|
all: |
89 |
|
|
@echo -e ${GREEN} "" |
90 |
|
|
@${RESET} |
91 |
|
|
|
92 |
|
|
standalone: all exe |
93 |
|
|
|
94 |
|
|
prepare: test mkbindir mklibdir mkversion |
95 |
|
|
|
96 |
|
|
exe: prepare ${CXXEXELIBS} |
97 |
|
|
|
98 |
|
|
libs: prepare ${LIBROOTLIBS} ${LIBCPPLIBS} |
99 |
|
|
|
100 |
mocchiut |
1.14 |
include ../Make.dect |
101 |
mocchiut |
1.1 |
|
102 |
|
|
# A small target to check environmental variables |
103 |
|
|
%_env: |
104 |
|
|
@${test_env} |
105 |
|
|
|
106 |
|
|
.PHONY: install installdoc installlib installmacros installinc installexe installcmacro |
107 |
|
|
.PHONY: clean depclean info mkbindir mklibdir testcern testpamenv test |
108 |
|
|
|
109 |
|
|
mkbindir: ${DIRBIN} |
110 |
|
|
${DIRBIN}: |
111 |
|
|
@${test_and_mk} |
112 |
|
|
|
113 |
|
|
mklibdir: ${DIRLIB} |
114 |
|
|
${DIRLIB}: |
115 |
|
|
@${test_and_mk} |
116 |
|
|
|
117 |
|
|
# Here what has to be deleted in clean target |
118 |
|
|
clean: TOBEDEL= ${DIRSRC}/*.o ${DIRSRC}/*Dict.cpp ${DIRSRC}/*Dict.h ${FOBJS} ${FULLLIBS} ${DIRBIN}/${CXXEXELIBS} ${CPPOBJS} ${CXXEXEOBJS} ${FULLLINKCLIBS} ${FULLMACROCLIBS} ${FULLLINKMACROCLIBS} ${DIRSRC}/RunInfoVerl2.cpp |
119 |
|
|
clean: |
120 |
|
|
@${test_and_rm} |
121 |
|
|
|
122 |
|
|
distclean: clean |
123 |
|
|
distclean: TOBEDEL= ${DIRBIN} ${DIRLIB} |
124 |
|
|
distclean: |
125 |
|
|
@${test_and_rm} |
126 |
|
|
|
127 |
|
|
forceinstall: FORCE=-f |
128 |
|
|
forceinstall: install |
129 |
|
|
|
130 |
|
|
forceinstallstandalone: FORCE=-f |
131 |
|
|
forceinstallstandalone: installstandalone |
132 |
|
|
|
133 |
|
|
upgrade: FORCE=-u |
134 |
|
|
upgrade: install |
135 |
|
|
|
136 |
|
|
upgradestandalone: FORCE=-u |
137 |
|
|
upgradestandalone: installstandalone |
138 |
|
|
|
139 |
|
|
install: installlib installinc installmacros installcalib installdoc installcmacro |
140 |
|
|
|
141 |
|
|
installstandalone: install installexe |
142 |
|
|
|
143 |
|
|
installlib: LINK=y |
144 |
|
|
installlib: TOBEMOVED= $(FULLLIBS:${DIRLIB}%=${PAM_LIB}%) |
145 |
|
|
installlib: ORIGIN=${DIRLIB} |
146 |
|
|
installlib: |
147 |
|
|
@${test_and_cp} |
148 |
|
|
|
149 |
|
|
installcmacro: LINK=y |
150 |
|
|
installcmacro: TOBEMOVED= $(FULLMACROCLIBS:${DIRLIB}%=${PAM_LIB}%) |
151 |
|
|
installcmacro: ORIGIN=${DIRLIB} |
152 |
|
|
installcmacro: |
153 |
|
|
@${test_and_cp} |
154 |
|
|
|
155 |
|
|
installinc: TOBEMOVED= $(INCSRCS:${DIRINC}/%=${PAM_INC}/%) |
156 |
|
|
installinc: ORIGIN=${DIRINC} |
157 |
|
|
installinc: |
158 |
|
|
@${test_and_cp} |
159 |
|
|
|
160 |
|
|
installexe: TOBEMOVED= $(EXESRCS:${DIRBIN}/%=${PAM_BIN}/%) |
161 |
|
|
installexe: ORIGIN=${DIRBIN} |
162 |
|
|
installexe: |
163 |
|
|
@${test_and_cp} |
164 |
|
|
|
165 |
|
|
installmacros: TOBEMOVED= $(MACROSSRCS:${DIRMACROS}/%=${PAM_MACROS}/%) |
166 |
|
|
installmacros: ORIGIN=${DIRMACROS} |
167 |
|
|
installmacros: |
168 |
|
|
@${test_and_cp} |
169 |
|
|
|
170 |
|
|
installcalib: TOBEMOVED= $(CALIBFILES:${DIRCALIB}/%=${PAM_CALIB}/%) |
171 |
|
|
installcalib: ORIGIN=${DIRCALIB} |
172 |
|
|
installcalib: |
173 |
|
|
@${test_and_cp} |
174 |
|
|
|
175 |
|
|
installdoc: TOBEMOVED= $(DOCFILES:${DIRDOC}/%=${PAM_DOC}/%) |
176 |
|
|
installdoc: ORIGIN=${DIRDOC} |
177 |
|
|
installdoc: |
178 |
|
|
@${test_and_cp} |
179 |
|
|
|
180 |
|
|
mkversion: |
181 |
|
|
@echo '#include <TSystem.h>' > ${DIRTOP}/${DIRSRC}/RunInfoVerl2.cpp; echo ' char *RunInfoInfo(bool print){ if ( print ) printf("\nRunInfo package version: ${VER}\n\nCompiled on '${TODAY}' with: '${GCCVER}'\n\nOn: '${UNAMEA}'\n\n"); return("${VER}"); }' >> ${DIRTOP}/${DIRSRC}/RunInfoVerl2.cpp |
182 |
|
|
@sleep 0.8 |
183 |
|
|
|
184 |
|
|
|
185 |
|
|
info: |
186 |
|
|
@echo " " |
187 |
|
|
@${EGREEN} "Infos for package :" ${WHITE} ${PACKAGE} |
188 |
|
|
@${EGREEN} " VERSION :" ${WHITE} ${VER} |
189 |
|
|
@${EGREEN} " EXECUTABLES :" ${WHITE} ${EXECUTABLES} |
190 |
|
|
@${EGREEN} " LIBS :" ${WHITE} ${LIBS} |
191 |
|
|
@${EGREEN} " DOCS :" ${WHITE} ${DOCS} |
192 |
|
|
@${EGREEN} " SRCS :" ${WHITE} ${SRCS} |
193 |
|
|
@${EGREEN} " MACROS :" ${WHITE} ${MACROS} |
194 |
|
|
@${EGREEN} " INCLUDE :" ${WHITE} ${INCLUDE} |
195 |
|
|
@echo " " |
196 |
|
|
@${RESET} |
197 |
|
|
|
198 |
|
|
test: testpamenv |
199 |
|
|
|
200 |
|
|
testpamenv: ${PAM_ENV} |
201 |
|
|
|
202 |
|
|
root-config: OPT=--cflags |
203 |
|
|
root-config: |
204 |
|
|
@${test_cmd} |
205 |
|
|
|
206 |
|
|
# Here follows some usefull macros |
207 |
|
|
define test_and_cp |
208 |
|
|
wd=`pwd`;\ |
209 |
|
|
for i in ${TOBEMOVED} ; do \ |
210 |
|
|
wv=$${i##/*/}; \ |
211 |
|
|
dest=$${i/$${wv}/}; \ |
212 |
|
|
${EGREEN} "Testing for :" ${WHITE} "$${i}" ; ${RESET}; \ |
213 |
|
|
if [ ! "${FORCE}" ] ; then \ |
214 |
|
|
if [ ! -f $${i} ]; then \ |
215 |
|
|
${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
216 |
|
|
${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \ |
217 |
|
|
cp ${ORIGIN}/$${i##/*/} $${i}; \ |
218 |
|
|
else \ |
219 |
|
|
${ERED} "File already exist !!!! Please delete it " ${WHITE}; ${RESET}; \ |
220 |
|
|
fi;\ |
221 |
|
|
else \ |
222 |
|
|
if [ "${FORCE}" == "-u" ] ; then \ |
223 |
|
|
if [ "`basename $${i}`" != "`basename $${i} _${VER}.so`" ]; then \ |
224 |
|
|
${EYELLOW} "Removing: "${WHITE} ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so; ${RESET}; \ |
225 |
|
|
rm -f ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so ; \ |
226 |
|
|
${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
227 |
|
|
${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \ |
228 |
|
|
cp ${ORIGIN}/$${i##/*/} $${i}; \ |
229 |
|
|
else \ |
230 |
|
|
${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
231 |
|
|
${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \ |
232 |
mocchiut |
1.8 |
cp -rf ${ORIGIN}/$${i##/*/} $${i}; \ |
233 |
mocchiut |
1.1 |
fi; \ |
234 |
|
|
else \ |
235 |
|
|
${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
236 |
|
|
${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \ |
237 |
mocchiut |
1.8 |
cp -rf ${FORCE} ${ORIGIN}/$${i##/*/} $${i}; \ |
238 |
mocchiut |
1.1 |
fi;\ |
239 |
|
|
fi ;\ |
240 |
|
|
if [ ! -z ${LINK} ] ; then \ |
241 |
|
|
${EGREEN} "Creating symlink from : "${WHITE} $${wv/_${VER}/} ;\ |
242 |
|
|
${EGREEN} " to : "${WHITE} $${i##/*/} ; ${RESET}; \ |
243 |
|
|
cd $${dest}; \ |
244 |
|
|
ln -sf $${wv} $${wv/_${VER}/}; \ |
245 |
|
|
cd $${wd}; \ |
246 |
|
|
fi \ |
247 |
|
|
done |
248 |
|
|
endef |
249 |
|
|
|
250 |
|
|
define test_and_mk |
251 |
|
|
${EGREEN} "Testing for :" ${WHITE} "$@"; ${RESET} |
252 |
|
|
test -d "$@" || \ |
253 |
|
|
(${EGREEN} "Creating : "${WHITE} "$@"; ${RESET}; mkdir -p $@) |
254 |
|
|
endef |
255 |
|
|
|
256 |
|
|
define test_env |
257 |
|
|
${EGREEN} "Testing for env:" ${WHITE} $(patsubst %_env,%,$@); ${RESET} |
258 |
|
|
printenv $(patsubst %_env,%,$@) 1>/dev/null || \ |
259 |
|
|
(${ERED} "ERROR, variable : "${WHITE} $(patsubst %_env,%,$@) \ |
260 |
|
|
${RED} "not defined !!! Check your env. settings"; \ |
261 |
|
|
${RESET}; exit 1) |
262 |
|
|
${EGREEN} " Defined:" ${WHITE} $${$(patsubst %_env,%,$@)}; ${RESET} |
263 |
|
|
endef |
264 |
|
|
|
265 |
|
|
define test_cmd |
266 |
|
|
${EGREEN} "Testing for cmd:" ${WHITE} $@ ${OPT}; ${RESET} |
267 |
|
|
$@ ${OPT} 1>/dev/null 2>&1 || \ |
268 |
|
|
(${ERED} "ERROR, command : "${WHITE} $@ ${OPT}\ |
269 |
|
|
${RED} "not found !!! Check your installation"; \ |
270 |
|
|
${RESET}; exit 1) |
271 |
|
|
${EGREEN} " Present:" ${WHITE} $@ ${OPT}; ${RESET} |
272 |
|
|
endef |
273 |
|
|
|
274 |
|
|
define test_and_rm |
275 |
|
|
for i in ${TOBEDEL}; do \ |
276 |
|
|
test -d $${i} || (${ERED} "Removing file :"${WHITE} $${i}; ${RESET}; \ |
277 |
|
|
rm -f $${i} ); \ |
278 |
|
|
test ! -d $${i} || (${ERED} "Removing dir :"${WHITE} $${i}; ${RESET}; \ |
279 |
|
|
rm -rf $${i} ); \ |
280 |
|
|
done |
281 |
|
|
endef |