#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

#export DH_VERBOSE=1

PACKAGE	=	$(shell dh_listpackages)
TMPDIR	=	$(CURDIR)/debian/$(PACKAGE)
INSTALL	=	install

CFLAGS = -Wall -g

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -O0
else
	CFLAGS += -O2
endif

build: build-stamp
build-stamp: 
	dh_testdir
	cd $(CURDIR)/src && $(MAKE) CDEBUG="$(CFLAGS)" LDEBUG="-g"
	touch $@

clean: 
	dh_testdir
	dh_testroot
	rm -f build-stamp
	cd $(CURDIR)/src && $(MAKE) -i distclean
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_installdirs usr/bin usr/share/man/man1
	cd $(CURDIR)/src && $(MAKE) install BINDIR="$(TMPDIR)/usr/bin" MANDIR="$(TMPDIR)/usr/share/man/man1"

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

binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs
	dh_installdocs tofrodos.html
	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 
