#!/usr/bin/make -f
# This file was adapted from the sample debian/rules generated by dh_make.
# original file: GNU copyright 1997 to 1999 by Joey Hess.
# adaptation: (c) 2002--2006 by Emmanuel Beffara.

settings.py: configure
	dh_testdir
	./configure --python=python --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info

build-arch:
build-indep: build
build: build-stamp

build-stamp:  settings.py
	dh_testdir
	$(MAKE)
	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	# upstream tar ball carries no Makefile in root, hence clean target
	# in debian/rules returns exit code != 0, if package was never built.
	# Ignoring this here.
	-$(MAKE) distclean
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs
	$(MAKE) install prefix=$(CURDIR)/debian/rubber/usr
	install -p --mode=644 debian/xelatex.py $(CURDIR)/debian/rubber/usr/lib/python2.7/site-packages/rubber/latex_modules
	rm $(CURDIR)/debian/rubber/usr/share/rubber/modules/etex.rub

# Build architecture-independent files here.
binary-indep: build install
	dh_testdir
	dh_testroot
	dh_pysupport
	dh_installdocs
	dh_installman
	dh_installinfo doc/rubber.info
	dh_installchangelogs NEWS
	dh_link
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary-arch:

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