File: rules

package info (click to toggle)
udev 164-3
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 4,336 kB
  • ctags: 1,738
  • sloc: ansic: 18,516; sh: 11,378; perl: 1,725; xml: 1,286; makefile: 692; python: 34
file content (208 lines) | stat: -rwxr-xr-x 6,563 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
#!/usr/bin/make -f
SHELL+= -e

BUILD_UDEB := 1
USE_SELINUX := 1



include /usr/share/hardening-includes/hardening.make
CFLAGS += $(HARDENING_CFLAGS)
LDFLAGS += $(HARDENING_LDFLAGS)

QUILT_STAMPFN=.stamp-patched
include /usr/share/quilt/quilt.make

D  := $(CURDIR)/debian/udev
DU := $(CURDIR)/debian/udev-udeb
DGU:= $(CURDIR)/debian/udev-gtk-udeb

CONFFLAGS := --prefix=/usr --sysconfdir=/etc --sbindir=/sbin \
  --with-rootlibdir=/lib --libexecdir=/lib/udev \
  --enable-static --disable-dependency-tracking
CONFFLAGS_deb  := $(CONFFLAGS) --enable-gtk-doc --enable-introspection
CONFFLAGS_udeb := $(CONFFLAGS)

##############################################################################
DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
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 USE_SELINUX
  CONFFLAGS_deb += --with-selinux
endif

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

##############################################################################
all: build

