#!/usr/bin/make -f

# resolve DEB_HOST_RUST_TYPE
include /usr/share/rustc/architecture.mk

# use local fork of debcargo and dh-cargo
PATH := $(CURDIR)/debian/dh-cargo/bin:$(PATH)
PERL5LIB = $(CURDIR)/debian/dh-cargo/lib
export PATH PERL5LIB

# enable custom execution of cargo wrapper
export DEB_HOST_GNU_TYPE DEB_HOST_RUST_TYPE CARGO_HOME

%:
	dh $@ --buildsystem cargo

execute_before_dh_auto_build:
	mkdir --parents tonic-health/src/generated/ tonic-reflection/src/generated/ tonic-types/src/generated/
	CARGO_HOME=debian/cargo_home cargo run --package codegen
