-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile_hdgeant4
93 lines (79 loc) · 3.1 KB
/
Makefile_hdgeant4
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
# Makefile_hdgeant4
PWD = $(shell pwd)
ifdef HDGEANT4_VERSION
SOURCE_CODE_TARGET = $(HDGEANT4_HOME)/.untar_done
ifdef HDGEANT4_DIRTAG
HDGEANT4_DIR = hdgeant4-$(HDGEANT4_VERSION)^$(HDGEANT4_DIRTAG)
else
HDGEANT4_DIR = hdgeant4-$(HDGEANT4_VERSION)
endif
TARFILE = $(HDGEANT4_VERSION).tar.gz
else
SOURCE_CODE_TARGET = $(HDGEANT4_HOME)/.clone_done
ifndef HDGEANT4_URL
HDGEANT4_URL=https://github.com/jeffersonlab/hdgeant4
endif
ifdef HDGEANT4_DIRTAG
HDGEANT4_DIR = $(notdir $(HDGEANT4_URL))^$(HDGEANT4_DIRTAG)
else
HDGEANT4_DIR = $(notdir $(HDGEANT4_URL))
endif
ifndef HDGEANT4_BRANCH
HDGEANT4_BRANCH = master
endif
endif
UNTAR_TEMP_DIR := untar_temp_dir_$(shell echo $$RANDOM)
HDGEANT4_HOME = $(PWD)/$(HDGEANT4_DIR)
PYTHON_CONFIG = $(shell $(BUILD_SCRIPTS)/python_chooser.sh config)
PYTHON_BOOST = $(shell $(BUILD_SCRIPTS)/python_chooser.sh boost)
PYTHON_LIB_OPTION = $(shell $(BUILD_SCRIPTS)/python_chooser.sh lib)
PYTHON_MAJOR_VERSION = $(shell $(BUILD_SCRIPTS)/python_chooser.sh version)
PYTHON_MINOR_VERSION = $(shell $(BUILD_SCRIPTS)/python_chooser.sh minor)
ifeq '$(PYTHON_MAJOR_VERSION)' '3'
PYTHON_GE_3 = true
else
PYTHON_GE_3 = false
endif
QTHOME_LOCATION := $(shell if [ -d "/usr/lib64/qt5" ]; then echo /usr/lib64/qt5; elif [ -d "/usr/lib64/qt4" ]; then echo /usr/lib64/qt4; else echo not_found; fi)
ifneq ($(QTHOME_LOCATION), not_found)
QTHOME_DEF = QTHOME=$(QTHOME_LOCATION)
endif
all: force_rebuild_action $(HDGEANT4_HOME)/hdgeant4_prereqs_version.xml
force_rebuild_action:
ifdef FORCE
@echo forcing rebuild
$(RM) $(HDGEANT4_HOME)/.make_done
endif
$(TARFILE):
wget --no-verbose --no-check-certificate -O $@ https://github.com/jeffersonlab/hdgeant4/archive/$(TARFILE)
$(HDGEANT4_HOME)/.clone_done:
git clone -b $(HDGEANT4_BRANCH) $(HDGEANT4_URL) $(HDGEANT4_DIR)
ifdef HDGEANT4_HASH
cd $(HDGEANT4_DIR) ; git checkout $(HDGEANT4_HASH)
endif
date > $@
$(HDGEANT4_HOME)/.untar_done: $(TARFILE)
rm -rf $(UNTAR_TEMP_DIR)
mkdir $(UNTAR_TEMP_DIR)
cd $(UNTAR_TEMP_DIR) ; tar zxf ../$(TARFILE)
mv -v $(UNTAR_TEMP_DIR)/* $(HDGEANT4_DIR)
rmdir -v $(UNTAR_TEMP_DIR)
date > $@
$(HDGEANT4_HOME)/.link_to_fixes_done: $(SOURCE_CODE_TARGET)
@test -d $(HDGEANT4_HOME)/src/G4.$(GEANT4_VERSION)fixes || (echo G4fixes directory does not exist. GEANT4_VERSION must be defined. GEANT4_VERSION = $(GEANT4_VERSION) ; exit 1)
cd $(HDGEANT4_HOME)/src ; ln -s G4.$(GEANT4_VERSION)fixes G4fixes
date > $@
$(HDGEANT4_HOME)/.patch_done: $(HDGEANT4_HOME)/.link_to_fixes_done
cd $(HDGEANT4_HOME); \
patch -p1 < ${BUILD_SCRIPTS}/patches/hdgeant4/hdgeant4_c++11.patch
date > $@
$(HDGEANT4_HOME)/.make_done: $(HDGEANT4_HOME)/.patch_done
cd $(HDGEANT4_HOME) ; \
if [ -z "$$G4SYSTEM" ] ; \
then echo Geant4 setup not complete, sourcing geant4make.sh ; \
. `find $(G4ROOT)/share/ -name geant4make.sh` ; \
fi ; \
make PYTHON_CONFIG=$(PYTHON_CONFIG) PYTHON_LIB_OPTION=$(PYTHON_LIB_OPTION) BOOST_PYTHON_LIB=-l$(PYTHON_BOOST) $(QTHOME_DEF) $(HDGEANT4_MAKE_OPTIONS) ; \
date > $@
$(HDGEANT4_HOME)/hdgeant4_prereqs_version.xml: $(HDGEANT4_HOME)/.make_done
cd $(HDGEANT4_HOME) ; $(BUILD_SCRIPTS)/version_prereqs.pl hdgeant4