~smoser/ubuntu/quantal/module-init-tools/lp-1115710

« back to all changes in this revision

Viewing changes to debian/rules

  • Committer: Bazaar Package Importer
  • Author(s): Andy Whitcroft
  • Date: 2011-06-08 11:53:21 UTC
  • mfrom: (0.1.13 sid)
  • Revision ID: james.westby@ubuntu.com-20110608115321-2zwtf5l3mbbz1sck
Tags: 3.13-1ubuntu1
* Manual Resync with Debian version 3.13-1.
  - Remaining changes:
    + Ubuntu specific control scripts carrying upgrade quirks
    + Ubuntu specific modprobe.d/depmod.d contents
    + debian/patches/ubuntu-maps_by_default -- Reenable map files
    + debian/patches/ubuntu-modinfo-wantparm-uninitialised -- fix
      performance issue due to unitialised variable in modinfo
    + switch source to 'unapply-patches' to simplify merging with
      debian upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/make -f
2
 
# debian/rules for the module-init-tools package.
3
 
# Copyright © 2009 Canonical Ltd.
4
 
# Author: Scott James Remnant <scott@ubuntu.com>
5
 
 
6
 
# Uncomment this to turn on verbose mode.
7
 
#export DH_VERBOSE=1
8
 
 
9
 
export DH_OPTIONS
10
 
 
11
 
CFLAGS = -Wall -g
12
 
LDFLAGS = -Wl,-z,relro -Wl,-z,now
13
 
 
14
 
# Disable optimisations if noopt found in $DEB_BUILD_OPTIONS
15
 
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
16
 
        CFLAGS += -O0
17
 
        LDFLAGS += -Wl,-O0
18
 
else
19
 
        CFLAGS += -Os
20
 
        LDFLAGS += -Wl,-O1
21
 
endif
22
 
 
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)
27
 
 
28
 
ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
29
 
        confflags += --build=$(DEB_HOST_GNU_TYPE)
30
 
else
31
 
        confflags += --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
32
 
endif
33
 
 
34
 
 
35
 
# Configure the package
36
 
build/config.status: configure
37
 
        [ -d build ] || mkdir build
38
 
        cd build && ../configure \
39
 
                $(confflags) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
40
 
                --prefix=/usr \
41
 
                --exec-prefix= \
42
 
                --sysconfdir=/etc \
43
 
                --mandir=\$${datadir}/man \
44
 
                --infodir=\$${infodir}/info
45
 
 
46
 
# Build the package
47
 
build: build/build-stamp
48
 
build/build-stamp: build/config.status
49
 
        dh_testdir
50
 
 
51
 
        $(MAKE) -C build
52
 
        touch $@
53
 
 
54
 
# Install files
55
 
install:
56
 
install: build
57
 
        dh_testdir
58
 
        dh_testroot
 
2
SHELL+= -e
 
3
 
 
4
BUILD_UDEB := 1
 
5
DISABLE_ZLIB := --disable-zlib
 
6
CONFFLAGS := --disable-static-utils --prefix=/
 
7
 
 
8
 
 
9
D := $(CURDIR)/debian/module-init-tools
 
10
 
 
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)
 
16
else
 
17
  CONFFLAGS += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
 
18
endif
 
19
 
 
20
ifdef BUILD_UDEB
 
21
  BUILD_UDEB_TARGET := .stamp-build-udeb
 
22
else
 
23
  NO_PACKAGE := --no-package=module-init-tools-udeb
 
24
endif
 
25
 
 
26
##############################################################################
 
27
all: build
 
28
 
 
29
clean:
 
30
        rm -rf .stamp-* build-*
 
31
        dh_clean
 
32
 
 
33
build-deb/config.status:
 
34
        rm -f *.[0-9] # XXX workaround for out of tree builds
 
35
        [ -d build-deb ] || mkdir build-deb
 
36
        cd build-deb/ && \
 
37
        ../configure CFLAGS='$(CFLAGS)' \
 
38
                $(DISABLE_ZLIB) $(CONFFLAGS)
 
39
 
 
40
build-udeb/config.status:
 
41
        [ -d build-udeb ] || mkdir build-udeb
 
42
        cd build-udeb/ && \
 
43
        ../configure CFLAGS='$(CFLAGS) -Os -fomit-frame-pointer' \
 
44
                --disable-zlib $(CONFFLAGS)
 
45
 
 
46
build: .stamp-build
 
47
.stamp-build: build-deb/config.status
 
48
        dh_testdir
 
49
        cd build-deb && $(MAKE)
 
50
        touch $@
 
51
 
 
52
build: .stamp-build-udeb
 
53
.stamp-build-udeb: build-udeb/config.status
 
54
        dh_testdir
 
55
        cd build-udeb && $(MAKE) lsmod insmod depmod modprobe
 
56
        touch $@
 
57
 
 
58
install: .stamp-build $(BUILD_UDEB_TARGET) checkroot
 
59
        dh_testdir
59
60
        dh_clean -k
60
 
        dh_installdirs -v
61
 
 
62
 
        $(MAKE) -C build DESTDIR="$(CURDIR)/debian/tmp" install
63
 
 
64
 
 
65
 
binary: binary-indep binary-arch
66
 
 
67
 
# Build architecture-independent files here.
68
 
binary-indep:
69
 
# We have nothing to do by default.
70
 
 
71
 
# Build architecture-dependent files here.
72
 
binary-arch: DH_OPTIONS=-a
73
 
binary-arch: build install
 
61
 
 
62
        dh_installdirs bin/ sbin/ etc/modprobe.d/ lib/modules/
 
63
        dh_install --sourcedir=build-deb/ -p module-init-tools
 
64
 
 
65
ifdef BUILD_UDEB
 
66
        dh_installdirs bin/ sbin/ -p module-init-tools-udeb
 
67
        dh_install --sourcedir=build-udeb/ -p module-init-tools-udeb
 
68
endif
 
69
 
 
70
binary-arch: install
74
71
        dh_testdir
75
72
        dh_testroot
76
73
        dh_installchangelogs ChangeLog
77
 
        dh_installdocs
78
 
        dh_installexamples
79
 
        dh_install --sourcedir=debian/tmp
 
74
        dh_installdocs NEWS
 
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 .
81
 
        dh_installman
82
 
        dh_link
 
78
        dh_link bin/lsmod sbin/lsmod
83
79
        dh_strip
84
80
        dh_compress
85
81
        dh_fixperms
86
82
        dh_installdeb
87
 
        dh_makeshlibs
88
83
        dh_shlibdeps
89
 
        dh_gencontrol
 
84
        dh_gencontrol $(NO_PACKAGE)
90
85
        dh_md5sums
91
 
        dh_builddeb
92
 
 
93
 
 
94
 
# Clean up the mess we made
95
 
clean:
96
 
        dh_testdir
97
 
 
98
 
        rm -rf build
99
 
        dh_clean 
100
 
 
101
 
 
102
 
.PHONY: build install binary-indep binary-arch binary clean
 
86
        dh_builddeb $(NO_PACKAGE)
 
87
 
 
88
binary: binary-arch
 
89
 
 
90
get-orig-source:
 
91
        cd $(dir $(firstword $(MAKEFILE_LIST)))../ && \
 
92
        uscan --rename --force-download --destdir $(CURDIR)
 
93
 
 
94
checkroot:
 
95
        test root = "`whoami`"
 
96
 
 
97
.PHONY: binary binary-arch binary-indep unpack build clean checkroot get-orig-source