2
# debian/rules for the module-init-tools package.
3
# Copyright © 2009 Canonical Ltd.
4
# Author: Scott James Remnant <scott@ubuntu.com>
6
# Uncomment this to turn on verbose mode.
12
LDFLAGS = -Wl,-z,relro -Wl,-z,now
14
# Disable optimisations if noopt found in $DEB_BUILD_OPTIONS
15
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
23
# These are used for cross-compiling and for saving the configure script
24
# from having to guess our platform (since we know it already)
25
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
26
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
28
ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
29
confflags += --build=$(DEB_HOST_GNU_TYPE)
31
confflags += --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
35
# Configure the package
36
build/config.status: configure
37
[ -d build ] || mkdir build
38
cd build && ../configure \
39
$(confflags) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
43
--mandir=\$${datadir}/man \
44
--infodir=\$${infodir}/info
47
build: build/build-stamp
48
build/build-stamp: build/config.status
5
DISABLE_ZLIB := --disable-zlib
6
CONFFLAGS := --disable-static-utils --prefix=/
9
D := $(CURDIR)/debian/module-init-tools
11
##############################################################################
12
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
13
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
14
ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
15
CONFFLAGS += --build $(DEB_HOST_GNU_TYPE)
17
CONFFLAGS += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
21
BUILD_UDEB_TARGET := .stamp-build-udeb
23
NO_PACKAGE := --no-package=module-init-tools-udeb
26
##############################################################################
30
rm -rf .stamp-* build-*
33
build-deb/config.status:
34
rm -f *.[0-9] # XXX workaround for out of tree builds
35
[ -d build-deb ] || mkdir build-deb
37
../configure CFLAGS='$(CFLAGS)' \
38
$(DISABLE_ZLIB) $(CONFFLAGS)
40
build-udeb/config.status:
41
[ -d build-udeb ] || mkdir build-udeb
43
../configure CFLAGS='$(CFLAGS) -Os -fomit-frame-pointer' \
44
--disable-zlib $(CONFFLAGS)
47
.stamp-build: build-deb/config.status
49
cd build-deb && $(MAKE)
52
build: .stamp-build-udeb
53
.stamp-build-udeb: build-udeb/config.status
55
cd build-udeb && $(MAKE) lsmod insmod depmod modprobe
58
install: .stamp-build $(BUILD_UDEB_TARGET) checkroot
62
$(MAKE) -C build DESTDIR="$(CURDIR)/debian/tmp" install
65
binary: binary-indep binary-arch
67
# Build architecture-independent files here.
69
# We have nothing to do by default.
71
# Build architecture-dependent files here.
72
binary-arch: DH_OPTIONS=-a
73
binary-arch: build install
62
dh_installdirs bin/ sbin/ etc/modprobe.d/ lib/modules/
63
dh_install --sourcedir=build-deb/ -p module-init-tools
66
dh_installdirs bin/ sbin/ -p module-init-tools-udeb
67
dh_install --sourcedir=build-udeb/ -p module-init-tools-udeb
76
73
dh_installchangelogs ChangeLog
79
dh_install --sourcedir=debian/tmp
75
dh_installman extra/*.5 build-deb/*.5 build-deb/*.8
76
rm $D/usr/share/man/man5/modprobe.d.5
80
77
dh_installinit --no-start -- start 15 S .
78
dh_link bin/lsmod sbin/lsmod
84
dh_gencontrol $(NO_PACKAGE)
94
# Clean up the mess we made
102
.PHONY: build install binary-indep binary-arch binary clean
86
dh_builddeb $(NO_PACKAGE)
91
cd $(dir $(firstword $(MAKEFILE_LIST)))../ && \
92
uscan --rename --force-download --destdir $(CURDIR)
95
test root = "`whoami`"
97
.PHONY: binary binary-arch binary-indep unpack build clean checkroot get-orig-source