#!/usr/bin/make -f
# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.

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


autoreconf:
	rm -f acinclude.m4
	autoreconf -fi

build: patch-stamp build-stamp
build-stamp:
	dh_testdir
	dh_autoreconf debian/rules -- autoreconf
	./configure --prefix=/usr
	make
	(cd doc; make info pdf html)
	touch build-stamp

clean: unpatch
	dh_testdir
	dh_testroot
	dh_auto_clean
	rm -f fdesign/Makefile demos/Makefile fd2ps/Makefile gl/Makefile
	rm -f lib/include/Makefile lib/Makefile image/Makefile Makefile
	rm -f build-stamp
	dh_autoreconf_clean
	dh_clean

# Build architecture-independent files here.
binary-indep: build

# Build architecture-dependent files here.

build-arch: DH_OPTIONS=-a
build-arch: build

install-arch: build
	dh_testdir
	dh_testroot
	dh_prep
	$(MAKE) install DESTDIR=`pwd`/debian/tmp
	dh_installdirs
	dh_install
	rm -fR debian/libforms-doc/usr/share/doc/libforms-doc/html/images/CVS
	dh_installman -p libforms-bin fd2ps/fd2ps.1 fdesign/fdesign.1
	dh_installman -p libforms-dev lib/xforms.5
	(cd debian/libforms-dev/usr/share/man/man5/ ; ln -s xforms.5.gz libforms1.5.gz)
	dh_installdocs
	dh_installdocs -p libforms-doc doc/xforms.pdf
	dh_installchangelogs
	dh_installinfo -p libforms-dev doc/xforms.info*
#	for i in `ls debian/*.lintian-overrides`; do \
#	install -p -m 0644 -o root -g root $$i \
#	debian/`basename $$i .lintian-overrides`/usr/share/lintian/overrides/`basename $$i .lintian-overrides`; \
#	done
	dh_strip
	dh_compress
	dh_fixperms

binary-arch: DH_options=-a
binary-arch: build install-arch
	dh_makeshlibs
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb


source diff:                                                                  
	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install-arch patch-stamp unpatch
