#!/usr/bin/make -f
	
DEB_DH_INSTALL_SOURCEDIR=debian/tmp

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

DEB_CONFIGURE_PREFIX=/usr
DEB_CONFIGURE_SYSCONFDIR=/etc
DEB_CONFIGURE_EXTRA_FLAGS := --disable-sequence-diagrams --enable-gtk-doc
DEB_DH_STRIP_ARGS=--dbg-package=libfarsight-0.1-2 --dbg-package=farsight0.1-2-rtp
DEB_DH_MAKESHLIBS_ARGS := --exclude=rtp --exclude=rawudp --exclude=jingle
DEB_INSTALL_DOCS_farsight0.1-doc :=  docs/core/html

# Use soft-float and thumb mode if it enabled.
ifneq (,$(findstring thumb,$(DEB_BUILD_OPTIONS)))
        CFLAGS += -mthumb
        CXXFLAGS += -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' | wc -l`; \
                        else echo 1; fi)
        endif
        NJOBS := -j$(PARALLEL_JOBS)
endif
DEB_MAKE_ENVVARS := MAKEFLAGS=$(NJOBS)

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