Bug#872381: dpkg-dev: optimize Makefile snippets for debian/rules (4/5)
From
Nicolas Boulenguez@1:229/2 to
All on Wed Jan 10 22:10:01 2024
[continued from previous message]
Subject: [PATCH 5/8] scripts/buildflags.mk: reduce the number of subprocesses
Ensure that dpkg-buildflags is only called when a *FLAGS variable is
is expanded.
If so, call it once and cache all results for future expansions.
---
scripts/mk/buildflags.mk | 45 +++++++++++++++++++++++-----------------
1 file changed, 26 insertions(+), 19 deletions(-)
diff --git a/scripts/mk/buildflags.mk b/scripts/mk/buildflags.mk
index 02baa53f2..f0d32d78c 100644
--- a/scripts/mk/buildflags.mk
+++ b/scripts/mk/buildflags.mk
@@ -26,8 +26,13 @@
# LDFLAGS_FOR_BUILD: flags for the build linker.
#
# You can also export them in the environment by setting
-# DPKG_EXPORT_BUILDFLAGS to a non-empty value.
+# DPKG_EXPORT_BUILDFLAGS.
#
+# These variables are computed by dpkg-buildflags(1) and should not be
+# directly overridden. The following setting are exported to
+# dpkg-buildflags.
+# DEB_BUILD_{OPTIONS,MAINT_OPTIONS,PATH}
+# DEB_*_MAINT_{APPEND,PREPEND,SET,STRIP}
ifndef dpkg_buildflags.mk_included
dpkg_buildflags.mk_included :=
@@ -35,31 +40,24 @@ dpkg_buildflags.mk_included :=
# This list is kept in sync with the default set of flags returned
# by dpkg-buildflags.
-dpkg_lazy_eval ?= $$(or $$(value DPKG_CACH