#!/usr/bin/make -f
#
# Debian Makefile for ada-reference-manual
# Copyright (c) 2010 Stephen Leake <stephen_leake@stephe-leake.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
# To build this package in a chroot:
# schroot -d `cd ..; pwd` --chroot=unstable -- dpkg-buildpackage -uc -us -i"_MTN|\\.mtn-ignore"
#
# To run lintian:
# schroot -d `cd ..; pwd` --chroot=unstable -- make -f debian/rules lint

.SUFFIXES=

# Targets mandated by the Debian Policy

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

build: build-stamp

build-stamp: debian/tmp/arm2005-html
build-stamp: debian/tmp/aarm2005-html
build-stamp: debian/tmp/arm2005.info
build-stamp: debian/tmp/aarm2005.info
build-stamp: debian/tmp/arm2005.pdf
build-stamp: debian/tmp/aarm2005.pdf
build-stamp: debian/tmp/arm2005.text
build-stamp: debian/tmp/aarm2005.text
	touch build-stamp

debian/tmp/%-html : %.texinfo | debian/tmp
	makeinfo --html --no-validate --no-number-sections $< -o $@

debian/tmp/%.info : %.texinfo | debian/tmp
	makeinfo --no-validate --no-split --no-number-sections $< -o $@

debian/tmp/%.dvi : %.texinfo | debian/tmp
	cd debian/tmp; texi2dvi --quiet --tidy ../../$<

debian/tmp/%.text : %.texinfo | debian/tmp
	makeinfo --plaintext --no-validate --no-number-sections $< -o $@

debian/tmp :
	mkdir debian/tmp

debian/tmp/%.ps : debian/tmp/%.dvi
	dvips -o $@ $<

debian/tmp/%.pdf : debian/tmp/%.ps
	ps2pdf $< $@

clean:
	dh_clean
	rm -f build-stamp

binary: binary-indep binary-arch

binary-indep:
	dh_installchangelogs
	dh_installdocs -p ada-reference-manual-html debian/tmp/*-html
	dh_installinfo -p ada-reference-manual-info debian/tmp/*.info*
	dh_installdocs -p ada-reference-manual-info debian/copyright
	dh_installdocs -p ada-reference-manual-pdf debian/tmp/*.pdf
	dh_installdocs -p ada-reference-manual-text debian/tmp/*.text
	dh_compress
	dh_gencontrol
	dh_md5sums
	dh_builddeb

# no architecture-dependent files
binary-arch:

lint:
	cd ..; lintian -i ada-reference-manual*.changes

# end of file

