rules: Use dh_autotools-dev* to update config.{sub,guess}.
[libmpdclient-debian.git] / debian / rules
1 #! /usr/bin/make -f
2 # debian/rules for libmpdclient
3 #
4 # Written by Sebastian Harl <tokkee@debian.org>
5
6 # Uncomment this to turn on verbose mode.
7 #export DH_VERBOSE=1
8
9 # These are used for cross-compiling and for saving the configure script
10 # from having to guess our platform (since we know it already)
11 DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
12 DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
13
14 CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS)
15 CFLAGS = $(shell dpkg-buildflags --get CFLAGS)
16 CFLAGS += -Wall -g
17
18 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
19         CFLAGS += -O0
20 else
21         CFLAGS += -O2
22 endif
23
24 CHECK = check
25
26 ifneq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
27         CHECK =
28 endif
29
30 config.status: configure
31         dh_testdir
32         dh_autotools-dev_updateconfig
33         
34         ./configure \
35                         --host=$(DEB_HOST_GNU_TYPE) \
36                         --build=$(DEB_BUILD_GNU_TYPE) \
37                         --prefix=/usr \
38                         --mandir=\$${prefix}/share/man \
39                         CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)"
40
41 build: build-arch build-indep
42
43 build-arch: build-stamp
44 build-indep: build-stamp
45
46 build-stamp: config.status
47         dh_testdir
48         
49         $(MAKE)
50         test -z '$(CHECK)' || make $(CHECK)
51         
52         touch build-stamp
53
54 clean:
55         dh_testdir
56         dh_testroot
57         rm -f build-stamp
58         
59         [ ! -f Makefile ] || $(MAKE) distclean
60         
61         dh_autotools-dev_restoreconfig
62         dh_clean
63
64 install: build
65         dh_testdir
66         dh_testroot
67         dh_prep
68         dh_installdirs
69         
70         $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
71         
72         # we do not want .la files in Debian
73         rm -f debian/tmp/usr/lib/libmpdclient.la
74         
75         # these files do not include any useful content
76         rm -f debian/tmp/usr/share/doc/libmpdclient/README
77         rm -f debian/tmp/usr/share/doc/libmpdclient/COPYING
78         
79         # install that file as changelog instead
80         rm -f debian/tmp/usr/share/doc/libmpdclient/NEWS
81         
82         dh_install --sourcedir=debian/tmp --fail-missing
83
84 binary-indep: build install
85         dh_testdir
86         dh_testroot
87         dh_installchangelogs -i NEWS
88         dh_installdocs -i -A AUTHORS
89         dh_compress -i
90         dh_fixperms -i
91         dh_installdeb -i
92         dh_gencontrol -i
93         dh_md5sums -i
94         dh_builddeb -i
95
96 binary-arch: build install
97         dh_testdir
98         dh_testroot
99         dh_installchangelogs -a NEWS
100         dh_installdocs -a -A AUTHORS
101         dh_link -a
102         dh_strip -a --dbg-package=libmpdclient2-dbg
103         dh_compress -a
104         dh_fixperms -a
105         dh_makeshlibs -a -V 'libmpdclient2 (>= 2.2)'
106         dh_installdeb -a
107         dh_shlibdeps -a
108         dh_gencontrol -a
109         dh_md5sums -a
110         dh_builddeb -a
111
112 binary: binary-indep binary-arch
113 .PHONY: build clean binary-indep binary-arch binary install
114