#!/usr/bin/make -f
VERSION := $(shell dpkg-parsechangelog | grep ^Version | cut -d' ' -f2-)

build:
binary: binary-indep
binary-arch:
binary-indep:
	install -m 644 -D doom1.wad debian/tmp/usr/share/games/doom/doom1.wad
	install -m 644 -D debian/copyright debian/tmp/usr/share/doc/doom-wad-shareware/copyright
	gzip -c9 debian/changelog > debian/tmp/usr/share/doc/doom-wad-shareware/changelog.Debian.gz
	if [ ! -d debian/tmp/DEBIAN ] ; then mkdir debian/tmp/DEBIAN; fi
	dpkg-gencontrol
	cd debian/tmp && find usr/ -type f -print0 | xargs -r0 md5sum >DEBIAN/md5sums
	dpkg-deb -b debian/tmp ../doom-wad-shareware_$(VERSION)_all.deb
clean:
	if [ -d debian/tmp ]; then rm -r debian/tmp; fi
	if [ -f debian/files ]; then rm debian/files; fi