#!/usr/bin/make -f
#-*- makefile -*-

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

PACKAGE = eblook

build: build-stamp
build-stamp:
	dh_testdir
	./configure --prefix=/usr --infodir=/usr/share/info --with-eb-conf=/etc/eb.conf --without-readline
	$(MAKE)
	touch $@

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp eblook-for-h2m
	rm -f dos/Makefile
	[ ! -f Makefile ] || $(MAKE) SUBDIRS= distclean
	dh_clean

install:
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs
	$(MAKE) DESTDIR=$(CURDIR)/debian/$(PACKAGE) install-exec

	cp debian/eblook-for-h2m .
	chmod 700 eblook-for-h2m
	install -d $(CURDIR)/debian/$(PACKAGE)/usr/share/man/man1
	PATH=$(CURDIR)/debian/$(PACKAGE)/usr/bin:$${PATH} help2man --include=$(CURDIR)/debian/eblook.h2m --output=$(CURDIR)/debian/$(PACKAGE)/usr/share/man/man1/eblook.1 $(CURDIR)/eblook-for-h2m; \
	rm -f eblook-for-h2m

# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs ChangeLog
	dh_installdocs
	dh_installinfo
#	dh_installexamples
#	dh_installmenu
	dh_installman
	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
