File: rules

package info (click to toggle)
kmod 23-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,524 kB
  • ctags: 1,705
  • sloc: ansic: 14,537; xml: 1,848; makefile: 593; sh: 214; python: 7
file content (148 lines) | stat: -rwxr-xr-x 4,008 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
#!/usr/bin/make -f
SHELL+= -e

KMOD_RECONFIGURE := 1
BUILD_UDEB := 1



D   := $(CURDIR)/debian/kmod
DK  := $(CURDIR)/debian/libkmod2
DD  := $(CURDIR)/debian/libkmod-dev
DKU := $(CURDIR)/debian/libkmod2-udeb

CONFFLAGS = --sysconfdir=/etc --bindir=/bin
CONFFLAGS_deb  = $(CONFFLAGS) \
  $(shell DEB_BUILD_MAINT_OPTIONS="hardening=+bindnow" \
    dpkg-buildflags --export=configure || true) \
  --enable-gtk-doc \
  --libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
  --with-rootlibdir=/lib/$(DEB_HOST_MULTIARCH) \
  --enable-debug
CONFFLAGS_udeb = $(CONFFLAGS) \
  $(subst -O2,-Os -fomit-frame-pointer,$(shell DEB_BUILD_MAINT_OPTIONS="hardening=-all" \
    dpkg-buildflags --export=configure || true)) \
  --libdir=/lib --with-rootlibdir=/lib

##############################################################################
SOURCE_DATE_EPOCH ?= $(shell dpkg-parsechangelog --show-field=Date | date --file=- +%s)
export SOURCE_DATE_EPOCH

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
  CONFFLAGS += --build $(DEB_HOST_GNU_TYPE)
else
  CONFFLAGS += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
endif

ifdef BUILD_UDEB
  BUILD_UDEB_TARGET := .stamp-build-udeb
else
  NO_PACKAGE := --no-package=libkmod2-udeb
endif

##############################################################################
clean:
	rm -rf .stamp-* build-*deb
ifdef KMOD_RECONFIGURE
	rm -f aclocal.m4 autom4te.cache/* config.h.in config.h.in~ configure \
		$$(find . -name Makefile.in) \
		$$(find m4/ build-aux/ libkmod/ -type l)
endif
	dh_clean

# if enabled, must build-depend on: autoconf, automake, libtool, gtk-doc-tools
ifdef KMOD_RECONFIGURE
configure: configure.ac
	gtkdocize --docdir libkmod/docs
	autoreconf --force --install --symlink
endif

build-deb/config.status: configure
	[ -d build-deb ] || mkdir build-deb
	cd build-deb/ && \
	../configure $(CONFFLAGS_deb)

build-udeb/config.status: configure
	[ -d build-udeb ] || mkdir build-udeb
	cd build-udeb/ && \
	../configure $(CONFFLAGS_udeb)

build: build-arch build-indep
build-arch: .stamp-build $(BUILD_UDEB_TARGET)
build-indep: .stamp-build $(BUILD_UDEB_TARGET)
.stamp-build: build-deb/config.status
	dh_testdir
	cd build-deb/ && \
	$(MAKE) all V=1
	touch $@

build-udeb: .stamp-build-udeb
.stamp-build-udeb: build-udeb/config.status
	dh_testdir
	cd build-udeb/ && \
	$(MAKE) all V=1
	touch $@

binary-all: .stamp-binary
.stamp-binary: build checkroot
	dh_testdir
	dh_prep

	cd build-deb/ && \
	$(MAKE) install DESTDIR=$D
	rm $D/usr/lib/*/*.la

	dh_movefiles --sourcedir=debian/kmod
	rmdir --parents --ignore-fail-on-non-empty $$(find $D -type d -empty)

	dh_installdirs
	cp extra/aliases.conf $D/lib/modprobe.d/
	install --mode=755 debian/kmod.initramfs-hook \
		$D/usr/share/initramfs-tools/hooks/kmod

ifdef BUILD_UDEB
	cd build-udeb/ && \
	$(MAKE) install-exec DESTDIR=$(DKU)
	rm -r $(DKU)/lib/

	egrep -i '^[a-z]' extra/aliases.conf > $(DKU)/etc/modprobe.d/aliases.conf
endif

	dh_installdocs -pkmod -plibkmod-dev --link-doc=libkmod2
	dh_installdocs -pkmod --link-doc=libkmod2 README TODO
	dh_installdocs -plibkmod2
	cp libkmod/README $(DD)/usr/share/doc/libkmod2/README.libkmod
	dh_installchangelogs NEWS
	dh_installman extra/*.5
	dh_installinit --no-start
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
	dh_makeshlibs --add-udeb=libkmod2-udeb -- -c4
	dh_shlibdeps -- --warnings=7
	dh_installdeb
	dh_gencontrol $(NO_PACKAGE)
	dh_md5sums
	touch $@

binary-arch: .stamp-binary
	dh_builddeb -a $(NO_PACKAGE)

binary-indep: .stamp-binary
	dh_builddeb -i

binary:	binary-arch binary-indep

checkroot:
	test root = "`whoami`"

get-orig-source:
	cd $(dir $(firstword $(MAKEFILE_LIST)))../ && \
	uscan --rename --force-download --watchfile debian/watch --destdir $(CURDIR)

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