-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathMakefile
More file actions
143 lines (116 loc) · 6.1 KB
/
Makefile
File metadata and controls
143 lines (116 loc) · 6.1 KB
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
# Makefile for xcache
BUILD_XCACHE_CONSISTENCY_CHECK ?= 1
# ------------------------------------------------------------------------------
# Release information: Update for each release
# ------------------------------------------------------------------------------
PACKAGE := xcache
VERSION := 4.1.0
# ------------------------------------------------------------------------------
# Other configuration: May need to change for a release
# ------------------------------------------------------------------------------
PYTHON = python
LIBEXEC_FILES := src/xcache-reporter \
src/renew-proxy
INSTALL_LIBEXEC_DIR := usr/libexec/xcache
XROOTD_CONFIG := $(wildcard configs/atlas-xcache/xrootd/*) \
$(wildcard configs/cms-xcache/xrootd/*) \
$(wildcard configs/xcache/xrootd/*) \
$(wildcard configs/xcache-redir/xrootd/*) \
XROOTD_CONFIGD := $(wildcard configs/atlas-xcache/config.d/*) \
$(wildcard configs/cms-xcache/config.d/*) \
$(wildcard configs/xcache/config.d/*) \
$(wildcard configs/xcache-redir/config.d/*) \
ifeq ($(BUILD_XCACHE_CONSISTENCY_CHECK), 1)
SYSTEMD_UNITS := $(wildcard configs/xcache/systemd/*) \
$(wildcard configs/xcache-consistency-check/systemd/*)
else
SYSTEMD_UNITS := $(wildcard configs/xcache/systemd/*)
endif
TMPFILES_D := configs/xcache/tmpfiles/xcache.conf
INSTALL_XROOTD_DIR := etc/xrootd
INSTALL_SYSTEMD_UNITDIR := usr/lib/systemd/system
PYTHON_LIB := src/xrootd_cache_stats.py
DIST_FILES := $(LIBEXEC_FILES) $(PYTHON_LIB) Makefile
# ------------------------------------------------------------------------------
# Internal variables: Do not change for a release
# ------------------------------------------------------------------------------
DIST_DIR_PREFIX := dist_dir_
TARBALL_DIR := $(PACKAGE)-$(VERSION)
TARBALL_NAME := $(PACKAGE)-$(VERSION).tar.gz
UPSTREAM := /p/vdt/public/html/upstream
UPSTREAM_DIR := $(UPSTREAM)/$(PACKAGE)/$(VERSION)
INSTALL_PYTHON_DIR := $(shell $(PYTHON) -c 'from sysconfig import get_path; print(get_path("purelib"))')
# ------------------------------------------------------------------------------
.PHONY: _default distclean install dist upstream check
_default:
@echo "There is no default target; choose one of the following:"
@echo "make install DESTDIR=path -- install files to path"
@echo "make dist -- make a distribution source tarball"
@echo "make upstream [UPSTREAM=path] -- install source tarball to upstream cache rooted at path"
@echo "make check -- use pylint to check for errors"
@echo
@echo "Add BUILD_XCACHE_CONSISTENCY_CHECK=0 to skip building xcache-consistency-check"
distclean:
rm -f *.tar.gz
ifneq ($(strip $(DIST_DIR_PREFIX)),) # avoid evil
rm -fr $(DIST_DIR_PREFIX)*
endif
install:
mkdir -p $(DESTDIR)/$(INSTALL_LIBEXEC_DIR)
install -p -m 0755 $(LIBEXEC_FILES) $(DESTDIR)/$(INSTALL_LIBEXEC_DIR)
sed -i -e 's/##VERSION##/$(VERSION)/g' $(DESTDIR)/$(INSTALL_LIBEXEC_DIR)/xcache-reporter
mkdir -p $(DESTDIR)/$(INSTALL_PYTHON_DIR)
install -p -m 0644 $(PYTHON_LIB) $(DESTDIR)/$(INSTALL_PYTHON_DIR)
mkdir -p $(DESTDIR)/$(INSTALL_XROOTD_DIR)
# XRootD configuration files
install -p -m 0644 $(XROOTD_CONFIG) $(DESTDIR)/$(INSTALL_XROOTD_DIR)
mkdir -p $(DESTDIR)/$(INSTALL_XROOTD_DIR)/config.d
install -p -m 0644 $(XROOTD_CONFIGD) $(DESTDIR)/$(INSTALL_XROOTD_DIR)/config.d
ifeq ($(BUILD_XCACHE_CONSISTENCY_CHECK),1)
# XCache Consistency Check
mkdir -p $(DESTDIR)/usr/bin
mkdir -p $(DESTDIR)/var/lib/xcache-consistency-check
install -p -m 0755 src/xcache-consistency-check $(DESTDIR)/usr/bin/xcache-consistency-check
install -p -m 0644 configs/xcache-consistency-check/xrootd/xcache-consistency-check.cfg $(DESTDIR)/etc/xrootd/xcache-consistency-check.cfg
endif
# systemd unit files
mkdir -p $(DESTDIR)/$(INSTALL_SYSTEMD_UNITDIR)
install -p -m 0644 $(SYSTEMD_UNITS) $(DESTDIR)/$(INSTALL_SYSTEMD_UNITDIR)
# systemd unit overrides
mkdir -p $(DESTDIR)/$(INSTALL_SYSTEMD_UNITDIR)/xrootd-renew-proxy.service.d
# atlas-xcache
mkdir -p $(DESTDIR)/$(INSTALL_SYSTEMD_UNITDIR)/xrootd@atlas-xcache.service.d
install -p -m 0644 configs/atlas-xcache/overrides/10-atlas-xcache-overrides.conf $(DESTDIR)/$(INSTALL_SYSTEMD_UNITDIR)/xrootd@atlas-xcache.service.d/
install -p -m 0644 configs/atlas-xcache/overrides/xrootd-renew-proxy/10-atlas-refresh-proxy-overrides.conf $(DESTDIR)/$(INSTALL_SYSTEMD_UNITDIR)/xrootd-renew-proxy.service.d/
# cms-xcache
mkdir -p $(DESTDIR)/$(INSTALL_SYSTEMD_UNITDIR)/xrootd@cms-xcache.service.d
mkdir -p $(DESTDIR)/$(INSTALL_SYSTEMD_UNITDIR)/cmsd@cms-xcache.service.d
install -p -m 0644 configs/cms-xcache/overrides/xrootd/10-cms-xcache-overrides.conf $(DESTDIR)/$(INSTALL_SYSTEMD_UNITDIR)/xrootd@cms-xcache.service.d/
install -p -m 0644 configs/cms-xcache/overrides/cmsd/10-cms-xcache-overrides.conf $(DESTDIR)/$(INSTALL_SYSTEMD_UNITDIR)/cmsd@cms-xcache.service.d/
install -p -m 0644 configs/cms-xcache/overrides/xrootd-renew-proxy/10-cms-refresh-proxy-overrides.conf $(DESTDIR)/$(INSTALL_SYSTEMD_UNITDIR)/xrootd-renew-proxy.service.d/
# systemd tempfiles
mkdir -p $(DESTDIR)/run/xcache-auth
mkdir -p $(DESTDIR)/run/xcache-redir
mkdir -p $(DESTDIR)/usr/lib/tmpfiles.d
install -p -m 0644 $(TMPFILES_D) $(DESTDIR)/usr/lib/tmpfiles.d
$(TARBALL_NAME): $(DIST_FILES)
$(eval TEMP_DIR := $(shell mktemp -d -p . $(DIST_DIR_PREFIX)XXXXXXXXXX))
mkdir -p $(TEMP_DIR)/$(TARBALL_DIR)
cp -pr $(DIST_FILES) $(TEMP_DIR)/$(TARBALL_DIR)/
sed -i -e 's/##VERSION##/$(VERSION)/g' $(TEMP_DIR)/$(TARBALL_DIR)/xcache-reporter
tar czf $(TARBALL_NAME) -C $(TEMP_DIR) $(TARBALL_DIR)
rm -rf $(TEMP_DIR)
dist: $(TARBALL_NAME)
upstream: $(TARBALL_NAME)
ifeq ($(shell ls -1d $(UPSTREAM) 2>/dev/null),)
@echo "Must have existing upstream cache directory at '$(UPSTREAM)'"
else ifneq ($(shell ls -1 $(UPSTREAM_DIR)/$(TARBALL_NAME) 2>/dev/null),)
@echo "Source tarball already installed at '$(UPSTREAM_DIR)/$(TARBALL_NAME)'"
@echo "Remove installed source tarball or increment release version"
else
mkdir -p $(UPSTREAM_DIR)
install -p -m 0644 $(TARBALL_NAME) $(UPSTREAM_DIR)/$(TARBALL_NAME)
rm -f $(TARBALL_NAME)
endif
check:
pylint -E $(LIBEXEC_FILES) $(PYTHON_LIB)