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

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

DPKG_EXPORT_BUILFLAGS=1
include /usr/share/dpkg/buildflags.mk

CFLAGS += $(CPPFLAGS)

build-arch: build
build-indep: 
build: build-stamp
build-stamp:
	dh_testdir
	mv ChangeLog changelog
	# Prevent regeneration of any of the auto* gunk.
	touch configure aclocal.m4 Makefile.in
	touch config.h.in
	./configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info
	make CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)"

	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp
	if [ -f changelog ]; then \
		mv changelog ChangeLog; \
	fi
	if [ -f Makefile ]; then $(MAKE) clean ; fi
	if [ -f Makefile ]; then $(MAKE) distclean ; fi

	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs

	$(MAKE) DESTDIR=`pwd`/debian/usbview install

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

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installdocs
	dh_installexamples
	dh_installmenu

	cp debian/usbview.desktop debian/usbview/usr/share/applications

	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
.PHONY: build clean binary-indep binary-arch binary install
