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

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

export DEB_LDFLAGS_MAINT_APPEND=-Wl,--as-needed
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
DEB_BUILD_ARCH     ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)

ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
  NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
  MAKEFLAGS += -j$(NUMJOBS)
endif

ifeq (ppc64el,$(filter $(DEB_BUILD_ARCH),ppc64el))
  CFLAGS += -O2
endif

%:
	dh  $@ --with gir

override_dh_autoreconf:
	NOCONFIGURE=1 dh_autoreconf --as-needed ./autogen.sh

override_dh_auto_configure:
	dh_auto_configure -- --disable-static \
	                     --enable-startup-notification=yes \
	                     --disable-silent-rules \
			     --enable-gtk-doc

override_dh_girepository:
	dh_girepository /usr/lib/$(DEB_HOST_MULTIARCH)/muffin

override_dh_strip:
	dh_strip --dbg-package=muffin-dbg

override_dh_install:
	dh_install -X.la --fail-missing
