#!/usr/bin/make -f

# Based on debhelper sample rules file by Joey Hess

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

# shared library versions, option 1
version=2.0.5
major=2
# option 2, assuming the library is created as src/.libs/libfoo.so.2.0.5 or so
#version=`ls src/.libs/lib*.so.* | \
# awk '{if (match($$0,/[0-9]+\.[0-9]+\.[0-9]+$$/)) print substr($$0,RSTART)}'`
#major=`ls src/.libs/lib*.so.* | \
# awk '{if (match($$0,/\.so\.[0-9]+$$/)) print substr($$0,RSTART+4)}'`

build: build-stamp
build-stamp:
	dh_testdir

	# Add here commands to compile the package.
	$(MAKE) depend
	$(MAKE)

	touch build-stamp

clean:
	dh_testdir
	rm -f build-stamp configure-stamp

	# Add here commands to clean up after the build process.
	$(MAKE) clean

	dh_clean

# Build architecture-independent files here.
binary-indep:
	@echo No architecture-independent packages.

# Build architecture-dependent files here.
binary-arch: build
	dh_testdir
	dh_testroot

	$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp

	dh_movefiles

	install -d debian/bogl-bterm-udeb/usr/bin
	install -m 755 debian/bogl-bterm/usr/bin/bterm debian/bogl-bterm-udeb/usr/bin/bterm
	install -d debian/bogl-bterm-udeb/usr/share/terminfo/b
	install -m 644 debian/bogl-bterm/usr/share/terminfo/b/bterm debian/bogl-bterm-udeb/usr/share/terminfo/b/bterm

	dh_installdocs
	dh_installexamples
	dh_installman
	dh_installinfo
	dh_installchangelogs
	dh_link
	dh_strip
	dh_compress
	dh_fixperms

	dh_makeshlibs
	dh_installdeb
	dh_shlibdeps

	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary configure
