1 |
# Calorimeter flight analysis software |
# PamelaLevel2 software |
2 |
# SOFTWARE VERSION |
# SOFTWARE VERSION |
3 |
VER= v0r00 |
VER= v6r00 |
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 |
CC=gcc |
26 |
CFLAGS=-Wall -O -fPIC -pthread -g |
#CFLAGS=-Wall -O -fPIC -pthread -g ${PAM_BIT} |
27 |
#CFLAGS=-Wall -O -fPIC -pthread |
CFLAGS=-Wall -O4 -fPIC -pthread ${PAM_BIT} |
28 |
# Enviroment: |
# Enviroment: |
29 |
GCCVER=`gcc --version | head -1` |
GCCVER=`gcc --version | head -1` |
30 |
UNAMEA=`uname -a` |
UNAMEA=`uname -a` |
31 |
TODAY=`date` |
TODAY=`date` |
32 |
# F77 |
# F77 |
33 |
F77=g77 |
F77=g77 |
34 |
F77FLAGS= -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -g -extend_source -static -fno-backslash |
#F77FLAGS= -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -g -extend_source -static -fno-backslash ${PAM_BIT} |
35 |
#F77FLAGS= -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -extend_source -static -fno-backslash |
F77FLAGS= -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -extend_source -static -fno-backslash ${PAM_BIT} |
36 |
# C++ |
# C++ |
37 |
CXX=g++ |
CXX=g++ |
38 |
CXXFLAGS=-Wall -O -fPIC -pthread -g |
#CXXFLAGS=-Wall -O -fPIC -pthread -g ${PAM_BIT} |
39 |
#CXXFLAGS=-Wall -O -fPIC -pthread |
CXXFLAGS=-Wall -O4 -fPIC -pthread ${PAM_BIT} |
40 |
# ROOTCINT |
# ROOTCINT |
41 |
ROOTCINT=rootcint |
ROOTCINT=rootcint |
42 |
# Here the variables definig the local directories |
# Here the variables definig the local directories |
43 |
DIRTOP=${shell pwd} |
DIRTOP=${shell pwd} |
44 |
DIRLIB=lib/${ARCH}/ |
DIRLIB=lib/${ARCH}/ |
45 |
DIRBIN=bin/${ARCH}/ |
DIRBIN=bin/${ARCH}/ |
46 |
DIRSRC=src |
DIRSRC=src |
47 |
DIRINC=inc |
DIRINC=inc |
48 |
DIRDOC=doc |
DIRDOC=doc |
49 |
DIRMACROS=macros |
DIRMACROS=macros |
50 |
DIRCALIB=calib |
DIRCALIB=calib |
51 |
# Here the PAMELA environmental variables to be checked |
# Here the PAMELA environmental variables to be checked |
52 |
PAM_ENV= PAM_BIN_env PAM_LIB_env PAM_INC_env PAM_DOC_env PAM_CALIB_env PAM_YODA_env |
PAM_ENV= PAM_BIN_env PAM_LIB_env PAM_INC_env PAM_DOC_env PAM_CALIB_env PAM_YODA_env |
53 |
# Here the local variables used to build the targets |
# Here the local variables used to build the targets |
54 |
#------------------------------------------------- |
#------------------------------------------------- |
55 |
FSRCS= |
FSRCS= |
56 |
FOBJS=$(FSRCS:${DIRSRC}/F77/%.f=${DIRLIB}/%.o) |
FOBJS=$(FSRCS:${DIRSRC}/F77/%.f=${DIRLIB}/%.o) |
57 |
#------------------------------------------------- |
#------------------------------------------------- |
58 |
CSRCS= |
CSRCS= |
59 |
COBJS=$(CSRCS:${DIRSRC}%.cpp=${DIRLIB}/%.o) |
COBJS=$(CSRCS:${DIRSRC}%.cpp=${DIRLIB}/%.o) |
60 |
#------------------------------------------------- |
#------------------------------------------------- |
61 |
# librerie utilizzabili da root (ci deve essere anche il ***LinkDef.h ) |
# librerie utilizzabili da root (ci deve essere anche il ***LinkDef.h ) |
62 |
LIBROOTSRCS=${DIRSRC}/PamLevel2.cpp |
LIBROOTSRCS=${DIRSRC}/PamLevel2.cpp |
63 |
LIBROOTLIBS=$(LIBROOTSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so) |
LIBROOTLIBS=$(LIBROOTSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so) |
64 |
LIBROOTOBJS= |
LIBROOTOBJS= |
65 |
LIBROOTCLIBS=libPamLevel2 |
LIBROOTCLIBS=libPamLevel2 |
66 |
FULLROOTCLIBS=$(LIBROOTCLIBS:%=${DIRLIB}/%_${VER}.so) |
FULLROOTCLIBS=$(LIBROOTCLIBS:%=${DIRLIB}/%_${VER}.so) |
67 |
#------------------------------------------------- |
#------------------------------------------------- |
68 |
# librerie C++ NON utilizzabili da root |
# librerie C++ NON utilizzabili da root |
69 |
LIBCPPSRCS=#${DIRSRC}/PamLevel2.cpp |
LIBCPPSRCS=#${DIRSRC}/PamLevel2.cpp |
70 |
LIBCPPLIBS=$(LIBCPPSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so) |
LIBCPPLIBS=$(LIBCPPSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so) |
71 |
LIBCPPCLIBS=#libPamLevel2 |
LIBCPPCLIBS=#libPamLevel2 |
72 |
FULLCPPCLIBS=$(LIBCPPCLIBS:%=${DIRLIB}/%_${VER}.so) |
FULLCPPCLIBS=$(LIBCPPCLIBS:%=${DIRLIB}/%_${VER}.so) |
73 |
#------------------------------------------------- |
#------------------------------------------------- |
74 |
# librerie F77 NON utilizzabili da root |
# librerie F77 NON utilizzabili da root |
75 |
LIBF77SRCS= |
LIBF77SRCS= |
76 |
LIBF77OBJS= $(LIBF77SRCS:${DIRSRC}/F77/%.f=${DIRLIB}/%.o) |
LIBF77OBJS= $(LIBF77SRCS:${DIRSRC}/F77/%.f=${DIRLIB}/%.o) |
77 |
LIBF77LIBS= $(LIBF77SRCS:${DIRSRC}/F77/%.f=${DIRLIB}/lib%_${VER}.so) |
LIBF77LIBS= $(LIBF77SRCS:${DIRSRC}/F77/%.f=${DIRLIB}/lib%_${VER}.so) |
78 |
LIBF77CLIBS= |
LIBF77CLIBS= |
79 |
FULLF77CLIBS=$(LIBF77CLIBS:%=${DIRLIB}/%_${VER}.so) |
FULLF77CLIBS=$(LIBF77CLIBS:%=${DIRLIB}/%_${VER}.so) |
80 |
#------------------------------------------------- |
#------------------------------------------------- |
81 |
FULLLIBS=${FULLROOTCLIBS} ${FULLCPPCLIBS} ${FULLF77CLIBS} |
FULLLIBS=${FULLROOTCLIBS} ${FULLCPPCLIBS} ${FULLF77CLIBS} |
82 |
|
|
83 |
#------------------------------------------------- |
#------------------------------------------------- |
84 |
# eseguibile |
# eseguibile |
85 |
CXXEXESRCS= |
CXXEXESRCS= |
86 |
CXXEXEOBJS=$(CXXEXESRCS:${DIRSRC}%.cpp=${DIRLIB}%.o) |
CXXEXEOBJS=$(CXXEXESRCS:${DIRSRC}%.cpp=${DIRLIB}%.o) |
87 |
CXXEXELIBS:= |
CXXEXELIBS:= |
88 |
|
|
89 |
OTHERLIBS= |
OTHERLIBS= |
90 |
#------------------------------------------------- |
#------------------------------------------------- |
91 |
# variabili per l'installazione |
# variabili per l'installazione |
92 |
EXESRCS= |
EXESRCS= |
93 |
INCSRCS=${DIRINC}/PamLevel2.h |
INCSRCS=${DIRINC}/PamLevel2.h |
94 |
MACROSSRCS= |
MACROSSRCS= |
95 |
CALIBFILES= |
CALIBFILES= |
96 |
DOCFILES= |
DOCFILES= |
97 |
# Here the Variables used for info target |
# Here the Variables used for info target |
98 |
PACKAGE=Tracker flight software |
PACKAGE=Tracker flight software |
99 |
EXECUTABLES=${EXESRCS} |
EXECUTABLES=${EXESRCS} |
100 |
LIBS= ${FULLLIBS} ${OTHERLIBS} |
LIBS= ${FULLLIBS} ${OTHERLIBS} |
101 |
DOCS= |
DOCS= |
102 |
SRCS= |
SRCS= |
103 |
MACROS= ${MACROSSRCS} |
MACROS= ${MACROSSRCS} |
104 |
INCLUDE= ${INCSRCS} |
INCLUDE= ${INCSRCS} |
105 |
# |
# |
106 |
TOBEDEL = junk |
TOBEDEL = junk |
107 |
ROOTINC=$$${shell root-config --incdir} |
ROOTINC=$$${shell root-config --incdir} |
108 |
NROOTINC=${shell root-config --incdir} |
NROOTINC=${shell root-config --incdir} |
109 |
# Let's start |
# Let's start |
110 |
all : test mkbindir mklibdir mkverpath ${LIBF77LIBS} ${LIBROOTLIBS} ${LIBCPPLIBS} ${CXXEXELIBS} |
all : test mkbindir mklibdir ${LIBF77LIBS} ${LIBROOTLIBS} ${LIBCPPLIBS} ${CXXEXELIBS} |
111 |
all: |
all: |
112 |
@echo -e ${GREEN} "" |
@echo -e ${GREEN} "" |
113 |
@(${EGREEN} " Finished, now you can install the package \n (use: make install or make upgrade or make forceinstall) "; ${RESET}) |
@(${EGREEN} " Finished, now you can install the package \n (use: make install or make upgrade or make forceinstall) "; ${RESET}) |
114 |
@echo -e ${GREEN} "" |
@echo -e ${GREEN} "" |
115 |
@${RESET} |
@${RESET} |
116 |
|
|
117 |
# Here some general rules to produce objects in our local dir |
# Here some general rules to produce objects in our local dir |
118 |
${DIRLIB}/%.o: ${DIRSRC}/%.cpp |
${DIRLIB}/%.o: ${DIRSRC}/%.cpp |
119 |
@(${EYELLOW} " C++ object ------------------------") |
@(${EYELLOW} " C++ object ------------------------") |
120 |
@(${EGREEN} "Creating object file: "${WHITE} "$@"; ${RESET}) |
@(${EGREEN} "Creating object file: "${WHITE} "$@"; ${RESET}) |
121 |
@${CXX} ${CXXFLAGS} -c -o $@ ${DIRSRC}/`basename ${@} .o`.cpp -I${DIRINC} -I${PAM_INC} -I${PAM_YODA}/include/yoda/ `root-config --cflags` |
@${CXX} ${CXXFLAGS} -c -o $@ ${DIRSRC}/`basename ${@} .o`.cpp -I${DIRINC} -I${PAM_INC} -I${PAM_YODA}/include/yoda/ `root-config --cflags` |
122 |
|
|
123 |
${DIRLIB}/%.o : ${DIRSRC}/F77/%.f |
${DIRLIB}/%.o : ${DIRSRC}/F77/%.f |
124 |
@(${EYELLOW} " F77 object ------------------------") |
@(${EYELLOW} " F77 object ------------------------") |
125 |
@(${EGREEN} "Creating object file: "${WHITE} "$@"; ${RESET}) |
@(${EGREEN} "Creating object file: "${WHITE} "$@"; ${RESET}) |
126 |
@${F77} ${F77FLAGS} -c -o $@ ${DIRSRC}/F77/`basename ${@} .o`.f -I${DIRINC}/F77 -I${NROOTINC} -I${PAM_YODA}/include/yoda |
@${F77} ${F77FLAGS} -c -o $@ ${DIRSRC}/F77/`basename ${@} .o`.f -I${DIRINC}/F77 -I${NROOTINC} -I${PAM_YODA}/include/yoda |
127 |
|
|
128 |
|
|
129 |
# .so from .o fortran |
# .so from .o fortran |
130 |
${LIBF77LIBS}: ${LIBF77OBJS} |
${LIBF77LIBS}: ${LIBF77OBJS} |
131 |
@(${EYELLOW} " F77 shared library --------------------------") |
@(${EYELLOW} " F77 shared library --------------------------") |
132 |
@(${EGREEN} "Creating library: "${WHITE} "$@"; ${RESET}) |
@(${EGREEN} "Creating library: "${WHITE} "$@"; ${RESET}) |
133 |
@${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ $^ -lg2c `cernlib mathlib` |
@${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ $^ -lg2c `doc/cernlib_pam mathlib` |
134 |
|
|
135 |
|
|
136 |
${LIBROOTLIBS}: ${LIBROOTSRCS} ${FOBJS} |
${LIBROOTLIBS}: ${LIBROOTSRCS} ${FOBJS} |
137 |
@(${EYELLOW} " ROOT library ------------------------") |
@(${EYELLOW} " ROOT library ------------------------") |
138 |
@(${EGREEN} "Creating file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp"; ${RESET}) |
@(${EGREEN} "Creating file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp"; ${RESET}) |
139 |
# |
# |
140 |
# Create *Dict.cpp and *Dict.h |
# Create *Dict.cpp and *Dict.h |
141 |
# |
# |
142 |
@${ROOTCINT} -f ${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp -c -I${ROOTINC} -I${PAM_YODA}/include/yoda/ -I${PAM_INC} ${DIRINC}/`basename $(@F) _${VER}.so | sed s/lib//`.h ${DIRINC}/`basename $(@F) _${VER}.so | sed s/lib//`LinkDef.h |
# @${ROOTCINT} -f ${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp -c -I${ROOTINC} -I${PAM_YODA}/include/yoda/ -I${PAM_INC} ${DIRINC}/`basename $(@F) _${VER}.so | sed s/lib//`.h ${DIRINC}/`basename $(@F) _${VER}.so | sed s/lib//`LinkDef.h |
143 |
# |
@${ROOTCINT} -f ${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp -c -I${PAM_INC} -I${ROOTINC} -I${PAM_YODA}/include/yoda/ ${DIRINC}/`basename $(@F) _${VER}.so | sed s/lib//`.h ${DIRINC}/`basename $(@F) _${VER}.so | sed s/lib//`LinkDef.h |
144 |
# create .o |
# |
145 |
# |
# order of include directories changed since RunInfo.h can be found (with completely different definition) in YODA while we want to load the DV one! |
146 |
@(${EGREEN} "Compiling file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`.cpp"; ${RESET}) |
# should be fixed some time changing names... |
147 |
@cd ${DIRSRC} &>/dev/null && ${CXX} ${CXXFLAGS} -c `basename $(@F) _${VER}.so | sed s/lib//`.cpp -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_INC} -I${PAM_YODA}/include/yoda/ -I${NROOTINC}; |
# |
148 |
@(${EGREEN} "Compiling file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp"; ${RESET}) |
# create .o |
149 |
@cd ${DIRSRC} &>/dev/null && ${CXX} ${CXXFLAGS} -c `basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_INC} -I${PAM_YODA}/include/yoda/ -I${NROOTINC}; |
# |
150 |
# |
@(${EGREEN} "Compiling file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`.cpp"; ${RESET}) |
151 |
# create .so |
@cd ${DIRSRC} &>/dev/null && ${CXX} ${CXXFLAGS} -c `basename $(@F) _${VER}.so | sed s/lib//`.cpp -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_INC} -I${PAM_YODA}/include/yoda/ -I${NROOTINC}; |
152 |
# |
@(${EGREEN} "Compiling file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp"; ${RESET}) |
153 |
@(${EGREEN} "Compiling shared library: "${WHITE} "$@"; ${RESET}) |
@cd ${DIRSRC} &>/dev/null && ${CXX} ${CXXFLAGS} -c `basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_INC} -I${PAM_YODA}/include/yoda/ -I${NROOTINC}; |
154 |
@${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ -lg2c -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_YODA}/include/yoda -I${PAM_INC} ${DIRTOP}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`.o ${DIRTOP}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.o ${LIBROOTOBJS} `cernlib mathlib` 1>/dev/null |
# |
155 |
# @ln -sf ${DIRTOP}/${DIRLIB}/$(@F) ${DIRTOP}/${DIRLIB}/$(patsubst %_${VER}.so,%.so,$(@F)) |
# create .so |
156 |
|
# |
157 |
${LIBCPPLIBS}: ${LIBCPPSRCS} |
@(${EGREEN} "Compiling shared library: "${WHITE} "$@"; ${RESET}) |
158 |
# |
@${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ -lg2c -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_YODA}/include/yoda -I${PAM_INC} ${DIRTOP}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`.o ${DIRTOP}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.o ${LIBROOTOBJS} `doc/cernlib_pam mathlib` 1>/dev/null |
159 |
# create .o |
# @ln -sf ${DIRTOP}/${DIRLIB}/$(@F) ${DIRTOP}/${DIRLIB}/$(patsubst %_${VER}.so,%.so,$(@F)) |
160 |
# |
|
161 |
@(${EGREEN} "Compiling file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`.cpp"; ${RESET}) |
${LIBCPPLIBS}: ${LIBCPPSRCS} |
162 |
@cd ${DIRSRC} &>/dev/null && ${CXX} ${CXXFLAGS} -c `basename $(@F) _${VER}.so | sed s/lib//`.cpp -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_YODA}/include/yoda/ -I${NROOTINC} -I${PAM_INC} ; |
# |
163 |
# |
# create .o |
164 |
# create .so |
# |
165 |
# |
@(${EGREEN} "Compiling file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`.cpp"; ${RESET}) |
166 |
@(${EGREEN} "Compiling shared library: "${WHITE} "$@"; ${RESET}) |
@cd ${DIRSRC} &>/dev/null && ${CXX} ${CXXFLAGS} -c `basename $(@F) _${VER}.so | sed s/lib//`.cpp -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_YODA}/include/yoda/ -I${NROOTINC} -I${PAM_INC} ; |
167 |
@${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ -lg2c -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_YODA}/include/yoda/ -I${PAM_INC} ${DIRTOP}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`.o 1>/dev/null |
# |
168 |
|
# create .so |
169 |
|
# |
170 |
${CXXEXELIBS}: ${COBJS} ${FOBJS} ${CXXEXEOBJS} |
@(${EGREEN} "Compiling shared library: "${WHITE} "$@"; ${RESET}) |
171 |
@(${EVIOLET} "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *") |
@${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ -lg2c -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_YODA}/include/yoda/ -I${PAM_INC} ${DIRTOP}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`.o 1>/dev/null |
172 |
@(${EGREEN} "Creating exec file: "${WHITE} "$@"; ${RESET}) |
|
173 |
@${CXX} ${CXXFLAGS} -o ${DIRBIN}/$@ ${DIRLIB}/$@.o -I${DIRTOP}/${DIRINC} -I${PAM_INC} -I${PAM_YODA}/include/yoda/ ${PAM_YODA}/lib/libyoda.so ${FOBJS} ${COBJS} ${FULLLIBS} ${OTHERLIBS} -lThread `root-config --cflags --glibs` `cernlib mathlib` ; |
|
174 |
|
${CXXEXELIBS}: ${COBJS} ${FOBJS} ${CXXEXEOBJS} |
175 |
# A small target to check environmental variables |
@(${EVIOLET} "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *") |
176 |
%_env: |
@(${EGREEN} "Creating exec file: "${WHITE} "$@"; ${RESET}) |
177 |
@${test_env} |
@${CXX} ${CXXFLAGS} -o ${DIRBIN}/$@ ${DIRLIB}/$@.o -I${DIRTOP}/${DIRINC} -I${PAM_INC} -I${PAM_YODA}/include/yoda/ ${PAM_YODA}/lib/libyoda.so ${FOBJS} ${COBJS} ${FULLLIBS} ${OTHERLIBS} -lThread `root-config --cflags --glibs` `doc/cernlib_pam mathlib` ; |
178 |
|
|
179 |
.PHONY: install installdoc installlib installmacros installinc installexe installcmacro |
# A small target to check environmental variables |
180 |
.PHONY: clean depclean info mkbindir mklibdir testcern testpamenv test |
%_env: |
181 |
|
@${test_env} |
182 |
mkbindir: ${DIRBIN} |
|
183 |
${DIRBIN}: |
.PHONY: install installdoc installlib installmacros installinc installexe installcmacro |
184 |
@${test_and_mk} |
.PHONY: clean depclean info mkbindir mklibdir testcern testpamenv test |
185 |
|
|
186 |
mklibdir: ${DIRLIB} |
mkbindir: ${DIRBIN} |
187 |
${DIRLIB}: |
${DIRBIN}: |
188 |
@${test_and_mk} |
@${test_and_mk} |
189 |
|
|
190 |
# Here what has to be deleted in clean target |
mklibdir: ${DIRLIB} |
191 |
clean: TOBEDEL= ${DIRSRC}/*.o ${DIRSRC}/*Dict.cpp ${DIRSRC}/*Dict.h ${FOBJS} ${FULLLIBS} ${DIRBIN}/${CXXEXELIBS} ${COBJS} ${CXXEXEOBJS} ${DIRSRC}/TrkVerl2.cpp |
${DIRLIB}: |
192 |
clean: |
@${test_and_mk} |
193 |
@${test_and_rm} |
|
194 |
|
# Here what has to be deleted in clean target |
195 |
distclean: clean |
clean: TOBEDEL= ${DIRSRC}/*.o ${DIRSRC}/*Dict.cpp ${DIRSRC}/*Dict.h ${FOBJS} ${FULLLIBS} ${DIRBIN}/${CXXEXELIBS} ${COBJS} ${CXXEXEOBJS} |
196 |
distclean: TOBEDEL= ${DIRBIN} ${DIRLIB} |
clean: |
197 |
distclean: |
@${test_and_rm} |
198 |
@${test_and_rm} |
|
199 |
|
distclean: clean |
200 |
forceinstall: FORCE=-f |
distclean: TOBEDEL= ${DIRBIN} ${DIRLIB} |
201 |
forceinstall: install |
distclean: |
202 |
|
@${test_and_rm} |
203 |
upgrade: FORCE=-u |
|
204 |
upgrade: install |
forceinstall: FORCE=-f |
205 |
|
forceinstall: install |
206 |
install: installlib installinc installmacros installcalib installdoc installexe installcmacro |
|
207 |
|
upgrade: FORCE=-u |
208 |
installlib: LINK=y |
upgrade: install |
209 |
installlib: TOBEMOVED= $(FULLLIBS:${DIRLIB}%=${PAM_LIB}%) |
|
210 |
installlib: ORIGIN=${DIRLIB} |
install: installlib installinc installmacros installcalib installdoc installexe installcmacro |
211 |
installlib: |
|
212 |
@${test_and_cp} |
installlib: LINK=y |
213 |
|
installlib: TOBEMOVED= $(FULLLIBS:${DIRLIB}%=${PAM_LIB}%) |
214 |
installcmacro: LINK=y |
installlib: ORIGIN=${DIRLIB} |
215 |
installcmacro: TOBEMOVED= $(FULLMACROCLIBS:${DIRLIB}%=${PAM_LIB}%) |
installlib: |
216 |
installcmacro: ORIGIN=${DIRLIB} |
@${test_and_cp} |
217 |
installcmacro: |
|
218 |
@${test_and_cp} |
installcmacro: LINK=y |
219 |
|
installcmacro: TOBEMOVED= $(FULLMACROCLIBS:${DIRLIB}%=${PAM_LIB}%) |
220 |
installinc: TOBEMOVED= $(INCSRCS:${DIRINC}/%=${PAM_INC}/%) |
installcmacro: ORIGIN=${DIRLIB} |
221 |
installinc: ORIGIN=${DIRINC} |
installcmacro: |
222 |
installinc: |
@${test_and_cp} |
223 |
@${test_and_cp} |
|
224 |
|
installinc: TOBEMOVED= $(INCSRCS:${DIRINC}/%=${PAM_INC}/%) |
225 |
installexe: TOBEMOVED= $(EXESRCS:${DIRBIN}/%=${PAM_BIN}/%) |
installinc: ORIGIN=${DIRINC} |
226 |
installexe: ORIGIN=${DIRBIN} |
installinc: |
227 |
installexe: |
@${test_and_cp} |
228 |
@${test_and_cp} |
|
229 |
|
installexe: TOBEMOVED= $(EXESRCS:${DIRBIN}/%=${PAM_BIN}/%) |
230 |
installmacros: TOBEMOVED= $(MACROSSRCS:${DIRMACROS}/%=${PAM_MACROS}/%) |
installexe: ORIGIN=${DIRBIN} |
231 |
installmacros: ORIGIN=${DIRMACROS} |
installexe: |
232 |
installmacros: |
@${test_and_cp} |
233 |
@${test_and_cp} |
|
234 |
|
installmacros: TOBEMOVED= $(MACROSSRCS:${DIRMACROS}/%=${PAM_MACROS}/%) |
235 |
installcalib: TOBEMOVED= $(CALIBFILES:${DIRCALIB}/%=${PAM_CALIB}/%) |
installmacros: ORIGIN=${DIRMACROS} |
236 |
installcalib: ORIGIN=${DIRCALIB} |
installmacros: |
237 |
installcalib: |
@${test_and_cp} |
238 |
@${test_and_cp} |
|
239 |
|
installcalib: TOBEMOVED= $(CALIBFILES:${DIRCALIB}/%=${PAM_CALIB}/%) |
240 |
installdoc: TOBEMOVED= $(DOCFILES:${DIRDOC}/%=${PAM_DOC}/%) |
installcalib: ORIGIN=${DIRCALIB} |
241 |
installdoc: ORIGIN=${DIRDOC} |
installcalib: |
242 |
installdoc: |
@${test_and_cp} |
243 |
@${test_and_cp} |
|
244 |
|
installdoc: TOBEMOVED= $(DOCFILES:${DIRDOC}/%=${PAM_DOC}/%) |
245 |
mkverpath: |
installdoc: ORIGIN=${DIRDOC} |
246 |
@echo '#include <TSystem.h>' > ${DIRTOP}/${DIRSRC}/TrkVerl2.cpp; echo ' void info(){ printf("\nTracker Level2 flight package version: ${VER}\n\nCompiled on '${TODAY}' with: '${GCCVER}'\n\nOn: '${UNAMEA}'\n\n"); }' >> ${DIRTOP}/${DIRSRC}/TrkVerl2.cpp |
installdoc: |
247 |
@sleep 0.8 |
@${test_and_cp} |
248 |
|
|
249 |
|
#mkverpath: |
250 |
|
# @echo '#include <TSystem.h>' > ${DIRTOP}/${DIRSRC}/TrkVerl2.cpp; echo ' void info(){ printf("\nTracker Level2 flight package version: ${VER}\n\nCompiled on '${TODAY}' with: '${GCCVER}'\n\nOn: '${UNAMEA}'\n\n"); }' >> ${DIRTOP}/${DIRSRC}/TrkVerl2.cpp |
251 |
info: |
# @sleep 0.8 |
252 |
@echo " " |
|
253 |
@${EGREEN} "Infos for package :" ${WHITE} ${PACKAGE} |
|
254 |
@${EGREEN} " VERSION :" ${WHITE} ${VER} |
|
255 |
@${EGREEN} " EXECUTABLES :" ${WHITE} ${EXECUTABLES} |
info: |
256 |
@${EGREEN} " INCLUDES :" ${WHITE} ${INCLUDE} |
@echo " " |
257 |
@${EGREEN} " LIBS :" ${WHITE} ${LIBS} |
@${EGREEN} "Infos for package :" ${WHITE} ${PACKAGE} |
258 |
@${EGREEN} " DOCS :" ${WHITE} ${DOCS} |
@${EGREEN} " VERSION :" ${WHITE} ${VER} |
259 |
@${EGREEN} " SRCS :" ${WHITE} ${SRCS} |
@${EGREEN} " EXECUTABLES :" ${WHITE} ${EXECUTABLES} |
260 |
@${EGREEN} " MACROS :" ${WHITE} ${MACROS} |
@${EGREEN} " INCLUDES :" ${WHITE} ${INCLUDE} |
261 |
@echo " " |
@${EGREEN} " LIBS :" ${WHITE} ${LIBS} |
262 |
@${RESET} |
@${EGREEN} " DOCS :" ${WHITE} ${DOCS} |
263 |
|
@${EGREEN} " SRCS :" ${WHITE} ${SRCS} |
264 |
test: testpamenv |
@${EGREEN} " MACROS :" ${WHITE} ${MACROS} |
265 |
|
@echo " " |
266 |
testpamenv: ${PAM_ENV} |
@${RESET} |
267 |
|
|
268 |
root-config: OPT=--cflags |
test: testpamenv |
269 |
root-config: |
|
270 |
@${test_cmd} |
testpamenv: ${PAM_ENV} |
271 |
|
|
272 |
# Here follows some usefull macros |
root-config: OPT=--cflags |
273 |
define test_and_cp |
root-config: |
274 |
wd=`pwd`;\ |
@${test_cmd} |
275 |
for i in ${TOBEMOVED} ; do \ |
|
276 |
wv=$${i##/*/}; \ |
# Here follows some usefull macros |
277 |
dest=$${i/$${wv}/}; \ |
define test_and_cp |
278 |
${EGREEN} "Testing for :" ${WHITE} "$${i}" ; ${RESET}; \ |
wd=`pwd`;\ |
279 |
if [ ! "${FORCE}" ] ; then \ |
for i in ${TOBEMOVED} ; do \ |
280 |
if [ ! -f $${i} ]; then \ |
wv=$${i##/*/}; \ |
281 |
${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
dest=$${i/$${wv}/}; \ |
282 |
${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \ |
${EGREEN} "Testing for :" ${WHITE} "$${i}" ; ${RESET}; \ |
283 |
cp ${ORIGIN}/$${i##/*/} $${i}; \ |
if [ ! "${FORCE}" ] ; then \ |
284 |
else \ |
if [ ! -f $${i} ]; then \ |
285 |
${ERED} "File already exist !!!! Please delete it " ${WHITE}; ${RESET}; \ |
${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
286 |
fi;\ |
${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \ |
287 |
else \ |
cp ${ORIGIN}/$${i##/*/} $${i}; \ |
288 |
if [ "${FORCE}" == "-u" ] ; then \ |
else \ |
289 |
if [ "`basename $${i}`" != "`basename $${i} _${VER}.so`" ]; then \ |
${ERED} "File already exist !!!! Please delete it " ${WHITE}; ${RESET}; \ |
290 |
${EYELLOW} "Removing: "${WHITE} ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so; ${RESET}; \ |
fi;\ |
291 |
rm -f ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so ; \ |
else \ |
292 |
${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
if [ "${FORCE}" == "-u" ] ; then \ |
293 |
${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \ |
if [ "`basename $${i}`" != "`basename $${i} _${VER}.so`" ]; then \ |
294 |
cp ${ORIGIN}/$${i##/*/} $${i}; \ |
${EYELLOW} "Removing: "${WHITE} ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so; ${RESET}; \ |
295 |
else \ |
rm -f ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so ; \ |
296 |
${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
297 |
${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \ |
${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \ |
298 |
cp -f ${ORIGIN}/$${i##/*/} $${i}; \ |
cp ${ORIGIN}/$${i##/*/} $${i}; \ |
299 |
fi; \ |
else \ |
300 |
else \ |
${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
301 |
${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \ |
302 |
${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \ |
cp -f ${ORIGIN}/$${i##/*/} $${i}; \ |
303 |
cp ${FORCE} ${ORIGIN}/$${i##/*/} $${i}; \ |
fi; \ |
304 |
fi;\ |
else \ |
305 |
fi ;\ |
${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
306 |
if [ ! -z ${LINK} ] ; then \ |
${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \ |
307 |
${EGREEN} "Creating symlink from : "${WHITE} $${wv/_${VER}/} ;\ |
cp ${FORCE} ${ORIGIN}/$${i##/*/} $${i}; \ |
308 |
${EGREEN} " to : "${WHITE} $${i##/*/} ; ${RESET}; \ |
fi;\ |
309 |
cd $${dest}; \ |
fi ;\ |
310 |
ln -sf $${wv} $${wv/_${VER}/}; \ |
if [ ! -z ${LINK} ] ; then \ |
311 |
cd $${wd}; \ |
${EGREEN} "Creating symlink from : "${WHITE} $${wv/_${VER}/} ;\ |
312 |
fi \ |
${EGREEN} " to : "${WHITE} $${i##/*/} ; ${RESET}; \ |
313 |
done |
cd $${dest}; \ |
314 |
endef |
ln -sf $${wv} $${wv/_${VER}/}; \ |
315 |
|
cd $${wd}; \ |
316 |
define test_and_mk |
fi \ |
317 |
${EGREEN} "Testing for :" ${WHITE} "$@"; ${RESET} |
done |
318 |
test -d "$@" || \ |
endef |
319 |
(${EGREEN} "Creating : "${WHITE} "$@"; ${RESET}; mkdir -p $@) |
|
320 |
endef |
define test_and_mk |
321 |
|
${EGREEN} "Testing for :" ${WHITE} "$@"; ${RESET} |
322 |
define test_env |
test -d "$@" || \ |
323 |
${EGREEN} "Testing for env:" ${WHITE} $(patsubst %_env,%,$@); ${RESET} |
(${EGREEN} "Creating : "${WHITE} "$@"; ${RESET}; mkdir -p $@) |
324 |
printenv $(patsubst %_env,%,$@) 1>/dev/null || \ |
endef |
325 |
(${ERED} "ERROR, variable : "${WHITE} $(patsubst %_env,%,$@) \ |
|
326 |
${RED} "not defined !!! Check your env. settings"; \ |
define test_env |
327 |
${RESET}; exit 1) |
${EGREEN} "Testing for env:" ${WHITE} $(patsubst %_env,%,$@); ${RESET} |
328 |
${EGREEN} " Defined:" ${WHITE} $${$(patsubst %_env,%,$@)}; ${RESET} |
printenv $(patsubst %_env,%,$@) 1>/dev/null || \ |
329 |
endef |
(${ERED} "ERROR, variable : "${WHITE} $(patsubst %_env,%,$@) \ |
330 |
|
${RED} "not defined !!! Check your env. settings"; \ |
331 |
define test_cmd |
${RESET}; exit 1) |
332 |
${EGREEN} "Testing for cmd:" ${WHITE} $@ ${OPT}; ${RESET} |
${EGREEN} " Defined:" ${WHITE} $${$(patsubst %_env,%,$@)}; ${RESET} |
333 |
$@ ${OPT} 1>/dev/null 2>&1 || \ |
endef |
334 |
(${ERED} "ERROR, command : "${WHITE} $@ ${OPT}\ |
|
335 |
${RED} "not found !!! Check your installation"; \ |
define test_cmd |
336 |
${RESET}; exit 1) |
${EGREEN} "Testing for cmd:" ${WHITE} $@ ${OPT}; ${RESET} |
337 |
${EGREEN} " Present:" ${WHITE} $@ ${OPT}; ${RESET} |
$@ ${OPT} 1>/dev/null 2>&1 || \ |
338 |
endef |
(${ERED} "ERROR, command : "${WHITE} $@ ${OPT}\ |
339 |
|
${RED} "not found !!! Check your installation"; \ |
340 |
define test_and_rm |
${RESET}; exit 1) |
341 |
for i in ${TOBEDEL}; do \ |
${EGREEN} " Present:" ${WHITE} $@ ${OPT}; ${RESET} |
342 |
test -d $${i} || (${ERED} "Removing file :"${WHITE} $${i}; ${RESET}; \ |
endef |
343 |
rm -f $${i} ); \ |
|
344 |
test ! -d $${i} || (${ERED} "Removing dir :"${WHITE} $${i}; ${RESET}; \ |
define test_and_rm |
345 |
rm -rf $${i} ); \ |
for i in ${TOBEDEL}; do \ |
346 |
done |
test -d $${i} || (${ERED} "Removing file :"${WHITE} $${i}; ${RESET}; \ |
347 |
endef |
rm -f $${i} ); \ |
348 |
|
test ! -d $${i} || (${ERED} "Removing dir :"${WHITE} $${i}; ${RESET}; \ |
349 |
|
rm -rf $${i} ); \ |
350 |
|
done |
351 |
|
endef |