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

Contents of /DarthVader/S4Level2/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.22 - (show annotations) (download)
Tue Oct 14 14:07:26 2014 UTC (10 years, 1 month ago) by mocchiut
Branch: MAIN
CVS Tags: v10RED, v10REDr01, HEAD
Changes since 1.21: +1 -1 lines
Error occurred while calculating annotation data.
10RED: lost sync bug fixed

1 #S4 flight analysis software
2 # SOFTWARE VERSION
3 VER= v4r06
4 include ../Make.def
5 # Here the variables definig the local directories
6 DIRTOP=${shell pwd}
7 DIRLIB=../lib/${ARCH}
8 DIRBIN=../bin/${ARCH}
9 #DIRLIB=lib/${ARCH}
10 #DIRBIN=bin/${ARCH}
11 DIRSRC=src
12 DIRINC=inc
13 DIRDOC=doc
14 DIRMACROS=macros
15 DIRCALIB=calib
16 # Here the PAMELA environmental variables to be checked
17 PAM_ENV= PAM_BIN_env PAM_LIB_env PAM_INC_env PAM_DOC_env PAM_YODA_env
18
19 # Here the local variables used to build the targets
20 # -- F77 - no libraries --
21 FSRCS=
22 FOBJS=$(FSRCS:${DIRSRC}%.for=${DIRLIB}%.o)
23
24 # -- CPP - no libraries --
25 CPPSRCS=
26 CPPOBJS=$(CPPSRCS:${DIRSRC}%.cpp=${DIRLIB}%.o)
27
28 # -- C - no libraries --
29 CSRCS=
30 COBJS=$(CSRCS:${DIRSRC}%.c=${DIRLIB}%.o)
31
32 # -- CPP - ROOT libraries --
33 LIBROOTSRCS=${DIRSRC}/S4Level2.cpp
34
35 LIBROOTLIBS=$(LIBROOTSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so)
36 LIBROOTCLIBS=libS4Level2
37 FULLROOTCLIBS=$(LIBROOTCLIBS:%=${DIRLIB}/%_${VER}.so)
38
39 # -- CPP - NON-ROOT libraries --
40 LIBCPPSRCS= ${DIRSRC}/S4Core.cpp \
41 ${DIRSRC}/S4Verl2.cpp
42 LIBCPPLIBS=$(LIBCPPSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so)
43 LIBCPPCLIBS=libS4Core libS4Verl2
44 FULLLIBCPPLIBS=$(LIBCPPCLIBS:%=${DIRLIB}/%_${VER}.so)
45
46 # -- CPP - Executables --
47 CXXEXESRCS=${DIRSRC}/S4_LEVEL2.cpp
48 CXXEXEOBJS=$(CXXEXESRCS:${DIRSRC}%.cpp=${DIRLIB}%.o)
49 CXXEXELIBS:=S4_LEVEL2
50
51 # -- list of tracker objects needed to link
52 TRKOBJS=${PAM_LIB}/libGLTables.so ${DIRLIB}/libRunInfo.so
53 # -- directory where to find tracker headers needed to compile
54 SUBDIR=../RunInfo
55 SUBINC=$(shell for dir in `echo ${SUBDIR}`; do echo -I$${dir}/inc; done)
56 # List of all libraries we want to install
57 FULLLIBS = ${FULLROOTCLIBS} ${FULLLIBCPPLIBS}
58
59 # Other objects to install
60 EXESRCS=${DIRBIN}/S4_LEVEL2
61
62 INCSRCS=${DIRINC}/S4Level2.h ${DIRINC}/S4Struct.h
63
64 MACROSSRCS=
65
66 CALIBFILES=
67
68 DOCFILES=
69
70 # Here the Variables used for info target
71 PACKAGE=S4 analysis flight software
72 EXECUTABLES= ${EXESRCS}
73 LIBS= ${FULLLIBS}
74 DOCS=
75 SRCS=
76 #SRCS= ${FSRCS} ${CRSCS} ${CXXEXESRCS} ${LIBROOTSRCS} ${LIBCPPSRCS}
77 MACROS= ${MACROSSRCS}
78 INCLUDE= ${INCSRCS}
79 #
80 TOBEDEL = junk
81 ROOTINC=$$${shell root-config --incdir}
82 NROOTINC=${shell root-config --incdir}
83 # Let's start
84 #all: test mkbindir mklibdir mkverpath ${FOBJS} ${CPPOBJS} ${LIBROOTLIBS} ${LIBCPPLIBS} ${CXXEXELIBS}
85 all: prepare libs
86 all:
87 @echo -e ${GREEN} ""
88 @${RESET}
89
90 standalone: all exe
91
92 prepare: test mkbindir mklibdir mkverpath
93
94 exe: prepare ${CXXEXELIBS}
95
96 libs: prepare ${LIBROOTLIBS} ${LIBCPPLIBS}
97
98 include ../Make.dect
99
100 # A small target to check environmental variables
101 %_env:
102 @${test_env}
103
104 .PHONY: install installdoc installlib installmacros installinc installexe installcmacro
105 .PHONY: clean depclean info mkbindir mklibdir testcern testpamenv test
106
107 mkbindir: ${DIRBIN}
108 ${DIRBIN}:
109 @${test_and_mk}
110
111 mklibdir: ${DIRLIB}
112 ${DIRLIB}:
113 @${test_and_mk}
114
115 # Here what has to be deleted in clean target
116 clean: TOBEDEL= ${DIRSRC}/*.o ${DIRSRC}/*Dict.cpp ${DIRSRC}/*Dict.h ${FOBJS} ${FULLLIBS} ${DIRBIN}/${CXXEXELIBS} ${CPPOBJS} ${CXXEXEOBJS} ${FULLLINKCLIBS} ${FULLMACROCLIBS} ${FULLLINKMACROCLIBS} ${DIRSRC}/S4Verl2.cpp
117 clean:
118 @${test_and_rm}
119
120 distclean: clean
121 distclean: TOBEDEL= ${DIRBIN} ${DIRLIB}
122 distclean:
123 @${test_and_rm}
124
125
126 forceinstall: FORCE=-f
127 forceinstall: install
128
129 forceinstallstandalone: FORCE=-f
130 forceinstallstandalone: installstandalone
131
132 upgrade: FORCE=-u
133 upgrade: install
134
135 upgradestandalone: FORCE=-u
136 upgradestandalone: installstandalone
137
138 install: installlib installinc installmacros installcalib installdoc installcmacro
139
140 installstandalone: install installexe
141
142 installlib: LINK=y
143 installlib: TOBEMOVED= $(FULLLIBS:${DIRLIB}%=${PAM_LIB}%)
144 installlib: ORIGIN=${DIRLIB}
145 installlib:
146 @${test_and_cp}
147
148 installcmacro: LINK=y
149 installcmacro: TOBEMOVED= $(FULLMACROCLIBS:${DIRLIB}%=${PAM_LIB}%)
150 installcmacro: ORIGIN=${DIRLIB}
151 installcmacro:
152 @${test_and_cp}
153
154 installinc: TOBEMOVED= $(INCSRCS:${DIRINC}/%=${PAM_INC}/%)
155 installinc: ORIGIN=${DIRINC}
156 installinc:
157 @${test_and_cp}
158
159 installexe: TOBEMOVED= $(EXESRCS:${DIRBIN}/%=${PAM_BIN}/%)
160 installexe: ORIGIN=${DIRBIN}
161 installexe:
162 @${test_and_cp}
163
164 installmacros: TOBEMOVED= $(MACROSSRCS:${DIRMACROS}/%=${PAM_MACROS}/%)
165 installmacros: ORIGIN=${DIRMACROS}
166 installmacros:
167 @${test_and_cp}
168
169 installcalib: TOBEMOVED= $(CALIBFILES:${DIRCALIB}/%=${PAM_CALIB}/%)
170 installcalib: ORIGIN=${DIRCALIB}
171 installcalib:
172 @${test_and_cp}
173
174 installdoc: TOBEMOVED= $(DOCFILES:${DIRDOC}/%=${PAM_DOC}/%)
175 installdoc: ORIGIN=${DIRDOC}
176 installdoc:
177 @${test_and_cp}
178
179 mkverpath:
180 @echo '#include <TSystem.h>' > ${DIRTOP}/${DIRSRC}/S4Verl2.cpp; echo 'const char *S4Info(bool print){ if ( print ) printf("\nS4 Level2 flight package version: ${VER}\n\nCompiled on '${TODAY}' with: '${GCCVER}'\n\nOn: '${UNAMEA}'\n\n"); return("${VER}"); }' >> ${DIRTOP}/${DIRSRC}/S4Verl2.cpp
181 @sleep 0.8
182
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 cp -f ${ORIGIN}/$${i##/*/} $${i}; \
233 fi; \
234 else \
235 ${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\
236 ${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \
237 cp ${FORCE} ${ORIGIN}/$${i##/*/} $${i}; \
238 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

  ViewVC Help
Powered by ViewVC 1.1.23