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

Annotation of /DarthVader/CalorimeterLevel2/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.44 - (hide annotations) (download)
Tue Aug 4 14:56:57 2009 UTC (15 years, 3 months ago) by mocchiut
Branch: MAIN
Changes since 1.43: +1 -1 lines
Compilation bugs fixed

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

  ViewVC Help
Powered by ViewVC 1.1.23