#!/usr/bin/make -f
# -*- makefile -*-

export DEB_BUILD_MAINT_OPTIONS=hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
DEB_HOST_GNU_CPU ?= $(shell dpkg-architecture -qDEB_HOST_GNU_CPU)
DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
MAKEOPTIONS = V=1 UNAME='$(DEB_HOST_ARCH_OS)' HOST_CPU='$(DEB_HOST_GNU_CPU)' APIDIR=/usr/include/mupen64plus/ DEBUG=1 PREFIX=/usr/ COREDIR="/usr/lib/$(DEB_HOST_MULTIARCH)/" PLUGINDIR="/usr/lib/$(DEB_HOST_MULTIARCH)/mupen64plus" MANDIR=/usr/share/man/ BINDIR=/usr/games/ OPTFLAGS="" PIE=1

binary binary-arch binary-indep build build-arch build-indep clean install install-arch install-indep:
	dh $@ --sourcedirectory="projects/unix" --parallel --list-missing

get-orig-source:
	$(CURDIR)/debian/get-orig-source.sh

override_dh_auto_build:
	dh_auto_build -- all $(MAKEOPTIONS)

override_dh_auto_install:
	dh_auto_install -- $(MAKEOPTIONS)

override_dh_strip:
	dh_strip -a --dbg-package=mupen64plus-ui-console-dbg

override_dh_installchangelogs:
	dh_installchangelogs RELEASE

.PHONY: binary binary-arch binary-indep build build-arch build-indep clean install install-arch install-indep \
	get-orig-source override_dh_auto_build override_dh_auto_install override_dh_strip override_dh_installchangelogs
