#!/usr/bin/make -f

package = zip-crypt
docdir = debian/tmp/usr/share/doc/$(package)

build:
	$(checkdir)
	touch build

clean:
	$(checkdir)
	rm -f build
	rm -f `find . -name "*~"`
	rm -rf debian/tmp debian/files* core debian/substvars

binary-arch: checkroot build
	$(checkdir)

binary-indep: checkroot build
	$(checkdir)
	rm -rf debian/tmp
	install -d debian/tmp/DEBIAN $(docdir)
	cp -p debian/changelog debian/copyright $(docdir)
	gzip -9 $(docdir)/changelog
	dpkg-gencontrol -isp
	chown -R root:root debian/tmp
	chmod -R go=rX debian/tmp
	dpkg --build debian/tmp ..

define checkdir
	test -f debian/rules
endef

binary: binary-indep binary-arch

checkroot:
	$(checkdir)
	test root = "`whoami`"

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