| 1 |
# PamelaDigitizer |
# PamelaDigitizer |
| 2 |
# SOFTWARE VERSION |
# SOFTWARE VERSION |
| 3 |
VER= v2r01 |
VER= v3r00 |
| 4 |
# An almost general purpouse Makefile for PAMELA repository |
# An almost general purpouse Makefile for PAMELA repository |
| 5 |
# Let's start with some useful definition to make the echo colored |
# Let's start with some useful definition to make the echo colored |
| 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 |
#MAKE |
#MAKE |
| 25 |
MAKE=make |
MAKE=make |
| 26 |
# C |
# C |
| 27 |
CC=gcc |
CC=gcc |
| 28 |
#CFLAGS=-Wall -O -fPIC -pthread -g |
#CFLAGS=-Wall -O -fPIC -pthread -g ${PAM_BIT} |
| 29 |
CFLAGS=-Wall -O -fPIC -pthread |
CFLAGS=-Wall -O -fPIC -pthread ${PAM_BIT} |
| 30 |
# Enviroment: |
# Enviroment: |
| 31 |
GCCVER=`gcc --version | head -1` |
GCCVER=`gcc --version | head -1` |
| 32 |
UNAMEA=`uname -a` |
UNAMEA=`uname -a` |
| 33 |
TODAY=`date` |
TODAY=`date` |
| 34 |
# F77 |
# F77 |
| 35 |
F77=g77 |
F77=g77 |
| 36 |
#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} |
| 37 |
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} |
| 38 |
# C++ |
# C++ |
| 39 |
CXX=g++ |
CXX=g++ |
| 40 |
CXXFLAGS=-Wall -O -fPIC -pthread |
# ROOTCINT |
| 41 |
# ROOTCINT |
ROOTCINT=rootcint |
| 42 |
ROOTCINT=rootcint |
|
| 43 |
# Here the variables defining the local directories |
# Compilers settings |
| 44 |
# ... not used ... |
ROOTCFLAGS =`root-config --cflags` |
| 45 |
# Here the PAMELA environmental variables to be checked |
ROOTLDFLAGS =`root-config --ldflags` |
| 46 |
# ... not used ... |
ROOTLIBS =`root-config --libs` -lHbook |
| 47 |
|
CERNLIBS =`cernlib_noshift kernlib,packlib,genlib` |
| 48 |
# Here the local variables used to build the targets |
F77LIBS =-lg2c -lnsl |
| 49 |
|
SYSLIBS =-lm -ldl -rdynamic |
| 50 |
|
LD =g++ |
| 51 |
# Compilers settings |
CXXFLAGS= -O3 -Wall -fPIC ${ROOTCFLAGS} ${PAM_BIT} |
| 52 |
ROOTCFLAGS =`root-config --cflags` |
#CXXFLAGS= -g -Wall -O ${ROOTCFLAGS} ${PAM_BIT} |
| 53 |
ROOTLDFLAGS =`root-config --ldflags` |
# flags needed on the pamelatov's: |
| 54 |
ROOTLIBS =`root-config --libs` -lHbook |
#LDFLAGS = $(PAM_BIT) |
| 55 |
CERNLIBS =`cernlib_noshift kernlib,packlib,genlib` |
LDFLAGS = -lmathlib -lpacklib -lkernlib -llapack -lg2c -lm -lnsl -lcrypt -L/cern/2005/lib $(PAM_BIT) |
| 56 |
F77LIBS =-lg2c -lnsl |
#LDFLAGS = -g -llapack -lg2c -lm -lnsl -lcrypt -L/cern/2005/lib $(PAM_BIT) |
| 57 |
SYSLIBS =-lm -ldl -rdynamic |
|
| 58 |
LD =g++ |
CXXSRCS= Digitizer.cxx DigitizeRunHeader.cxx DigitizeCalo.cxx DigitizeTOF.cxx DigitizeAC.cxx DigitizeS4.cxx DigitizeND.cxx Write.cxx DigitizeTRK.cxx Pamelagp2Digits.cxx DigitVersion.cxx |
| 59 |
CXXFLAGS=-g -O -Wall -fPIC ${ROOTCFLAGS} |
OBJS=$(CXXSRCS:%.cxx=%.o) |
| 60 |
#CXXFLAGS= -g -Wall -O ${ROOTCFLAGS} |
|
| 61 |
# flags needed on the pamelatov's: |
CPPSRCS= CRC.cpp calcrc.cpp |
| 62 |
LDFLAGS = -g -lmathlib -lpacklib -lkernlib -llapack -lg2c -lm -lnsl -lcrypt -L/cern/2005/lib |
CPOBJS=$(CPPSRCS:%.cpp=%.o) |
| 63 |
#LDFLAGS = -g -llapack -lg2c -lm -lnsl -lcrypt -L/cern/2005/lib |
|
| 64 |
|
HEAS =$(SRCS:.cpp=.h) |
| 65 |
HEAS =$(SRCS:.cpp=.h) |
#OBJS =$(SRCS:.cpp=.o) |
| 66 |
OBJS =$(SRCS:.cpp=.o) |
DEPS =$(SRCS:.cpp=.d) |
| 67 |
DEPS =$(SRCS:.cpp=.d) |
CLAS =$(DICS:.cpp= ) |
| 68 |
CLAS =$(DICS:.cpp= ) |
CLASH=$(DICS:.cpp=.h) |
| 69 |
CLASH=$(DICS:.cpp=.h) |
JUNK =$(addsuffix ~,${SRCS}) $(addsuffix ~,${HEAS}) |
| 70 |
JUNK =$(addsuffix ~,${SRCS}) $(addsuffix ~,${HEAS}) |
DICO =$(addsuffix Dict.o, ${CLAS}) |
| 71 |
DICO =$(addsuffix Dict.o, ${CLAS}) |
DICH =$(addsuffix Dict.h, ${CLAS}) |
| 72 |
DICH =$(addsuffix Dict.h, ${CLAS}) |
|
| 73 |
|
all: prepare libs Pamelagp2Digits |
| 74 |
all: mkverpath Pamelagp2Digits |
@echo -e ${GREEN} "" |
| 75 |
@echo -e ${GREEN} "" |
@(${EGREEN} " Finished, now you can install the package \n (use: make install) "; ${RESET}) |
| 76 |
@(${EGREEN} " Finished, now you can install the package \n (use: make install) "; ${RESET}) |
@echo -e ${GREEN} "" |
| 77 |
@echo -e ${GREEN} "" |
@${RESET} |
| 78 |
@${RESET} |
|
| 79 |
|
prepare: mkverpath |
| 80 |
|
|
| 81 |
Pamelagp2Digits: DigitVersion.o CRC.o calcrc.o Pamelagp2Digits.o Digitizer.o DigitizeRunHeader.o DigitizeCalo.o DigitizeTOF.o DigitizeAC.o DigitizeS4.o DigitizeND.o Write.o DigitizeTRK.o ${OBJS} ${DICO} |
libs: $(CPOBJS) ${OBJS} ${DICO} |
| 82 |
# @(${EWHITE} " Compiling Pamelagp2Digits... \n ") |
|
| 83 |
$(LD) $(LDFLAGS) -o $@ $^ ${ROOTLIBS} ${CERNLIBS} ${F77LIBS} ${SYSLIBS} ${PAM_LIB}/libGLTables.so ${PAM_LIB}/libsgp4.so ${PAM_YODA}/lib/libyoda.so |
|
| 84 |
@rm -f *.o |
#Pamelagp2Digits: DigitVersion.o CRC.o calcrc.o Pamelagp2Digits.o Digitizer.o DigitizeRunHeader.o DigitizeCalo.o DigitizeTOF.o DigitizeAC.o DigitizeS4.o DigitizeND.o Write.o DigitizeTRK.o ${OBJS} ${DICO} |
| 85 |
|
Pamelagp2Digits: |
| 86 |
Digitizer: Digitizer.o ${OBJS} ${DICO} |
@(${EWHITE} " Compiling Pamelagp2Digits... \n ") |
| 87 |
$(LD) $(LDFLAGS) -o $@ $^ ${ROOTLIBS} ${CERNLIBS} ${F77LIBS} ${SYSLIBS} |
@ $(LD) $(LDFLAGS) -o $@ $^ ${ROOTLIBS} ${CERNLIBS} ${F77LIBS} ${SYSLIBS} ${PAM_LIB}/libGLTables.so ${PAM_LIB}/libsgp4.so ${PAM_YODA}/lib/libyoda.so ${OBJS} $(CPOBJS) |
| 88 |
|
@rm -f *.o |
| 89 |
depend: ${DEPS} |
|
| 90 |
|
Digitizer: Digitizer.o ${OBJS} ${DICO} |
| 91 |
%.d: %.cpp |
$(LD) $(LDFLAGS) -o $@ $^ ${ROOTLIBS} ${CERNLIBS} ${F77LIBS} ${SYSLIBS} |
| 92 |
@echo Creating dependencies for $< |
|
| 93 |
@$(CXX) -MM $(CXXFLAGS) $< -o $@ |
depend: ${DEPS} |
| 94 |
|
|
| 95 |
|
|
| 96 |
|
%.d: %.cxx |
| 97 |
.SUFFIXES: .cxx |
@echo Creating dependencies for $< |
| 98 |
.cxx.o: |
@$(CXX) -MM $(CXXFLAGS) $< -o $@ |
| 99 |
$(CXX) $(CXXFLAGS) -c $< `root-config --cflags` -I${PAM_YODA}/include/yoda/ -I${PAM_INC}/ |
|
| 100 |
|
.SUFFIXES: .cxx |
| 101 |
|
%.o: %.cxx |
| 102 |
.PHONY: clean |
@(${EGREEN} "Creating CXX object file: "${WHITE} "`basename $@`"; ${RESET}) |
| 103 |
|
@$(CXX) $(CXXFLAGS) -c $< `root-config --cflags` -I${PAM_YODA}/include/yoda/ -I${PAM_INC}/ |
| 104 |
mkverpath: |
|
| 105 |
@(${EGREEN} creating file DigitVersion.cpp; ${RESET}) |
.SUFFIXES: .cpp |
| 106 |
@echo '#include <TSystem.h>' > DigitVersion.cpp; echo ' char *DigitizerInfo(bool print){ if ( print ) printf("\nPAMELA PamelaDigitizer version: ${VER}\n\nCompiled on '${TODAY}' with: '${GCCVER}'\n\nOn: '${UNAMEA}'\n\n"); return("${VER}"); }' >> DigitVersion.cpp |
%.o: %.cpp |
| 107 |
@sleep 0.8 |
@(${EGREEN} "Creating CPP object file: "${WHITE} "`basename $@`"; ${RESET}) |
| 108 |
|
@$(CXX) $(CXXFLAGS) -c $< `root-config --cflags` -I${PAM_YODA}/include/yoda/ -I${PAM_INC}/ |
| 109 |
clean: |
|
| 110 |
|
.PHONY: clean |
| 111 |
|
|
| 112 |
@(${EGREEN} Removing object files .....) |
mkverpath: |
| 113 |
@rm -f *~ |
@(${EGREEN} creating file DigitVersion.cxx; ${RESET}) |
| 114 |
@rm -f ${OBJS} ${DICO} *.o |
@echo '#include <TSystem.h>' > DigitVersion.cxx; echo ' char *DigitizerInfo(bool print){ if ( print ) printf("\nPAMELA PamelaDigitizer version: ${VER}\n\nCompiled on '${TODAY}' with: '${GCCVER}'\n\nOn: '${UNAMEA}'\n\n"); return("${VER}"); }' >> DigitVersion.cxx |
| 115 |
@echo Removing dependencies files ..... |
@sleep 1.2 |
| 116 |
@rm -f ${DEPS} |
|
| 117 |
@echo Removing dictionary files ..... |
clean: |
| 118 |
@rm -f ${JUNK} ${DICH} |
|
| 119 |
@echo Removing temporary files ..... |
|
| 120 |
@rm -f ${JUNK} |
@(${EGREEN} Removing object files .....) |
| 121 |
@rm -f DigitVersion.cpp; ${RESET} |
@rm -f *~ |
| 122 |
|
@rm -f ${OBJS} ${CPOBJS} ${DICO} *.o |
| 123 |
install: |
@echo " Removing dependencies files ....." |
| 124 |
# @echo "TEST: copying the executable in the PAM_BIN directory"; |
@rm -f ${DEPS} |
| 125 |
@(${EGREEN} "copying the executable in the PAM_BIN directory"; ${RESET}) |
@echo " Removing dictionary files ....." |
| 126 |
cp Pamelagp2Digits ${PAM_BIN}/. |
@rm -f ${JUNK} ${DICH} |
| 127 |
|
@echo " Removing temporary files ....." |
| 128 |
|
@rm -f ${JUNK} |
| 129 |
|
@rm -f DigitVersion.cxx; |
| 130 |
|
@echo " Removing Pamelagp2Digits ....." |
| 131 |
|
@rm -f ${JUNK} |
| 132 |
|
@rm -f Pamelagp2Digits; ${RESET} |
| 133 |
|
|
| 134 |
|
install: |
| 135 |
|
# @echo "TEST: copying the executable in the PAM_BIN directory"; |
| 136 |
|
@(${EGREEN} "copying the executable in the PAM_BIN directory"; ${RESET}) |
| 137 |
|
cp Pamelagp2Digits ${PAM_BIN}/. |