#!/usr/bin/make -f

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

PACKAGE=silo-installer
VERSION=$(shell dpkg-parsechangelog | grep ^Version: | cut -d ' ' -f 2)
ARCH=$(shell dpkg --print-architecture)
FILENAME=$(PACKAGE)_$(VERSION)_$(ARCH).udeb
PRIORITY=$(shell grep ^Priority: debian/control | cut -d ' ' -f 2)

# This is the debhelper compatability version to use.
export DH_COMPAT=3

# Udebs have no postrm file, don't make one
export DH_OPTIONS=-n

build: build-stamp
build-stamp:
	dh_testdir

	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp
	rm -f debian/files~
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k


# Build architecture-independent files here.
binary-indep: build install
	dh_testdir
	dh_testroot
	dh_installdebconf
	cp debian/isinstallable debian/silo-installer/DEBIAN/
	dh_installdeb 
	dh_gencontrol -- -fdebian/files~
	dpkg-distaddfile $(FILENAME) debian-installer $(PRIORITY)
	dh_builddeb --filename=$(FILENAME)

# Build architecture-dependent files here.
binary-arch: build install


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