#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

ifndef UPVER
UPVER := $(shell dpkg-parsechangelog | grep ^Version | cut -d\  -f2 | cut -d- -f1 | cut -d+ -f1)
endif

DEBVER := $(UPVER)+ds1

%:
	dh $@

override_dh_auto_build:
	cat feature-detects/*.js > feature-detects.js
	uglifyjs -o modernizr.min.js modernizr.js

	# Drop copyright from minified version since it would get
	#+only the first stanza.
	uglifyjs -nc -o feature-detects.min.js feature-detects.js

get-orig-source:
	uscan \
		--verbose \
		--force-download \
		--download-version $(UPVER) \
		--rename \
		--repack \
		--destdir .
	tar xf modernizr_$(UPVER).orig.tar.gz
	rm -vrf Modernizr-Modernizr-*/test/
	tar cf modernizr_$(DEBVER).orig.tar Modernizr-Modernizr-*/
	gzip -9 modernizr_$(DEBVER).orig.tar
	rm -rf modernizr_$(UPVER).orig.tar.gz Modernizr-Modernizr-*/
