1 |
#Orbital Information for flight analysis software |
#Orbital Information for flight analysis software |
2 |
# SOFTWARE VERSION |
# SOFTWARE VERSION |
3 |
VER= v0r02 |
VER= v3r00 |
4 |
# An almost general purpouse Makefile for PAMELA repository |
# |
5 |
# Let's start with some usefull definition for colorize the echo |
include ../Make.def |
|
RED='\E[1;31;40m' |
|
|
GREEN='\E[1;32;40m' |
|
|
YELLOW='\E[1;33;40m' |
|
|
BLUE='\E[1;34;40m' |
|
|
WHITE='\E[1;37;40m' |
|
|
VIOLET='\E[1;35;40m' |
|
|
CYAN='\E[1;36;40m' |
|
|
# Here the echo definition to use them |
|
|
EVIOLET=echo -e ${VIOLET} |
|
|
ECYAN=echo -e ${CYAN} |
|
|
ERED=echo -e ${RED} |
|
|
EGREEN=echo -e ${GREEN} |
|
|
EYELLOW=echo -e ${YELLOW} |
|
|
EBLUE=echo -e ${BLUE} |
|
|
EWHITE=echo -e ${WHITE} |
|
|
# Reset the terminal |
|
|
RESET=tput sgr0 |
|
|
# Here the variables used to override the standard make flags |
|
|
# C |
|
|
CC=gcc |
|
|
#CFLAGS=-Wall -O -fPIC -pthread -g |
|
|
CFLAGS=-Wall -O -fPIC -pthread |
|
|
# Enviroment: |
|
|
GCCVER=`gcc --version | head -1` |
|
|
UNAMEA=`uname -a` |
|
|
TODAY=`date` |
|
|
# F77 |
|
|
F77=g77 |
|
|
#F77FLAGS= -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -g -extend_source -static -fno-backslash |
|
|
F77FLAGS= -Wall -Wno-globals -fvxt -fno-automatic -fbounds-check -extend_source -static -fno-backslash |
|
|
# C++ |
|
|
CXX=g++ |
|
|
#CXXFLAGS=-Wall -O -fPIC -pthread -g |
|
|
CXXFLAGS=-Wall -O -fPIC -pthread |
|
|
# ROOTCINT |
|
|
ROOTCINT=rootcint |
|
6 |
# Here the variables definig the local directories |
# Here the variables definig the local directories |
7 |
DIRTOP=${shell pwd} |
DIRTOP=${shell pwd} |
8 |
DIRLIB=../lib/${ARCH} |
DIRLIB=../lib/${ARCH} |
19 |
|
|
20 |
# Here the local variables used to build the targets |
# Here the local variables used to build the targets |
21 |
# -- F77 - no libraries -- |
# -- F77 - no libraries -- |
22 |
FSRCS= |
FSRCS=${DIRSRC}/igrf_sub.for |
23 |
FOBJS=$(FSRCS:${DIRSRC}%.for=${DIRLIB}%.o) |
FOBJS=$(FSRCS:${DIRSRC}%.for=${DIRLIB}%.o) |
24 |
|
|
25 |
# -- CPP - no libraries -- |
# -- CPP - no libraries -- |
31 |
COBJS=$(CSRCS:${DIRSRC}%.c=${DIRLIB}%.o) |
COBJS=$(CSRCS:${DIRSRC}%.c=${DIRLIB}%.o) |
32 |
|
|
33 |
# -- CPP - ROOT libraries -- |
# -- CPP - ROOT libraries -- |
34 |
LIBROOTSRCS=${DIRSRC}/OrbitalInfo.cpp |
LIBROOTSRCS=${DIRSRC}/OrbitalInfo.cpp \ |
35 |
|
${DIRSRC}/InclinationInfo.cpp \ |
36 |
|
${DIRSRC}/OrientationInfo.cpp |
37 |
|
|
38 |
LIBROOTLIBS=$(LIBROOTSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so) |
LIBROOTLIBS=$(LIBROOTSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so) |
39 |
LIBROOTCLIBS=libOrbitalInfo |
LIBROOTCLIBS=libOrbitalInfo libInclinationInfo libOrientationInfo |
40 |
FULLROOTCLIBS=$(LIBROOTCLIBS:%=${DIRLIB}/%_${VER}.so) |
FULLROOTCLIBS=$(LIBROOTCLIBS:%=${DIRLIB}/%_${VER}.so) |
41 |
|
|
42 |
# -- CPP - NON-ROOT libraries -- |
# -- CPP - NON-ROOT libraries -- |
55 |
#TRKOBJS=${DIRTOP}/../lib2/libTrkLevel2.so ${DIRTOP}/../lib2/libtrack.so |
#TRKOBJS=${DIRTOP}/../lib2/libTrkLevel2.so ${DIRTOP}/../lib2/libtrack.so |
56 |
#TRKOBJS=${PAM_LIB}/libTrkLevel2.so ${PAM_LIB}/libtrack.so ${PAM_LIB}/libreadB.so ${PAM_LIB}/libinterB.so ${PAM_LIB}/libGLTables.so ${PAM_LIB}/libRunInfo.so |
#TRKOBJS=${PAM_LIB}/libTrkLevel2.so ${PAM_LIB}/libtrack.so ${PAM_LIB}/libreadB.so ${PAM_LIB}/libinterB.so ${PAM_LIB}/libGLTables.so ${PAM_LIB}/libRunInfo.so |
57 |
#TRKOBJS= |
#TRKOBJS= |
58 |
OTHERLIBS=${DIRLIB}/libGLTables.so ${DIRLIB}/libRunInfo.so |
OTHERLIBS=${PAM_LIB}/libGLTables.so ${DIRLIB}/libRunInfo.so ${DIRLIB}/libToFLevel2.so |
59 |
# -- directory where to find tracker headers needed to compile |
# -- directory where to find tracker headers needed to compile |
60 |
#TRKHEAD=${DIRTOP}/../tracker/inc |
#TRKHEAD=${DIRTOP}/../tracker/inc |
61 |
#TRKHEAD=${PAM_INC} |
#TRKHEAD=${PAM_INC} |
62 |
SUBDIR=../GLTables ../RunInfo |
SUBDIR=../RunInfo ../ToFLevel2 ../TrackerLevel2 ../TriggerLevel2 |
63 |
SUBINC=$(shell for dir in `echo ${SUBDIR}`; do echo -I$${dir}/inc; done) |
SUBINC=$(shell for dir in `echo ${SUBDIR}`; do echo -I$${dir}/inc; done) |
64 |
|
|
65 |
# List of all libraries we want to install |
# List of all libraries we want to install |
68 |
# Other objects to install |
# Other objects to install |
69 |
EXESRCS=${DIRBIN}/OrbitalInfoLevel2 |
EXESRCS=${DIRBIN}/OrbitalInfoLevel2 |
70 |
|
|
71 |
INCSRCS=${DIRINC}/OrbitalInfo.h |
INCSRCS=${DIRINC}/OrbitalInfo.h ${DIRINC}/OrbitalInfoStruct.h ${DIRINC}/InclinationInfo.h ${DIRINC}/OrientationInfo.h |
72 |
|
|
73 |
MACROSSRCS= |
MACROSSRCS= |
74 |
|
|
93 |
#all: test mkbindir mklibdir mkverpath ${FOBJS} ${CPPOBJS} ${LIBROOTLIBS} ${LIBCPPLIBS} ${CXXEXELIBS} |
#all: test mkbindir mklibdir mkverpath ${FOBJS} ${CPPOBJS} ${LIBROOTLIBS} ${LIBCPPLIBS} ${CXXEXELIBS} |
94 |
all: prepare libs |
all: prepare libs |
95 |
all: |
all: |
96 |
@echo -e ${GREEN} "" |
# @echo -e ${GREEN} "" |
97 |
@(${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}) |
98 |
@echo -e ${GREEN} "" |
@echo -e ${GREEN} "" |
99 |
@${RESET} |
@${RESET} |
100 |
|
|
106 |
|
|
107 |
libs: prepare ${LIBROOTLIBS} ${LIBCPPLIBS} |
libs: prepare ${LIBROOTLIBS} ${LIBCPPLIBS} |
108 |
|
|
109 |
# Here some general rules to produce objects in our local dir |
include ../Make.dect |
|
${DIRLIB}/%.o: ${DIRSRC}/%.cpp |
|
|
@(${EGREEN} "Creating CPP object file: "${WHITE} "`basename $@`"; ${RESET}) |
|
|
@${CXX} ${CXXFLAGS} -c -o $@ ${DIRSRC}/`basename ${@} .o`.cpp -I${DIRINC} ${SUBINC} -I${PAM_YODA}/include/yoda/ -I${PAM_YODA}/include/utils/ `root-config --cflags` |
|
|
|
|
|
${DIRLIB}/%.o: ${DIRSRC}/%.c |
|
|
@(${EGREEN} "Creating C object file: "${WHITE} "`basename $@`"; ${RESET}) |
|
|
@${CXX} ${CXXFLAGS} -c -o $@ ${DIRSRC}/`basename ${@} .o`.c -I${DIRINC} ${SUBINC} -I${PAM_YODA}/include/yoda/ `root-config --cflags` |
|
|
|
|
|
${DIRLIB}/%.o: ${DIRSRC}/%.for |
|
|
@(${EGREEN} "Creating F77 object file: "${WHITE} "`basename $@`"; ${RESET}) |
|
|
@${F77} ${F77FLAGS} -c -o $@ ${DIRSRC}/`basename ${@} .o`.for -I${DIRINC} |
|
|
|
|
|
${LIBROOTLIBS}: ${LIBROOTSRCS} |
|
|
@(${EGREEN} "ROOTCINT - creating file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp"; ${RESET}) |
|
|
# |
|
|
# Create *Dict.cpp and *Dict.h |
|
|
# |
|
|
@${ROOTCINT} -f ${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp -c -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 |
|
|
# |
|
|
# create .o |
|
|
# |
|
|
@(${EGREEN} "Compiling CPP file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`.cpp"; ${RESET}) |
|
|
@${CXX} ${CXXFLAGS} -c ${DIRTOP}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`.cpp -o ${DIRTOP}/${DIRLIB}/`basename $(@F) _${VER}.so | sed s/lib//`.o -I${DIRTOP}/${DIRINC} -I${DIRTOP} ${SUBINC} -I${PAM_YODA}/include/yoda/ -I${NROOTINC}; |
|
|
@(${EGREEN} "Compiling CPP file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp"; ${RESET}) |
|
|
@${CXX} ${CXXFLAGS} -c ${DIRTOP}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.cpp -o ${DIRTOP}/${DIRLIB}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.o -I${DIRTOP}/${DIRINC} -I${DIRTOP} ${SUBINC} -I${PAM_YODA}/include/yoda/ -I${NROOTINC}; |
|
|
# |
|
|
# create .so |
|
|
# |
|
|
@(${EGREEN} "Creating shared library: "${WHITE} "`basename $@`"; ${RESET}) |
|
|
@${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ -lg2c -I${DIRTOP}/${DIRINC} -I${DIRTOP} -I${PAM_YODA}/include/yoda/ ${SUBINC} ${DIRTOP}/${DIRLIB}/`basename $(@F) _${VER}.so | sed s/lib//`.o ${DIRTOP}/${DIRLIB}/`basename $(@F) _${VER}.so | sed s/lib//`Dict.o 1>/dev/null |
|
|
@ln -sf ${DIRTOP}/${DIRLIB}/$(@F) ${DIRTOP}/${DIRLIB}/$(patsubst %_${VER}.so,%.so,$(@F)) |
|
|
|
|
|
${LIBCPPLIBS}: ${LIBSRCS} ${COBJS} ${FOBJS} |
|
|
# |
|
|
# create .o |
|
|
# |
|
|
@(${EGREEN} "Compiling CPP file: "${WHITE} "`basename $(@F) _${VER}.so | sed s/lib//`.cpp"; ${RESET}) |
|
|
@${CXX} ${CXXFLAGS} -c ${DIRTOP}/${DIRSRC}/`basename $(@F) _${VER}.so | sed s/lib//`.cpp -o ${DIRTOP}/${DIRLIB}/`basename $(@F) _${VER}.so | sed s/lib//`.o -I${DIRTOP}/${DIRINC} -I${DIRTOP} ${SUBINC} -I${PAM_YODA}/include/yoda/ -I${NROOTINC}; |
|
|
# |
|
|
# create .so |
|
|
# |
|
|
@(${EGREEN} "Creating shared library: "${WHITE} "`basename $@`"; ${RESET}) |
|
|
@${CXX} ${CXXFLAGS} -Xlinker -soname=$(@F) -shared -o $@ -lg2c -I${DIRTOP}/${DIRINC} -I${DIRTOP} ${SUBINC} -I${PAM_YODA}/include/yoda/ ${DIRTOP}/${DIRLIB}/`basename $(@F) _${VER}.so | sed s/lib//`.o ${FOBJS} ${COBJS} 1>/dev/null |
|
|
@ln -sf ${DIRTOP}/${DIRLIB}/$(@F) ${DIRTOP}/${DIRLIB}/$(patsubst %_${VER}.so,%.so,$(@F)) |
|
|
|
|
|
${CXXEXELIBS}: ${CPPOBJS} ${COBJS} ${CXXEXEOBJS} |
|
|
@(${EGREEN} "Creating exec file: "${WHITE} "$@"; ${RESET}) |
|
|
@${CXX} ${CXXFLAGS} -o ${DIRBIN}/$@ ${DIRLIB}/$@.o ${FULLROOTCLIBS} ${FULLLIBCPPLIBS} ${OTHERLIBS} ${CPPOBJS} ${COBJS} ${FOBJS} ${PAM_YODA}/lib/libyoda.so -lThread `root-config --cflags --glibs` `cernlib mathlib` |
|
|
|
|
110 |
# A small target to check environmental variables |
# A small target to check environmental variables |
111 |
%_env: |
%_env: |
112 |
@${test_env} |
@${test_env} |