Name

mk_declare — Declare special variables

Synopsis

MODULES="... core ..."

mk_declare [-i] [-e] [-s] [-o] vars...

mk_declare [-i] [-e] [-s] [-o] var=value...

Options

-i

Marks all listed variables as inherited by subdirectories. Each subdirectory may override the variable by setting it to a new value; the original value will be restored upon returning to the parent directory.

-e

Mark all listed variables as exported. Their values will be available when the user runs make.

-s

Mark all listed variables as system-dependent. The variables may have different values for each target system. The values will be swapped out when the target system is changed with mk_system.

-o

Mark all listed variables as output variables. Their values will be substituted when processing a file with mk_output_file.

Description

Marks each variable in the list with the above attributes. If the second form is used for a variable, it will also be assigned value at the same time.

Examples

configure()
{
    mk_declare -e FOO="foo"
    BAR="bar"
}

make()
{
    mk_target TARGET="foobar" my_custom_function '$@'
}

my_custom_function()
{
    # The value of FOOBAR is available here because it was exported
    echo "$FOOBAR" > "$1"
    # The value of BAR is not available, so this will not print "bar"
    mk_msg "BAR=$BAR"
}