XPost: linux.debian.bugs.dist
From:
[email protected]
Hello.
Previous implementation was preventing one expansion with $(value),
but this quotation is now counter-productive.
Three commits are attached:
2/ regression test
3/ patch
1/ an unrelated suggestion inspired by this bug
From 67c012557c29edf884a6535d8b3120d36d6ebd85 Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <
[email protected]>
Date: Fri, 19 Jul 2024 13:20:06 +0200
Subject: [PATCH 1/3] scripts/mk: ensure dpkg_datadir is computed once
dpkg_datadir ?= $(dir $(lastword $(MAKEFILE_LIST)))
is equivalent to
ifndef dpkg_datadir
dpkg_datadir = $(..)
endif
$(..) is computed each time dpkg_datadir is expanded, so the result
will be wrong if MAKEFILE_LIST has grown meanwhile.
Assign with := so that the value is computed and never expanded again.
---
scripts/mk/buildtools.mk | 4 +++-
scripts/mk/vendor.mk | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/scripts/mk/buildtools.mk b/scripts/mk/buildtools.mk
index 1f63beede..def15c103 100644
--- a/scripts/mk/buildtools.mk
+++ b/scripts/mk/buildtools.mk
@@ -28,7 +28,9 @@
ifndef dpkg_buildtools_mk_included
dpkg_buildtools_mk_included = yes
-dpkg_datadir ?= $(dir $(lastword $(MAKEFILE_LIST)))
+ifndef dpkg_datadir
+ dpkg_datadir := $(dir $(lastword $(MAKEFILE_LIST)))
+endif
include $(dpkg_datadir)/architecture.mk
# We set the TOOL_FOR_BUILD variables to the specified value, and the TOOL diff --git a/scripts/mk/vendor.mk b/scripts/mk/vendor.mk
index 43898d956..d257eddcb 100644
--- a/scripts/mk/vendor.mk
+++ b/scripts/mk/vendor.mk
@@ -36,7 +36,9 @@
ifndef dpkg_vendor_mk_included
dpkg_vendor_mk_included = yes
-dpkg_datadir ?= $(dir $(lastword $(MAKEFILE_LIST)))
+ifndef dpkg_datadir
+ dpkg_datadir := $(dir $(lastword $(MAKEFILE_LIST)))
+endif