#!/usr/bin/make -f
# GNU copyright 1997 to 1999 by Joey Hess.
# Copyright (C) 2000,2001 by Robert Bihlmeyer.

export DH_COMPAT=2

PKGDIR = debian/quintuple-agent
DOCDIR = $(PKGDIR)/usr/share/doc/quintuple-agent

INSTALL_DATA = install -o root -g root -p -m644

CFLAGS = -O2 -Wall
ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
  CFLAGS += -g
endif

build: build-stamp
build-stamp:
	dh_testdir

	./configure --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info --enable-debug="$(CFLAGS)"
	# Add here commands to compile the package.
	$(MAKE)

	touch build-stamp

clean:
	dh_testdir

	# Add here commands to clean up after the build process.
	-$(MAKE) distclean

	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs usr/share/info

	$(MAKE) install prefix=`pwd`/$(PKGDIR)/usr


# 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_testversion
	dh_testdir
	dh_testroot
	dh_installdocs
	dh_installmanpages
	$(INSTALL_DATA) doc/manual.info $(PKGDIR)/usr/share/info/q-agent.info
	$(INSTALL_DATA) ChangeLog $(DOCDIR)/changelog
	$(INSTALL_DATA) debian/changelog $(DOCDIR)/changelog.Debian
	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
