#!/usr/bin/make -f

%:
	dh "$@"

DEBVERSION:=$(shell head -n 1 debian/changelog \
		    | sed -e 's/^[^(]*(\([^)]*\)).*/\1/')
ORIGTARVER:=$(shell echo $(DEBVERSION) | sed -e 's/^.*://' -e 's/-[0-9.]*$$//')# -e 's/.dfsg$$//' -e 's/~//')

UPVERSION:=$(shell echo $(ORIGTARVER) | tr -d '~')

FILENAME := ilbc_$(ORIGTARVER).orig.tar.gz
FULLNAME := ilbc-$(UPVERSION)
URL := http://soft-switch.org/downloads/codecs/ilbc-$(UPVERSION).tgz

override_dh_auto_configure:
	dh_auto_configure -- --enable-doc --enable-tests

# FIXME: should be done in Makefile.am?
override_dh_auto_clean:
	dh_auto_clean
	rm -rf doc/api

get-orig-source:
	-@@dh_testdir
	@@[ -d ../tarballs/. ]||mkdir -p ../tarballs
	@@echo Downloading $(FILENAME) from $(URL) ...
	@@wget -N -nv -T10 -t3 -O ../tarballs/$(FILENAME) $(URL)
