# HG changeset patch
# User Dan Villiom Podlaski Christiansen <danchr@gmail.com>
# Date 1678122147 -3600
#      Mon Mar 06 18:02:27 2023 +0100
# Branch stable
# Node ID c499b1c999728ea3d078dee36b83508bbebe003d
# Parent  6299de7640978d4ac095f8f2f39e531ef5b06409
# EXP-Topic patches
makefile

diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -21,7 +21,7 @@ PYOXIDIZER?=pyoxidizer
 HGPYTHONS ?= $(HGROOT)/build/pythons
 PURE=
 PIP_OPTIONS_PURE=--config-settings --global-option="$(PURE)"
-PIP_OPTIONS_INSTALL=--no-deps --ignore-installed --no-build-isolation
+PIP_OPTIONS_INSTALL=--no-deps --ignore-installed --no-build-isolation --root="$(DESTDIR)/"
 PIP_PREFIX=$(PREFIX)
 PYFILESCMD=find mercurial hgext doc -name '*.py'
 PYFILES:=$(shell $(PYFILESCMD))
@@ -73,7 +73,7 @@ local:
 
 .PHONY: build-chg
 build-chg:
-	make -C contrib/chg
+	$(MAKE) -C contrib/chg
 
 .PHONY: build-rhg
 build-rhg:
@@ -115,7 +115,7 @@ install-bin:
 
 .PHONY: install-chg
 install-chg: build-chg
-	make -C contrib/chg install PREFIX="$(PREFIX)"
+	$(MAKE) -C contrib/chg install PREFIX="$(PREFIX)"
 
 .PHONY: install-doc
 install-doc:
@@ -134,7 +134,7 @@ install-home-doc:
 
 .PHONY: install-rhg
 install-rhg: build-rhg
-	install -m 755 rust/target/release/rhg "$(PREFIX)"/bin/
+	install -m 755 rust/target/$(CARGO_BUILD_TARGET)/release/rhg "$(DESTDIR)$(PREFIX)"/bin/
 
 .PHONY: dist
 dist: tests dist-notests
