-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
226 lines (178 loc) · 8.06 KB
/
Makefile
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
#
# This is the main GENIE project Makefile.
# Each package has its own Makefile which is invoked by this one.
# Machine specific flags and locations are read from 'make/Make.include'.
# Configuration options are read from 'make/Make.config' generated by the 'configure' script.
#
# Author: Costas Andreopoulos <costas.andreopoulos \at stfc.ac.uk>
#
SHELL = /bin/sh
NAME = all
MAKEFILE = Makefile
# Include machine specific flags and locations (inc. files & libs)
#
include $(GENIE)/src/make/Make.include
INSTALL_TARGETS = check-previous-installation \
make-install-dirs \
copy-install-files
# define targets
CORE := Algorithm Messenger Registry Conventions
UTILS := Numerical CrossSections PDG Utils
OPTIONAL_MODULES := NucleonDecay ReWeight VLE VHE FluxDrivers Geo MuELoss
VLD_TOOLS := validation/EvScan validation/MCx validation/NuXSec validation/StructFunc validation/Hadronization validation/Intranuke validation/Merenyi validation/eA
VLD_TOOLS += validation/Tuning
ifeq ($(strip $(GOPT_ENABLE_ROOMUHISTOS)),YES)
#VLD_TOOLS += validation/MINERvA/ReWeightIO
#VLD_TOOLS += validation/MINERvA/Q2_QE_CC
VLD_TOOLS += validation/MINERvA
endif
EVGEN_MODULES := BaryonResonance Base EVGCore EVGDrivers Interaction GHEP Ntuple
MEDIUM_ENERGY_MODULES := BodekYang Charm Coherent Decay Diffractive DIS Elastic ElFF EVGModules Fragmentation GiBUU HadronTransport LlewellynSmith NuE Nuclear PartonModel PDF QEL ReinSeghal RES
TEST_MEDIUM_ENERGY_MODULES := MEC NuGamma
SUPPORT_APP_MODULES := support/t2k/EvGen support/numi/EvGen support/atmo/EvGen support/atmo/UpMuFluxGen support/ndcy/EvGen support/rwght support/masterclass
APP_MODULES := stdapp test
ALL_MODULES := $(OPTIONAL_MODULES) $(VLD_TOOLS) $(EVGEN_MODULES) $(MEDIUM_ENERGY_MODULES) $(SUPPORT_APP_MODULES) $(APP_MODULES) $(TEST_MEDIUM_ENERGY_MODULES) $(CORE) $(UTILS)
# Modules which we want to call 'make install' on
INSTALL_MODULES := $(CORE) $(UTILS) $(OPTIONAL_MODULES) $(EVGEN_MODULES) $(MEDIUM_ENERGY_MODULES) $(TEST_MEDIUM_ENERGY_MODULES)
# For each optional module, there's a variable set in Make.config that
# is "YES" if the module should be compiled, and blank if it should
# not. For each optional module we define a variable
# <MODULENAME>_OPTVAR whose value is the name of the variable that
# defines whether it should be built or not. It would be better to
# change the variable names in Make.config, but this way is more
# self-contained (don't have to change the configure script)
NucleonDecay_OPTVAR := GOPT_ENABLE_NUCLEON_DECAY
ReWeight_OPTVAR := GOPT_ENABLE_RWGHT
VLE_OPTVAR := GOPT_ENABLE_VLE_EXTENSION
VHE_OPTVAR := GOPT_ENABLE_VHE_EXTENSION
FluxDrivers_OPTVAR := GOPT_ENABLE_FLUX_DRIVERS
Geo_OPTVAR := GOPT_ENABLE_GEOM_DRIVERS
MuELoss_OPTVAR := GOPT_ENABLE_MUELOSS
validation/EvScan_OPTVAR := GOPT_ENABLE_VALIDATION_TOOLS
validation/MCx_OPTVAR := GOPT_ENABLE_VALIDATION_TOOLS
validation/NuXSec_OPTVAR := GOPT_ENABLE_VALIDATION_TOOLS
validation/StructFunc_OPTVAR := GOPT_ENABLE_VALIDATION_TOOLS
validation/Hadronization_OPTVAR := GOPT_ENABLE_VALIDATION_TOOLS
validation/Intranuke_OPTVAR := GOPT_ENABLE_VALIDATION_TOOLS
validation/Merenyi_OPTVAR := GOPT_ENABLE_VALIDATION_TOOLS
validation/eA_OPTVAR := GOPT_ENABLE_VALIDATION_TOOLS
test_OPTVAR := GOPT_ENABLE_TEST
support/t2k/EvGen_OPTVAR := GOPT_ENABLE_T2K
support/numi/EvGen_OPTVAR := GOPT_ENABLE_NUMI
support/atmo/EvGen_OPTVAR := GOPT_ENABLE_ATMO
support/atmo/UpMuFluxGen_OPTVAR := GOPT_ENABLE_ATMO
support/ndcy/EvGen_OPTVAR := GOPT_ENABLE_NUCLEON_DECAY
support/rwght_OPTVAR := GOPT_ENABLE_RWGHT
support/masterclass_OPTVAR := GOPT_ENABLE_MASTERCLASS
.PHONY: all $(ALL_MODULES)
all: $(ALL_MODULES)
# This is subtle and tricky. OPTVAR will hold the name of the variable
# that defines whether we build the module defined by $@ (eg
# GOPT_ENABLE_MASTERCLASS). OPTVAL will hold the *value* of that
# variable (eg YES). Both have to be set with "=", not ":=", because
# we want them expanded inside the target where $@ is set
OPTVAR = $($@_OPTVAR)
OPTVAL = $($($@_OPTVAR))
# A little function that returns "buildit" if the module named by $@
# should be built, and an empty string if it should not. The module
# should be built if there's no variable called <MODULENAME>_OPTVAR
# (ie, if $(OPTVAR) is null), or if there is such a variable, and its value is YES.
#
# The return value convention is just for the benefit of the $(if ...)
# function that we'll use later, which considers non-empty strings to
# be true and empty strings to be false
should_build = $(if $(OPTVAR),$(if $(findstring YES,$(OPTVAL)),buildit), buildit)
# The rule to build a module: if should_build says we should build it, just call $(MAKE) in its directory
$(ALL_MODULES): bin lib src/Conventions/GVersion.h src/Conventions/GBuild.h install-scripts
$(if $(call should_build), \
@echo "Building $@" ;\
$(MAKE) -C src/$@,\
@echo "Skipping $@")
# Dependencies between modules
$(OPTIONAL_MODULES) $(MEDIUM_ENERGY_MODULES) $(TEST_MEDIUM_ENERGY_MODULES): $(EVGEN_MODULES)
$(EVGEN_MODULES): $(CORE) $(UTILS)
$(VLD_TOOLS) $(SUPPORT_APP_MODULES) $(APP_MODULES): $(OPTIONAL_MODULES) $(MEDIUM_ENERGY_MODULES) $(TEST_MEDIUM_ENERGY_MODULES)
install: $(INSTALL_TARGETS)
bin lib:
mkdir -p ${GENIE}/$@; chmod 755 ${GENIE}/$@
src/Conventions/GVersion.h:
perl ${GENIE}/src/scripts/setup/genie-write-gversion
src/Conventions/GBuild.h:
perl ${GENIE}/src/scripts/setup/genie-write-gbuild
# This target is used for generating the doxygen documentation
# during the genie build.
# It only does so if the option has been enabled explicitly by the user.
doxygen-doc:
ifeq ($(strip $(GOPT_ENABLE_DOXYGEN_DOC)),YES)
@echo " "
@echo "** Building doxygen documentation..."
$(MAKE) -C src/scripts doxygen
else
endif
# Use this target to generate the doxygen documentation at any
# point, independently of your local genie build.
doxygen:
@echo " "
@echo "** Building doxygen documentation..."
$(MAKE) -C src/scripts doxygen
install-scripts:
@echo " "
@echo "** Installing scripts..."
$(MAKE) -C src/scripts install
save-build-env: FORCE
@echo " "
@echo "** Taking a snapshot of the build environment..."
perl ${GENIE}/src/scripts/setup/genie-build-env-snapshot
check-previous-installation: FORCE
@echo " "
@echo "** Testing for existing GENIE installation at specified installation location..."
ifeq ($(strip $(GENIE_PREVIOUS_INSTALLATION)),YES)
$(error Previous installation exists at your specified installation path: $(GENIE_INSTALLATION_PATH). Try 'gmake distclean' first)
endif
make-install-dirs: FORCE
@echo " "
@echo "** Creating directory structure for GENIE installation..."
[ -d ${GENIE_INSTALLATION_PATH} ] || mkdir ${GENIE_INSTALLATION_PATH}
cd ${GENIE_INSTALLATION_PATH}
[ -d ${GENIE_BIN_INSTALLATION_PATH} ] || mkdir ${GENIE_BIN_INSTALLATION_PATH}
[ -d ${GENIE_LIB_INSTALLATION_PATH} ] || mkdir ${GENIE_LIB_INSTALLATION_PATH}
[ -d ${GENIE_INCBASE_INSTALLATION_PATH} ] || mkdir ${GENIE_INCBASE_INSTALLATION_PATH}
mkdir ${GENIE_INC_INSTALLATION_PATH}
$(foreach mod, $(INSTALL_MODULES), mkdir ${GENIE_INC_INSTALLATION_PATH}/$(mod) ; )
copy-install-files: FORCE
@echo " "
@echo "** Copying libraries/binaries/headers to installation location..."
cp ${GENIE_BIN_PATH}/* ${GENIE_BIN_INSTALLATION_PATH};\
$(foreach mod, $(INSTALL_MODULES), $(MAKE) -C src/$(mod) install ; )
.PHONY: purge
purge: FORCE
@echo " "
@echo "** Purging..."
$(foreach mod, $(ALL_MODULES), make -C src/$(mod) purge ;)
cd ${GENIE}
.PHONY: clean clean-files clean-dir clean-etc
clean: clean-files clean-dir clean-etc
clean-files:
@echo " "
@echo "** Cleaning..."
$(foreach mod, $(ALL_MODULES), make -C src/$(mod) clean ;)
cd $(GENIE);\
[ -d ./bin ] && rm -f ./bin/*;\
[ -d ./lib ] && rm -f ./lib/*;\
cd $(GENIE)
clean-dir: clean-files
@echo "Deleting GENIE lib and bin directories...";\
cd $(GENIE);\
[ -d ./bin ] && rmdir ./bin;\
[ -d ./lib ] && rmdir ./lib
clean-etc:
cd $(GENIE); \
rm -f ./*log; \
cd ${GENIE}
distclean: FORCE
@echo " "
@echo "** Cleaning GENIE installation... "
[ ! -d ${GENIE_INSTALLATION_PATH}/include/GENIE ] || rm -rf ${GENIE_INSTALLATION_PATH}/include/GENIE/
$(foreach mod, $(ALL_MODULES), make -C src/$(mod) distclean ;)
FORCE:
# DO NOT DELETE