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

Contents of /quicklook/tracker/flight/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Wed Mar 22 15:55:14 2006 UTC (18 years, 8 months ago) by pam-fi
Branch: MAIN
CVS Tags: R1v01
*** empty log message ***

1 # Flight quick look - FQLOOK
2 # SOFTWARE VERSION
3 VER= v1r00
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 CXX=g++
26 CXXFLAGS=-Wall
27 # Here the variables definig the local directories
28 DIRTOP=${shell pwd}
29 DIRLIB=lib
30 DIRBIN=bin
31 DIRSRC=src
32 DIRDOC=doc
33 DIRMACROS=macros
34 # Here the PAMELA environmental variables to be checked
35 PAM_ENV= PAM_BIN_env PAM_LIB_env PAM_INC_env PAM_DOC_env PAM_MACROS_env PAM_CALIB_env PAM_YODA_env
36 # Here the local variables used to build the targets
37
38 CXXEXESRCS=${DIRSRC}/TrackerQLookBasic.cpp \
39 ${DIRSRC}/TrackerQLookExpert.cpp \
40 ${DIRSRC}/TrkCalibQLookBasic.cpp \
41 ${DIRSRC}/TrkCalibQLookExpert.cpp
42 CXXEXELIBS=$(CXXEXESRCS:${DIRSRC}/%.cpp=%)
43 EXESRCS= ${DIRBIN}/TrackerQLookBasic ${DIRBIN}/TrackerQLookExpert ${DIRBIN}/TrkCalibQLookBasic ${DIRBIN}/TrkCalibQLookExpert
44
45 DOCFILES=${DIRDOC}/FlightTrkQLook-OperatorManual.doc ${DIRDOC}/FlightTrkQLook-OperatorManual.pdf
46
47 # Here the Variables used for info target
48 PACKAGE=Tracker flight quick look software
49 EXECUTABLES=
50 LIBS= ${FLIBS} ${FOBJS} ${CLIBS} ${COBJS} ${CXXEXEOBJS}
51 DOCS=
52 SRCS= ${FSRCS} ${CRSCS} ${CXXEXESRCS}
53 MACROS= ${MACROSSRCS}
54 NROOTINC=${shell root-config --incdir}
55 #
56 TOBEDEL =
57 # Let's start
58 all : test mkbindir mklibdir ${CXXEXELIBS}
59 all:
60 @echo -e ${GREEN} ""
61 @(${EGREEN} " Finished, now you can install the package \n (use: make install or make upgrade or make forceinstall) "; ${RESET})
62 @echo -e ${GREEN} ""
63 @${RESET}
64
65 # Here some general rules to produce objects in our local dir
66 ${CXXEXELIBS}: ${CXXEXESRCS}
67 @(${EGREEN} "Creating exec file: "${WHITE} "$@"; ${RESET})
68 ${CXX} ${CXXFLAGS} -c ${DIRSRC}/$@.cpp -o ${DIRLIB}/$@.o -I${PAM_YODAINC} -I${PAM_YODASRC} -I${NROOTINC};
69 ${CXX} ${CXXFLAGS} -o ${DIRBIN}/$@ ${DIRLIB}/$@.o -I${PAM_YODAINC} -I${PAM_YODASRC} ${PAM_YODA}/lib/libyoda.so `root-config --cflags --glibs`;
70
71 # A small target to check environmental variables
72 %_env:
73 @${test_env}
74
75 .PHONY: install installdoc installexe
76 .PHONY: clean depclean info mklibdir testcern testpamenv test
77
78 mkbindir: ${DIRBIN}
79 ${DIRBIN}:
80 @${test_and_mk}
81
82 mklibdir: ${DIRLIB}
83 ${DIRLIB}:
84 @${test_and_mk}
85
86 # Here what has to be deleted in clean target
87 clean: TOBEDEL= ${DIRBIN}
88 clean:
89 @${test_and_rm}
90
91 distclean: clean
92 distclean: TOBEDEL= ${DIRBIN} ${DIRLIB}
93 distclean:
94 @${test_and_rm}
95
96 forceinstall: FORCE=-f
97 forceinstall: install
98
99 upgrade: FORCE=-u
100 upgrade: install
101
102 install: installdoc installexe
103
104 installexe: TOBEMOVED= $(EXESRCS:${DIRBIN}/%=${PAM_BIN}/%)
105 installexe: ORIGIN=${DIRBIN}
106 installexe:
107 @${test_and_cp}
108
109 installdoc: TOBEMOVED= $(DOCFILES:${DIRDOC}/%=${PAM_DOC}/%)
110 installdoc: ORIGIN=${DIRDOC}
111 installdoc:
112 @${test_and_cp}
113
114 info:
115 @echo " "
116 @${EGREEN} "Infos for package :" ${WHITE} ${PACKAGE}
117 @${EGREEN} " VERSION :" ${WHITE} ${VER}
118 @${EGREEN} " EXECUTABLES :" ${WHITE} ${EXECUTABLES}
119 @${EGREEN} " LIBS :" ${WHITE} ${LIBS}
120 @${EGREEN} " DOCS :" ${WHITE} ${DOCS}
121 @${EGREEN} " SRCS :" ${WHITE} ${SRCS}
122 @${EGREEN} " MACROS :" ${WHITE} ${MACROS}
123 @echo " "
124 @${RESET}
125
126 test: testpamenv
127
128 testpamenv: ${PAM_ENV}
129
130 root-config: OPT=--cflags
131 root-config:
132 @${test_cmd}
133
134 # Here follows some usefull macros
135 define test_and_cp
136 wd=`pwd`;\
137 for i in ${TOBEMOVED} ; do \
138 wv=$${i##/*/}; \
139 dest=$${i/$${wv}/}; \
140 ${EGREEN} "Testing for :" ${WHITE} "$${i}" ; ${RESET}; \
141 if [ ! "${FORCE}" ] ; then \
142 if [ ! -f $${i} ]; then \
143 ${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\
144 ${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \
145 cp ${ORIGIN}/$${i##/*/} $${i}; \
146 else \
147 ${ERED} "File already exist !!!! Please delete it " ${WHITE}; ${RESET}; \
148 fi;\
149 else \
150 if [ "${FORCE}" == "-u" ] ; then \
151 if [ "`basename $${i}`" != "`basename $${i} _${VER}.so`" ]; then \
152 ${EYELLOW} "Removing: "${WHITE} ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so; ${RESET}; \
153 rm -f ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so ; \
154 ${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\
155 ${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \
156 cp ${ORIGIN}/$${i##/*/} $${i}; \
157 else \
158 ${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\
159 ${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \
160 cp -f ${ORIGIN}/$${i##/*/} $${i}; \
161 fi; \
162 else \
163 ${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\
164 ${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \
165 cp ${FORCE} ${ORIGIN}/$${i##/*/} $${i}; \
166 fi;\
167 fi ;\
168 if [ ! -z ${LINK} ] ; then \
169 ${EGREEN} "Creating symlink from : "${WHITE} $${wv/_${VER}/} ;\
170 ${EGREEN} " to : "${WHITE} $${i##/*/} ; ${RESET}; \
171 cd $${dest}; \
172 ln -sf $${wv} $${wv/_${VER}/}; \
173 cd $${wd}; \
174 fi \
175 done
176 endef
177
178 define test_and_mk
179 ${EGREEN} "Testing for :" ${WHITE} "$@"; ${RESET}
180 test -d "$@" || \
181 (${EGREEN} "Creating : "${WHITE} "$@"; ${RESET}; mkdir -p $@)
182 endef
183
184 define test_env
185 ${EGREEN} "Testing for env:" ${WHITE} $(patsubst %_env,%,$@); ${RESET}
186 printenv $(patsubst %_env,%,$@) 1>/dev/null || \
187 (${ERED} "ERROR, variable : "${WHITE} $(patsubst %_env,%,$@) \
188 ${RED} "not defined !!! Check your env. settings"; \
189 ${RESET}; exit 1)
190 ${EGREEN} " Defined:" ${WHITE} $${$(patsubst %_env,%,$@)}; ${RESET}
191 endef
192
193 define test_cmd
194 ${EGREEN} "Testing for cmd:" ${WHITE} $@ ${OPT}; ${RESET}
195 $@ ${OPT} 1>/dev/null 2>&1 || \
196 (${ERED} "ERROR, command : "${WHITE} $@ ${OPT}\
197 ${RED} "not found !!! Check your installation"; \
198 ${RESET}; exit 1)
199 ${EGREEN} " Present:" ${WHITE} $@ ${OPT}; ${RESET}
200 endef
201
202 define test_and_rm
203 for i in ${TOBEDEL}; do \
204 test -d $${i} || (${ERED} "Removing file :"${WHITE} $${i}; ${RESET}; \
205 rm -f $${i} ); \
206 test ! -d $${i} || (${ERED} "Removing dir :"${WHITE} $${i}; ${RESET}; \
207 rm -rf $${i} ); \
208 done
209 endef

  ViewVC Help
Powered by ViewVC 1.1.23