#!/usr/bin/make -f
export DH_VERBOSE = 1
export DEB_BUILD_OPTIONS += noautodbgsym nocheck

include /usr/share/dh-dlang/dlang-flags.mk
INSTALL_DIR = $(CURDIR)/debian/dtools/usr/bin
RDMD_BIN = ${INSTALL_DIR}/dtools-rdmd
RDMD = ${RDMD_BIN} --compiler=${DC} --build-only -od. ${DFLAGS}

%:
	dh $@

override_dh_auto_clean:
	rm -Rf dtools-rdmd.o

override_dh_auto_configure:

override_dh_auto_build:

override_dh_auto_install:
	${DC} -od. -of${RDMD_BIN} ${DFLAGS} rdmd.d
	help2man -s 1 -N -n "D build tool" --version-string="2.112.1" \
		${RDMD_BIN} -o debian/rdmd.1
	for bin in catdoc ddemangle detab dget tolf; do \
		${RDMD} -of${INSTALL_DIR}/dtools-$${bin} $${bin}.d; done
	${RDMD} -of${INSTALL_DIR}/dtools-dustmite DustMite/dustmite.d
