#!/usr/bin/make -f

PACKAGE=ranch
VERSION = $(shell dpkg-parsechangelog | sed -rne 's/^Version: ([0-9.]+)(\+dfsg)?.*$$/\1/p')

%:
	dh $@

override_dh_auto_clean:
	rm -rf doc/*.html
	rm -rf doc/*.css
	rm -rf doc/*.png
	rm -rf doc/edoc-info

	dh_auto_clean

override_dh_auto_build-arch:
	make
override_dh_auto_build-indep:
	make docs

override_dh_auto_install:
	dh_auto_install

	install -d \
		$(CURDIR)/debian/erlang-$(PACKAGE)/usr/lib/erlang/lib/$(PACKAGE)-$(VERSION)/ebin
	install -m 644 ebin/* \
		$(CURDIR)/debian/erlang-$(PACKAGE)/usr/lib/erlang/lib/$(PACKAGE)-$(VERSION)/ebin/

override_dh_gencontrol-arch:
	erlang-depends -a -perlang-ranch
	dh_gencontrol -a -perlang-ranch

override_dh_compress:
	dh_compress -X.erl -X.beam
