summaryrefslogtreecommitdiff
path: root/debian/rules
blob: b13f218a80fbae02eee6df061921bd77d410471c (plain)
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
#!/usr/bin/make -f
# Copyright © 2001-2005 Mario Jou/3en <joussen@debian.org>
# Copyright © 2005-2008 Martin F. Krafft <madduck@debian.org>
# Distributable under the terms of the GNU GPL version 2.
#

#export DH_VERBOSE=1

export CROSS_COMPILE=$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)-
LDFLAGS = $(shell dpkg-buildflags --get LDFLAGS)
CXFLAGS = $(shell dpkg-buildflags --get CFLAGS) \
	  $(shell dpkg-buildflags --get CPPFLAGS)
BUILDFLAGS = CXFLAGS="$(CXFLAGS)" LDFLAGS="$(LDFLAGS)" DEBIAN=yes
DESTDIR = $(CURDIR)/debian/mdadm
DESTDIR_UDEB = $(DESTDIR)-udeb

build-arch: build-stamp

build-stamp:
	dh_testdir
	$(MAKE) all $(BUILDFLAGS) CONFFILE=/etc/mdadm/mdadm.conf CONFFILE2=/etc/mdadm.conf
	touch $@

# udeb rules should go, the only diff is the conffile location,
# and d-i specifies path explicitly when needed

udeb/dir-stamp:
	rm -rf udeb
	mkdir udeb
	ln *.[ch] Makefile udeb/
	touch $@

build-arch: udeb/build-stamp

udeb/build-stamp: udeb/dir-stamp
	dh_testdir
	$(MAKE) -C udeb mdadm mdmon $(BUILDFLAGS) CONFFILE=/tmp/mdadm.conf
	touch $@

clean:
	dh_testdir
	rm -f build-stamp
	$(MAKE) clean
	rm -rf udeb
	dh_clean

install-arch: build-arch
	dh_testdir
	dh_prep
	dh_installdirs

	$(MAKE) install install-systemd DESTDIR=$(DESTDIR)

	mkdir -p $(DESTDIR)/etc/mdadm
	install -Dm0755 debian/initramfs/hook \
		$(DESTDIR)/usr/share/initramfs-tools/hooks/mdadm
	install -Dm0755 debian/initramfs/script.local-block \
		$(DESTDIR)/usr/share/initramfs-tools/scripts/local-block/mdadm
	install -Dm0755 debian/initramfs/script.local-bottom \
		$(DESTDIR)/usr/share/initramfs-tools/scripts/local-bottom/mdadm
	install -Dm0644 debian/mdadm.modules \
		$(DESTDIR)/etc/modprobe.d/mdadm.conf

	install -Dm0755 debian/mkconf $(DESTDIR)/usr/share/mdadm/mkconf
	install -Dm0755 debian/checkarray $(DESTDIR)/usr/share/mdadm/checkarray
	install -Dm0755 debian/bugscript $(DESTDIR)/usr/share/bug/mdadm/script
	install -Dm0755 udeb/mdadm $(DESTDIR_UDEB)/sbin/mdadm
	install -Dm0755 udeb/mdmon $(DESTDIR_UDEB)/sbin/mdmon
	install -Dm0644 udev-md-raid-arrays.rules $(DESTDIR_UDEB)/lib/udev/rules.d/63-md-raid-arrays.rules
	install -Dm0644 debian/mdadm-shutdown.service $(DESTDIR)/lib/systemd/system/mdadm-shutdown.service
ifeq ($(shell dpkg-vendor --derives-from Ubuntu && echo yes), yes)
	install -Dm0644 udev-md-raid-assembly.rules $(DESTDIR_UDEB)/lib/udev/rules.d/64-md-raid-assembly.rules
	install -Dm0644 debian/source_mdadm.py $(DESTDIR)/usr/share/apport/package-hooks/source_mdadm.py
endif

binary-arch: install-arch
	dh_testdir
	dh_testroot
	dh_installdebconf
	dh_installdocs
	dh_installexamples -pmdadm mdadm.conf-example misc/syslog-events
	dh_installinit --init-script=mdadm-waitidle --no-start -- stop 98 0 6 .
	dh_link -pmdadm /dev/null /lib/systemd/system/mdadm-waitidle.service
	dh_installinit -- defaults 25
	dh_link -pmdadm /dev/null /lib/systemd/system/mdadm.service
	dh_installman
	dh_installcron
	dh_installchangelogs ChangeLog
	dh_installlogcheck
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
ifeq ($(shell dpkg-vendor --derives-from Ubuntu && echo yes), yes)
	dh_gencontrol -- -Vmta:Suggests="default-mta | mail-transport-agent"
else
	dh_gencontrol -- -Vmta:Recommends="default-mta | mail-transport-agent"
endif
	dh_md5sums
	dh_builddeb

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