#!/usr/bin/make -f

# output every command that modifies files on the build system.
#DH_VERBOSE = 1
PACKAGE=three
BUILDDIR=$(CURDIR)/build

# the following lines look redundant, but are actually needed because of ../build
.PHONY: build
build:
	dh $@

%:
	dh $@

# Currently upstream doesn't support automated headless tests.
# As a temporary substitute, you could manually run the below commands, then
# apply d/patches/fix-tests.patch, then run `python -m SimpleHTTPServer` and go
# to http://localhost:8000/test/unit/unittests_three.html to see them pass.
# If they don't, then check that d/ghetto.sh still works properly.
#override_dh_auto_configure:
#	ln -s /usr/share/javascript/qunit/qunit.js test/unit/qunit-1.18.0.js
#	ln -s /usr/share/javascript/qunit/qunit.css test/unit/qunit-1.18.0.css

override_dh_auto_build:
	mkdir -p $(BUILDDIR)
	debian/ghetto.sh > $(BUILDDIR)/$(PACKAGE).js
	uglifyjs -o $(BUILDDIR)/$(PACKAGE).min.js $(BUILDDIR)/$(PACKAGE).js

override_dh_auto_clean:
	rm -rf $(BUILDDIR)
