#!/usr/bin/make -f

PACKAGE=cowboy
VERSION=$(DEB_VERSION_UPSTREAM:+dfsg=)
include /usr/share/dpkg/pkg-info.mk

%:
	dh $@ --with rebar

override_dh_auto_build:
	make app SKIP_DEPS=yes
	make docs SKIP_DEPS=yes

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_auto_test:
	# Disable

override_dh_installdocs-indep:
	dh_installdocs

	mv $(CURDIR)/debian/erlang-cowboy-doc/usr/share/doc/erlang-cowboy/* \
		$(CURDIR)/debian/erlang-cowboy-doc/usr/share/doc/erlang-cowboy-doc/
	rmdir $(CURDIR)/debian/erlang-cowboy-doc/usr/share/doc/erlang-cowboy
	rm -rf $(CURDIR)/debian/erlang-cowboy-doc/usr/share/doc/erlang-cowboy-doc/edoc/overview.edoc


override_dh_installexamples-indep:
	dh_installexamples

override_dh_compress:
	dh_compress -X.erl -X.beam -X.pdf

override_dh_auto_clean:
	rm -rf doc/*.html doc/*.png doc/*.css doc/edoc-info
	rm -rf ebin/*.beam ebin/cowboy.app
