#! /usr/bin/make -f

SHELL = bash
package = util-linux

ifndef DEB_HOST_ARCH
DEB_BUILD_ARCH := $(shell dpkg --print-installation-architecture)
DEB_HOST_ARCH = $(DEB_BUILD_ARCH)
endif

export arch = $(DEB_HOST_ARCH)
version := $(shell sed -e '1{;s|^util-linux (\(.*\))\ .*|\1|;q;}' debian/changelog)

fdisk_arch = $(findstring $(arch),alpha i386 powerpc arm armel mips mipsel hppa ia64)
sparc = $(findstring $(arch),sparc)
nohwclock = $(findstring $(arch),s390)

#'

build:
	$(checkdir)
	./configure
	$(MAKE) all arch=$(arch)
	touch build

clean:
	$(checkdir)
	rm -f build sys-utils/rdev
	touch make_include
	-$(MAKE) distclean
	find . -name '*~' -print0 | xargs -0r rm
	find . -name '*.orig' -print0 | xargs -0r rm
	find . -name '*.rej' -print0 | xargs -0r rm
	rm -rf debian/tmp* debian/files* debian/substvars po/messages

# Architecture independant stuff

install: 
	mkdir -p debian/tmp/sbin
	cp fdisk/cfdisk debian/tmp/sbin/cfdisk

binary-arch:	checkroot build install
	dh_testdir
	dh_testroot
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
#	dh_md5sums
	dh_installdocs
	dh_installman fdisk/cfdisk.8
	dh_installchangelogs
	dh_compress
	dh_builddeb

define checkdir
	test -f fdisk/fdisk.c -a -f debian/rules
endef

binary:	binary-arch

source diff:
	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false

checkroot:
	$(checkdir)

.PHONY: binary binary-arch binary-indep clean checkroot

# Local Variables:
# mode:Makefile
# End:
