#!/usr/bin/make -f

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/autotools.mk
include /usr/share/cdbs/1/class/gnome.mk
include /usr/share/cdbs/1/rules/simple-patchsys.mk

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

ifneq (,$(findstring parallel,$(DEB_BUILD_OPTIONS)))
    PARALLEL_JOBS := $(shell echo $(DEB_BUILD_OPTIONS) | \
        sed -e 's/.*parallel=\([0-9]\+\).*/\1/')
    ifeq ($(DEB_BUILD_OPTIONS),$(PARALLEL_JOBS))
        PARALLEL_JOBS := $(shell if [ -f /proc/cpuinfo ]; \
            then echo `cat /proc/cpuinfo | grep 'processor' | head -2 | wc -l`; \
            else echo 1; fi)
    endif
    NJOBS := -j$(PARALLEL_JOBS)
endif
DEB_MAKE_ENVVARS := MAKEFLAGS=$(NJOBS)

DEB_SHLIBDEPS_INCLUDE := debian/tmp/usr/lib

DEB_DH_MAKESHLIBS_ARGS_ALL := -V

DEB_DH_STRIP_ARGS := --dbg-package=evolution-data-server --dbg-package=libedataserver --dbg-package=libedata-book --dbg-package=libebook

DEB_CONFIGURE_EXTRA_FLAGS := \
	--prefix=/usr \
	--with-dbus \
	--without-openldap \
	--without-libgnome \
	--disable-groupwise \
	--disable-nss \
	--without-soup \
	--disable-nntp \
	--without-bug-buddy \
	--disable-calendar

debian/stamp-autotools-files:
	./autogen.sh $(DEB_CONFIGURE_EXTRA_FLAGS)
	touch debian/stamp-configured

common-build-arch common-build-indep:: debian/stamp-configured
	make

clean::
	dh_clean intltool-extract intltool-merge intltool-update \
	.po/.intltool-merge-cache
	rm -f debian/stamp-configured
