#!/usr/bin/make -f

%:
	dh $@ --with sphinxdoc

override_dh_installinit:
	dh_installinit --name=hippotatd

# For local testing with upstream dependencies:
#    NAILING_CARGO=nailing-cargo make check
#    NAILING_CARGO=nailing-cargo dpkg-buildpackage -Pupstream-cargo -uc -

ifeq (,$(filter upstream-cargo, $(DEB_BUILD_PROFILES)))

include /usr/share/dpkg/architecture.mk
include /usr/share/dpkg/buildflags.mk
include /usr/share/rustc/architecture.mk
export CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
export DEB_HOST_RUST_TYPE DEB_HOST_GNU_TYPE

PATH:=/usr/share/cargo/bin:$(PATH)
CARGO_HOME=$(shell pwd)/debian/cargo_home
DEB_CARGO_CRATE=hippotat
export PATH CARGO_HOME DEB_CARGO_CRATE

TARGET_RELEASE_DIR = target/$(DEB_HOST_RUST_TYPE)/release
export TARGET_RELEASE_DIR

execute_before_dh_auto_build:
	if test -f Cargo.lock; then mv Cargo.lock Cargo.lock.upstream; fi
	cargo prepare-debian /usr/share/cargo/registry

execute_before_dh_auto_clean:
	if test -f Cargo.lock.upstream; \
	then mv Cargo.lock.upstream Cargo.lock; fi

override_dh_auto_test:
	@echo not running tests during build - they need unshare

endif
