#!/usr/bin/make -f

DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
export DEB_LDFLAGS_MAINT_APPEND = -pthread

%:
	dh $@

override_dh_auto_configure:
	-test -r /usr/share/misc/config.sub && \
		cp -f /usr/share/misc/config.sub config.sub
	-test -r /usr/share/misc/config.guess && \
		cp -f /usr/share/misc/config.guess config.guess
	./configure --host=$(DEB_HOST_GNU_TYPE) \
		--build=$(DEB_BUILD_GNU_TYPE) \
		--prefix=/usr

override_dh_auto_build:
	dh_auto_build

override_dh_clean:
	dh_clean
	rm -f c/scheme48.def config.guess config.sub config.log config.status
	rm -f Makefile
	rm -f c/scheme48arch.h c/sysdep.h

override_dh_auto_install:
	dh_auto_install
	dh_installchangelogs doc/news.txt

#include /usr/share/quilt/quilt.make
#
#DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
#DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
#
#build: build-stamp
#build-stamp: patch
#	dh build --before dh_auto_configure
#	-test -r /usr/share/misc/config.sub && \
#		cp -f /usr/share/misc/config.sub config.sub
#	-test -r /usr/share/misc/config.guess && \
#		cp -f /usr/share/misc/config.guess config.guess
#	LDFLAGS="-pthread" ./configure --host=$(DEB_HOST_GNU_TYPE) \
#		--build=$(DEB_BUILD_GNU_TYPE) \
#		--prefix=/usr
#	dh build --after dh_auto_configure
#	touch build-stamp
#
#clean: unpatch
#	dh clean
#	rm -f c/scheme48.def config.guess config.sub
#
#
#install: build install-stamp
#install-stamp:
#	dh install
#	touch install-stamp
#
#binary-arch: install
#	dh binary-arch
#
#binary-indep:
#	dh binary-indep
#
#binary: binary-arch binary-indep
#
#.PHONY: binary binary-arch binary-indep build clean install