clean: unpatch
	rm -rf .stamp-* build-*
	rm -f aclocal.m4 autom4te.cache/* config.h.in config.h.in~ configure \
		ltmain.sh install-sh missing depcomp config.sub config.guess \
		gtk-doc.make m4/* $$(find . -name Makefile.in)
	dh_clean

autoreconf: .stamp-autoreconf
.stamp-autoreconf: $(QUILT_STAMPFN)
	gtkdocize
	# improve support for out of tree builds, and it's still not enough
	sed 's/srcdir/builddir/g' < gtk-doc.make > gtk-doc.make.tmp && \
		mv gtk-doc.make.tmp gtk-doc.make
	autoreconf --force --install --symlink
	touch $@

build-deb/config.status: .stamp-autoreconf
	[ -d build-deb ] || mkdir build-deb
	cd build-deb/ && \
	../configure CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
		$(CONFFLAGS_deb)

build-udeb/config.status: .stamp-autoreconf
	[ -d build-udeb ] || mkdir build-udeb
	cd build-udeb/ && \
	../configure CFLAGS="$(CFLAGS) -Os -fomit-frame-pointer" \
		LDFLAGS="$(LDFLAGS)" \
		$(CONFFLAGS_udeb)

build: .stamp-build
.stamp-build: build-deb/config.status
	dh_testdir
	cd build-deb/ && \
	$(MAKE) all USB_DATABASE=/usr/share/misc/usb.ids
	touch $@

build-udeb: .stamp-build-udeb
.stamp-build-udeb: build-udeb/config.status
	dh_testdir
	cd build-udeb/ && \
	$(MAKE) all \
		extras_input_id_input_id_LDADD='-Llibudev/ -ludev'
	touch $@

binary-arch: .stamp-build $(BUILD_UDEB_TARGET) checkroot
	dh_testdir
	dh_clean -k
	dh_installdirs

	cd build-deb/ && \
	$(MAKE) install DESTDIR=$D

	dh_movefiles --sourcedir=debian/udev
	cd $D && rm -r usr/lib/pkgconfig/ usr/include/ usr/share/gtk-doc/ \
		usr/share/gir-1.0/ usr/lib/girepository-1.0/ \
		usr/lib/*.la

	install --mode=755 extra/*.agent extra/create_static_nodes \
		$D/lib/udev/
	cp extra/hotplug.functions $D/lib/udev/

	cd $D/lib/udev/rules.d/ && rm 60-cdrom_id.rules \
		61-persistent-storage-edd.rules
	cp rules/debian/*.rules $D/lib/udev/rules.d/
	perl extra/subst_lib_name $D
	cp extra/links.conf $D/etc/udev/

	install --mode=644 extra/blacklist.conf extra/fbdev-blacklist.conf \
		$D/etc/modprobe.d/

	install --mode=755 extra/initramfs.hook \
		$D/usr/share/initramfs-tools/hooks/udev
	install --mode=755 extra/initramfs.top \
		$D/usr/share/initramfs-tools/scripts/init-top/udev
	install --mode=755 extra/initramfs.bottom \
		$D/usr/share/initramfs-tools/scripts/init-bottom/udev

ifdef BUILD_UDEB
	grep '^[[:alnum:]]' extra/links.conf > $(DU)/etc/udev/links.conf
	grep '^[[:alnum:]]' udev.conf > $(DU)/etc/udev/udev.conf

	cp rules/debian/*.rules $(DU)/lib/udev/rules.d/
	cd $(DU)/lib/udev/rules.d/ && rm 60-persistent-storage-tape.rules
	cp rules/rules.d/60-persistent-input.rules $(DU)/lib/udev/rules.d/
	echo 'MODE="0666"' > $(DU)/lib/udev/rules.d/91-permissions.rules

	install --mode=755 $(addprefix build-udeb/udev/, udevd udevadm) \
		$(DU)/sbin/
	install --mode=755 $(addprefix build-udeb/extras/, \
		ata_id/ata_id cdrom_id/cdrom_id edd_id/edd_id \
		path_id/path_id scsi_id/scsi_id usb_id/usb_id ) \
		extras/rule_generator/write_*_rules extra/firmware.agent \
		$(DU)/lib/udev/
	install --mode=644 extras/rule_generator/rule_generator.functions \
		extra/hotplug.functions \
		$(DU)/lib/udev/
	install --mode=644 extra/blacklist.conf $(DU)/etc/modprobe.d/
	install --mode=755 extra/udev.startup \
		$(DU)/lib/debian-installer/start-udev
	install --mode=755 extra/udev.base-installer \
		$(DU)/usr/lib/base-installer.d/05udev

	cp -a build-udeb/libudev/.libs/libudev.so.0* $(DGU)/lib/
	install --mode=755 build-udeb/extras/input_id/.libs/input_id \
		$(DGU)/lib/udev/
ifeq ($(DEB_HOST_ARCH),$(filter $(DEB_HOST_ARCH),sparc sparc64))
	install --mode=755 build-udeb/extras/vio_type/vio_type $(DGU)/lib/udev/
endif
endif

ifneq ($(DEB_HOST_ARCH),$(filter $(DEB_HOST_ARCH),sparc sparc64))
	rm $D/lib/udev/vio_type $D/usr/share/man/man8/vio_type.8
endif

	# workaround for #555111
	cp -a libudev/docs/html/* \
		$(CURDIR)/debian/libudev-dev/usr/share/gtk-doc/html/libudev/
	cp -a extras/gudev/docs/html/* \
		$(CURDIR)/debian/libgudev-1.0-dev/usr/share/gtk-doc/html/gudev/

	dh_link
	dh_installchangelogs ChangeLog
	dh_installdocs README NEWS TODO
	dh_installexamples extra/udev.vim
	dh_installdebconf
	dh_installinit --no-start --update-rcd-params='start 03 S .'
	dh_installinit --no-start --update-rcd-params='start 36 S .' \
		--name=udev-mtab

	# remove duplicate changelogs
	cd $(CURDIR)/debian/ && rm -r \
		libgudev-1.0-dev/usr/share/doc/libgudev-1.0-dev/ \
		gir1.0-gudev-1.0/usr/share/doc/gir1.0-gudev-1.0/ \
		libudev-dev/usr/share/doc/libudev-dev/
	ln -s libgudev-1.0-0 $(CURDIR)/debian/libgudev-1.0-dev/usr/share/doc/libgudev-1.0-dev
	ln -s libgudev-1.0-0 $(CURDIR)/debian/gir1.0-gudev-1.0/usr/share/doc/gir1.0-gudev-1.0
	ln -s libudev0 $(CURDIR)/debian/libudev-dev/usr/share/doc/libudev-dev

	dh_strip
	dh_compress
	dh_fixperms
	dh_makeshlibs --add-udeb=udev-gtk-udeb -- -c4
	dh_shlibdeps --exclude=/lib/udev/udev-acl -- --warnings=7
	dh_girepository
	dh_installdeb
	dh_gencontrol $(NO_PACKAGE)
	dh_md5sums
	dh_builddeb $(NO_PACKAGE)


binary:	binary-arch

checkroot:
	test root = "`whoami`"

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

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