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