#!/usr/bin/make -f
%:
	dh $@

override_dh_auto_build:
	uglifyjs -o knowl.min.js knowl.js

# Upstream doesn't ship a tarball, so we create our own.  The version number
# comes from the most recent timestamp of the two files.
get-orig-source:
	wget -P tmp http://aimath.org/knowl.js
	wget -P tmp http://aimath.org/knowlstyle.css
	date -d @`stat -c %Y tmp/knowl.js` +%Y%m%d  > jsdate
	date -d @`stat -c %Y tmp/knowlstyle.css	` +%Y%m%d > cssdate
	if test `cat cssdate` -ge `cat jsdate`; then \
		cat cssdate > date; \
	else \
		cat jsdate > date; \
	fi
	cd tmp && \
	tar -cf knowl.js_0~`cat ../date`.orig.tar knowl.js knowlstyle.css
	gzip -n tmp/knowl.js_0~`cat date`.orig.tar
	mv tmp/knowl.js_0~`cat date`.orig.tar.gz ..
	rm -rf tmp *date
