#!/usr/bin/make -f

#Workaround a segfault on amd64 when optimization are O2
ifeq (amd64,$(shell dpkg-architecture -qDEB_HOST_ARCH))
	CFLAGS += -O0
else
	CFLAGS += -O2
endif

%:
	dh $@

override_dh_auto_configure:
	LINKFLAGS="${LDFLAGS} -Wl,--as-needed" ./waf --nocache configure --prefix=/usr \
	--enable-debug \
	--config-backends=gconf,keyfile \
	--vfs-backends=gio,gnome-vfs,thunar-vfs \
	--desktop-entry-backends=glib,gnome \
	--with-glade \
	--enable-docs
	./waf --nocache build

override_dh_auto_install:
	./waf --nocache install --destdir=$(CURDIR)/debian/tmp

override_dh_strip:
	dh_strip --dbg-package=libdesktop-agnostic0-dbg

override_dh_auto_clean:
	rm -rf build sphinx.pyc
	./waf --nocache distclean
	rm -f configure	# so dh_auto_configure doesn't try to use this broken fallback
