#!/usr/bin/make -f

# DH_VERBOSE=1
# policy manual, section 10.1
CFLAGS = -Wall -g
ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
    CFLAGS += -O0
else
    CFLAGS += -O2
endif

package = autolog

build:
	dh_testdir
	make
	touch build

clean:
	dh_testdir
	dh_testroot
	rm -f build
	[ ! -f Makefile ] || $(MAKE) clean
	dh_clean
	rm -f `find . -name "*~"`

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

binary-arch:	build
	dh_testdir
	dh_testroot
	rm -rf debian/$(package)
	install -d debian/$(package)/etc debian/$(package)/etc/logrotate.d debian/$(package)/etc/init.d
	make install DESTDIR=`pwd`/debian/$(package) CFLAGS="$(CFLAGS)"
	install -m644 debian/logrotate debian/$(package)/etc/logrotate.d/autolog
	install -m644 autolog.init debian/$(package)/etc/init.d/autolog
	dh_installdirs usr/share/lintian/overrides/
	dh_install debian/overrides/autolog usr/share/lintian/overrides/
	dh_installdocs -n
	dh_installexamples
	dh_installchangelogs CHANGES
	dh_installcron
	dh_installman debian/autolog.8 debian/autolog.conf.5
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdebconf
	dh_shlibdeps
	dh_gencontrol
	dh_installdeb
	dh_md5sums
	dh_builddeb

# Below here is fairly generic really

binary:		binary-indep binary-arch
