summaryrefslogtreecommitdiffstats
path: root/scripts/mk/buildflags.mk
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-07 13:30:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-07 13:30:09 +0000
commit3c05da1bdef2a6e2142b4fcac974e7e3fc0db93c (patch)
tree9532e637f47d6ff7246ccbabb62d4e2b4b5908df /scripts/mk/buildflags.mk
parentAdding debian version 1.22.6. (diff)
downloaddpkg-3c05da1bdef2a6e2142b4fcac974e7e3fc0db93c.tar.xz
dpkg-3c05da1bdef2a6e2142b4fcac974e7e3fc0db93c.zip
Merging upstream version 1.22.7.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'scripts/mk/buildflags.mk')
-rw-r--r--scripts/mk/buildflags.mk56
1 files changed, 25 insertions, 31 deletions
diff --git a/scripts/mk/buildflags.mk b/scripts/mk/buildflags.mk
index 4b8a3d8..a8eac9e 100644
--- a/scripts/mk/buildflags.mk
+++ b/scripts/mk/buildflags.mk
@@ -28,52 +28,46 @@
# You can also export them in the environment by setting
# DPKG_EXPORT_BUILDFLAGS to a non-empty value.
#
+
+ifndef dpkg_buildflags_mk_included
+dpkg_buildflags_mk_included = yes
+
# This list is kept in sync with the default set of flags returned
# by dpkg-buildflags.
-dpkg_lazy_eval ?= $$(or $$(value DPKG_CACHE_$(1)),$$(eval DPKG_CACHE_$(1) := $$(shell $(2)))$$(value DPKG_CACHE_$(1)))
-
-DPKG_BUILDFLAGS_LIST = \
+DPKG_BUILDFLAGS_LIST := $(foreach var,\
ASFLAGS \
- ASFLAGS_FOR_BUILD \
CFLAGS \
- CFLAGS_FOR_BUILD \
CPPFLAGS \
- CPPFLAGS_FOR_BUILD \
CXXFLAGS \
- CXXFLAGS_FOR_BUILD \
OBJCFLAGS \
- OBJCFLAGS_FOR_BUILD \
OBJCXXFLAGS \
- OBJCXXFLAGS_FOR_BUILD \
DFLAGS \
- DFLAGS_FOR_BUILD \
FFLAGS \
- FFLAGS_FOR_BUILD \
FCFLAGS \
- FCFLAGS_FOR_BUILD \
LDFLAGS \
- LDFLAGS_FOR_BUILD \
- # EOL
-
-define dpkg_buildflags_export_envvar
- ifdef $(1)
- DPKG_BUILDFLAGS_EXPORT_ENVVAR += $(1)="$$(value $(1))"
- endif
-endef
+ ,$(var) $(var)_FOR_BUILD)
-$(eval $(call dpkg_buildflags_export_envvar,DEB_BUILD_OPTIONS))
-$(eval $(call dpkg_buildflags_export_envvar,DEB_BUILD_MAINT_OPTIONS))
-$(eval $(call dpkg_buildflags_export_envvar,DEB_BUILD_PATH))
-$(foreach flag,$(DPKG_BUILDFLAGS_LIST),\
- $(foreach operation,SET STRIP APPEND PREPEND,\
- $(eval $(call dpkg_buildflags_export_envvar,DEB_$(flag)_MAINT_$(operation)))))
-
-dpkg_buildflags_setvar = $(1) = $(call dpkg_lazy_eval,$(1),$(DPKG_BUILDFLAGS_EXPORT_ENVVAR) dpkg-buildflags --get $(1))
-
-$(foreach flag,$(DPKG_BUILDFLAGS_LIST),\
- $(eval $(call dpkg_buildflags_setvar,$(flag))))
+dpkg_buildflags_run = $(eval $(shell \
+ $(foreach exported,\
+ DEB_BUILD_OPTIONS \
+ DEB_BUILD_MAINT_OPTIONS \
+ DEB_BUILD_PATH \
+ $(foreach flag,$(DPKG_BUILDFLAGS_LIST),\
+ $(foreach operation,SET STRIP APPEND PREPEND,\
+ DEB_$(flag)_MAINT_$(operation))),\
+ $(if $(value $(exported)),\
+ $(exported)="$(value $(exported))"))\
+ dpkg-buildflags | sed 's/\([^=]*\)\(.*\)/$$(eval \1:\2)/'))
ifdef DPKG_EXPORT_BUILDFLAGS
+ # We need to compute the values right now.
+ $(dpkg_buildflags_run)
export $(DPKG_BUILDFLAGS_LIST)
+else
+ dpkg_lazy_eval ?= $(eval $(1) = $(2)$$($(1)))
+ $(foreach v,$(DPKG_BUILDFLAGS_LIST),\
+ $(call dpkg_lazy_eval,$(v),$$(dpkg_buildflags_run)))
endif
+
+endif # dpkg_buildflags_mk_included