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