#!/usr/bin/make -f
#
# debian/rules for kernel-source.
#
# GNU copyright 1997 to 1999 by Joey Hess.
# Copyright (c) 1999-2000 Herbert Xu <herbert@debian.org>
#
# $Id: rules,v 1.7 2001/10/02 09:12:02 herbert Exp $

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

# This is the debhelper compatability version to use.
export DH_COMPAT=2

build: build-stamp
build-stamp:
	dh_testdir

	$(MAKE) -C scripts/cramfs CFLAGS='-g -O2 -Wall'

	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp install-stamp

	make-kpkg clean
	$(MAKE) -C scripts/cramfs clean
	rm -f .config*
	rm -f debian/copyright

	dh_clean

install: install-stamp
install-stamp: build-stamp
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	cp scripts/cramfs/mkcramfs debian/mkcramfs/usr/sbin
	cp debian/mkcramfs.8 debian/mkcramfs/usr/share/man/man8

	touch install-stamp

# Build architecture-independent files here.
binary-indep: build install
	dh_testdir
	dh_testroot

	make-kpkg kernel-doc
	make-kpkg kernel-source

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir -a
	dh_testroot -a
	cp /usr/share/kernel-package/copyright.source debian/copyright
	dh_installdocs -a
	rm debian/mkcramfs/usr/share/doc/mkcramfs/README.Debian
	dh_installchangelogs -a
	dh_strip -a
	dh_compress -a
	dh_fixperms -a
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

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