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

Annotation of /DarthVader/ToFLevel2/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.25 - (hide annotations) (download)
Thu Aug 6 14:59:32 2009 UTC (15 years, 3 months ago) by pam-fi
Branch: MAIN
Changes since 1.24: +1 -1 lines
Some warning fixed.

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

  ViewVC Help
Powered by ViewVC 1.1.23