mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-24 22:13:52 +01:00
This allows exporting variables only for some target. It will allow not exporting variables when not needed, and so prevent unnecessary evaluation.
20 lines
650 B
Makefile
20 lines
650 B
Makefile
# Utilities to set variables and environment for targets
|
|
# These functions should help replacing immediate evaluation and global 'export'
|
|
|
|
|
|
# Target specific export the variables for that target
|
|
#
|
|
# target-export-variables <target> <variables>
|
|
#
|
|
# Parameters
|
|
# target: name of target
|
|
# variables: the variables to export
|
|
#
|
|
# The variable will only be evaluated when executing the target as when
|
|
# doing export
|
|
target-export-variables = $(foreach var,$(2),$(call _target-export-variable,$1,$(var)))
|
|
|
|
# '$1: export $2' cannot be used alone
|
|
# By using '?=' the variable is evaluated at runtime only
|
|
_target-export-variable = $(eval $1: export $2?=)
|