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

Contents of /DarthVader/TriggerLevel2/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


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

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

  ViewVC Help
Powered by ViewVC 1.1.23