#!/usr/bin/make -f
# David Martnez <ender@debian.org>
# It seems that I finally changed this cursed Makefile to DHv3.
# Now I only have to change this cursed Makefile to DHv4. :-)

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

version=$(shell expr `pwd` : '.*-\([0-9.]*\)')
version_major=$(shell expr `pwd` : '.*-\([0-9]*\).[0-9.]*')

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -g
endif

# WBS codec is licensed by British Telecommunications,
# and its license is not compatible with DFSG.
CFLAGS += -DREMOVE_WBS_CODEC

CFLAGS += -DUSE_INTERP_RESULT

#export DH_VERBOSE=1

CFLAGS += -O2
export CFLAGS

# Let's roll...
config: config-stamp

config-stamp:
	dh_testdir
	dh_autotools-dev_updateconfig
	./configure --enable-ipv6 \
		    --with-tcl=/usr/include/tcl \
		    --with-tk=/usr/include/tcl \
		    --with-tcltk-version="" \
		    --with-common=/usr/include/uclmmbase \
		    --mandir=$(CURDIR)/debian/rat/usr/share/man
	touch config-stamp

build: config build-stamp

build-stamp:
	dh_testdir
	$(MAKE)
	touch build-stamp

clean: clean1

clean1:
	dh_testdir
	dh_testroot
	rm -f build-stamp config-stamp
	if [ -e Makefile ] ; then $(MAKE) distclean; fi
	dh_autotools-dev_restoreconfig
	dh_clean

install: build
	dh_testdir
	dh_clean
	dh_installdirs

	$(MAKE) install prefix=$(CURDIR)/debian/tmp/usr

	dh_movefiles
build-indep build-arch binary-indep: build

binary-arch: build install
	dh_testdir
	dh_installdocs
#	dh_installmenu
	dh_install
	dh_installman
#	dh_undocumented rat-ui.1 rat-media.1
	dh_installchangelogs
	dh_fixperms
	dh_strip
	dh_compress
	dh_fixperms
	dh_makeshlibs
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

source diff:								  
	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary
# vim:set noet ai sts=8 sw=8 tw=0:
