File: rules

package info (click to toggle)
lvm2 2.02.168-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 12,500 kB
  • ctags: 15,264
  • sloc: ansic: 142,688; sh: 22,776; python: 6,500; makefile: 2,288; ruby: 332; awk: 20; cpp: 10
file content (315 lines) | stat: -rwxr-xr-x 11,100 bytes parent folder | download
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
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
#!/usr/bin/make -f

# Uncomment this to turn on verbose mode. 
#export DH_VERBOSE=1

DEB_HOST_ARCH       ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_HOST_MULTIARCH  ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

DEB_CFLAGS_MAINT_STRIP = -O2
include /usr/share/dpkg/buildflags.mk

SOURCE := $(shell dpkg-parsechangelog | sed -ne 's,^Source: *\(.*\)$$,\1,p')
VERSION_COMPLETE := $(shell dpkg-parsechangelog | sed -ne 's,^Version: *\(.*\)$$,\1,p')
VERSION_DEBIAN := $(shell echo "$(VERSION_COMPLETE)" | sed -e 's,^[^-]*-,,')

DEVMAPPER_ABINAME = 1.02.1
DEVMAPPER_VERSION_PLAIN = $(shell awk '{print $$1}' VERSION_DM)
DEVMAPPER_VERSION = 2:$(DEVMAPPER_VERSION_PLAIN)
DEVMAPPER_VERSION_DEBIAN = $(DEVMAPPER_VERSION)-$(VERSION_DEBIAN)
DEVMAPPER_VERSION_FILE = $(DEVMAPPER_VERSION_PLAIN)-$(VERSION_DEBIAN)

LVM2APP_ABINAME = 2.2
LVM2CMD_ABINAME = 2.02

MAKE_REAL := $(MAKE)
MAKE_SELF := $(MAKE) -f debian/rules

BUILD_DIR = debian/build
STAMPS_DIR = debian/stamps

ifeq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS_OPT_DEB = -O2
CFLAGS_OPT_UDEB = -Os
endif

CONFIGURE = ./configure \
		CC=gcc CFLAGS="$(CPPFLAGS) $(CFLAGS)" LDFLAGS="$(LDFLAGS)" CLDFLAGS="$(LDFLAGS)" \
		--build $(DEB_BUILD_GNU_TYPE)
ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
CONFIGURE += --host $(DEB_HOST_GNU_TYPE)
endif

CONFIGURE += \
	--prefix=/usr \
	--exec-prefix= \
	--sbindir=/sbin \
	--mandir=\$${prefix}/share/man \
	--infodir=\$${prefix}/share/info

source: $(STAMPS_DIR)/source

$(STAMPS_DIR)/source: SOURCE_FILES = $(filter-out debian .svn, $(wildcard * .[^.]*))
$(STAMPS_DIR)/source: DIR = $(BUILD_DIR)/source
$(STAMPS_DIR)/source:
	@mkdir -p $(STAMPS_DIR)
	rm -rf $(DIR)
	mkdir -p '$(DIR)'
	cp -al $(SOURCE_FILES) '$(DIR)'
	cd $(DIR); autoreconf
	touch $@

setup: $(STAMPS_DIR)/setup_deb $(STAMPS_DIR)/setup_udeb

$(STAMPS_DIR)/setup_deb: SOURCE_DIR = $(BUILD_DIR)/source
$(STAMPS_DIR)/setup_deb: DIR = $(BUILD_DIR)/build_deb
$(STAMPS_DIR)/setup_deb: $(STAMPS_DIR)/source
	rm -rf $(DIR)
	cp -al '$(SOURCE_DIR)' '$(DIR)'
	cd $(DIR); \
	$(CONFIGURE) \
		--libdir=/lib/$(DEB_HOST_MULTIARCH) \
		--with-usrlibdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
		--with-optimisation="$(CFLAGS_OPT_DEB)" \
		--with-cache=internal \
		--with-clvmd=corosync \
		--with-cluster=internal \
		--with-device-uid=0 \
		--with-device-gid=6 \
		--with-device-mode=0660 \
		--with-default-pid-dir=/run \
		--with-default-run-dir=/run/lvm \
		--with-default-locking-dir=/run/lock/lvm \
		--with-thin=internal \
		--with-thin-check=/usr/sbin/thin_check \
		--with-thin-dump=/usr/sbin/thin_dump \
		--with-thin-repair=/usr/sbin/thin_repair \
		--enable-applib \
		--enable-blkid_wiping \
		--enable-cmdlib \
		--enable-cmirrord \
		--enable-dmeventd \
		--enable-lvmetad \
		--enable-lvmpolld \
		--enable-pkgconfig \
		--enable-readline \
		--enable-udev_rules \
		--enable-udev_sync \
		--disable-udev-systemd-background-jobs
	touch $@

$(STAMPS_DIR)/setup_udeb: SOURCE_DIR = $(BUILD_DIR)/source
$(STAMPS_DIR)/setup_udeb: DIR = $(BUILD_DIR)/build_udeb
$(STAMPS_DIR)/setup_udeb: $(STAMPS_DIR)/source
	rm -rf $(DIR)
	cp -al '$(SOURCE_DIR)' '$(DIR)'
	cd $(DIR); \
	$(CONFIGURE) \
		--with-optimisation="$(CFLAGS_OPT_UDEB)" \
		--with-cluster=none \
		--with-lvm1=none \
		--with-pool=none \
		--disable-readline \
		--disable-selinux
	touch $@

build: build-arch build-indep
build-arch: $(STAMPS_DIR)/build_deb $(STAMPS_DIR)/build_udeb
build-indep:

build_deb: $(STAMPS_DIR)/build_deb
build_udeb: $(STAMPS_DIR)/build_udeb

$(STAMPS_DIR)/build_deb: DIR = $(BUILD_DIR)/build_deb
$(STAMPS_DIR)/build_deb: $(STAMPS_DIR)/setup_deb
	dh_testdir
	+$(MAKE_REAL) -C $(DIR) LIB_VERSION_DM=$(DEVMAPPER_ABINAME)
	cd $(DIR)/python; make liblvm_python.c; $(foreach i, $(shell pyversions -r; py3versions -r), $(i) setup.py build;)
	touch $@

$(STAMPS_DIR)/build_%: DIR = $(BUILD_DIR)/build_$*
$(STAMPS_DIR)/build_%: $(STAMPS_DIR)/setup_%
	dh_testdir
	+$(MAKE_REAL) -C $(DIR) LIB_VERSION_DM=$(DEVMAPPER_ABINAME)
	touch $@

$(BUILD_DIR) $(STAMPS_DIR):
	@[ -d $@ ] || mkdir $@

maintainerclean:
	rm -rf $(filter-out .svn .svk debian, $(wildcard * .[^.]*))

clean:
	dh_testdir
	rm -rf $(BUILD_DIR) $(STAMPS_DIR)
	dh_clean

$(STAMPS_DIR)/install_deb: DIR = $(BUILD_DIR)/build_deb
$(STAMPS_DIR)/install_deb: INSTALL_DIR = $(BUILD_DIR)/install_deb
$(STAMPS_DIR)/install_deb: $(STAMPS_DIR)/build_deb
	dh_testdir
	dh_testroot
	rm -rf $(INSTALL_DIR)
	+$(MAKE_REAL) -C $(DIR) \
		install \
		install_systemd_generators \
		install_systemd_units \
		install_tmpfiles_configuration \
		DESTDIR=$(CURDIR)/$(INSTALL_DIR) \
		LIB_VERSION_DM=$(DEVMAPPER_ABINAME)
	cd $(DIR)/python; $(foreach i, $(shell pyversions -r; py3versions -r), $(i) setup.py install --skip-build --install-layout deb --root $(CURDIR)/$(INSTALL_DIR);)
	touch $@

$(STAMPS_DIR)/install_%: DIR = $(BUILD_DIR)/build_$*
$(STAMPS_DIR)/install_%: INSTALL_DIR = $(BUILD_DIR)/install_$*
$(STAMPS_DIR)/install_%: $(STAMPS_DIR)/build_%
	dh_testdir
	dh_testroot
	rm -rf $(INSTALL_DIR)
	+$(MAKE_REAL) -C $(DIR) \
		install \
		DESTDIR=$(CURDIR)/$(INSTALL_DIR) \
		LIB_VERSION_DM=$(DEVMAPPER_ABINAME)
	touch $@

install-base-prep:
	dh_testdir
	dh_testroot
	dh_prep
	dh_install -X .svn --sourcedir=$(INSTALL_DIR)

