
WORKDIR=$(shell basename `pwd`)
PACKAGE=$(shell echo $(WORKDIR) | sed 's/-.*//')
VERSION=$(shell echo $(WORKDIR) | sed 's/.*-//')


##########################################################
# normal devel builds

default: build lintian

build:
	rm -f .ok
	(time dpkg-buildpackage -nc -us -uc -rfakeroot && touch .ok) \
		2>&1 | tee build.log
	test -f .ok

lintian:
	lintian ../$(PACKAGE)_$(VERSION)*.changes

clean:
	fakeroot debian/rules clean
	rm -f build.log .ok


##########################################################
# build releases

release:
	dpkg-buildpackage -si -tc -rfakeroot

port:
	dpkg-buildpackage -B -tc -rfakeroot


##########################################################
# misc

source src: clean
	(cd ..; dpkg-source -b $(PACKAGE))

work unpack: clean
	debian/rules work

.PHONY: default build lintian clean release port
.PHONY: source src work unpack

