#!/usr/bin/make -f
#-*- makefile -*-
# Made with the aid of dh_make, by Craig Small
# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
# Some lines taken from debmake, by Christoph Lameter.

export DH_VERBOSE=1

DEB_BUILD_GNU_TYPE	?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_GNU_TYPE	?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
CONFARGS= --host=$(DEB_HOST_GNU_TYPE)
endif

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_CFLAGS_MAINT_APPEND = -Wall
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

build-arch: build
build-indep: build
build: build-stamp
build-stamp:
	dh_testdir

	./configure \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=`pwd`/debian/`dh_listpackages`/usr/share/man \
		--with-regex=gnu \
		--with-editor=/usr/bin/editor $(CONFARGS)
	$(MAKE) CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)"

	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp
	[ ! -f Makefile ] || $(MAKE) distclean
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs

	$(MAKE) install prefix=`pwd`/debian/`dh_listpackages`/
	install -m 0755 debian/lesspipe `pwd`/debian/`dh_listpackages`/bin/lesspipe
	ln -s lesspipe `pwd`/debian/`dh_listpackages`/bin/lessfile
	ln -s lesspipe.1.gz `pwd`/debian/`dh_listpackages`/usr/share/man/man1/lessfile.1.gz

binary-indep: build install

binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installdebconf
	dh_installdocs
	dh_installexamples
	dh_installmenu
	dh_installmime
	dh_installcron
	dh_installman debian/lesspipe.1
	dh_installchangelogs NEWS
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

source diff:                                                                  
	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary
