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

Annotation of /DarthVader/CalorimeterLevel2/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.56 - (hide annotations) (download)
Tue Oct 14 14:07:07 2014 UTC (10 years, 1 month ago) by mocchiut
Branch: MAIN
CVS Tags: v10RED, v10REDr01, HEAD
Changes since 1.55: +1 -1 lines
10RED: lost sync bug fixed

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

  ViewVC Help
Powered by ViewVC 1.1.23