install-base:
	dh_installchangelogs $(if $(CHANGELOG),$(CHANGELOG),WHATS_NEW)
	dh_installdebconf
	dh_installdocs
	dh_installexamples
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol -- $(GENCONTROL_ARGS)
	dh_md5sums
	dh_builddeb $(BUILDDEB_ARGS)

install_clvm: export DH_OPTIONS = -pclvm
install_clvm: DIR = $(BUILD_DIR)/install_deb
install_clvm: $(STAMPS_DIR)/install_deb
	+$(MAKE_SELF) install-base-prep INSTALL_DIR='$(DIR)'
	dh_systemd_enable --no-enable lvm2-cluster-activation.service
	dh_systemd_start --no-start --no-restart-after-upgrade lvm2-cluster-activation.service
	+$(MAKE_SELF) install-base

install_dmeventd: export DH_OPTIONS = -pdmeventd
install_dmeventd: DIR = $(BUILD_DIR)/install_deb
install_dmeventd: $(STAMPS_DIR)/install_deb install_liblvm2
	+$(MAKE_SELF) install-base-prep INSTALL_DIR='$(DIR)'
	dh_systemd_enable --no-enable dm-event.service
	dh_systemd_enable dm-event.socket
	dh_systemd_start --restart-after-upgrade dm-event.socket
	dh_makeshlibs
	+$(MAKE_SELF) install-base CHANGELOG=WHATS_NEW_DM GENCONTROL_ARGS="-v$(DEVMAPPER_VERSION_DEBIAN)"

install_dmsetup: export DH_OPTIONS = -pdmsetup
install_dmsetup: DIR = $(BUILD_DIR)/install_deb
install_dmsetup: $(STAMPS_DIR)/install_deb install_libdevmapper
	+$(MAKE_SELF) install-base-prep INSTALL_DIR='$(DIR)'
	+$(MAKE_SELF) install-base CHANGELOG=WHATS_NEW_DM GENCONTROL_ARGS="-v$(DEVMAPPER_VERSION_DEBIAN)"

install_dmsetup-udeb: PACKAGE_NAME = dmsetup-udeb
install_dmsetup-udeb: export DH_OPTIONS = -p$(PACKAGE_NAME)
install_dmsetup-udeb: PACKAGE_FILE = $(PACKAGE_NAME)_$(DEVMAPPER_VERSION_FILE)_$(DEB_HOST_ARCH).udeb
install_dmsetup-udeb: DIR = $(BUILD_DIR)/install_udeb
install_dmsetup-udeb: $(STAMPS_DIR)/install_udeb install_libdevmapper
	+$(MAKE_SELF) install-base-prep INSTALL_DIR='$(DIR)'
	+$(MAKE_SELF) install-base \
		BUILDDEB_ARGS="--filename=$(PACKAGE_FILE)" \
		GENCONTROL_ARGS="-v$(DEVMAPPER_VERSION_DEBIAN)"

install_libdevmapper: export DH_OPTIONS = -plibdevmapper$(DEVMAPPER_ABINAME)
install_libdevmapper: DIR = $(BUILD_DIR)/install_deb
install_libdevmapper: $(STAMPS_DIR)/install_deb
	+$(MAKE_SELF) install-base-prep INSTALL_DIR='$(DIR)'
	dh_makeshlibs \
		--add-udeb 'libdevmapper$(DEVMAPPER_ABINAME)-udeb' \
	       	"-Vlibdevmapper$(DEVMAPPER_ABINAME) (>= $(DEVMAPPER_VERSION))" \
		-- "-v$(DEVMAPPER_VERSION_DEBIAN)" -c2
	+$(MAKE_SELF) install-base CHANGELOG=WHATS_NEW_DM GENCONTROL_ARGS="-v$(DEVMAPPER_VERSION_DEBIAN)"

install_libdevmapper-event: export DH_OPTIONS = -plibdevmapper-event$(DEVMAPPER_ABINAME)
install_libdevmapper-event: DIR = $(BUILD_DIR)/install_deb
install_libdevmapper-event: $(STAMPS_DIR)/install_deb
	+$(MAKE_SELF) install-base-prep INSTALL_DIR='$(DIR)'
	dh_makeshlibs \
		"-Vlibdevmapper-event$(DEVMAPPER_ABINAME) (>= $(DEVMAPPER_VERSION))" \
		-- "-v$(DEVMAPPER_VERSION_DEBIAN)" -c2
	+$(MAKE_SELF) install-base CHANGELOG=WHATS_NEW_DM GENCONTROL_ARGS="-v$(DEVMAPPER_VERSION_DEBIAN)"

