#!/usr/bin/make -f


%:
	dh $@

override_dh_auto_clean:
	dh_auto_clean
	rm -rf data essay.kct default.custom.yaml

override_dh_auto_build:
	# create a default.custom.yaml here, and use it
	# to build all the schemas
	echo "patch:"          > default.custom.yaml
	echo "  schema_list:" >> default.custom.yaml
	find -name '*.schema.yaml' \
	    | xargs -l1 basename -s .schema.yaml \
	    | perl -pe 's/^/    - schema: /' \
	    | sort | uniq >> default.custom.yaml
	mkdir -p data
	cp -v default.custom.yaml data

	cp -v extra/*.yaml data
	dh_auto_build
	# restore the original copy of default.yaml
	cp -v default.yaml data
	rm -fv data/default.custom.yaml

override_dh_install:
	dh_install --fail-missing
