/[PAMELA software]/quicklook/tracker/flight/Makefile
ViewVC logotype

Contents of /quicklook/tracker/flight/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.27 - (show annotations) (download)
Thu Mar 8 01:41:01 2007 UTC (17 years, 9 months ago) by pam-fi
Branch: MAIN
CVS Tags: v1r29
Changes since 1.26: +1 -1 lines
obt bug fixed

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

  ViewVC Help
Powered by ViewVC 1.1.23