#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

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

build:
	dh_testdir

clean:
	dh_testdir
	dh_clean

PATCHNAME=linuxabi
INSTALLDIR=debian/kernel-patch-$(PATCHNAME)/usr/src/kernel-patches/i386

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	mkdir -p $(INSTALLDIR)/{$(PATCHNAME),apply,unpatch}
	tar --create --gzip --file=$(INSTALLDIR)/$(PATCHNAME)/$(PATCHNAME)-patches.tar.gz $(PATCHNAME)-*-*.patch
	[[ ! -e $(PATCHNAME)-versions.txt ]] || \
	  cp -a $(PATCHNAME)-versions.txt $(INSTALLDIR)/$(PATCHNAME)
	cp -a debian/patch-script.sh $(INSTALLDIR)/$(PATCHNAME)
	chmod +x $(INSTALLDIR)/$(PATCHNAME)
	ln -s ../$(PATCHNAME)/patch-script.sh $(INSTALLDIR)/apply/$(PATCHNAME)
	ln -s ../$(PATCHNAME)/patch-script.sh $(INSTALLDIR)/unpatch/$(PATCHNAME)
	dh_installdocs
	dh_installchangelogs
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_gencontrol
	dh_md5sums

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

# Build architecture-dependent files here.
binary-arch: install
	dh_testdir
	dh_testroot
	dh_builddeb -a

# We have nothing to do by default.

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