[continued from previous message]
+ifndef dpkg_buildtools.mk_included
+dpkg_buildtools.mk_included :=
+
+ifndef dpkg_architecture.mk_included
+ifndef dpkg_datadir
+ dpkg_datadir := $(patsubst %/buildtools.mk,%,$(lastword $(MAKEFILE_LIST))) +endif
include $(dpkg_datadir)/architecture.mk
+endif
# We set the TOOL_FOR_BUILD variables to the specified value, and the TOOL
# variables (for the host) to their triplet-prefixed form iff they are
@@ -74,3 +81,5 @@ $(eval $(call dpkg_buildtool_setvar,AR,ar))
$(eval $(call dpkg_buildtool_setvar,RANLIB,ranlib))
$(eval $(call dpkg_buildtool_setvar,PKG_CONFIG,pkgconf))
$(eval $(call dpkg_buildtool_setvar,QMAKE,qmake))
+
+endif
diff --git a/scripts/mk/default.mk b/scripts/mk/default.mk
index 0b2fd4aca..61921e30e 100644
--- a/scripts/mk/default.mk
+++ b/scripts/mk/default.mk
@@ -1,7 +1,13 @@
# This Makefile fragment (since dpkg 1.16.1) includes all the Makefile
# fragments that define variables that can be useful within debian/rules.
-dpkg_datadir = $(srcdir)/mk
+ifndef dpkg_default.mk_included
+dpkg_default.mk_included :=
+
+ifndef dpkg_datadir
+ dpkg_datadir := $(patsubst %/default.mk,%,$(lastword $(MAKEFILE_LIST))) +endif
+
include $(dpkg_datadir)/architecture.mk
include $(dpkg_datadir)/buildapi.mk
ifeq ($(call dpkg_build_api_ge,1),yes)
@@ -11,3 +17,5 @@ include $(dpkg_datadir)/buildflags.mk
include $(dpkg_datadir)/buildopts.mk
include $(dpkg_datadir)/pkg-info.mk
include $(dpkg_datadir)/vendor.mk
+
+endif
diff --git a/scripts/mk/pkg-info.mk b/scripts/mk/pkg-info.mk
index bccde2317..5b38d84e9 100644
--- a/scripts/mk/pkg-info.mk
+++ b/scripts/mk/pkg-info.mk
@@ -13,6 +13,9 @@
# specified by <
https://reproducible-builds.org/specs/source-date-epoch/>
# (since dpkg 1.18.8).
+i