#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# This file is public domain software, originally written by Joey Hess. 

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

ARCH_DIR     := build-arch
DESTDIR		:= debian/$(shell dh_listpackages)

include /usr/share/dpatch/dpatch.make

build: build-stamp
build-stamp: patch-stamp
	dh_testdir
	test -d $(DEB_BUILD_ARCH) || { echo "Unsupported build architecture: $(DEB_BUILD_ARCH)" >&2; exit 1; } 
	# Nothing to do
	touch "$@"

clean: clean1 unpatch
clean1:
	dh_testdir
	dh_testroot
	dh_clean

install: build-stamp
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs

	install -pcm 0755 $(ARCH_DIR)/upx $(DESTDIR)/usr/bin/upx-nrv
	$(ARCH_DIR)/upx -d $(DESTDIR)/usr/bin/upx-nrv

	install -pcm 0644 $(ARCH_DIR)/upx.1 $(DESTDIR)/usr/share/man/man1/upx-nrv.1

# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs $(ARCH_DIR)/NEWS
	dh_installdocs $(ARCH_DIR)/BUGS $(ARCH_DIR)/README \
			$(ARCH_DIR)/THANKS $(ARCH_DIR)/upx.doc \
			$(ARCH_DIR)/upx.html

#	dh_installexamples
#	dh_install
#	dh_installmenu
#	dh_installdebconf	
#	dh_installlogrotate
#	dh_installemacsen
#	dh_installpam
#	dh_installmime
#	dh_installinit
#	dh_installcron
#	dh_installinfo
#	dh_undocumented
#	dh_installman
#	dh_link
#	dh_strip
	dh_lintian
	dh_compress
	dh_fixperms
#	dh_makeshlibs
	dh_installdeb
#	dh_perl
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

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