1 |
# Flight quick look - FQLOOK |
# Tracker Flight quick look |
2 |
# SOFTWARE VERSION |
# SOFTWARE VERSION |
3 |
VER= v1r00 |
VER= v1r14 |
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' |
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 |
25 |
|
CC=gcc |
26 |
|
CFLAGS=-Wall -O -fPIC -pthread |
27 |
|
# Enviroment: |
28 |
|
GCCVER=`gcc --version | head -1` |
29 |
|
UNAMEA=`uname -a` |
30 |
|
TODAY=`date` |
31 |
|
# F77 |
32 |
|
F77=g77 |
33 |
|
F77FLAGS= -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -g -extend_source -static -fno-backslash |
34 |
# C++ |
# C++ |
35 |
CXX=g++ |
CXX=g++ |
36 |
CXXFLAGS=-Wall |
CXXFLAGS=-Wall -O -fPIC -pthread |
37 |
|
# ROOTCINT |
38 |
|
ROOTCINT=rootcint |
39 |
# Here the variables definig the local directories |
# Here the variables definig the local directories |
40 |
DIRTOP=${shell pwd} |
DIRTOP=${shell pwd} |
41 |
DIRLIB=lib |
DIRLIB=lib |
42 |
DIRBIN=bin |
DIRBIN=bin |
43 |
DIRSRC=src |
DIRSRC=src |
44 |
|
DIRINC=inc |
45 |
DIRDOC=doc |
DIRDOC=doc |
46 |
DIRMACROS=macros |
DIRMACROS=macros |
47 |
# Here the PAMELA environmental variables to be checked |
# Here the PAMELA environmental variables to be checked |
48 |
PAM_ENV= PAM_BIN_env PAM_LIB_env PAM_INC_env PAM_DOC_env PAM_MACROS_env PAM_CALIB_env PAM_YODA_env |
PAM_ENV= PAM_BIN_env PAM_LIB_env PAM_INC_env PAM_DOC_env PAM_MACROS_env PAM_YODA_env |
49 |
# Here the local variables used to build the targets |
# Here the local variables used to build the targets |
50 |
|
|
51 |
CXXEXESRCS=${DIRSRC}/TrackerQLookBasic.cpp \ |
MACROSRCS=${DIRMACROS}/FTrkQLook_BASIC.cxx \ |
52 |
${DIRSRC}/TrackerQLookExpert.cpp \ |
${DIRMACROS}/FTrkQLook_EXPERT.cxx \ |
53 |
${DIRSRC}/TrkCalibQLookBasic.cpp \ |
${DIRMACROS}/FTrkCalibQLook_BASIC.cxx \ |
54 |
${DIRSRC}/TrkCalibQLookExpert.cpp |
${DIRMACROS}/FTrkCalibQLook_EXPERT.cxx \ |
55 |
CXXEXELIBS=$(CXXEXESRCS:${DIRSRC}/%.cpp=%) |
${DIRMACROS}/FTrkScanQLook_EXPERT.cxx |
56 |
EXESRCS= ${DIRBIN}/TrackerQLookBasic ${DIRBIN}/TrackerQLookExpert ${DIRBIN}/TrkCalibQLookBasic ${DIRBIN}/TrkCalibQLookExpert |
MACROSLIBS=$(MACROSRCS:${DIRMACROS}/%.cxx=${DIRLIB}/lib%_${VER}.so) |
57 |
|
MACROCLIBS=libFTrkQLook_BASIC libFTrkQLook_EXPERT libFTrkCalibQLook_BASIC libFTrkCalibQLook_EXPERT libFTrkScanQLook_EXPERT |
58 |
|
FULLMACROCLIBS=$(MACROCLIBS:%=${DIRLIB}/%_${VER}.so) |
59 |
|
FULLLINKMACROCLIBS=$(MACROCLIBS:%=${DIRLIB}/%.so) |
60 |
|
|
61 |
|
CXXEXESRCS=${DIRSRC}/FTrkQLook_BASIC.cc \ |
62 |
|
${DIRSRC}/FTrkQLook_EXPERT.cc \ |
63 |
|
${DIRSRC}/FTrkCalibQLook_BASIC.cc \ |
64 |
|
${DIRSRC}/FTrkCalibQLook_EXPERT.cc \ |
65 |
|
${DIRSRC}/FTrkScanQLook_EXPERT.cc |
66 |
|
CXXEXEOBJS=$(CXXEXESRCS:${DIRSRC}%.cc=${DIRBIN}%.o) |
67 |
|
CXXEXELIBS:=FTrkQLook_BASIC FTrkQLook_EXPERT FTrkCalibQLook_BASIC FTrkCalibQLook_EXPERT FTrkScanQLook_EXPERT |
68 |
|
|
69 |
|
EXESRCS= ${DIRBIN}/FTrkQLook_BASIC ${DIRBIN}/FTrkQLook_EXPERT ${DIRBIN}/FTrkCalibQLook_BASIC ${DIRBIN}/FTrkCalibQLook_EXPERT ${DIRBIN}/FTrkScanQLook_EXPERT |
70 |
|
|
71 |
|
INCSRCS= |
72 |
|
|
73 |
|
MACROSSRCS=${DIRMACROS}/FTrkQLook_BASIC.C ${DIRMACROS}/FTrkQLook_EXPERT.C ${DIRMACROS}/FTrkCalibQLook_BASIC.C ${DIRMACROS}/FTrkCalibQLook_EXPERT.C ${DIRMACROS}/FTrkScanQLook_EXPERT.C |
74 |
|
|
75 |
DOCFILES=${DIRDOC}/FlightTrkQLook-OperatorManual.doc ${DIRDOC}/FlightTrkQLook-OperatorManual.pdf |
DOCFILES=${DIRDOC}/FlightTrkQLook-OperatorManual.doc ${DIRDOC}/FlightTrkQLook-OperatorManual.pdf |
76 |
|
|
81 |
DOCS= |
DOCS= |
82 |
SRCS= ${FSRCS} ${CRSCS} ${CXXEXESRCS} |
SRCS= ${FSRCS} ${CRSCS} ${CXXEXESRCS} |
83 |
MACROS= ${MACROSSRCS} |
MACROS= ${MACROSSRCS} |
|
NROOTINC=${shell root-config --incdir} |
|
84 |
# |
# |
85 |
TOBEDEL = |
TOBEDEL = junk |
86 |
|
ROOTINC=$$${shell root-config --incdir} |
87 |
# Let's start |
# Let's start |
88 |
all : test mkbindir mklibdir ${CXXEXELIBS} |
all : test mkbindir mklibdir ${MACROSLIBS} ${CXXEXELIBS} |
89 |
all: |
all: |
90 |
@echo -e ${GREEN} "" |
@echo -e ${GREEN} "" |
91 |
@(${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}) |
93 |
@${RESET} |
@${RESET} |
94 |
|
|
95 |
# Here some general rules to produce objects in our local dir |
# Here some general rules to produce objects in our local dir |
96 |
${CXXEXELIBS}: ${CXXEXESRCS} |
${DIRBIN}/%.o: ${DIRSRC}/%.cc |
97 |
|
@(${EGREEN} "Creating object file: "${WHITE} "$@"; ${RESET}) |
98 |
|
@cat ${DIRSRC}/`basename ${@} .o`.cc > ${DIRSRC}/temp.cc; |
99 |
|
@echo ' ' >> ${DIRSRC}/temp.cc |
100 |
|
@echo 'void info(){ printf("\nQLOOK flight package version: ${VER}\n\nCompiled on '${TODAY}' with: '${GCCVER}'\n\nOn: '${UNAMEA}'\n\n"); }' >> ${DIRSRC}/temp.cc |
101 |
|
@${CXX} ${CXXFLAGS} -c -o $@ ${DIRSRC}/temp.cc -I${DIRINC} -I${PAM_INC} -I${PAM_YODA}/include/yoda `root-config --cflags` |
102 |
|
|
103 |
|
|
104 |
|
${MACROSLIBS}: ${MACROSRCS} |
105 |
|
@(${EGREEN} "Compiling macro: "${WHITE} "$@"; ${RESET}) |
106 |
|
@${ROOTCINT} -f ${DIRMACROS}/`basename $(@F) _${VER}.so | sed s/lib//`link.cxx -c -I${ROOTINC} ${DIRINC}/`basename $(@F) _${VER}.so | sed s/lib//`func.h ${DIRINC}/`basename $(@F) _${VER}.so | sed s/lib//`LinkDef.h |
107 |
|
@${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ ${DIRMACROS}/`basename $(@F) _${VER}.so | sed s/lib//`.cxx ${DIRMACROS}/`basename $(@F) _${VER}.so | sed s/lib//`link.cxx -lg2c -I${PAM_INC} -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_YODA}/include/yoda ${PAM_YODA}/lib/libyoda.so `root-config --cflags --glibs` 1>/dev/null |
108 |
|
|
109 |
|
${CXXEXELIBS}: ${CXXEXEOBJS} |
110 |
@(${EGREEN} "Creating exec file: "${WHITE} "$@"; ${RESET}) |
@(${EGREEN} "Creating exec file: "${WHITE} "$@"; ${RESET}) |
111 |
${CXX} ${CXXFLAGS} -c ${DIRSRC}/$@.cpp -o ${DIRLIB}/$@.o -I${PAM_YODAINC} -I${PAM_YODASRC} -I${NROOTINC}; |
@${CXX} ${CXXFLAGS} -o ${DIRBIN}/$@ ${DIRBIN}/$@.o -I${DIRINC} -I${PAM_INC} -I${PAM_YODA}/include/yoda ${PAM_YODA}/lib/libyoda.so ${DIRTOP}/${DIRLIB}/lib$@_${VER}.so `root-config --cflags --glibs`; |
112 |
${CXX} ${CXXFLAGS} -o ${DIRBIN}/$@ ${DIRLIB}/$@.o -I${PAM_YODAINC} -I${PAM_YODASRC} ${PAM_YODA}/lib/libyoda.so `root-config --cflags --glibs`; |
@rm -f ${DIRSRC}/temp.cc |
113 |
|
|
114 |
# A small target to check environmental variables |
# A small target to check environmental variables |
115 |
%_env: |
%_env: |
116 |
@${test_env} |
@${test_env} |
117 |
|
|
118 |
.PHONY: install installdoc installexe |
.PHONY: install installdoc installlib installmacros installinc installexe installcmacro |
119 |
.PHONY: clean depclean info mklibdir testcern testpamenv test |
.PHONY: clean depclean info mkbindir mklibdir testcern testpamenv test |
120 |
|
|
121 |
mkbindir: ${DIRBIN} |
mkbindir: ${DIRBIN} |
122 |
${DIRBIN}: |
${DIRBIN}: |
127 |
@${test_and_mk} |
@${test_and_mk} |
128 |
|
|
129 |
# Here what has to be deleted in clean target |
# Here what has to be deleted in clean target |
130 |
clean: TOBEDEL= ${DIRBIN} |
clean: TOBEDEL= ${DIRMACROS}/*link.cxx ${DIRMACROS}/*link.h ${FOBJS} ${FULLLIBS} ${DIRBIN}/${CXXEXELIBS} ${DIRBIN}/${EXESRCS} ${COBJS} ${CXXEXEOBJS} ${FULLLINKFLIBS} ${FULLLINKCLIBS} ${FULLMACROCLIBS} ${FULLLINKMACROCLIBS} |
131 |
clean: |
clean: |
132 |
@${test_and_rm} |
@${test_and_rm} |
133 |
|
|
142 |
upgrade: FORCE=-u |
upgrade: FORCE=-u |
143 |
upgrade: install |
upgrade: install |
144 |
|
|
145 |
install: installdoc installexe |
install: installlib installinc installmacros installdoc installexe installcmacro |
146 |
|
|
147 |
|
installlib: LINK=y |
148 |
|
installlib: TOBEMOVED= $(FULLLIBS:${DIRLIB}%=${PAM_LIB}%) |
149 |
|
installlib: ORIGIN=${DIRLIB} |
150 |
|
installlib: |
151 |
|
@${test_and_cp} |
152 |
|
|
153 |
|
installcmacro: LINK=y |
154 |
|
installcmacro: TOBEMOVED= $(FULLMACROCLIBS:${DIRLIB}%=${PAM_LIB}%) |
155 |
|
installcmacro: ORIGIN=${DIRLIB} |
156 |
|
installcmacro: |
157 |
|
@${test_and_cp} |
158 |
|
|
159 |
|
installinc: TOBEMOVED= $(INCSRCS:${DIRINC}/%=${PAM_INC}/%) |
160 |
|
installinc: ORIGIN=${DIRINC} |
161 |
|
installinc: |
162 |
|
@${test_and_cp} |
163 |
|
|
164 |
installexe: TOBEMOVED= $(EXESRCS:${DIRBIN}/%=${PAM_BIN}/%) |
installexe: TOBEMOVED= $(EXESRCS:${DIRBIN}/%=${PAM_BIN}/%) |
165 |
installexe: ORIGIN=${DIRBIN} |
installexe: ORIGIN=${DIRBIN} |
166 |
installexe: |
installexe: |
167 |
@${test_and_cp} |
@${test_and_cp} |
168 |
|
|
169 |
|
installmacros: TOBEMOVED= $(MACROSSRCS:${DIRMACROS}/%=${PAM_MACROS}/%) |
170 |
|
installmacros: ORIGIN=${DIRMACROS} |
171 |
|
installmacros: |
172 |
|
@${test_and_cp} |
173 |
|
|
174 |
installdoc: TOBEMOVED= $(DOCFILES:${DIRDOC}/%=${PAM_DOC}/%) |
installdoc: TOBEMOVED= $(DOCFILES:${DIRDOC}/%=${PAM_DOC}/%) |
175 |
installdoc: ORIGIN=${DIRDOC} |
installdoc: ORIGIN=${DIRDOC} |
176 |
installdoc: |
installdoc: |