1 |
# Compilers settings |
2 |
ROOTCFLAGS =`root-config --cflags` |
3 |
ROOTLDFLAGS =`root-config --ldflags` |
4 |
ROOTLIBS =`root-config --libs` -lHbook |
5 |
CERNLIBS =`cernlib kernlib,packlib,genlib` |
6 |
F77LIBS =-lg2c -lnsl |
7 |
SYSLIBS =-lm -ldl -rdynamic |
8 |
LD =g++ |
9 |
CXXFLAGS=-g -O -Wall -fPIC ${ROOTCFLAGS} |
10 |
#CXXFLAGS= -g -Wall -O ${ROOTCFLAGS} |
11 |
LDFLAGS = -g |
12 |
|
13 |
DICS = pCasID.cpp pHeaderID.cpp pTof.cpp pCat.cpp \ |
14 |
pTofHit.cpp pCal.cpp pCatHit.cpp pHitID.cpp pTofID.cpp \ |
15 |
pCalHit.cpp pCatID.cpp pNdID.cpp pTrdID.cpp \ |
16 |
pCalID.cpp pCaliID.cpp \ |
17 |
pCas.cpp pCasHit.cpp pSpeID.cpp |
18 |
|
19 |
MGRS = pPheaMgr.cpp pPhitMgr.cpp pPdetMgr.cpp |
20 |
UTIL = pUtils.cpp pBlockPointer.cpp |
21 |
|
22 |
SRCS = pCasID.cpp pHeaderID.cpp pTof.cpp pCat.cpp pHit.cpp \ |
23 |
pTofHit.cpp pCal.cpp pCatHit.cpp pHitID.cpp pTofID.cpp \ |
24 |
pCalHit.cpp pCatID.cpp pNdID.cpp pTrdID.cpp \ |
25 |
pCalID.cpp pDetector.cpp pCaliID.cpp pEvent.cpp \ |
26 |
pCas.cpp pCasHit.cpp pHeader.cpp pSpeID.cpp \ |
27 |
pPheaMgr.cpp pPhitMgr.cpp pPdetMgr.cpp \ |
28 |
pUtils.cpp pBlockPointer.cpp |
29 |
|
30 |
HEAS =$(SRCS:.cpp=.h) |
31 |
OBJS =$(SRCS:.cpp=.o) |
32 |
DEPS =$(SRCS:.cpp=.d) |
33 |
CLAS =$(DICS:.cpp= ) |
34 |
CLASH=$(DICS:.cpp=.h) |
35 |
JUNK =$(addsuffix ~,${SRCS}) $(addsuffix ~,${HEAS}) |
36 |
DICO =$(addsuffix Dict.o, ${CLAS}) |
37 |
DICH =$(addsuffix Dict.h, ${CLAS}) |
38 |
|
39 |
all: gp2root libpEvent.so |
40 |
|
41 |
testcashit: testcashit.o pAllEventDict.o ${OBJS} ${DICO} |
42 |
$(LD) $(LDFLAGS) -o $@ $^ ${ROOTLIBS} |
43 |
|
44 |
|
45 |
libpEvent.so: LDFLAGS=-O `root-config --ldflags` |
46 |
libpEvent.so: SOFLAGS=-shared |
47 |
libpEvent.so: pAllEventDict.o ${OBJS} ${DICO} |
48 |
$(LD) $(SOFLAGS) $(LDFLAGS) $^ -o $@ |
49 |
|
50 |
%Dict.cxx: %.h %LinkDef.h |
51 |
rootcint -f $@ -c $^ |
52 |
|
53 |
%Dict.o: %Dict.cxx |
54 |
|
55 |
%LinkDef.h: |
56 |
@echo "#pragma link off all class;" > $@ |
57 |
@echo "#pragma link off all function;" >> $@ |
58 |
@echo "#pragma link off all global;" >> $@ |
59 |
@echo "#pragma link C++ class `echo $@ | sed 's/LinkDef.h//'`;" >> $@ |
60 |
|
61 |
pAllEventLinkDef.h: pEvent.h pDetector.h pHit.h pHeader.h |
62 |
@echo "#pragma link off all class;" > $@ |
63 |
@echo "#pragma link off all function;" >> $@ |
64 |
@echo "#pragma link off all global;" >> $@ |
65 |
@for i in $^; do \ |
66 |
echo "#pragma link C++ class `echo "$$i" | sed 's/.h//'`;" >> $@;\ |
67 |
done |
68 |
|
69 |
|
70 |
pAllEventDict.cxx: pEvent.h pDetector.h pHit.h pHeader.h pAllEventLinkDef.h |
71 |
rootcint -f $@ -c $^ |
72 |
|
73 |
gp2root: gp2root.o pAllEventDict.o ${OBJS} ${DICO} |
74 |
$(LD) $(LDFLAGS) -o $@ $^ ${ROOTLIBS} ${CERNLIBS} ${F77LIBS} ${SYSLIBS} |
75 |
|
76 |
depend: ${DEPS} |
77 |
|
78 |
%.d: %.cpp |
79 |
@echo Creating dependencies for $< |
80 |
@$(CXX) -MM $(CXXFLAGS) $< -o $@ |
81 |
|
82 |
-include ${DEPS} |
83 |
|
84 |
.SUFFIXES: .cxx |
85 |
.cxx.o: |
86 |
$(CXX) $(CXXFLAGS) -c $< `root-config --cflags` |
87 |
|
88 |
|
89 |
.PHONY: clean |
90 |
|
91 |
clean: |
92 |
@echo Removing object files ..... |
93 |
@rm -f ${OBJS} ${DICO} |
94 |
@echo Removing dependencies files ..... |
95 |
@rm -f ${DEPS} |
96 |
@echo Removing dictionary files ..... |
97 |
@rm -f ${JUNK} ${DICH} |
98 |
@echo Removing temporary files ..... |
99 |
@rm -f ${JUNK} |