#! /usr/bin/make -f
############################ -*- Mode: Makefile -*- ###########################
## rules ---
## Author	    : Manoj Srivastava and Diego Biurrun
##
###############################################################################


# VERSION=$(shell LC_ALL=C dpkg-parsechangelog | grep ^Version: | \
#                          sed 's/^Version: *//')
#

#    $Id: rules,v 1.27 2001/01/19 19:35:10 srivasta Exp $


# Please change the maintainer information, as well as the debian version
# below, (and maybe the priority as well, especially if you are uploading
# an official package)

# Priority of this version (or urgency, as dchanges would call it)
priority := Low
#  Package specific stuff

FILES_TO_CLEAN  = debian/files
STAMPS_TO_CLEAN = stamp-binary
DIRS_TO_CLEAN   =


DOCDIR  = debian/tmp/usr/share/doc/cdcopy
MAN1DIR = debian/tmp/usr/share/man/man1
CONFDIR = debian/tmp/etc

# install commands
install_file=    install -p    -o root -g root -m 644
install_program= install -p    -o root -g root -m 755
make_directory=  install -p -d -o root -g root -m 755


all build:
# Builds the binary package.


clean:
	rm -f $(FILES_TO_CLEAN) $(STAMPS_TO_CLEAN)
	rm -f -r debian/tmp
	rm -f `find .  -name '*~'`


tarball: clean
	tar --exclude=debian -czf cdcopy0.0.6-6.tar.gz *


binary:
	rm -rf debian/tmp  debian/tmp.deb

	$(make_directory)  debian/tmp/DEBIAN
	$(make_directory)  debian/tmp/usr/bin
	$(make_directory)  $(MAN1DIR)
	$(make_directory)  $(DOCDIR)
	$(make_directory)  $(CONFDIR)

	$(install_file)    debian/conffiles 	debian/tmp/DEBIAN/conffiles
	$(install_program) debian/postinst	debian/tmp/DEBIAN/postinst
	$(install_program) debian/prerm 	debian/tmp/DEBIAN/prerm

	$(install_file)    debian/changelog 	$(DOCDIR)/changelog.Debian
	$(install_file)    Changelog.txt 	$(DOCDIR)/changelog
	$(install_file)    README.txt 		$(DOCDIR)/README.txt
	$(install_file)    README 		$(DOCDIR)/README
	gzip -9fqr	$(DOCDIR)

	$(install_file)    debian/copyright  	$(DOCDIR)/copyright

	$(install_file)    cdcopy.conf  	$(CONFDIR)/cdcopy.conf

	$(install_file)    cdcopy.1     	$(MAN1DIR)/cdcopy.1
	gzip -9fqr	$(MAN1DIR)

	$(install_program) cdcopy  		debian/tmp/usr/bin/cdcopy


	dpkg-gencontrol -isp
	chown -R root.root debian/tmp
	dpkg --build       debian/tmp ..
	touch              stamp-binary



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