-
Notifications
You must be signed in to change notification settings - Fork 47
/
Makefile.in
290 lines (248 loc) · 9.08 KB
/
Makefile.in
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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
# Makefile for drbd
#
# This file is part of DRBD by Philipp Reisner and Lars Ellenberg.
#
# Copyright (C) 2001-2008, LINBIT Information Technologies GmbH.
# Copyright (C) 2001-2008, Philipp Reisner <[email protected]>.
# Copyright (C) 2002-2008, Lars Ellenberg <[email protected]>.
# Copyright (C) 2008-2024, LINBIT HA-Solutions GmbH.
#
# drbd is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# drbd is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with drbd
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#
# TODO move some of the more cryptic bash scriptlets here into scripts/*
# and call those from here. -- lge
# variables set by configure
GIT = @GIT@
LN_S = @LN_S@
PREFIX = @prefix@
RPMBUILD = @RPMBUILD@
SED = @SED@
# features enabled or disabled by configure
WITH_UDEV = @WITH_UDEV@
WITH_XEN = @WITH_XEN@
WITH_PACEMAKER = @WITH_PACEMAKER@
WITH_HEARTBEAT = @WITH_HEARTBEAT@
WITH_RGMANAGER = @WITH_RGMANAGER@
WITH_BASHCOMPLETION = @WITH_BASHCOMPLETION@
WITH_84_SUPPORT = @WITH_84_SUPPORT@
WITH_MANUAL = @WITH_MANUAL@
WITH_DRBDMON = @WITH_DRBDMON@
WITH_WINDRBD = @WITH_WINDRBD@
WITH_CLITEST = @WITH_CLITEST@
# for some reason some of the commands below only work correctly in bash,
# and not in e.g. dash. I'm too lazy to fix it to be compatible.
SHELL=/bin/bash
PNAME := drbd-utils
DOCKERREGISTRY := drbd.io
ARCH ?= amd64
ifneq ($(strip $(ARCH)),)
DOCKERREGISTRY := $(DOCKERREGISTRY)/$(ARCH)
endif
DOCKERREGPATH = $(DOCKERREGISTRY)/$(PNAME)
DOCKER_TAG ?= latest
RPM_SUBPROJECTS = drbd-utils drbd-bash-completion drbd-udev drbd-selinux
TOOLS_DIRS := user/shared user/v9 scripts
DOC_DIRS := documentation/v9 documentation/ja/v9
ifeq ($(WITH_84_SUPPORT),yes)
TOOLS_DIRS += user/v84
DOC_DIRS += documentation/v84 documentation/ja/v84
endif
ifeq ($(WITH_DRBDMON),yes)
TOOLS_DIRS += user/drbdmon
endif
ifeq ($(WITH_WINDRBD),yes)
TOOLS_DIRS += user/windrbd
endif
ifeq ($(WITH_MANUAL),yes)
SUBDIRS = $(TOOLS_DIRS) $(DOC_DIRS)
else
SUBDIRS = $(TOOLS_DIRS)
endif
all-yes := check-submods configure tools
all-$(WITH_MANUAL) += doc
all: $(all-yes)
.PHONY: all tools doc
tools:
@ set -e; for i in $(TOOLS_DIRS); do $(MAKE) -C $$i ; done
@ echo -e "\n\tUserland tools build was successful."
doc:
$(MAKE) -C documentation/v9 doc
$(MAKE) -C documentation/ja/v9 doc
ifeq ($(WITH_84_SUPPORT),yes)
$(MAKE) -C documentation/v84 doc
$(MAKE) -C documentation/ja/v84 doc
endif
.PHONY: test testorfail
ifeq ($(WITH_CLITEST),yes)
test:
$(MAKE) -C user/v9 test
ifeq ($(WITH_84_SUPPORT),yes)
$(MAKE) -C user/v84 test
endif
else
test:
$(warning "clitest" not found, test target disabled)
endif
ifeq ($(WITH_CLITEST),yes)
testorfail:
$(MAKE) test
else
testorfail:
$(error "clitest" not found, but tests are required for a release)
endif
# we cannot use 'git submodule foreach':
# foreach only works if submodule already checked out
.PHONY: check-submods
check-submods:
@if test -d .git && test -s .gitmodules; then \
for d in `grep "^\[submodule" .gitmodules | cut -f2 -d'"'`; do \
if [ ! "`ls -A $$d`" ]; then \
git submodule init; \
git submodule update; \
break; \
fi; \
done; \
fi
.PHONY: doc-clean install install-tools clean distclean extra-clean uninstall
doc-clean:
$(MAKE) -C documentation/v9 doc-clean
$(MAKE) -C documentation/ja/v9 doc-clean
ifeq ($(WITH_84_SUPPORT),yes)
$(MAKE) -C documentation/v84 doc-clean
$(MAKE) -C documentation/ja/v84 doc-clean
endif
install-yes := install-tools
install-$(WITH_MANUAL) += install-doc
install: $(install-yes)
install-tools:
@ set -e; for i in $(patsubst drbd,,$(TOOLS_DIRS)); do $(MAKE) -C $$i install; done
install-doc:
@ set -e; for i in $(patsubst drbd,,$(DOC_DIRS)); do $(MAKE) -C $$i install; done
.NOTPARALLEL clean:
@ set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i clean; done
rm -f *~
rm -rf dist
distclean:
@ set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i distclean; done
rm -f *~ .filelist
rm -rf dist
rm -rf autom4te.cache
rm -f config.log
EXTRA_CLEAN += Makefile user/Makefile user/v84/Makefile user/v9/Makefile scripts/Makefile user/drbdmon/Makefile
EXTRA_CLEAN += documentation/Makefile documentation/v84/Makefile documentation/v9/Makefile documentation/ja/v84/Makefile documentation/ja/v9/Makefile
EXTRA_CLEAN += user/shared/config.h drbd.spec
EXTRA_CLEAN += configure config.status
extra-clean: distclean
rm -f $(EXTRA_CLEAN)
uninstall:
@ set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i uninstall; done
.PHONY: check_VERSION
ifndef VERSION
check_VERSION:
$(error environment variable VERSION is not set)
else
check_VERSION:
true
endif
# only call this wrapper from drbd-utils.spdx.json
.PHONY: spdx-sub
spdx-sub:
cat $(SPDX_FILE).in | jq --args '.creationInfo.created = "$(SPDX_DATE)" | .packages[].versionInfo = "$(VERSION)" | .documentNamespace = "$(SPDX_DOC_NS)"' > $(SPDX_FILE)
.PHONY: sbom/drbd-utils.spdx.json
sbom/drbd-utils.spdx.json: check_VERSION
$(MAKE) -s spdx-sub SPDX_DATE="$$(date --utc +%FT%TZ)" SPDX_DOC_NS="https://linbit.com/spdx-docs/drbd-utils-$(VERSION)-$$(cat /proc/sys/kernel/random/uuid)" SPDX_FILE="$@"
! grep -q __PLACEHOLDER__ $@
# only call this wrapper from drbd-utils.cdx.json
.PHONY: cdx-sub
cdx-sub:
cat $(CDX_FILE).in | jq --args '.metadata.timestamp = "$(CDX_DATE)" | .metadata.component.version = "$(VERSION)" | .metadata.component."bom-ref" = "$(PURL)" | .metadata.component.purl = "$(PURL)" | .components = [$$ARGS.positional[] | {name:., type: "application", version: "$(VERSION)", licenses: [{licenses:{id: "GPL-2.0-or-later"}}], externalReferences:[{url: "https://github.com/LINBIT/drbd-utils", type: "website"}]}]' $(RPM_SUBPROJECTS) > $(CDX_FILE)
.PHONY: sbom/drbd-utils.cdx.json
sbom/drbd-utils.cdx.json: check_VERSION
$(MAKE) -s cdx-sub CDX_DATE="$$(date --utc +%FT%TZ)" PURL="pkg:github/LINBIT/drbd-utils@v$(VERSION)" CDX_FILE="$@"
! grep -q __PLACEHOLDER__ $@
.PHONY: check_changelogs_up2date
check_changelogs_up2date: check_VERSION
lbvers.py check \
--base='$(BASE)' --build='$(BUILD)' --build-nr='$(BUILD_NR)' --pkg-nr='$(PKG_NR)' \
--changelog=ChangeLog \
--rpm-spec=drbd.spec.in --rpm-spec-changelog-only \
--debian-changelog=debian/changelog \
--configureac=configure.ac \
--dockerfiles=Dockerfile --dockertoken=DRBD_UTILS_VERSION
.PHONY: .filelist
.filelist: check_VERSION
@set -e ; submodules=`$(GIT) submodule foreach --quiet 'echo $$path'`; \
$(GIT) ls-files | \
grep -vxF -e "$$submodules" | \
grep -v "^\.gitlab" | \
sed '$(if $(PRESERVE_DEBIAN),,/^debian/d);s#^#$(PNAME)-$(VERSION)/#' | \
grep -v "gitignore\|gitmodules" > .filelist
@$(GIT) submodule foreach --quiet 'git ls-files | sed -e "s,^,$(PNAME)-$(VERSION)/$$path/,"' | \
grep -v "gitignore\|gitmodules" >> .filelist
@[ -s .filelist ] # assert there is something in .filelist now
@find documentation -name "[^.]*.[578]" -o -name "*.html" | \
sed "s/^/$(PNAME)-$(VERSION)\//" >> .filelist ; \
echo $(PNAME)-$(VERSION)/user/shared/drbd_buildtag.h >> .filelist ; \
echo $(PNAME)-$(VERSION)/user/shared/config.h.in >> .filelist ; \
echo $(PNAME)-$(VERSION)/.filelist >> .filelist ; \
echo $(PNAME)-$(VERSION)/configure >> .filelist ; \
echo $(PNAME)-$(VERSION)/sbom/drbd-utils.spdx.json >> .filelist ; \
echo $(PNAME)-$(VERSION)/sbom/drbd-utils.cdx.json >> .filelist ; \
echo "./.filelist updated."
tools doc: check-submods
.PHONY: check_all_committed release debrelease tarball
check_all_committed:
@$(if $(FORCE),-,)modified=`$(GIT) ls-files -m -t`; \
if test -n "$$modified" ; then \
echo "$$modified"; \
false; \
fi
release: testorfail
$(MAKE) tarball
debrelease: testorfail
$(MAKE) tarball PRESERVE_DEBIAN=1
configure.ac: ;
configure: configure.ac
aclocal
autoheader
autoconf
config.status: configure
@printf "\nYou need to call ./configure with appropriate arguments (again).\n\n"; exit 1
tarball: check_VERSION check-submods check_all_committed check_changelogs_up2date distclean doc configure sbom/drbd-utils.spdx.json sbom/drbd-utils.cdx.json .filelist
rm -f drbd-utils-$(VERSION)
$(LN_S) . drbd-utils-$(VERSION)
for f in $$(<.filelist) ; do [ -e $$f ] && continue ; echo missing: $$f ; exit 1; done
tar --owner=0 --group=0 -czf - -T .filelist > drbd-utils-$(VERSION).tar.gz
rm drbd-utils-$(VERSION)
ifdef RPMBUILD
drbd.spec: drbd.spec.in configure
./configure --enable-spec
endif
.PHONY: selinux
selinux:
$(MAKE) -C selinux
ifneq ($(FORCE),1)
dockerimage: debrelease
else
dockerimage:
endif
docker build -t $(DOCKERREGPATH):$(DOCKER_TAG) $(EXTRA_DOCKER_BUILDARGS) .
docker tag $(DOCKERREGPATH):$(DOCKER_TAG) $(DOCKERREGPATH):latest
.PHONY: dockerpath
dockerpath:
@echo $(DOCKERREGPATH):latest $(DOCKERREGPATH):$(DOCKER_TAG)
Makefile.in: ;
Makefile: Makefile.in config.status
./config.status Makefile