def _expand_make_vars(ctx, vals):
    """Expands make variables of the form $(SOME_VAR_NAME).

    Args:
      ctx: The rules context.
      vals: Dictionary. Values of the form $(...) will be replaced.

    Returns:
      A dictionary containing vals.keys() and the expanded values.
    """
    res = {}
    for k, v in vals.items():
        if v.startswith("$(") and v.endswith(")"):
            res[k] = ctx.var.get(v[2:-1], v)
        else:
            res[k] = v
    return res