#!/usr/bin/make -f
# This file was originally written by Joey Hess and Craig Small.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1


configure: configure-stamp
configure-stamp:
	dh_testdir
	
	# configure with --partial-install so the files won't be installed as
	# lv, then we can install them as levee
	./configure.sh --partial-install

	touch configure-stamp

build: build-stamp
build-stamp: configure-stamp
	dh_testdir

	$(MAKE) 

	# Adjust names
	[ ! -f lv.1 ] || mv lv.1 levee.1
	[ ! -f lev ] || mv lev levee

	touch $@

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp configure-stamp install-stamp

	# Clean up
	[ ! -f Makefile ] || $(MAKE) distclean
	[ ! -f levee.1 ] || mv levee.1 lv.1
	[ ! -f lev ] || mv lev levee

	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs
	dh_install

binary-indep: build install
# We have nothing to do by default.

binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs
	dh_installdocs
	dh_installexamples
	dh_installmenu
	dh_installman levee.1
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

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