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

Contents of /DarthVader/OrbitalInfo/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.32 - (show annotations) (download)
Fri Mar 28 20:47:14 2014 UTC (10 years, 8 months ago) by pam-mep
Branch: MAIN
Changes since 1.31: +4 -0 lines
new OrbitalInfo code

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

  ViewVC Help
Powered by ViewVC 1.1.23