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