summaryrefslogtreecommitdiffstats
path: root/scripts/mk/architecture.mk
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-07 13:30:08 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-07 13:30:08 +0000
commit44cf9c6d2d274eac37502e835155f7e985f1b8e6 (patch)
tree9576ba968924c5b9a55ba9e14f4f26184c62c7d4 /scripts/mk/architecture.mk
parentAdding upstream version 1.22.6. (diff)
downloaddpkg-44cf9c6d2d274eac37502e835155f7e985f1b8e6.tar.xz
dpkg-44cf9c6d2d274eac37502e835155f7e985f1b8e6.zip
Adding upstream version 1.22.7.upstream/1.22.7
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--scripts/mk/architecture.mk18
1 files changed, 14 insertions, 4 deletions
diff --git a/scripts/mk/architecture.mk b/scripts/mk/architecture.mk
index c11cada..4f0559c 100644
--- a/scripts/mk/architecture.mk
+++ b/scripts/mk/architecture.mk
@@ -1,11 +1,21 @@
# This Makefile fragment (since dpkg 1.16.1) defines all the DEB_HOST_* and
# DEB_BUILD_* variables that dpkg-architecture can return. Existing values
# of those variables are preserved as per policy.
+# All variables are exported.
-dpkg_lazy_eval ?= $$(or $$(value DPKG_CACHE_$(1)),$$(eval DPKG_CACHE_$(1) := $$(shell $(2)))$$(value DPKG_CACHE_$(1)))
-
-dpkg_architecture_setvar = export $(1) ?= $(call dpkg_lazy_eval,$(1),dpkg-architecture -q$(1))
+ifndef dpkg_architecture_mk_included
+dpkg_architecture_mk_included = yes
+dpkg_architecture_vars = \
$(foreach machine,BUILD HOST TARGET,\
$(foreach var,ARCH ARCH_ABI ARCH_LIBC ARCH_OS ARCH_CPU ARCH_BITS ARCH_ENDIAN GNU_CPU GNU_SYSTEM GNU_TYPE MULTIARCH,\
- $(eval $(call dpkg_architecture_setvar,DEB_$(machine)_$(var)))))
+ DEB_$(machine)_$(var)))
+
+# dpkg-buildpackage sets all variables. Optimize this frequent case.
+ifneq (,$(strip $(foreach v,$(dpkg_architecture_vars),$(if $(value $(v)),,1))))
+ $(foreach line,$(subst =,?=,$(shell dpkg-architecture)),$(eval $(line)))
+endif
+
+export $(dpkg_architecture_vars)
+
+endif # dpkg_architecture_mk_included