#!/usr/bin/make -f
# -*- makefile -*-  

# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

#
# This version is for a multibinary package. It also allows you to build any
# of the binary packages independantly, via binary-<package> targets.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# This is the debhelper compatability version to use.
export DH_COMPAT=1

# This has to be exported to make some magic below work.
export DH_OPTIONS

INST = install -p
package = transcode
installprefix = $(PWD)/debian/tmp

build: 
	$(checkdir)
	./configure --with-lame --prefix /usr
	nice -n 20 $(MAKE) -j 2
	touch build

clean:
	$(checkdir)
	dh_clean
	@if [ -f Makefile ]; then $(MAKE) distclean ; fi
	@rm -f log build config.cache

binary-indep:
# There are no architecture-independent files to be uploaded
# generated by this package.  If there were any they would be
# made here.

binary-arch: clean checkscripts build
	$(checkdir)
	@echo ":: Preparing packages"
	
	@dh_testdir
	@dh_testroot
	@dh_installdirs
	
	@make DESTDIR=$(installprefix) install
# remove *.la since it's for developmental purposes only(??)
	@rm -f `find debian/tmp -name "*.la"`

	dh_undocumented -p transcode avifix.1
	dh_undocumented -p transcode avimerge.1
	dh_undocumented -p transcode avisplit.1
	dh_undocumented -p transcode avisync.1
	dh_undocumented -p transcode transcode.1

#	@dh_installexamples
	dh_installdocs
	dh_installchangelogs -k ChangeLog

	dh_installmime
	dh_installmenu
#	@dh_installcron
#	dh_installmanpages -ptmp
	@dh_movefiles
	dh_compress
#	dh_fixperms -Xkv4lsetup
	dh_strip
	dh_shlibdeps
	dh_makeshlibs -V

	dh_gencontrol
	dh_installdeb
	dh_md5sums
	dh_builddeb -v

define checkdir
	@test -f debian/rules
endef

checkscripts:
	@echo ":: Checking scripts"

# Below here is fairly generic really

binary: binary-indep binary-arch

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

.PHONY: binary binary-indep binary-arch clean checkroot
