forked from rjones30/HDGeant4
-
Notifications
You must be signed in to change notification settings - Fork 4
/
GNUmakefile.OSX
155 lines (126 loc) · 5.25 KB
/
GNUmakefile.OSX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# $Id: GNUmakefile,v 1.1 1999-01-07 16:05:42 gunter Exp $
# --------------------------------------------------------------
# GNUmakefile for examples module. Gabriele Cosmo, 06/04/98.
# --------------------------------------------------------------
name := hdgeant4
G4TARGET := $(name)
G4EXLIB := true
G4LIB_BUILD_SHARED := true
G4WORKDIR := $(shell pwd)
ifndef G4ROOT
$(error G4ROOT is not set, please set it and try again)
endif
ifndef G4SYSTEM
$(error Geant4 environment not set up, please source $(G4ROOT)/share/Geant4-10.2.2/geant4make/geant4make.sh and try again)
endif
ifdef DIRACXX_HOME
CPPFLAGS += -I$(DIRACXX_HOME) -DUSING_DIRACXX -L$(DIRACXX_HOME) -lDirac
endif
CPPFLAGS += -I$(HDDS_HOME) -I./src -I./src/G4fixes
CPPFLAGS += -I./src/G4debug
CPPFLAGS += -I$(HALLD_RECON_HOME)/$(BMS_OSNAME)/include
CPPFLAGS += -I$(JANA_HOME)/include
CPPFLAGS += -I$(shell root-config --incdir)
CPPFLAGS += -I/usr/include/Qt
CPPFLAGS += $(shell python-config --includes)
CPPFLAGS += -Wno-unused-parameter
CPPFLAGS += -DUSE_SSE2 -std=c++11
#CPPFLAGS += -I/usr/include/Qt
#CPPFLAGS += -DLINUX_CPUTIME_PROFILING=1
#CPPFLAGS += -DCHECK_OVERLAPS_MM=1e-4
CPPFLAGS += -DBYPASS_DRAWING_CLIPPED_VOLUMES
CPPFLAGS += -DLAYERED_GEOMETRY_PICKING_EXTENSIONS
#CPPFLAGS += -DG4UI_USE_EXECUTIVE
CPPFLAGS += -DG4VIS_BUILD_OPENGL_DRIVER
CPPFLAGS += -DG4VIS_BUILD_OPENGLX_DRIVER
CPPFLAGS += -DG4MULTITHREADED
#CPPFLAGS += -DFORCE_PARTICLE_TYPE_CHARGED_GEANTINO
#CPPFLAGS += -DBP_DEBUG
#CPPFLAGS += -DMOD_SPONCE
#CPPFLAGS += -DDEBUG_PLACEMENT
#CPPFLAGS += -DDEBUG_SECTIONPLANE
#CPPFLAGS += -DDEBUG_SECTIONPLANE_ZAVE
# If you want to build against Geant4.10.03 or greater, you will need this line uncommented
CPPFLAGS += -DG4VUSERPHYSICSLIST_HAS_GETPARTICLEITERATOR
G4LIB_USE_GDML = 1
CPPVERBOSE = 1
#G4DEBUG = 1
hdgeant4_sources := $(filter-out src/CobremsGeneration.cc, $(wildcard src/*.cc))
G4fixes_sources := $(wildcard src/G4fixes/*.cc)
G4debug_sources := $(wildcard src/G4debug/*.cc)
HDDS_sources := $(HDDS_HOME)/XString.cpp $(HDDS_HOME)/XParsers.cpp $(HDDS_HOME)/hddsCommon.cpp
ROOTLIBS = $(shell root-config --libs) -lGeom -lTMVA -lTreePlayer
DANALIBS = -L$(HALLD_RECON_HOME)/$(BMS_OSNAME)/lib -lHDGEOMETRY -lDANA \
-lANALYSIS -lBCAL -lCCAL -lCDC -lCERE -lDIRC -lFCAL \
-lFDC -lFMWPC -lHDDM -lPAIR_SPECTROMETER -lPID -lRF \
-lSTART_COUNTER -lTAGGER -lTOF -lTPOL -lTRACKING \
-lTRIGGER -lDAQ -lTTAB -lEVENTSTORE -lKINFITTER -lTAC \
-L$(SQLITECPP_HOME)/lib -lSQLiteCpp -lsqlite3 \
-lxstream -lbz2 -lz \
$(shell mysql_config --libs) \
-L$(JANA_HOME)/lib -lJANA \
-L$(CCDB_HOME)/lib -lccdb \
-L$(EVIOROOT)/lib -levioxx -levio \
$(ROOTLIBS) \
-lpthread -ldl
G4shared_libs := $(wildcard $(G4ROOT)/lib/*.dylib)
INTYLIBS += $(DANALIBS)
INTYLIBS += -fPIC -I$(HDDS_HOME) -I$(XERCESCROOT)/include
INTYLIBS += -L${XERCESCROOT}/lib -lxerces-c
INTYLIBS += -L$(G4TMPDIR) -lhdds
INTYLIBS += -lboost_python $(shell python-config --libs)
INTYLIBS += -L$(G4ROOT)/lib $(patsubst $(G4ROOT)/lib/lib%.dylib, -l%, $(G4shared_libs))
INTYLIBS += -lgfortran
.PHONY: all
all: hdds cobrems sharedlib exe lib bin g4py
include $(G4INSTALL)/config/binmake.gmk
cobrems: $(G4TMPDIR)/libcobrems.dylib
hdds: $(G4TMPDIR)/libhdds.dylib
CXXFLAGS = -O3 -fPIC -W -Wall -pedantic -Wno-non-virtual-dtor -Wno-long-long
$(G4TMPDIR)/libcobrems.dylib: src/CobremsGeneration.cc
$(CXX) $(CXXFLAGS) $(CPPFLAGS) \
-flat_namespace -undefined suppress \
-shared -o $@ $^ $(G4shared_libs) -lboost_python
hdgeant4_objects := $(patsubst src/%.cc, $(G4TMPDIR)/%.o, $(hdgeant4_sources))
G4fixes_objects := $(patsubst src/G4fixes/%.cc, $(G4TMPDIR)/%.o, $(G4fixes_sources))
G4debug_objects := $(patsubst src/G4debug/%.cc, $(G4TMPDIR)/%.o, $(G4debug_sources))
sharedlib: $(G4TMPDIR)/libhdgeant4.dylib
$(G4TMPDIR)/libhdgeant4.dylib: $(hdgeant4_objects) $(G4fixes_objects) $(G4debug_objects)
$(G4TMPDIR)/%.o: src/G4fixes/%.cc
ifdef CPPVERBOSE
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $^
else
@echo Compiling $*.cc ...
@$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $^
endif
$(G4TMPDIR)/%.o: src/G4debug/%.cc
ifdef CPPVERBOSE
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $^
else
@echo Compiling $*.cc ...
@$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $^
endif
HDDSDIR := $(G4TMPDIR)/hdds
$(HDDSDIR)/%.o: $(HDDS_HOME)/%.cpp
@mkdir -p $(HDDSDIR)
ifdef CPPVERBOSE
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $^
else
@echo Compiling $*.cc ...
@$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $^
endif
$(G4TMPDIR)/libhdds.dylib: $(patsubst $(HDDS_HOME)/%.cpp, $(HDDSDIR)/%.o, $(HDDS_sources))
@$(CXX) -flat_namespace -undefined suppress -shared -o $@ $^
exe:
@mkdir -p $(G4LIBDIR)/$@
g4py: $(G4LIBDIR)/../../../g4py/HDGeant4/libhdgeant4.dylib \
$(G4LIBDIR)/../../../g4py/Cobrems/libcobrems.dylib
$(G4LIBDIR)/../../../g4py/HDGeant4/libhdgeant4.dylib: $(G4LIBDIR)/libhdgeant4.dylib
@rm -f $@
@cd g4py/HDGeant4 && ln -s ../../tmp/*/hdgeant4/libhdgeant4.dylib .
$(G4LIBDIR)/../../../g4py/Cobrems/libcobrems.dylib: $(G4LIBDIR)/libcobrems.dylib
@rm -f $@
@cd g4py/Cobrems && ln -s ../../tmp/*/hdgeant4/libcobrems.dylib .
utils: $(G4BINDIR)/beamtree
$(G4BINDIR)/beamtree: src/utils/beamtree.cc
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $@ $^ -L$(G4LIBDIR) -lhdgeant4 $(ROOTLIBS) -Wl,-rpath=$(G4LIBDIR)