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

#export DH_VERBOSE=1

PREFIX = $(CURDIR)/debian/tree/usr
MANDIR = $(PREFIX)/share/man/man1
# Leave LDFLAGS empty so symbol table and relocation information won't be
# removed from the executable; dh_strip takes care of this when needed
LDFLAGS =
CFLAGS = -g -Wall -fomit-frame-pointer -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
ifneq (,$(findstring noopt, $(DEB_BUILD_OPTIONS)))
        CFLAGS += -O0
else
        CFLAGS += -O2
endif

build: build-stamp
build-stamp:
	dh_testdir
	$(MAKE) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)"
	touch $@

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

install: build
	dh_testdir
	dh_testroot
	dh_clean
	$(MAKE) install prefix=$(PREFIX) MANDIR=$(MANDIR)

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

binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installdocs README
	dh_installchangelogs CHANGES
	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
