#!/usr/bin/make -f

STEMS = bootbox bootbox.all bootbox.locales
# generate documentation unless nodoc requested
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
DOCS = README.html README.txt
endif

override_dh_auto_build: $(patsubst %,dist/%.min.js.gz,$(STEMS)) \
 $(DOCS)

override_dh_installdocs:
	dh_installdocs --all -- $(DOCS)

# reproduce upstream build but with sourcemaps
# * include source-map
grunt:
	grunt

dist/%.min.js: grunt
	# Gunt build these files

# pre-compress for browser use
%.gz: %
	pigz --force --keep -11 -- $<
	brotli --force --keep --best --suffix=.brotli -- $<

%.html: %.md
	pandoc --from gfm-raw_html --to html --standalone --output $@ $<

%.txt: %.md
	pandoc --from gfm-raw_html --to plain --output $@ $<

%:
	dh $@

.SECONDARY:
