#!/usr/bin/make -f

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/autotools.mk

ifeq (,$(findstring nodocs,$(DEB_BUILD_OPTIONS)))
	DEB_INSTALL_DOCS_calendar-backend-doc := docs/doxygen-doc/html
endif

DEB_DH_INSTALL_SOURCEDIR=debian/tmp
DEB_DESTDIR=$(CURDIR)/debian/tmp

DEB_CONFIGURE_PREFIX=/usr
DEB_CONFIGURE_SYSCONFDIR=/etc
DEB_DH_STRIP_ARGS=--dbg-package=calendar-backend

ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
	DEB_CONFIGURE_EXTRA_FLAGS=--enable-debug
endif

# Use thumb mode if it enabled.
ifneq (,$(findstring thumb,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -mthumb
	CPPFLAGS += -mthumb
endif

# Prefer hardware floating point if enabled
ifneq (,$(findstring vfp,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -mfpu=vfp -mfloat-abi=softfp
	CPPFLAGS += -mfpu=vfp -mfloat-abi=softfp
endif

debian/stamp-autotools-files:
	autoreconf -v --install
	touch debian/stamp-autotools-files
