1 |
# Calorimeter flight analysis software |
# Calorimeter flight analysis software |
2 |
# SOFTWARE VERSION |
# SOFTWARE VERSION |
3 |
VER= v0r01 |
VER= v3r01 |
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 |
27 |
#CFLAGS=-Wall -O -fPIC -pthread |
#CFLAGS=-Wall -O -fPIC -pthread |
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 |
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 |
36 |
# C++ |
# C++ |
37 |
CXX=g++ |
CXX=g++ |
38 |
CXXFLAGS=-Wall -O -fPIC -pthread -g |
#CXXFLAGS=-Wall -O -fPIC -pthread -g |
39 |
#CXXFLAGS=-Wall -O -fPIC -pthread |
CXXFLAGS=-Wall -O -fPIC -pthread |
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 |
# |
# |
144 |
# create .o |
# create .o |
145 |
# |
# |
146 |
@(${EGREEN} "Compiling file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`.cpp"; ${RESET}) |
@(${EGREEN} "Compiling file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`.cpp"; ${RESET}) |
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}; |
@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}) |
@(${EGREEN} "Compiling file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp"; ${RESET}) |
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}; |
@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 |
# |
# |
151 |
# create .so |
# create .so |
152 |
# |
# |
153 |
@(${EGREEN} "Compiling shared library: "${WHITE} "$@"; ${RESET}) |
@(${EGREEN} "Compiling shared library: "${WHITE} "$@"; ${RESET}) |
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 |
@${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 |
155 |
# @ln -sf ${DIRTOP}/${DIRLIB}/$(@F) ${DIRTOP}/${DIRLIB}/$(patsubst %_${VER}.so,%.so,$(@F)) |
# @ln -sf ${DIRTOP}/${DIRLIB}/$(@F) ${DIRTOP}/${DIRLIB}/$(patsubst %_${VER}.so,%.so,$(@F)) |
156 |
|
|
157 |
${LIBCPPLIBS}: ${LIBCPPSRCS} |
${LIBCPPLIBS}: ${LIBCPPSRCS} |
158 |
# |
# |
159 |
# create .o |
# create .o |
160 |
# |
# |
161 |
@(${EGREEN} "Compiling file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`.cpp"; ${RESET}) |
@(${EGREEN} "Compiling file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`.cpp"; ${RESET}) |
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} ; |
@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 |
# |
# |
164 |
# create .so |
# create .so |
165 |
# |
# |
166 |
@(${EGREEN} "Compiling shared library: "${WHITE} "$@"; ${RESET}) |
@(${EGREEN} "Compiling shared library: "${WHITE} "$@"; ${RESET}) |
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 |
@${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 |
|
|
169 |
|
|
170 |
${CXXEXELIBS}: ${COBJS} ${FOBJS} ${CXXEXEOBJS} |
${CXXEXELIBS}: ${COBJS} ${FOBJS} ${CXXEXEOBJS} |
171 |
@(${EVIOLET} "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *") |
@(${EVIOLET} "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *") |
172 |
@(${EGREEN} "Creating exec file: "${WHITE} "$@"; ${RESET}) |
@(${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` ; |
@${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` ; |
174 |
|
|
175 |
# A small target to check environmental variables |
# A small target to check environmental variables |
176 |
%_env: |
%_env: |
177 |
@${test_env} |
@${test_env} |
178 |
|
|
179 |
.PHONY: install installdoc installlib installmacros installinc installexe installcmacro |
.PHONY: install installdoc installlib installmacros installinc installexe installcmacro |
180 |
.PHONY: clean depclean info mkbindir mklibdir testcern testpamenv test |
.PHONY: clean depclean info mkbindir mklibdir testcern testpamenv test |
181 |
|
|
182 |
mkbindir: ${DIRBIN} |
mkbindir: ${DIRBIN} |
183 |
${DIRBIN}: |
${DIRBIN}: |
184 |
@${test_and_mk} |
@${test_and_mk} |
185 |
|
|
186 |
mklibdir: ${DIRLIB} |
mklibdir: ${DIRLIB} |
187 |
${DIRLIB}: |
${DIRLIB}: |
188 |
@${test_and_mk} |
@${test_and_mk} |
189 |
|
|
190 |
# Here what has to be deleted in clean target |
# Here what has to be deleted in clean target |
191 |
clean: TOBEDEL= ${DIRSRC}/*.o ${DIRSRC}/*Dict.cpp ${DIRSRC}/*Dict.h ${FOBJS} ${FULLLIBS} ${DIRBIN}/${CXXEXELIBS} ${COBJS} ${CXXEXEOBJS} ${DIRSRC}/TrkVerl2.cpp |
clean: TOBEDEL= ${DIRSRC}/*.o ${DIRSRC}/*Dict.cpp ${DIRSRC}/*Dict.h ${FOBJS} ${FULLLIBS} ${DIRBIN}/${CXXEXELIBS} ${COBJS} ${CXXEXEOBJS} |
192 |
clean: |
clean: |
193 |
@${test_and_rm} |
@${test_and_rm} |
194 |
|
|
195 |
distclean: clean |
distclean: clean |
196 |
distclean: TOBEDEL= ${DIRBIN} ${DIRLIB} |
distclean: TOBEDEL= ${DIRBIN} ${DIRLIB} |
197 |
distclean: |
distclean: |
198 |
@${test_and_rm} |
@${test_and_rm} |
199 |
|
|
200 |
forceinstall: FORCE=-f |
forceinstall: FORCE=-f |
201 |
forceinstall: install |
forceinstall: install |
202 |
|
|
203 |
upgrade: FORCE=-u |
upgrade: FORCE=-u |
204 |
upgrade: install |
upgrade: install |
205 |
|
|
206 |
install: installlib installinc installmacros installcalib installdoc installexe installcmacro |
install: installlib installinc installmacros installcalib installdoc installexe installcmacro |
207 |
|
|
208 |
installlib: LINK=y |
installlib: LINK=y |
209 |
installlib: TOBEMOVED= $(FULLLIBS:${DIRLIB}%=${PAM_LIB}%) |
installlib: TOBEMOVED= $(FULLLIBS:${DIRLIB}%=${PAM_LIB}%) |
210 |
installlib: ORIGIN=${DIRLIB} |
installlib: ORIGIN=${DIRLIB} |
211 |
installlib: |
installlib: |
212 |
@${test_and_cp} |
@${test_and_cp} |
213 |
|
|
214 |
installcmacro: LINK=y |
installcmacro: LINK=y |
215 |
installcmacro: TOBEMOVED= $(FULLMACROCLIBS:${DIRLIB}%=${PAM_LIB}%) |
installcmacro: TOBEMOVED= $(FULLMACROCLIBS:${DIRLIB}%=${PAM_LIB}%) |
216 |
installcmacro: ORIGIN=${DIRLIB} |
installcmacro: ORIGIN=${DIRLIB} |
217 |
installcmacro: |
installcmacro: |
218 |
@${test_and_cp} |
@${test_and_cp} |
219 |
|
|
220 |
installinc: TOBEMOVED= $(INCSRCS:${DIRINC}/%=${PAM_INC}/%) |
installinc: TOBEMOVED= $(INCSRCS:${DIRINC}/%=${PAM_INC}/%) |
221 |
installinc: ORIGIN=${DIRINC} |
installinc: ORIGIN=${DIRINC} |
222 |
installinc: |
installinc: |
223 |
@${test_and_cp} |
@${test_and_cp} |
224 |
|
|
225 |
installexe: TOBEMOVED= $(EXESRCS:${DIRBIN}/%=${PAM_BIN}/%) |
installexe: TOBEMOVED= $(EXESRCS:${DIRBIN}/%=${PAM_BIN}/%) |
226 |
installexe: ORIGIN=${DIRBIN} |
installexe: ORIGIN=${DIRBIN} |
227 |
installexe: |
installexe: |
228 |
@${test_and_cp} |
@${test_and_cp} |
229 |
|
|
230 |
installmacros: TOBEMOVED= $(MACROSSRCS:${DIRMACROS}/%=${PAM_MACROS}/%) |
installmacros: TOBEMOVED= $(MACROSSRCS:${DIRMACROS}/%=${PAM_MACROS}/%) |
231 |
installmacros: ORIGIN=${DIRMACROS} |
installmacros: ORIGIN=${DIRMACROS} |
232 |
installmacros: |
installmacros: |
233 |
@${test_and_cp} |
@${test_and_cp} |
234 |
|
|
235 |
installcalib: TOBEMOVED= $(CALIBFILES:${DIRCALIB}/%=${PAM_CALIB}/%) |
installcalib: TOBEMOVED= $(CALIBFILES:${DIRCALIB}/%=${PAM_CALIB}/%) |
236 |
installcalib: ORIGIN=${DIRCALIB} |
installcalib: ORIGIN=${DIRCALIB} |
237 |
installcalib: |
installcalib: |
238 |
@${test_and_cp} |
@${test_and_cp} |
239 |
|
|
240 |
installdoc: TOBEMOVED= $(DOCFILES:${DIRDOC}/%=${PAM_DOC}/%) |
installdoc: TOBEMOVED= $(DOCFILES:${DIRDOC}/%=${PAM_DOC}/%) |
241 |
installdoc: ORIGIN=${DIRDOC} |
installdoc: ORIGIN=${DIRDOC} |
242 |
installdoc: |
installdoc: |
243 |
@${test_and_cp} |
@${test_and_cp} |
244 |
|
|
245 |
mkverpath: |
#mkverpath: |
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 |
# @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 |
247 |
@sleep 0.8 |
# @sleep 0.8 |
248 |
|
|
249 |
|
|
250 |
|
|
251 |
info: |
info: |
252 |
@echo " " |
@echo " " |
253 |
@${EGREEN} "Infos for package :" ${WHITE} ${PACKAGE} |
@${EGREEN} "Infos for package :" ${WHITE} ${PACKAGE} |
254 |
@${EGREEN} " VERSION :" ${WHITE} ${VER} |
@${EGREEN} " VERSION :" ${WHITE} ${VER} |
255 |
@${EGREEN} " EXECUTABLES :" ${WHITE} ${EXECUTABLES} |
@${EGREEN} " EXECUTABLES :" ${WHITE} ${EXECUTABLES} |
256 |
@${EGREEN} " INCLUDES :" ${WHITE} ${INCLUDE} |
@${EGREEN} " INCLUDES :" ${WHITE} ${INCLUDE} |
257 |
@${EGREEN} " LIBS :" ${WHITE} ${LIBS} |
@${EGREEN} " LIBS :" ${WHITE} ${LIBS} |
258 |
@${EGREEN} " DOCS :" ${WHITE} ${DOCS} |
@${EGREEN} " DOCS :" ${WHITE} ${DOCS} |
259 |
@${EGREEN} " SRCS :" ${WHITE} ${SRCS} |
@${EGREEN} " SRCS :" ${WHITE} ${SRCS} |
260 |
@${EGREEN} " MACROS :" ${WHITE} ${MACROS} |
@${EGREEN} " MACROS :" ${WHITE} ${MACROS} |
261 |
@echo " " |
@echo " " |
262 |
@${RESET} |
@${RESET} |
263 |
|
|
264 |
test: testpamenv |
test: testpamenv |
265 |
|
|
266 |
testpamenv: ${PAM_ENV} |
testpamenv: ${PAM_ENV} |
267 |
|
|
268 |
root-config: OPT=--cflags |
root-config: OPT=--cflags |
269 |
root-config: |
root-config: |
270 |
@${test_cmd} |
@${test_cmd} |
271 |
|
|
272 |
# Here follows some usefull macros |
# Here follows some usefull macros |
273 |
define test_and_cp |
define test_and_cp |
274 |
wd=`pwd`;\ |
wd=`pwd`;\ |
275 |
for i in ${TOBEMOVED} ; do \ |
for i in ${TOBEMOVED} ; do \ |
276 |
wv=$${i##/*/}; \ |
wv=$${i##/*/}; \ |
277 |
dest=$${i/$${wv}/}; \ |
dest=$${i/$${wv}/}; \ |
278 |
${EGREEN} "Testing for :" ${WHITE} "$${i}" ; ${RESET}; \ |
${EGREEN} "Testing for :" ${WHITE} "$${i}" ; ${RESET}; \ |
279 |
if [ ! "${FORCE}" ] ; then \ |
if [ ! "${FORCE}" ] ; then \ |
280 |
if [ ! -f $${i} ]; then \ |
if [ ! -f $${i} ]; then \ |
281 |
${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
282 |
${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \ |
${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \ |
283 |
cp ${ORIGIN}/$${i##/*/} $${i}; \ |
cp ${ORIGIN}/$${i##/*/} $${i}; \ |
284 |
else \ |
else \ |
285 |
${ERED} "File already exist !!!! Please delete it " ${WHITE}; ${RESET}; \ |
${ERED} "File already exist !!!! Please delete it " ${WHITE}; ${RESET}; \ |
286 |
fi;\ |
fi;\ |
287 |
else \ |
else \ |
288 |
if [ "${FORCE}" == "-u" ] ; then \ |
if [ "${FORCE}" == "-u" ] ; then \ |
289 |
if [ "`basename $${i}`" != "`basename $${i} _${VER}.so`" ]; then \ |
if [ "`basename $${i}`" != "`basename $${i} _${VER}.so`" ]; then \ |
290 |
${EYELLOW} "Removing: "${WHITE} ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so; ${RESET}; \ |
${EYELLOW} "Removing: "${WHITE} ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so; ${RESET}; \ |
291 |
rm -f ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so ; \ |
rm -f ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so ; \ |
292 |
${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
293 |
${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \ |
${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \ |
294 |
cp ${ORIGIN}/$${i##/*/} $${i}; \ |
cp ${ORIGIN}/$${i##/*/} $${i}; \ |
295 |
else \ |
else \ |
296 |
${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
297 |
${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \ |
${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \ |
298 |
cp -f ${ORIGIN}/$${i##/*/} $${i}; \ |
cp -f ${ORIGIN}/$${i##/*/} $${i}; \ |
299 |
fi; \ |
fi; \ |
300 |
else \ |
else \ |
301 |
${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\ |
302 |
${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \ |
${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \ |
303 |
cp ${FORCE} ${ORIGIN}/$${i##/*/} $${i}; \ |
cp ${FORCE} ${ORIGIN}/$${i##/*/} $${i}; \ |
304 |
fi;\ |
fi;\ |
305 |
fi ;\ |
fi ;\ |
306 |
if [ ! -z ${LINK} ] ; then \ |
if [ ! -z ${LINK} ] ; then \ |
307 |
${EGREEN} "Creating symlink from : "${WHITE} $${wv/_${VER}/} ;\ |
${EGREEN} "Creating symlink from : "${WHITE} $${wv/_${VER}/} ;\ |
308 |
${EGREEN} " to : "${WHITE} $${i##/*/} ; ${RESET}; \ |
${EGREEN} " to : "${WHITE} $${i##/*/} ; ${RESET}; \ |
309 |
cd $${dest}; \ |
cd $${dest}; \ |
310 |
ln -sf $${wv} $${wv/_${VER}/}; \ |
ln -sf $${wv} $${wv/_${VER}/}; \ |
311 |
cd $${wd}; \ |
cd $${wd}; \ |
312 |
fi \ |
fi \ |
313 |
done |
done |
314 |
endef |
endef |
315 |
|
|
316 |
define test_and_mk |
define test_and_mk |
317 |
${EGREEN} "Testing for :" ${WHITE} "$@"; ${RESET} |
${EGREEN} "Testing for :" ${WHITE} "$@"; ${RESET} |
318 |
test -d "$@" || \ |
test -d "$@" || \ |
319 |
(${EGREEN} "Creating : "${WHITE} "$@"; ${RESET}; mkdir -p $@) |
(${EGREEN} "Creating : "${WHITE} "$@"; ${RESET}; mkdir -p $@) |
320 |
endef |
endef |
321 |
|
|
322 |
define test_env |
define test_env |
323 |
${EGREEN} "Testing for env:" ${WHITE} $(patsubst %_env,%,$@); ${RESET} |
${EGREEN} "Testing for env:" ${WHITE} $(patsubst %_env,%,$@); ${RESET} |
324 |
printenv $(patsubst %_env,%,$@) 1>/dev/null || \ |
printenv $(patsubst %_env,%,$@) 1>/dev/null || \ |
325 |
(${ERED} "ERROR, variable : "${WHITE} $(patsubst %_env,%,$@) \ |
(${ERED} "ERROR, variable : "${WHITE} $(patsubst %_env,%,$@) \ |
326 |
${RED} "not defined !!! Check your env. settings"; \ |
${RED} "not defined !!! Check your env. settings"; \ |
327 |
${RESET}; exit 1) |
${RESET}; exit 1) |
328 |
${EGREEN} " Defined:" ${WHITE} $${$(patsubst %_env,%,$@)}; ${RESET} |
${EGREEN} " Defined:" ${WHITE} $${$(patsubst %_env,%,$@)}; ${RESET} |
329 |
endef |
endef |
330 |
|
|
331 |
define test_cmd |
define test_cmd |
332 |
${EGREEN} "Testing for cmd:" ${WHITE} $@ ${OPT}; ${RESET} |
${EGREEN} "Testing for cmd:" ${WHITE} $@ ${OPT}; ${RESET} |
333 |
$@ ${OPT} 1>/dev/null 2>&1 || \ |
$@ ${OPT} 1>/dev/null 2>&1 || \ |
334 |
(${ERED} "ERROR, command : "${WHITE} $@ ${OPT}\ |
(${ERED} "ERROR, command : "${WHITE} $@ ${OPT}\ |
335 |
${RED} "not found !!! Check your installation"; \ |
${RED} "not found !!! Check your installation"; \ |
336 |
${RESET}; exit 1) |
${RESET}; exit 1) |
337 |
${EGREEN} " Present:" ${WHITE} $@ ${OPT}; ${RESET} |
${EGREEN} " Present:" ${WHITE} $@ ${OPT}; ${RESET} |
338 |
endef |
endef |
339 |
|
|
340 |
define test_and_rm |
define test_and_rm |
341 |
for i in ${TOBEDEL}; do \ |
for i in ${TOBEDEL}; do \ |
342 |
test -d $${i} || (${ERED} "Removing file :"${WHITE} $${i}; ${RESET}; \ |
test -d $${i} || (${ERED} "Removing file :"${WHITE} $${i}; ${RESET}; \ |
343 |
rm -f $${i} ); \ |
rm -f $${i} ); \ |
344 |
test ! -d $${i} || (${ERED} "Removing dir :"${WHITE} $${i}; ${RESET}; \ |
test ! -d $${i} || (${ERED} "Removing dir :"${WHITE} $${i}; ${RESET}; \ |
345 |
rm -rf $${i} ); \ |
rm -rf $${i} ); \ |
346 |
done |
done |
347 |
endef |
endef |