/[PAMELA software]/quicklook/tof/Makefile
ViewVC logotype

Annotation of /quicklook/tof/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (hide annotations) (download) (vendor branch)
Thu May 11 10:07:39 2006 UTC (18 years, 6 months ago) by campana
Branch: ToF
CVS Tags: v1r00, start
Changes since 1.1: +0 -0 lines
ToF QuickLook script

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

  ViewVC Help
Powered by ViewVC 1.1.23