#!/usr/bin/make -f

DEB_MAKE_CHECK_TARGET := check
DEB_MAKE_INSTALL_TARGET = install
DEB_MAKE_CLEAN_TARGET := spotless

DEB_COMPRESS_EXCLUDE_ALL := .leg .peg .c .ref .bas Makefile

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_CFLAGS_MAINT_APPEND = -Wall
include /usr/share/dpkg/buildflags.mk

include /usr/share/cdbs/1/rules/upstream-tarball.mk
include /usr/share/cdbs/1/rules/utils.mk
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/makefile.mk

DEB_MAKE_EXTRA_ARGS += PREFIX=/usr ROOT=$(DEB_DESTDIR)

DEB_TAR_SRCDIR := .

DEB_INSTALL_EXAMPLES_peg := examples/*

ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
common-build-arch::
	PATH="..:$$PATH" $(MAKE) -C examples
	$(MAKE) -C examples clean
endif

# Needed by upstream build process
CDBS_BUILD_DEPENDS += , dpkg-dev (>= 1.16.1~)