1 |
# $Id: Makefile,v 1.0 2007/06/01 |
2 |
|
3 |
############################### geant4vmc Makefile ########################### |
4 |
|
5 |
PACKAGE = PamVMC_fc |
6 |
EXECUTABLE = bin/PamVMC.exe |
7 |
CXXVERBOSE = 1 |
8 |
|
9 |
ifeq ($(PLATFORM),) |
10 |
PLATFORM = $(shell root-config --arch) |
11 |
endif |
12 |
|
13 |
TOPDIR = $(PWD) |
14 |
BINDIR = $(TOPDIR)/tmp/tgt_$(PLATFORM)/$(PACKAGE) |
15 |
LIBDIR = $(TOPDIR)/lib/tgt_$(PLATFORM) |
16 |
|
17 |
ifeq ($(ROOTSYS),) |
18 |
ROOT_INCDIR = $(shell root-config --incdir) |
19 |
ROOT_BINDIR = $(shell root-config --prefix)/bin |
20 |
ROOT_ETCDIR = $(shell root-config --prefix)/etc/vmc |
21 |
else |
22 |
ROOT_INCDIR = $(ROOTSYS)/include |
23 |
ROOT_BINDIR = $(ROOTSYS)/bin |
24 |
ROOT_ETCDIR = $(ROOTSYS)/etc/vmc |
25 |
endif |
26 |
|
27 |
ROOT_LIBDIR = $(shell root-config --libs) -lVMC -lGeom -lEG -lTMVA -lMinuit -lXMLIO -lXMLParser -lMLP -lTreePlayer |
28 |
|
29 |
CLHEP_LIB = $(shell clheplib) |
30 |
G4_LIBS_PATH = $(wildcard $(G4LIB)/$(G4SYSTEM)/*.so) |
31 |
G4_LIBS = -L$(G4LIB)/$(G4SYSTEM) $(patsubst $(G4LIB)/$(G4SYSTEM)/lib%.so,-l%,$(G4_LIBS_PATH)) |
32 |
G4VMC_LIBDIR = -L$(G4VMC_DIR)/lib/tgt_$(PLATFORM) -lgeant4vmc -lg4root |
33 |
VGM_LIBS_PATH = $(wildcard $(VGM_INSTALL)/lib/$(G4SYSTEM)/*.so) |
34 |
VGM_LIBS = -L$(VGM_INSTALL)/lib/$(G4SYSTEM) $(patsubst $(VGM_INSTALL)/lib/$(G4SYSTEM)/lib%.so,-l%,$(VGM_LIBS_PATH)) |
35 |
G4_RUN_LIB=$(LIBDIR)/libPamG4RunConfiguration.so |
36 |
include $(ROOT_ETCDIR)/Makefile.$(PLATFORM) |
37 |
|
38 |
############################### Sources ####################################### |
39 |
|
40 |
# Rules |
41 |
# |
42 |
include $(ROOT_ETCDIR)/MakeRules |
43 |
|
44 |
# Dictionary |
45 |
# |
46 |
GDICT := $(BINDIR)/$(PACKAGE)Cint.cxx |
47 |
GDICTH := $(GDICT:.cxx=.h) |
48 |
GDICTO := $(patsubst %.cxx,%.o,$(GDICT)) |
49 |
|
50 |
# Sources |
51 |
# |
52 |
CXXSRC := $(wildcard src/*.cxx) |
53 |
CALSRC := $(wildcard cal/src/*.cxx) |
54 |
TRKSRC := $(wildcard trk/src/*.cxx) |
55 |
TRKFSRCS :=$(wildcard trk/src/f77/*.F) |
56 |
TOFSRC := $(wildcard tof/src/*.cxx) |
57 |
ACSRC := $(wildcard ac/src/*.cxx) |
58 |
S4SRC := $(wildcard s4/src/*.cxx) |
59 |
NDSRC := $(wildcard nd/src/*.cxx) |
60 |
|
61 |
|
62 |
SRCS := $(CXXSRC) $(CALSRC) $(TRKSRC) $(TOFSRC) $(ACSRC) $(S4SRC) $(NDSRC) |
63 |
FSRCS := $(TRKFSRCS) |
64 |
|
65 |
#executable objects |
66 |
EXECO = G4main/PamVMCmain.o |
67 |
EXECS = G4main/PamVMCmain.cxx |
68 |
EXECSO = $(TOPDIR)/lib/tgt_$(PLATFORM)/lib$(PACKAGE).so |
69 |
|
70 |
# C++ Headers |
71 |
# |
72 |
HDRS := $(wildcard include/*.h) |
73 |
HDRS += $(wildcard cal/include/*.h) |
74 |
HDRS += $(wildcard trk/include/*.h) |
75 |
HDRS += $(wildcard tof/include/*.h) |
76 |
HDRS += $(wildcard ac/include/*.h) |
77 |
HDRS += $(wildcard s4/include/*.h) |
78 |
HDRS += $(wildcard nd/include/*.h) |
79 |
|
80 |
HDRS := $(filter-out include/$(PACKAGE)LinkDef.h,$(HDRS)) |
81 |
HDRS += include/$(PACKAGE)LinkDef.h |
82 |
|
83 |
# Objects |
84 |
# |
85 |
CXXOBJ := $(patsubst %.cxx,$(BINDIR)/%.o,$(SRCS)) |
86 |
FOBJ := $(patsubst %.F,$(BINDIR)/%.o,$(FSRCS)) |
87 |
OBJS := $(CXXOBJ) $(GDICTO) $(FOBJ) |
88 |
|
89 |
# PAMELA LIBS |
90 |
# |
91 |
PAM_LIBS_PATH = $(wildcard $(PAM_LIB)/*.so) |
92 |
PAM_LIBS = -L$(PAM_LIB) $(patsubst $(PAM_LIB)/lib%.so,-l%,$(PAM_LIBS_PATH)) |
93 |
SHLIBS := ${PAM_LIBS} |
94 |
# Make include list |
95 |
# |
96 |
PAMINC := -I$(PAM_INC) -I$(PAM_INC)/yoda |
97 |
INCDIR := -Iinclude -I$(TOPDIR) \ |
98 |
-Ical/include \ |
99 |
-Itrk/include \ |
100 |
-Itof/include \ |
101 |
-Iac/include \ |
102 |
-Is4/include \ |
103 |
-Ind/include \ |
104 |
-I$(G4VMC_DIR)/include/geant4vmc \ |
105 |
-I$(CLHEP_BASE_DIR)/include \ |
106 |
-Iinclude -I$(G4INCLUDE) |
107 |
|
108 |
FINCDIR := -Itrk/include/f77 |
109 |
# C++ compilation flags |
110 |
# |
111 |
CXXFLAGS := -m32 $(CXXOPTS) -I. $(INCDIR) $(PAMINC) -I$(ROOT_INCDIR) ${PAMOPTS} |
112 |
FFLAGS := $(FINCDIR) -m32 -fPIC -std=legacy |
113 |
|
114 |
DEPINC += -I. -I$(ROOT_INCDIR) $(INCDIR) |
115 |
|
116 |
############################### Targets ####################################### |
117 |
|
118 |
RM_FILE=$(shell rm -f $(LIBDIR)/resxy_new.root)\ |
119 |
$(shell rm -f $(LIBDIR)/CalibTrk_00110_000_000.root) |
120 |
|
121 |
AUXDIR='aux' |
122 |
CP_FILE=$(shell mkdir -p ${LIBDIR})\ |
123 |
$(shell cp -rf ${AUXDIR}/resxy_new.root ${AUXDIR}/CalibTrk_00110_000_000.root ${AUXDIR}/parameters_l* ${LIBDIR}/) |
124 |
|
125 |
SLIBRARY = $(LIBDIR)/lib$(PACKAGE).$(SL) |
126 |
ALIBRARY = $(LIBDIR)/lib$(PACKAGE).a |
127 |
|
128 |
default: depend $(SLIBRARY) $(EXECUTABLE) |
129 |
|
130 |
|
131 |
$(LIBDIR)/lib$(PACKAGE).$(SL):$(CP_FILE) $(OBJS) $(FOBS) |
132 |
|
133 |
$(LIBDIR)/lib$(PACKAGE).a: $(CP_FILE) $(OBJS) $(FOBS) |
134 |
|
135 |
DICT:= $(GDICT) |
136 |
|
137 |
$(DICT): $(HDRS) |
138 |
|
139 |
depend: $(SRCS) $(FSRCS) |
140 |
|
141 |
TOCLEAN = $(BINDIR) $(RM_FILE) |
142 |
TOCLEANALL = $(BINDIR) $(LIBDIR) $(RM_FILE) |
143 |
|
144 |
$(EXECO): |
145 |
$(CXX) $(CXXFLAGS) -c $(EXECS) -o $(EXECO) |
146 |
|
147 |
$(EXECUTABLE): $(shell rm -f $(EXECO))\ |
148 |
$(shell rm -f $(EXECUTABLE))\ |
149 |
$(EXECSO) $(EXECO) |
150 |
@echo "Generating executable $@ ..." |
151 |
$(LD) $(LDFLAGS) $(EXECO) $(CXXFLAGS) $(CLHEP_LIB) $(G4VMC_LIBDIR) $(G4_LIBS) $(VGM_LIBS) $(LIBDIR)/lib$(PACKAGE).$(SL) $(PAM_LIBS) $(G4_RUN_LIB) $(ROOT_LIBDIR) -o $@ |
152 |
|
153 |
include $(ROOT_ETCDIR)/MakeMacros |
154 |
|
155 |
|
156 |
############################### Dependencies ################################## |
157 |
|
158 |
-include $(BINDIR)/Make-depend |