#! /usr/bin/make -f

CPPFLAGS = -I/usr/include/tcl8.4

ifeq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
OPTFLAG = -O2 -g
else
OPTFLAG = -g
endif

configure:
	dh --sourcedirectory=build build --until dh_auto_configure

build clean install binary-arch binary-indep binary:
	dh --sourcedirectory=build $@

override_dh_auto_configure:
	ADDCPPFLAGS="$(CPPFLAGS)" OPTFLAG="$(OPTFLAG)" \
		dh_auto_configure -- --with-x --enable-db --enable-re

override_dh_clean:
	# This is in the upstream tarball, so shouldn't be removed.
	dh_clean -X 'vi/#v_xchar.c#'

override_dh_auto_install:
	dh_auto_install -- prefix=$(CURDIR)/debian/vigor/usr

override_dh_installchangelogs:
	dh_installchangelogs docs/changelog

.PHONY: build clean install binary-arch binary-indep binary
