#!/usr/bin/make -f
# debian/rules for the bootchart package.
# Copyright © 2009 Canonical Ltd.
# Author: Scott James Remnant <scott@ubuntu.com>

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

export DH_OPTIONS

# Build the package
build:  build-stamp
build-stamp:
	dh_testdir

	$(MAKE)
	touch $@

# Install files into the deb
install:
install: build
	dh_testdir
	dh_testroot
	dh_clean -k 
	dh_installdirs

	install -D -m 755 -o root -g root bootchart-collector \
		debian/bootchart/lib/bootchart/collector
	install -D -m 755 -o root -g root bootchart-gather.sh \
		debian/bootchart/lib/bootchart/gather

	install -D -m 755 -o root -g root debian/bootchart.initramfs-hook \
		debian/bootchart/usr/share/initramfs-tools/hooks/bootchart
	install -D -m 755 -o root -g root debian/bootchart.initramfs-script \
		debian/bootchart/usr/share/initramfs-tools/scripts/init-top/bootchart


binary: binary-indep binary-arch

# Build architecture-independent files here.
binary-indep: DH_OPTIONS=-i
# We have nothing to do by default.

# Build architecture-dependent files here.
binary-arch: DH_OPTIONS=-a
binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installdocs
	dh_installchangelogs
	dh_installinit --no-start
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb


# Clean up the mess we made
clean: clean-source unpatch
clean-source:
	dh_testdir
	rm -f build-stamp

	-$(MAKE) clean

	dh_clean 


.PHONY: patch unpatch build install binary-indep binary-arch binary clean clean-source
