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

DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1

include /usr/share/dpkg/buildflags.mk


.PHONY: \
 configure-stamp configure \
 build-stamp build-indep build-arch build \
 clean \
 install \
 binary-indep binary-arch binary \
 fizmo-common fizmo-console fizmo-ncursesw


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

configure: configure-stamp
configure-stamp:
	dh_testdir
	dpkg-buildflags
	dh_auto_configure -- --bindir=/usr/games
	touch configure-stamp

build: configure-stamp build-stamp
build-stamp: configure-stamp
	dh_testdir
	dpkg-buildflags
	dh_prep -p$@
	DESTDIR=$(CURDIR)/debian/fizmo-ncursesw $(MAKE)
	touch build-stamp


# All build target will do nothing by default, since different types of
# builds are required to build each package. Building is instead invoked
# from the "binary" targets later on.

build-indep:

build-arch:

clean:
	dh_testdir
	dh_testroot
	dh_auto_clean -v -pfizmo-common -pfizmo-console -pfizmo-ncursesw
	dh_clean -v

install:

binary: binary-indep binary-arch

binary-indep: fizmo-common

binary-arch: fizmo-console fizmo-ncursesw


fizmo-common: build-stamp
	dh_testroot
	dh_installdirs
	dh_installchangelogs -p$@ CHANGELOG.txt
	dh_installdocs -p$@
	DESTDIR=$(CURDIR)/debian/fizmo-common $(MAKE) install-data-local
	dh_installexamples -p$@
	dh_installman -p$@
	dh_link -p$@
	dh_strip -p$@
	dh_compress -p$@
	dh_fixperms -p$@
	dh_installdeb -p$@
	dh_shlibdeps -p$@
	dh_gencontrol -p$@
	dh_md5sums -p$@
	dh_builddeb -p$@

fizmo-console: build-stamp
	dh_testroot
	dh_installdirs
	dh_installchangelogs -p$@ CHANGELOG.txt
	dh_installdocs -p$@
	dpkg-buildflags
	DESTDIR=$(CURDIR)/debian/fizmo-console $(MAKE) install-fizmo-console
	dh_installexamples -p$@
	dh_installman -p$@
	dh_install -p$@
	dh_lintian -p$@
	dh_link -p$@
	dh_strip -p$@
	dh_compress -p$@
	dh_fixperms -p$@
	dh_installdeb -p$@
	dh_shlibdeps -p$@
	dh_gencontrol -p$@
	dh_md5sums -p$@
	dh_builddeb -p$@

fizmo-ncursesw: build-stamp
	dh_testroot
	dh_installdirs
	dh_installchangelogs -p$@ CHANGELOG.txt
	dh_installdocs -p$@
	dpkg-buildflags
	DESTDIR=$(CURDIR)/debian/fizmo-ncursesw $(MAKE) install-fizmo-ncursesw
	dh_installexamples -p$@
	dh_installman -p$@
	dh_install -p$@
	dh_lintian -p$@
	dh_link -p$@
	dh_strip -p$@
	dh_compress -p$@
	dh_fixperms -p$@
	dh_installdeb -p$@
	dh_shlibdeps -p$@
	dh_gencontrol -p$@
	dh_md5sums -p$@
	dh_builddeb -p$@

