#!/usr/bin/make -f
# $Id: rules 148 2011-02-08 07:31:19Z robert $
# 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-arch: build-stamp
build-stamp: patch-stamp
	dh_testdir
	test -d $(DEB_BUILD_ARCH) || { echo "Unsupported build architecture: $(DEB_BUILD_ARCH)" >&2; exit 1; }
	touch "$@"

clean: clean-patched unpatch
clean-patched:
	dh_testdir
	dh_testroot
	rm -f build-stamp patch-stamp 
	dh_clean

install: build-arch
	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-dependent files here.
binary-arch: build-arch 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-indep build-indep:       # Nothing to do

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

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

.DEFAULT_GOAL := binary
