#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk # DEB_VERSION

export DH_GOLANG_INSTALL_EXTRA := \
	tests/data/crossPackage/other/other.json \
	tests/data/crossPackage/schema/schema.json \
	tests/data/crossPackageAllOf/other/other.json \
	tests/data/crossPackageAllOf/schema/schema.json \
	tests/data/crossPackageNoOutput/other/other.json \
	tests/data/crossPackageNoOutput/schema/schema.json \
	tests/data/extraImports/gopkgYAMLv3/gopkgYAMLv3.json \
	tests/data/extraImports/gopkgYAMLv3/gopkgYAMLv3.yaml \
	tests/data/extraImports/gopkgYAMLv3AdditionalProperties/gopkgYAMLv3AdditionalProperties.json \
	tests/data/extraImports/gopkgYAMLv3invalidEnum/gopkgYAMLv3invalidEnum.yaml \
	tests/data/misc/booleanAsSchema/booleanAsSchema.json \
	tests/data/misc/capitalization/capitalization.json \
	tests/data/misc/onlyModels/onlyModels.json \
	tests/data/misc/specialCharacters/specialCharacters.json \
	tests/data/misc/tags/tags.json \
	tests/data/refWithOverridesPath/schema-base.json \
	tests/data/refWithOverridesPath/schema-override.json \
	tests/data/refWithOverridesPath/schema.json \
	tests/data/yaml/yamlMultilineDescriptions/yamlMultilineDescriptions.yaml \
	tests/data/yaml/yamlStructNameFromFile/yamlStructNameFromFile.yaml

%:
	dh $@ --builddirectory=debian/_build --buildsystem=golang

B = $(CURDIR)/debian/tmp/usr/bin
M = $(CURDIR)/debian/tmp/usr/share/man/man1

ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
execute_before_dh_installman-arch:
	mkdir -pv $(M)
	help2man --version-string="$(DEB_VERSION)" \
		--no-info \
		--name="Generates Go code from JSON Schema files" \
		--output $(M)/go-jsonschema.1 \
		$(B)/go-jsonschema
endif
