1#!/usr/bin/make -f
2# MAde with the aid of dh_make, by Craig Small
3# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
4# Some lines taken from debmake, by Cristoph Lameter.
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)
11DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
12DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
13
14CFLAGS =
15
16ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
17        CFLAGS += -O0
18else
19        CFLAGS += -O2
20endif
21ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
22        INSTALL_PROGRAM += -s
23endif
24
25
26configure: configure-stamp
27configure-stamp:
28	dh_testdir
29
30	CFLAGS="$(CFLAGS)" ./configure \
31		--host=$(DEB_HOST_GNU_TYPE) \
32		--build=$(DEB_BUILD_GNU_TYPE) \
33		--prefix=/usr \
34		--mandir=\$${prefix}/share/man \
35		--sysconfdir=/etc
36
37	touch configure-stamp
38
39build: build-stamp
40build-stamp: configure-stamp
41	dh_testdir
42
43	$(MAKE)
44
45	touch build-stamp
46
47clean:
48	dh_testdir
49	dh_testroot
50
51	[ ! -f Makefile ] || $(MAKE) clean
52
53	rm -f configure-stamp build-stamp install-stamp \
54		config.cache config.h config.status config.log makefile
55
56	rm -f *.o diffstat
57
58	dh_clean
59
60install: install-stamp
61install-stamp: build-stamp
62	dh_testdir
63	dh_testroot
64	dh_clean -k
65	dh_installdirs
66
67	$(MAKE) install DESTDIR=$(CURDIR)/debian/diffstat
68
69	touch install-stamp
70
71# Build architecture-independent files here.
72binary-indep: build install
73# No binary-indep target.
74
75# Build architecture-dependent files here.
76binary-arch: build install
77	dh_testdir
78	dh_testroot
79	dh_installdocs
80	dh_installexamples
81	dh_installchangelogs CHANGES
82	dh_strip
83	dh_compress
84	dh_fixperms
85	dh_installdeb
86	dh_shlibdeps
87	dh_gencontrol
88	dh_md5sums
89	dh_builddeb
90
91binary: binary-indep binary-arch
92.PHONY: build clean binary-indep binary-arch binary install install-stamp
93