/[PAMELA software]/quicklook/calo/FQLOOK/Makefile
ViewVC logotype

Annotation of /quicklook/calo/FQLOOK/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.29 - (hide annotations) (download)
Fri Jan 17 15:10:28 2014 UTC (10 years, 10 months ago) by mocchiut
Branch: MAIN
CVS Tags: HEAD
Changes since 1.28: +1 -1 lines
Compilation warnings using GCC4.7 fixed

1 mocchiut 1.1 # Flight quick look - FQLOOK
2     # SOFTWARE VERSION
3 mocchiut 1.29 VER= v1r25
4 mocchiut 1.1 # An almost general purpouse Makefile for PAMELA repository
5     # Let's start with some usefull definition for colorize the echo
6     RED='\E[1;31;40m'
7     GREEN='\E[1;32;40m'
8     YELLOW='\E[1;33;40m'
9     BLUE='\E[1;34;40m'
10     WHITE='\E[1;37;40m'
11     VIOLET='\E[1;35;40m'
12     CYAN='\E[1;36;40m'
13     # Here the echo definition to use them
14     EVIOLET=echo -e ${VIOLET}
15     ECYAN=echo -e ${CYAN}
16     ERED=echo -e ${RED}
17     EGREEN=echo -e ${GREEN}
18     EYELLOW=echo -e ${YELLOW}
19     EBLUE=echo -e ${BLUE}
20     EWHITE=echo -e ${WHITE}
21     # Reset the terminal
22     RESET=tput sgr0
23     # Here the variables used to override the standard make flags
24     # C
25     CC=gcc
26 mocchiut 1.26 CFLAGS=-Wall -O4 -fPIC -pthread ${PAM_BIT}
27 mocchiut 1.1 # Enviroment:
28     GCCVER=`gcc --version | head -1`
29     UNAMEA=`uname -a`
30     TODAY=`date`
31     # F77
32 mocchiut 1.27 ifeq ($(GCC4),)
33     export GCCVERS=$(shell echo `gcc -dumpversion | sed 's/\./\ /g'`)
34     export GCCVERMAJ=$(word 1,$(GCCVERS))
35     export GCC4=$(shell echo `echo "${GCCVERMAJ} > 3" |bc -l`)
36     endif
37     ifeq ($(GCC4),1)
38     F77=gfortran
39     LG2C=-lgfortran
40     EXTRAOPT=
41     else
42 mocchiut 1.1 F77=g77
43 mocchiut 1.27 LG2C=-lg2c
44     EXTRAOPT=-Wno-globals -fvxt
45     endif
46     #F77FLAGS= -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -g -extend_source -static -fno-backslash ${PAM_BIT}
47     F77FLAGS= -Wall -funroll-loops -fPIC $(EXTRAOPT) -fno-automatic -fbounds-check -extend_source -static -fno-backslash ${PAM_BIT}
48 mocchiut 1.1 # C++
49     CXX=g++
50 mocchiut 1.26 CXXFLAGS=-Wall -O4 -fPIC -pthread ${PAM_BIT}
51 mocchiut 1.1 # ROOTCINT
52     ROOTCINT=rootcint
53     # Here the variables definig the local directories
54     DIRTOP=${shell pwd}
55     DIRLIB=lib/${ARCH}
56     DIRBIN=bin/${ARCH}
57     DIRSRC=src
58     DIRINC=inc
59     DIRDOC=doc
60     DIRMACROS=macros
61     DIRCALIB=calib
62     # Here the PAMELA environmental variables to be checked
63     PAM_ENV= PAM_BIN_env PAM_LIB_env PAM_INC_env PAM_DOC_env PAM_MACROS_env PAM_CALIB_env PAM_YODA_env
64     # Here the local variables used to build the targets
65    
66     MACROSRCS=${DIRMACROS}/FCaloQLOOK.cxx \
67     ${DIRMACROS}/FCaloCHKCALIB.cxx
68 mocchiut 1.4 MACROSLIBS=$(MACROSRCS:${DIRMACROS}/%.cxx=${DIRLIB}/lib%_${VER}.so)
69     MACROCLIBS=libFCaloQLOOK libFCaloCHKCALIB
70 mocchiut 1.1 FULLMACROCLIBS=$(MACROCLIBS:%=${DIRLIB}/%_${VER}.so)
71     FULLLINKMACROCLIBS=$(MACROCLIBS:%=${DIRLIB}/%.so)
72    
73     CXXEXESRCS=${DIRSRC}/FCaloQLOOK.cc ${DIRSRC}/FCaloCHKCALIB.cc
74     CXXEXEOBJS=$(CXXEXESRCS:${DIRSRC}%.cc=${DIRBIN}%.o)
75     CXXEXELIBS:=FCaloQLOOK FCaloCHKCALIB
76    
77     EXESRCS= ${DIRBIN}/FCaloQLOOK ${DIRBIN}/FCaloCHKCALIB
78    
79     INCSRCS=
80    
81     MACROSSRCS=${DIRMACROS}/FCaloQLOOK.C ${DIRMACROS}/FCaloCHKCALIB.C
82    
83     CALIBFILES=
84    
85 mocchiut 1.5 DOCFILES=${DIRDOC}/fcaloQLOOK.README.pdf ${DIRDOC}/FQL-calo-opmanual.pdf ${DIRDOC}/FQL-calo-opmanual.doc
86 mocchiut 1.1
87     # Here the Variables used for info target
88     PACKAGE=Calorimeter flight quick look software
89     EXECUTABLES=
90     LIBS= ${FLIBS} ${FOBJS} ${CLIBS} ${COBJS} ${CXXEXEOBJS}
91     DOCS=
92     SRCS= ${FSRCS} ${CRSCS} ${CXXEXESRCS}
93     MACROS= ${MACROSSRCS}
94     #
95     TOBEDEL = junk
96     ROOTINC=$$${shell root-config --incdir}
97     # Let's start
98     all : test mkbindir mklibdir ${MACROSLIBS} ${CXXEXELIBS}
99     all:
100     @echo -e ${GREEN} ""
101     @(${EGREEN} " Finished, now you can install the package \n (use: make install or make upgrade or make forceinstall) "; ${RESET})
102     @echo -e ${GREEN} ""
103     @${RESET}
104    
105     # Here some general rules to produce objects in our local dir
106     ${DIRBIN}/%.o: ${DIRSRC}/%.cc
107     @(${EGREEN} "Creating object file: "${WHITE} "$@"; ${RESET})
108     @cat ${DIRSRC}/`basename ${@} .o`.cc > ${DIRSRC}/temp.cc;
109     @echo ' ' >> ${DIRSRC}/temp.cc
110     @echo 'void info(){ printf("\nQLOOK flight package version: ${VER}\n\nCompiled on '${TODAY}' with: '${GCCVER}'\n\nOn: '${UNAMEA}'\n\n"); }' >> ${DIRSRC}/temp.cc
111     @${CXX} ${CXXFLAGS} -c -o $@ ${DIRSRC}/temp.cc -I${DIRINC} -I${PAM_INC} -I${PAM_YODA}/include/yoda/ `root-config --cflags`
112    
113 mocchiut 1.6
114 mocchiut 1.1 ${MACROSLIBS}: ${MACROSRCS}
115     @(${EGREEN} "Compiling macro: "${WHITE} "$@"; ${RESET})
116 mocchiut 1.4 @${ROOTCINT} -f ${DIRMACROS}/`basename $(@F) _${VER}.so | sed s/lib//`link.cxx -c -I${ROOTINC} ${DIRINC}/`basename $(@F) _${VER}.so | sed s/lib//`fun.h ${DIRINC}/`basename $(@F) _${VER}.so | sed s/lib//`LinkDef.h
117 mocchiut 1.27 @${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ ${DIRMACROS}/`basename $(@F) _${VER}.so | sed s/lib//`.cxx ${DIRMACROS}/`basename $(@F) _${VER}.so | sed s/lib//`link.cxx $(LG2C) -I${PAM_INC} -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_YODA}/include/yoda/ ${PAM_YODA}/lib/libyoda.so `root-config --cflags --glibs` 1>/dev/null
118 mocchiut 1.1
119     ${CXXEXELIBS}: ${CXXEXEOBJS}
120     @(${EGREEN} "Creating exec file: "${WHITE} "$@"; ${RESET})
121 mocchiut 1.4 @${CXX} ${CXXFLAGS} -o ${DIRBIN}/$@ ${DIRBIN}/$@.o -I${DIRINC} -I${PAM_INC} -I${PAM_YODA}/include/yoda/ ${PAM_YODA}/lib/libyoda.so ${DIRTOP}/${DIRLIB}/lib$@_${VER}.so `root-config --cflags --glibs`;
122 mocchiut 1.1 @rm -f ${DIRSRC}/temp.cc
123    
124     # A small target to check environmental variables
125     %_env:
126     @${test_env}
127    
128     .PHONY: install installdoc installlib installmacros installinc installexe installcmacro
129     .PHONY: clean depclean info mkbindir mklibdir testcern testpamenv test
130    
131     mkbindir: ${DIRBIN}
132     ${DIRBIN}:
133     @${test_and_mk}
134    
135     mklibdir: ${DIRLIB}
136     ${DIRLIB}:
137     @${test_and_mk}
138    
139     # Here what has to be deleted in clean target
140     clean: TOBEDEL= ${DIRMACROS}/*link.cxx ${DIRMACROS}/*link.h ${FOBJS} ${FULLLIBS} ${DIRBIN}/${CXXEXELIBS} ${COBJS} ${CXXEXEOBJS} ${FULLLINKFLIBS} ${FULLLINKCLIBS} ${FULLMACROCLIBS} ${FULLLINKMACROCLIBS}
141     clean:
142     @${test_and_rm}
143    
144     distclean: clean
145     distclean: TOBEDEL= ${DIRBIN} ${DIRLIB}
146     distclean:
147     @${test_and_rm}
148    
149     forceinstall: FORCE=-f
150     forceinstall: install
151    
152     upgrade: FORCE=-u
153     upgrade: install
154    
155     install: installlib installinc installmacros installcalib installdoc installexe installcmacro
156    
157     installlib: LINK=y
158     installlib: TOBEMOVED= $(FULLLIBS:${DIRLIB}%=${PAM_LIB}%)
159     installlib: ORIGIN=${DIRLIB}
160     installlib:
161     @${test_and_cp}
162    
163     installcmacro: LINK=y
164     installcmacro: TOBEMOVED= $(FULLMACROCLIBS:${DIRLIB}%=${PAM_LIB}%)
165     installcmacro: ORIGIN=${DIRLIB}
166     installcmacro:
167     @${test_and_cp}
168    
169     installinc: TOBEMOVED= $(INCSRCS:${DIRINC}/%=${PAM_INC}/%)
170     installinc: ORIGIN=${DIRINC}
171     installinc:
172     @${test_and_cp}
173    
174     installexe: TOBEMOVED= $(EXESRCS:${DIRBIN}/%=${PAM_BIN}/%)
175     installexe: ORIGIN=${DIRBIN}
176     installexe:
177     @${test_and_cp}
178    
179     installmacros: TOBEMOVED= $(MACROSSRCS:${DIRMACROS}/%=${PAM_MACROS}/%)
180     installmacros: ORIGIN=${DIRMACROS}
181     installmacros:
182     @${test_and_cp}
183    
184     installcalib: TOBEMOVED= $(CALIBFILES:${DIRCALIB}/%=${PAM_CALIB}/%)
185     installcalib: ORIGIN=${DIRCALIB}
186     installcalib:
187     @${test_and_cp}
188    
189     installdoc: TOBEMOVED= $(DOCFILES:${DIRDOC}/%=${PAM_DOC}/%)
190     installdoc: ORIGIN=${DIRDOC}
191     installdoc:
192     @${test_and_cp}
193    
194     info:
195     @echo " "
196     @${EGREEN} "Infos for package :" ${WHITE} ${PACKAGE}
197     @${EGREEN} " VERSION :" ${WHITE} ${VER}
198     @${EGREEN} " EXECUTABLES :" ${WHITE} ${EXECUTABLES}
199     @${EGREEN} " LIBS :" ${WHITE} ${LIBS}
200     @${EGREEN} " DOCS :" ${WHITE} ${DOCS}
201     @${EGREEN} " SRCS :" ${WHITE} ${SRCS}
202     @${EGREEN} " MACROS :" ${WHITE} ${MACROS}
203     @echo " "
204     @${RESET}
205    
206     test: testpamenv
207    
208     testpamenv: ${PAM_ENV}
209    
210     root-config: OPT=--cflags
211     root-config:
212     @${test_cmd}
213    
214     # Here follows some usefull macros
215     define test_and_cp
216     wd=`pwd`;\
217     for i in ${TOBEMOVED} ; do \
218     wv=$${i##/*/}; \
219     dest=$${i/$${wv}/}; \
220     ${EGREEN} "Testing for :" ${WHITE} "$${i}" ; ${RESET}; \
221     if [ ! "${FORCE}" ] ; then \
222     if [ ! -f $${i} ]; then \
223     ${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\
224     ${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \
225     cp ${ORIGIN}/$${i##/*/} $${i}; \
226     else \
227     ${ERED} "File already exist !!!! Please delete it " ${WHITE}; ${RESET}; \
228     fi;\
229     else \
230     if [ "${FORCE}" == "-u" ] ; then \
231     if [ "`basename $${i}`" != "`basename $${i} _${VER}.so`" ]; then \
232     ${EYELLOW} "Removing: "${WHITE} ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so; ${RESET}; \
233     rm -f ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so ; \
234     ${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\
235     ${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \
236     cp ${ORIGIN}/$${i##/*/} $${i}; \
237     else \
238     ${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\
239     ${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \
240     cp -f ${ORIGIN}/$${i##/*/} $${i}; \
241     fi; \
242     else \
243     ${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\
244     ${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \
245     cp ${FORCE} ${ORIGIN}/$${i##/*/} $${i}; \
246     fi;\
247     fi ;\
248     if [ ! -z ${LINK} ] ; then \
249     ${EGREEN} "Creating symlink from : "${WHITE} $${wv/_${VER}/} ;\
250     ${EGREEN} " to : "${WHITE} $${i##/*/} ; ${RESET}; \
251     cd $${dest}; \
252     ln -sf $${wv} $${wv/_${VER}/}; \
253     cd $${wd}; \
254     fi \
255     done
256     endef
257    
258     define test_and_mk
259     ${EGREEN} "Testing for :" ${WHITE} "$@"; ${RESET}
260     test -d "$@" || \
261     (${EGREEN} "Creating : "${WHITE} "$@"; ${RESET}; mkdir -p $@)
262     endef
263    
264     define test_env
265     ${EGREEN} "Testing for env:" ${WHITE} $(patsubst %_env,%,$@); ${RESET}
266     printenv $(patsubst %_env,%,$@) 1>/dev/null || \
267     (${ERED} "ERROR, variable : "${WHITE} $(patsubst %_env,%,$@) \
268     ${RED} "not defined !!! Check your env. settings"; \
269     ${RESET}; exit 1)
270     ${EGREEN} " Defined:" ${WHITE} $${$(patsubst %_env,%,$@)}; ${RESET}
271     endef
272    
273     define test_cmd
274     ${EGREEN} "Testing for cmd:" ${WHITE} $@ ${OPT}; ${RESET}
275     $@ ${OPT} 1>/dev/null 2>&1 || \
276     (${ERED} "ERROR, command : "${WHITE} $@ ${OPT}\
277     ${RED} "not found !!! Check your installation"; \
278     ${RESET}; exit 1)
279     ${EGREEN} " Present:" ${WHITE} $@ ${OPT}; ${RESET}
280     endef
281    
282     define test_and_rm
283     for i in ${TOBEDEL}; do \
284     test -d $${i} || (${ERED} "Removing file :"${WHITE} $${i}; ${RESET}; \
285     rm -f $${i} ); \
286     test ! -d $${i} || (${ERED} "Removing dir :"${WHITE} $${i}; ${RESET}; \
287     rm -rf $${i} ); \
288     done
289     endef

  ViewVC Help
Powered by ViewVC 1.1.23