1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-24 22:13:52 +01:00
RIOT/makefiles/utils/variables.mk
Gaëtan Harter fcf8c4782d
makefiles/utils: function to export variables for a target
This allows exporting variables only for some target.
It will allow not exporting variables when not needed, and so prevent
unnecessary evaluation.
2019-06-28 11:33:54 +02:00

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?=)