/[PAMELA software]/DarthVader/OrbitalInfo/Makefile
ViewVC logotype

Contents of /DarthVader/OrbitalInfo/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.26 - (show annotations) (download)
Thu Aug 6 14:59:28 2009 UTC (15 years, 3 months ago) by pam-fi
Branch: MAIN
CVS Tags: v9r00, v9r01
Changes since 1.25: +1 -1 lines
Some warning fixed.

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

  ViewVC Help
Powered by ViewVC 1.1.23