8c82591e4c6dea729e7dba8aff0b8db7311d83c3
[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 CFLAGS = -Wall -g
15
16 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
17         CFLAGS += -O0
18 else
19         CFLAGS += -O2
20 endif
21
22 CHECK = check
23
24 ifneq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
25         CHECK =
26 endif
27
28 config.status: configure
29         dh_testdir
30         
31         ./configure \
32                         --host=$(DEB_HOST_GNU_TYPE) \
33                         --build=$(DEB_BUILD_GNU_TYPE) \
34                         --prefix=/usr \
35                         --mandir=\$${prefix}/share/man \
36                         CFLAGS="$(CFLAGS)"
37
38 build: build-arch build-indep
39
40 build-arch: build-stamp
41 build-indep: build-stamp
42
43 build-stamp: config.status
44         dh_testdir
45         
46         $(MAKE)
47         test -z '$(CHECK)' || make $(CHECK)
48         
49         touch build-stamp
50
51 clean:
52         dh_testdir
53         dh_testroot
54         rm -f build-stamp
55         
56         [ ! -f Makefile ] || $(MAKE) distclean
57         
58         dh_clean
59
60 install: build
61         dh_testdir
62         dh_testroot
63         dh_prep
64         dh_installdirs
65         
66         $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
67         
68         # we do not want .la files in Debian
69         rm -f debian/tmp/usr/lib/libmpdclient.la
70         
71         # these files do not include any useful content
72         rm -f debian/tmp/usr/share/doc/libmpdclient/README
73         rm -f debian/tmp/usr/share/doc/libmpdclient/COPYING
74         
75         # install that file as changelog instead
76         rm -f debian/tmp/usr/share/doc/libmpdclient/NEWS
77         
78         dh_install --sourcedir=debian/tmp --fail-missing
79
80 binary-indep: build install
81         dh_testdir
82         dh_testroot
83         dh_installchangelogs -i NEWS
84         dh_installdocs -i -A AUTHORS
85         dh_compress -i
86         dh_fixperms -i
87         dh_installdeb -i
88         dh_gencontrol -i
89         dh_md5sums -i
90         dh_builddeb -i
91
92 binary-arch: build install
93         dh_testdir
94         dh_testroot
95         dh_installchangelogs -a NEWS
96         dh_installdocs -a -A AUTHORS
97         dh_link -a
98         dh_strip -a --dbg-package=libmpdclient2-dbg
99         dh_compress -a
100         dh_fixperms -a
101         dh_makeshlibs -a -V 'libmpdclient2 (>= 2.2)'
102         dh_installdeb -a
103         dh_shlibdeps -a
104         dh_gencontrol -a
105         dh_md5sums -a
106         dh_builddeb -a
107
108 binary: binary-indep binary-arch
109 .PHONY: build clean binary-indep binary-arch binary install
110