#!/usr/bin/make -f

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

export DH_GOPKG := github.com/appc/spec
#export DH_GOLANG_INSTALL_ALL := 1
#export DH_GOLANG_EXCLUDES := github.com/appc/spec/schema/types/isolator_resources.go

%:
	dh $@ --buildsystem=golang --with=golang --builddirectory=_build

override_dh_clean:
	dh_clean
	## Remove Files-Excluded (when built from checkout or non-DFSG tarball):
	$(RM) -rv `perl -0nE 'say $$1 if m{^Files\-Excluded\:\s*(.*?)(?:\n\n|Files:|Comment:)}sm;' debian/copyright`
	-find vendor -mindepth 1 -type d -empty -delete -printf 'removed %p\n'

override_dh_install:
	cd $(CURDIR)/debian/tmp/usr/share/gocode/src/$(DH_GOPKG) \
        && $(RM) -rv logos scripts DCO *.md LICENSE MAINTAINERS VERSION build test spec ace/build_aci
	## executable-not-elf-or-script:
	chmod -R -c -x+X $(CURDIR)/debian/tmp/usr/share/gocode/src/$(DH_GOPKG)
	dh_install -X.gitignore -XLICENSE