#!/usr/bin/make -f

include /usr/share/cdbs/1/rules/debhelper.mk
#include /usr/share/cdbs/1/rules/autoreconf.mk
include /usr/share/cdbs/1/class/autotools.mk
include /usr/share/cdbs/1/rules/patchsys-quilt.mk

DEB_DBG_PACKAGE_libnghttp2-5 = libnghttp2-5-dbg

DEB_CONFIGURE_EXTRA_FLAGS += --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \
  --bindir=\$${prefix}/bin/$(DEB_HOST_MULTIARCH) \
  --disable-failmalloc \
  --with-libxml2=yes \
  --with-spdylay=no

ifeq (,$(filter hurd-%,$(DEB_BUILD_ARCH)))
  DEB_CONFIGURE_EXTRA_FLAGS += --with-jemalloc=yes
endif

LDFLAGS += -Wl,--default-symver

## Show what dh_autoreconf is deleting / moving / restoring
#DEB_DH_AUTORECONF_ARGS := --verbose

# Do not want README so set the default docs explicitly
DEB_INSTALL_DOCS_ALL = AUTHORS README.rst

clean::
	rm -rf doc/manual/html doc/manual/doctrees doc/apiref.rst

install/libnghttp2-dev::
	rm -f debian/tmp/usr/lib/*/libnghttp2.la

build/libnghttp2-doc::
	$(MAKE) html

install/libnghttp2-doc::
	d=$(CURDIR)/debian/libnghttp2-doc/usr/share/doc/libnghttp2-doc; \
	mkdir -p $$d; \
	cp -pr doc/manual/html/* $$d; \
	cd $$d; \
	rm -f objects.inv; \
	cd _static; \
	ln -sf /usr/share/javascript/jquery/jquery.js; \
	ln -sf /usr/share/javascript/underscore/underscore.js
