lib/functions.mk: initial xport()
A few too many downstream makefiles employed the pattern of "export GLOBAL_VAR := $(VAR)"; macroize that.
This commit is contained in:
parent
fcf41f2201
commit
e36792ac90
@ -1,3 +1,4 @@
|
||||
# hooked from ../../lib/sugar.mk
|
||||
use/build-vm:
|
||||
@$(call add_feature)
|
||||
@$(call xport,ROOTPW)
|
||||
|
@ -1,5 +1,6 @@
|
||||
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)" ] && \
|
||||
|
Loading…
Reference in New Issue
Block a user