#!/usr/bin/make -f
# Made with the aid of debmake, by Christoph Lameter,
# based on the sample debian/rules file for GNU hello by Ian Jackson.

DPKG_EXPORT_BUILDFLAGS = 1
-include /usr/share/dpkg/buildflags.mk

package=mgdiff

build: build-arch
build-arch:
	dh_testdir
	xmkmf
	make depend XMULIBONLY=""
	make XMULIBONLY="" CFLAGS="$(CFLAGS)"
	touch build

clean:
	dh_testdir
	rm -f build
	make clean
	rm -f `find . -name "*~"`
	rm -rf debian/mgdiff debian/files* core debian/substvars debian/tmp
	dh_clean

binary-indep: build
	dh_testdir
	dh_testroot
# There are no architecture-independent files to be uploaded
# generated by this package.  If there were any they would be
# made here.

binary-arch: build
	dh_testdir
	dh_testroot
	dh_prep
	-rm -rf debian/mgdiff
	install -d debian/mgdiff debian/mgdiff/usr/bin debian/mgdiff/usr/share/man/man1 debian/mgdiff/usr/share/doc/mgdiff
	make install BINDIR=`pwd`/debian/mgdiff/usr/bin \
		XAPPLOADDIR=`pwd`/debian/mgdiff/etc/X11/app-defaults \
		XMULIBONLY=""
	make install.man MANDIR=`pwd`/debian/mgdiff/usr/share/man/man1 XMULIBONLY=""
	mkdir -p debian/mgdiff/usr/lib/rmgdiff
	install -m 755 debian/rmgdiff debian/mgdiff/usr/lib/rmgdiff
	install -m 644 debian/rmgdiff.awk debian/mgdiff/usr/lib/rmgdiff
	ln -s ../lib/rmgdiff/rmgdiff debian/mgdiff/usr/bin
	install -m 755 debian/cvsmgdiff debian/mgdiff/usr/bin
	install -m 644 debian/cvsmgdiff.1 debian/mgdiff/usr/share/man/man1
	install -m 644 debian/rmgdiff.1x debian/mgdiff/usr/share/man/man1
	install -m 644 debian/mgdiff.README debian/mgdiff/usr/share/doc/mgdiff
	install -m 755 debian/viewpatch debian/mgdiff/usr/share/doc/mgdiff
	chmod u+w debian/mgdiff/usr/share/man/man1/mgdiff.1x
	chmod u+w debian/mgdiff/etc/X11/app-defaults/Mgdiff
	dh_testdir
	dh_installdirs
	dh_installdocs
	dh_installman
	dh_installchangelogs 
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch
build-indep:

.PHONY: binary binary-arch binary-indep clean