#!/usr/bin/make -f

#export DH_VERBOSE=1


DEB_CFLAGS_MAINT_APPEND  := -pipe -Wall
DEB_LDFLAGS_MAINT_APPEND := -Wl,--as-needed

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)


# We need fno-strict-aliasing because otherwise g++ throws an
# inscrutable error; I'd rather fix the root cause, but I can't find
# it.
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
  DEB_CXXFLAGS_MAINT_APPEND=-fno-inline -fno-strict-aliasing
else
  DEB_CXXFLAGS_MAINT_APPEND=-fno-strict-aliasing
endif


%:
	dh $@ --with autoreconf --parallel

override_dh_auto_configure:
	dh_auto_configure -- $(CROSS_CONFIGURE_OPTIONS)

override_dh_auto_clean:
	-rm -rf doc/ikiwiki/.ikiwiki
	dh_auto_clean

# Build indep overrides
override_dh_auto_build-indep:
	$(MAKE) -C doc doc

override_dh_auto_test-indep:
        # No tests needed for docs

override_dh_auto_install-indep:
	$(MAKE) -C doc install
	dh_install -i -Xjquery.min.js

override_dh_installchangelogs:
	dh_installchangelogs -- NEWS

override_dh_installexamples:
	dh_installexamples -plibcwidget-dev src/cwidget/testcwidget.cc

override_dh_strip:
	dh_strip -a --dbg-package=libcwidget3-dbg
