#!/usr/bin/make -f
export DH_VERBOSE=1
export DEB_BUILD_MAINT_OPTIONS=hardening=+all

DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)

# Work around FTBFS on ppc64el in Ubuntu, which uses -O3 by default instead
# of -O2 like Debian. TODO: Investigate and fix root cause.
ifeq ($(DEB_HOST_ARCH),ppc64el)
ifeq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
export DEB_CFLAGS_MAINT_STRIP = -O3
export DEB_CFLAGS_MAINT_APPEND = -O2
endif
endif

%:
	dh $@ --parallel

override_dh_install:
	dh_install --fail-missing

override_dh_installchangelogs:
	dh_installchangelogs ChangeLog

# (shell-command "cd ../ ; debian/rules debian/qemubuilder.README.Debian")
debian/qemubuilder.README.Debian:
	w3m -dump 'http://wiki.debian.org/qemubuilder?action=raw' > $@.tmp
	mv $@.tmp $@

