Commit e36792ac authored by Michael Shigorin's avatar Michael Shigorin

lib/functions.mk: initial xport()

A few too many downstream makefiles employed the pattern of "export GLOBAL_VAR := $(VAR)"; macroize that.
parent fcf41f22
# hooked from ../../lib/sugar.mk
use/build-vm:
@$(call add_feature)
@$(call xport,ROOTPW)
use/cleanup:
@$(call add_feature)
@$(call xport,CLEANUP_PACKAGES)
use/cleanup/installer: use/cleanup
@$(call add,CLEANUP_PACKAGES,'installer-*')
......
......@@ -5,6 +5,7 @@ use/install2: use/stage2 sub/stage2/install2 use/metadata use/cleanup/installer
@$(call add,INSTALL2_PACKAGES,branding-$$(BRANDING)-alterator)
@$(call add,BASE_PACKAGES,branding-$$(BRANDING)-release)
@$(call add,BASE_LISTS,$(call tags,basesystem))
@$(call xport,BASE_BOOTLOADER)
use/install2/net: use/install2
@$(call add,INSTALL2_PACKAGES,curl)
......
......@@ -8,9 +8,6 @@ MKI_PACK_RESULTS = squash:altinst
# also removed in a cleanup hook but to spare a few cycles...
HSH_EXCLUDE_DOCS = 1
# pass downstream
GLOBAL_BASE_BOOTLOADER := $(BASE_BOOTLOADER)
debug::
@echo "** install2: IMAGE_PACKAGES: $(IMAGE_PACKAGES)"
@echo "** install2: IMAGE_PACKAGES_REGEXP: $(IMAGE_PACKAGES_REGEXP)"
......
......@@ -36,6 +36,14 @@ define try_body
printf '%s ?= %s\n' '$(1)' '$(2)' >> "$(CONFIG)"; }
endef
# xport() requests a variable to be exported to the scripts
xport = $(and $(1),$(xport_body))
define xport_body
{ $(log_body); \
v='$(1:GLOBAL_%=%)'; \
printf 'export GLOBAL_%s = $$(%s)\n' "$$v" "$$v" >> "$(CONFIG)"; }
endef
# if the rule being executed isn't logged yet, log it
define log_body
{ [ -s "$(CONFIG)" ] && \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment