#!/usr/bin/make -f
# Sample debian/rules that uses debhelper. 
# GNU copyright 1997 by Joey Hess.
#
# This version is for a hypothetical package that builds an
# architecture-dependant package, as well as an architecture-independent
# package.

# Uncomment this to turn on verbose mode. 
#export DH_VERBOSE=1

# This is the debhelper compatability version to use.
export DH_COMPAT=2

export LANGS=en pt_BR pl ko es it ru
export FORMATS=html text latexps

build: build-stamp
build-stamp:
	dh_testdir

	echo "Building ps for Korean and Italian version don't work" \
	| tee apt-howto-ko.ps > apt-howto-it.ps

	$(MAKE)

	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp

	# Cleans the build
	-rm -rf *.html *.ps *.txt *.sasp *.log *.tex *.toc *.aux *.dvi

	dh_clean

install:
install: build
	dh_testdir
	dh_testroot
	dh_clean -k

	# Install the other language versions
	for lang in $$LANGS ; do \
		install -d debian/tmp/usr/share/doc/apt-howto/$$lang/apt-howto-$$lang.html ; \
		install -m 644 apt-howto-$$lang.html/* debian/tmp/usr/share/doc/apt-howto/$$lang/apt-howto-$$lang.html/ ; \
		install -m 644 apt-howto-$$lang.ps debian/tmp/usr/share/doc/apt-howto/$$lang ; \
		install -m 644 apt-howto-$$lang.txt debian/tmp/usr/share/doc/apt-howto/$$lang ; \
		install -m 644 apt-howto-$$lang.sgml debian/tmp/usr/share/doc/apt-howto/$$lang ; \
	done

# Build architecture-independent files here.
# Pass -i to all debhelper commands in this target to reduce clutter.
binary-indep: build install
	dh_testdir
	dh_testroot
	dh_movefiles
	dh_installdocs
	dh_installchangelogs
	dh_link
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

# Build architecture-dependent files here.
binary-arch: build install

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