install_libdevmapper-dev: export DH_OPTIONS = -plibdevmapper-dev
install_libdevmapper-dev: DIR = $(BUILD_DIR)/install_deb
install_libdevmapper-dev: $(STAMPS_DIR)/install_deb
	+$(MAKE_SELF) install-base-prep INSTALL_DIR='$(DIR)'
	+$(MAKE_SELF) install-base CHANGELOG=WHATS_NEW_DM GENCONTROL_ARGS="-v$(DEVMAPPER_VERSION_DEBIAN)"

install_libdevmapper-udeb: PACKAGE_NAME = libdevmapper$(DEVMAPPER_ABINAME)-udeb
install_libdevmapper-udeb: export DH_OPTIONS = -p$(PACKAGE_NAME)
install_libdevmapper-udeb: PACKAGE_FILE = $(PACKAGE_NAME)_$(DEVMAPPER_VERSION_FILE)_$(DEB_HOST_ARCH).udeb
install_libdevmapper-udeb: DIR = $(BUILD_DIR)/install_udeb
install_libdevmapper-udeb: $(STAMPS_DIR)/install_udeb
	+$(MAKE_SELF) install-base-prep INSTALL_DIR='$(DIR)'
	+$(MAKE_SELF) install-base \
		BUILDDEB_ARGS="--filename=$(PACKAGE_FILE)" \
		GENCONTROL_ARGS="-v$(DEVMAPPER_VERSION_DEBIAN)"

install_liblvm2: export DH_OPTIONS = -pliblvm2app$(LVM2APP_ABINAME) -pliblvm2cmd$(LVM2CMD_ABINAME) -pliblvm2-dev
install_liblvm2: DIR = $(BUILD_DIR)/install_deb
install_liblvm2: $(STAMPS_DIR)/install_deb install_libdevmapper
	+$(MAKE_SELF) install-base-prep INSTALL_DIR='$(DIR)'
	dh_makeshlibs -V -- -c2
	+$(MAKE_SELF) install-base

install_lvm2: export DH_OPTIONS = -plvm2
install_lvm2: DIR = $(BUILD_DIR)/install_deb
install_lvm2: $(STAMPS_DIR)/install_deb install_libdevmapper install_liblvm2
	+$(MAKE_SELF) install-base-prep INSTALL_DIR='$(DIR)'
	dh_installinit --no-start
	dh_installinit --restart-after-upgrade --name lvm2-lvmetad
	dh_installinit --restart-after-upgrade --name lvm2-lvmpolld
	dh_systemd_enable \
		lvm2-monitor.service \
		lvm2-lvmetad.socket \
		lvm2-lvmpolld.socket
	dh_systemd_enable --no-enable \
		lvm2-lvmetad.service \
		lvm2-lvmpolld.service
	dh_systemd_start --restart-after-upgrade \
		lvm2-lvmetad.service \
		lvm2-lvmpolld.service
	dh_systemd_start --no-restart-on-upgrade \
		lvm2-lvmetad.socket \
		lvm2-lvmpolld.socket
	+$(MAKE_SELF) install-base

install_lvm2-udeb: export DH_OPTIONS = -plvm2-udeb
install_lvm2-udeb: DIR = $(BUILD_DIR)/install_udeb
install_lvm2-udeb: $(STAMPS_DIR)/install_udeb install_libdevmapper-udeb
	+$(MAKE_SELF) install-base-prep INSTALL_DIR='$(DIR)'
	+$(MAKE_SELF) install-base

install_python-lvm2: export DH_OPTIONS = -ppython-lvm2 -ppython3-lvm2
install_python-lvm2: DIR = $(BUILD_DIR)/install_deb
install_python-lvm2: $(STAMPS_DIR)/install_deb install_liblvm2
	+$(MAKE_SELF) install-base-prep INSTALL_DIR='$(DIR)'
	dh_python2
	dh_python3
	+$(MAKE_SELF) install-base

binary-indep:
binary-arch: $(addprefix install_,libdevmapper libdevmapper-udeb libdevmapper-event libdevmapper-dev dmsetup dmsetup-udeb dmeventd liblvm2 lvm2 lvm2-udeb clvm python-lvm2)

binary: binary-indep binary-arch

.PHONY: build clean binary-indep binary-arch binary install configure