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

Annotation of /quicklook/trigger/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


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

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

  ViewVC Help
Powered by ViewVC 1.1.23