#!/usr/bin/make -f
# Sample debian/rules that uses debhelper. 
# GNU copyright 1997 by Joey Hess.
#
# This version is for a hypothetical package that builds an
# architecture-dependant package, as well as an architecture-independent
# package.

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

# This has to be exported to make some magic below work.
export DH_OPTIONS

ifeq ($(DEB_BUILD_ARCH),hppa)
  EXTRACFLAGS=-ffunction-sections
else
  EXTRACFLAGS=
endif

build-arch: build
build-indep: build

build: build-stamp
build-stamp:
	dh_testdir
	cp -vf /usr/share/misc/config.sub /usr/share/misc/config.guess .
	CFLAGS="${EXTRACFLAGS}" ./configure --prefix=/usr
	$(MAKE)
	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp config.guess config.sub
	[ ! -f Makefile ] || $(MAKE) distclean

	dh_clean

install: DH_OPTIONS=
install: build
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs
	$(MAKE) install prefix=$(CURDIR)/debian/drgeo/usr
	install -m 644 $(CURDIR)/debian/drgeo_32x32.xpm $(CURDIR)/debian/drgeo/usr/share/pixmaps
	mkdir -p $(CURDIR)/debian/drgeo/usr/share/doc/drgeo/
	chrpath -d debian/drgeo/usr/bin/drgeo

# Build architecture-independent files here.
# Pass -i to all debhelper commands in this target to reduce clutter.
# binary-indep: DH_OPTIONS=-i
binary-indep: build install
# We have nothing to do by default.

# Build architecture-dependent files here.
# Pass -a to all debhelper commands in this target to reduce clutter.
binary-arch: DH_OPTIONS=-a
binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installdocs
	dh_installexamples
	dh_installmenu
	dh_installman debian/drgeo.1 debian/tm_drgeo.1
	dh_installchangelogs ChangeLog
	dh_strip
	dh_link
	dh_compress
	dh_fixperms
	dh_makeshlibs
	dh_shlibdeps
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

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