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