#!/usr/bin/make -f
# debian/rules for devscripts, based on the example file rules.indep.

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

export DH_COMPAT=3

ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
CFLAGS := CFLAGS='-g -O2 -Wall'
else
CFLAGS := CFLAGS='-O2 -Wall'
endif

build-indep: build-stamp-indep
build-stamp-indep:
	dh_testdir
	touch build-stamp-indep

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

build: build-arch build-indep

clean:
	dh_testdir
	dh_testroot
	-$(MAKE) clean
	rm -f build-stamp*
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs
	$(MAKE) DESTDIR=`pwd`/debian/devscripts install

# Build architecture-independent files here.
binary-indep: build-indep
# We have nothing to do

# Build architecture-dependent files here.
binary-arch: build-arch install
	dh_testdir
	dh_testroot
	dh_installdocs README
	dh_installexamples
#	This is now done by the make install command above
#	dh_installman
	dh_installchangelogs
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_perl
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch

.PHONY: build-arch build-indep build clean binary-indep binary-arch binary \
	install

# Local variables:
# mode: makefile
# End:
