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

Diff of /quicklook/tof/Makefile

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by campana, Wed May 17 16:35:59 2006 UTC revision 1.3 by campana, Thu Jun 15 10:26:55 2006 UTC
# Line 1  Line 1 
1  # Flight quick look - FQLOOK  # Flight quick look - FQLOOK
2  # SOFTWARE VERSION  # SOFTWARE VERSION
3  VER= v1r06  VER= v1r00
4  # An almost general purpouse Makefile for PAMELA repository  # An almost general purpouse Makefile for PAMELA repository
5  # Let's start with some usefull definition for colorize the echo  # Let's start with some usefull definition for colorize the echo
6  RED='\E[1;31;40m'  RED='\E[1;31;40m'
7  GREEN='\E[1;32;40m'  GREEN='\E[1;32;40m'
8  YELLOW='\E[1;33;40m'  YELLOW='\E[1;33;40m'
9  BLUE='\E[1;34;40m'  BLUE='\E[1;34;40m'
10  WHITE='\E[1;37;40m'  WHITE='\E[1;37;40m'
11  VIOLET='\E[1;35;40m'  VIOLET='\E[1;35;40m'
12  CYAN='\E[1;36;40m'  CYAN='\E[1;36;40m'
13  # Here the echo definition to use them  # Here the echo definition to use them
14  EVIOLET=echo -e ${VIOLET}  EVIOLET=echo -e ${VIOLET}
15  ECYAN=echo -e ${CYAN}  ECYAN=echo -e ${CYAN}
16  ERED=echo -e ${RED}  ERED=echo -e ${RED}
17  EGREEN=echo -e ${GREEN}  EGREEN=echo -e ${GREEN}
18  EYELLOW=echo -e ${YELLOW}  EYELLOW=echo -e ${YELLOW}
19  EBLUE=echo -e ${BLUE}  EBLUE=echo -e ${BLUE}
20  EWHITE=echo -e ${WHITE}  EWHITE=echo -e ${WHITE}
21  # Reset the terminal  # Reset the terminal
22  RESET=tput sgr0  RESET=tput sgr0
23  # Here the variables used to override the standard make flags  # Here the variables used to override the standard make flags
24  # C  # C++
25  CC=gcc  CXX=g++
26  CFLAGS=-Wall -O -fPIC -pthread  CXXFLAGS=-Wall
27  # Enviroment:  # Here the variables definig the local directories
28  GCCVER=`gcc --version | head -1`  DIRTOP=${shell pwd}
29  UNAMEA=`uname -a`  DIRLIB=lib
30  TODAY=`date`  DIRBIN=bin
31  # F77  DIRSRC=src
32  F77=g77  DIRDOC=doc
33  F77FLAGS=  -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -g -extend_source -static -fno-backslash  DIRMACROS=macros
34  # C++  # Here the  PAMELA environmental variables to be checked
35  CXX=g++  PAM_ENV= PAM_BIN_env PAM_LIB_env PAM_INC_env PAM_DOC_env PAM_YODA_env
36  CXXFLAGS=-Wall -O -fPIC -pthread  # Here the local variables used to build the targets
37  # ROOTCINT  
38  ROOTCINT=rootcint  CXXEXESRCS=${DIRSRC}/TofScan.cpp
39  # Here the variables definig the local directories  CXXEXELIBS=$(CXXEXESRCS:${DIRSRC}/%.cpp=%)
40  DIRTOP=${shell pwd}  EXESRCS= ${DIRBIN}/TofScan
41  DIRLIB=lib  DOCFILES=
42  DIRBIN=bin  
43  DIRSRC=src  # Here the Variables used for info target
44  DIRINC=inc  PACKAGE=ToF flight quick look software
45  DIRDOC=doc  EXECUTABLES=
46  DIRMACROS=macros  LIBS= ${FLIBS} ${FOBJS} ${CLIBS} ${COBJS} ${CXXEXEOBJS}
47  DIRCALIB=  DOCS=
48  # Here the  PAMELA environmental variables to be checked  SRCS= ${FSRCS} ${CRSCS} ${CXXEXESRCS}
49  PAM_ENV= PAM_BIN_env PAM_LIB_env PAM_INC_env PAM_DOC_env PAM_MACROS_env PAM_CALIB_env PAM_YODA_env  MACROS= ${MACROSSRCS}
50  # Here the local variables used to build the targets  NROOTINC=${shell root-config --incdir}
51    #
52  CXXEXESRCS=${DIRSRC}/TofScan.cpp  TOBEDEL =
53  CXXEXELIBS=$(CXXEXESRCS:${DIRSRC}/%.cpp=%)  # Let's start
54  EXESRCS= ${DIRBIN}/TofScan  all : test mkbindir mklibdir ${CXXEXELIBS}
55  DOCFILES=  all:
56            @echo -e ${GREEN} ""
57  # Here the Variables used for info target          @(${EGREEN} " Finished, now you can install the package \n  (use: make install or make upgrade or make forceinstall) "; ${RESET})
58  PACKAGE=ToF flight quick look software          @echo -e ${GREEN} ""
59  EXECUTABLES=          @${RESET}
60  LIBS= ${FLIBS} ${FOBJS} ${CLIBS} ${COBJS} ${CXXEXEOBJS}  
61  DOCS=  # Here some general rules to produce objects in our local dir
62  SRCS= ${FSRCS} ${CRSCS} ${CXXEXESRCS}  ${CXXEXELIBS}: ${CXXEXESRCS}
63  MACROS= ${MACROSSRCS}          @(${EGREEN} "Creating exec file: "${WHITE} "$@"; ${RESET})
64  NROOTINC=${shell root-config --incdir}          ${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  TOBEDEL =  
67  # Let's start  # A small target to check environmental variables
68  all : test mkbindir mklibdir ${MACROSLIBS} ${CXXEXELIBS}  %_env:
69  all:          @${test_env}
70          @echo -e ${GREEN} ""  
71          @(${EGREEN} " Finished, now you can install the package \n  (use: make install or make upgrade or make forceinstall) "; ${RESET})  .PHONY: install installexe
72          @echo -e ${GREEN} ""  .PHONY: clean depclean info mklibdir testcern testpamenv test
73          @${RESET}  
74    mkbindir: ${DIRBIN}
75  # Here some general rules to produce objects in our local dir  ${DIRBIN}:
76  ${CXXEXELIBS}: ${CXXEXESRCS}          @${test_and_mk}
77          @(${EGREEN} "Creating exec file: "${WHITE} "$@"; ${RESET})  
78          ${CXX} ${CXXFLAGS} -c ${DIRSRC}/$@.cpp -o ${DIRLIB}/$@.o -I${PAM_INC} -I${PAM_YODA}/include/yoda/ -I${NROOTINC};  mklibdir: ${DIRLIB}
79          ${CXX} ${CXXFLAGS} -o ${DIRBIN}/$@ ${DIRLIB}/$@.o -I${PAM_INC} -I${PAM_YODA}/include/yoda/ ${PAM_YODA}/lib/libyoda.so `root-config --cflags --glibs`;  ${DIRLIB}:
80            @${test_and_mk}
81  # A small target to check environmental variables  
82  %_env:  # Here what has to be deleted in clean target
83          @${test_env}  clean: TOBEDEL= ${DIRBIN}  
84    clean:
85  .PHONY: install installdoc installlib installmacros installinc installexe installcmacro          @${test_and_rm}
86  .PHONY: clean depclean info mkbindir mklibdir testcern testpamenv test  
87    distclean: clean
88  mkbindir: ${DIRBIN}  distclean: TOBEDEL= ${DIRBIN} ${DIRLIB}
89  ${DIRBIN}:  distclean:
90          @${test_and_mk}          @${test_and_rm}
91    
92  mklibdir: ${DIRLIB}  forceinstall: FORCE=-f
93  ${DIRLIB}:  forceinstall: install
94          @${test_and_mk}  
95    upgrade: FORCE=-u
96  # Here what has to be deleted in clean target  upgrade: install
97  clean: TOBEDEL= ${DIRBIN}  
98  clean:  install: installexe
99          @${test_and_rm}  
100    installexe: TOBEMOVED= $(EXESRCS:${DIRBIN}/%=${PAM_BIN}/%)
101  distclean: clean  installexe: ORIGIN=${DIRBIN}
102  distclean: TOBEDEL= ${DIRBIN} ${DIRLIB}  installexe:
103  distclean:          @${test_and_cp}
104          @${test_and_rm}  
105    installdoc: TOBEMOVED= $(DOCFILES:${DIRDOC}/%=${PAM_DOC}/%)
106  forceinstall: FORCE=-f  installdoc: ORIGIN=${DIRDOC}
107  forceinstall: install  installdoc:
108            @${test_and_cp}
109  upgrade: FORCE=-u  
110  upgrade: install  info:
111            @echo " "
112  install: installexe          @${EGREEN} "Infos for package :" ${WHITE} ${PACKAGE}
113            @${EGREEN} "          VERSION :" ${WHITE} ${VER}
114  installlib: LINK=y          @${EGREEN} "      EXECUTABLES :" ${WHITE} ${EXECUTABLES}
115  installlib: TOBEMOVED= $(FULLLIBS:${DIRLIB}%=${PAM_LIB}%)          @${EGREEN} "             LIBS :" ${WHITE} ${LIBS}
116  installlib: ORIGIN=${DIRLIB}          @${EGREEN} "             DOCS :" ${WHITE} ${DOCS}
117  installlib:          @${EGREEN} "             SRCS :" ${WHITE} ${SRCS}
118          @${test_and_cp}          @${EGREEN} "           MACROS :" ${WHITE} ${MACROS}
119            @echo " "
120  installcmacro: LINK=y          @${RESET}
121  installcmacro: TOBEMOVED= $(FULLMACROCLIBS:${DIRLIB}%=${PAM_LIB}%)  
122  installcmacro: ORIGIN=${DIRLIB}  test: testpamenv
123  installcmacro:  
124          @${test_and_cp}  testpamenv: ${PAM_ENV}
125    
126  installinc: TOBEMOVED= $(INCSRCS:${DIRINC}/%=${PAM_INC}/%)  root-config: OPT=--cflags
127  installinc: ORIGIN=${DIRINC}  root-config:
128  installinc:          @${test_cmd}
129          @${test_and_cp}  
130    # Here follows some usefull macros
131  installexe: TOBEMOVED= $(EXESRCS:${DIRBIN}/%=${PAM_BIN}/%)  define  test_and_cp
132  installexe: ORIGIN=${DIRBIN}  wd=`pwd`;\
133  installexe:  for i in ${TOBEMOVED} ; do \
134          @${test_and_cp}  wv=$${i##/*/}; \
135    dest=$${i/$${wv}/}; \
136  installmacros: TOBEMOVED= $(MACROSSRCS:${DIRMACROS}/%=${PAM_MACROS}/%)  ${EGREEN} "Testing for :" ${WHITE} "$${i}" ; ${RESET}; \
137  installmacros: ORIGIN=${DIRMACROS}  if [ ! "${FORCE}" ] ; then \
138  installmacros:   if [ ! -f $${i} ]; then  \
139          @${test_and_cp}    ${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\
140      ${EGREEN} "      to: "${WHITE} $${i} ; ${RESET}; \
141  installcalib: TOBEMOVED= $(CALIBFILES:${DIRCALIB}/%=${PAM_CALIB}/%)    cp ${ORIGIN}/$${i##/*/} $${i}; \
142  installcalib: ORIGIN=${DIRCALIB}   else \
143  installcalib:     ${ERED} "File already exist !!!! Please delete it " ${WHITE}; ${RESET}; \
144          @${test_and_cp}   fi;\
145    else \
146  installdoc: TOBEMOVED= $(DOCFILES:${DIRDOC}/%=${PAM_DOC}/%)     if [ "${FORCE}" == "-u" ] ; then \
147  installdoc: ORIGIN=${DIRDOC}       if [ "`basename $${i}`" != "`basename $${i} _${VER}.so`" ]; then \
148  installdoc:         ${EYELLOW} "Removing: "${WHITE} ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so; ${RESET}; \
149          @${test_and_cp}         rm -f ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so ; \
150           ${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\
151  info:         ${EGREEN} "      to: "${WHITE} $${i} ; ${RESET}; \
152          @echo " "         cp ${ORIGIN}/$${i##/*/} $${i}; \
153          @${EGREEN} "Infos for package :" ${WHITE} ${PACKAGE}       else \
154          @${EGREEN} "          VERSION :" ${WHITE} ${VER}         ${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\
155          @${EGREEN} "      EXECUTABLES :" ${WHITE} ${EXECUTABLES}         ${EYELLOW} "          to: "${WHITE} $${i} ; ${RESET}; \
156          @${EGREEN} "             LIBS :" ${WHITE} ${LIBS}         cp -f ${ORIGIN}/$${i##/*/} $${i}; \
157          @${EGREEN} "             DOCS :" ${WHITE} ${DOCS}       fi; \
158          @${EGREEN} "             SRCS :" ${WHITE} ${SRCS}     else \
159          @${EGREEN} "           MACROS :" ${WHITE} ${MACROS}       ${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\
160          @echo " "       ${EYELLOW} "          to: "${WHITE} $${i} ; ${RESET}; \
161          @${RESET}       cp ${FORCE} ${ORIGIN}/$${i##/*/} $${i}; \
162       fi;\
163  test: testpamenv  fi ;\
164    if [ ! -z ${LINK} ] ; then \
165  testpamenv: ${PAM_ENV}    ${EGREEN} "Creating symlink from : "${WHITE} $${wv/_${VER}/} ;\
166      ${EGREEN} "                   to : "${WHITE} $${i##/*/} ; ${RESET}; \
167  root-config: OPT=--cflags    cd $${dest}; \
168  root-config:    ln -sf $${wv} $${wv/_${VER}/}; \
169          @${test_cmd}    cd $${wd}; \
170    fi \
171  # Here follows some usefull macros  done
172  define  test_and_cp  endef
173  wd=`pwd`;\  
174  for i in ${TOBEMOVED} ; do \  define  test_and_mk
175  wv=$${i##/*/}; \  ${EGREEN} "Testing for :" ${WHITE} "$@"; ${RESET}
176  dest=$${i/$${wv}/}; \  test -d "$@" || \
177  ${EGREEN} "Testing for :" ${WHITE} "$${i}" ; ${RESET}; \  (${EGREEN} "Creating : "${WHITE} "$@"; ${RESET}; mkdir -p $@)
178  if [ ! "${FORCE}" ] ; then \  endef
179   if [ ! -f $${i} ]; then  \  
180    ${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\  define  test_env
181    ${EGREEN} "      to: "${WHITE} $${i} ; ${RESET}; \  ${EGREEN} "Testing for env:" ${WHITE} $(patsubst %_env,%,$@); ${RESET}
182    cp ${ORIGIN}/$${i##/*/} $${i}; \  printenv $(patsubst %_env,%,$@) 1>/dev/null || \
183   else \  (${ERED} "ERROR, variable : "${WHITE} $(patsubst %_env,%,$@) \
184     ${ERED} "File already exist !!!! Please delete it " ${WHITE}; ${RESET}; \  ${RED} "not defined !!! Check your env. settings"; \
185   fi;\  ${RESET}; exit 1)
186  else \  ${EGREEN} " Defined:" ${WHITE} $${$(patsubst %_env,%,$@)}; ${RESET}
187     if [ "${FORCE}" == "-u" ] ; then \  endef
188       if [ "`basename $${i}`" != "`basename $${i} _${VER}.so`" ]; then \  
189         ${EYELLOW} "Removing: "${WHITE} ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so; ${RESET}; \  define  test_cmd
190         rm -f ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so ; \  ${EGREEN} "Testing for cmd:" ${WHITE} $@ ${OPT}; ${RESET}
191         ${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\  $@ ${OPT} 1>/dev/null 2>&1 || \
192         ${EGREEN} "      to: "${WHITE} $${i} ; ${RESET}; \  (${ERED} "ERROR, command : "${WHITE} $@ ${OPT}\
193         cp ${ORIGIN}/$${i##/*/} $${i}; \  ${RED} "not found !!! Check your installation"; \
194       else \  ${RESET}; exit 1)
195         ${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\  ${EGREEN} " Present:" ${WHITE} $@ ${OPT}; ${RESET}
196         ${EYELLOW} "          to: "${WHITE} $${i} ; ${RESET}; \  endef
197         cp -f ${ORIGIN}/$${i##/*/} $${i}; \  
198       fi; \  define  test_and_rm
199     else \  for i in ${TOBEDEL}; do \
200       ${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\  test -d $${i} || (${ERED} "Removing file :"${WHITE} $${i}; ${RESET}; \
201       ${EYELLOW} "          to: "${WHITE} $${i} ; ${RESET}; \  rm -f $${i} ); \
202       cp ${FORCE} ${ORIGIN}/$${i##/*/} $${i}; \  test ! -d $${i} || (${ERED} "Removing dir :"${WHITE} $${i}; ${RESET}; \
203     fi;\  rm -rf $${i} ); \
204  fi ;\  done
205  if [ ! -z ${LINK} ] ; then \  endef
   ${EGREEN} "Creating symlink from : "${WHITE} $${wv/_${VER}/} ;\  
   ${EGREEN} "                   to : "${WHITE} $${i##/*/} ; ${RESET}; \  
   cd $${dest}; \  
   ln -sf $${wv} $${wv/_${VER}/}; \  
   cd $${wd}; \  
 fi \  
 done  
 endef  
   
 define  test_and_mk  
 ${EGREEN} "Testing for :" ${WHITE} "$@"; ${RESET}  
 test -d "$@" || \  
 (${EGREEN} "Creating : "${WHITE} "$@"; ${RESET}; mkdir -p $@)  
 endef  
   
 define  test_env  
 ${EGREEN} "Testing for env:" ${WHITE} $(patsubst %_env,%,$@); ${RESET}  
 printenv $(patsubst %_env,%,$@) 1>/dev/null || \  
 (${ERED} "ERROR, variable : "${WHITE} $(patsubst %_env,%,$@) \  
 ${RED} "not defined !!! Check your env. settings"; \  
 ${RESET}; exit 1)  
 ${EGREEN} " Defined:" ${WHITE} $${$(patsubst %_env,%,$@)}; ${RESET}  
 endef  
   
 define  test_cmd  
 ${EGREEN} "Testing for cmd:" ${WHITE} $@ ${OPT}; ${RESET}  
 $@ ${OPT} 1>/dev/null 2>&1 || \  
 (${ERED} "ERROR, command : "${WHITE} $@ ${OPT}\  
 ${RED} "not found !!! Check your installation"; \  
 ${RESET}; exit 1)  
 ${EGREEN} " Present:" ${WHITE} $@ ${OPT}; ${RESET}  
 endef  
   
 define  test_and_rm  
 for i in ${TOBEDEL}; do \  
 test -d $${i} || (${ERED} "Removing file :"${WHITE} $${i}; ${RESET}; \  
 rm -f $${i} ); \  
 test ! -d $${i} || (${ERED} "Removing dir :"${WHITE} $${i}; ${RESET}; \  
 rm -rf $${i} ); \  
 done  
 endef  

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.23