summaryrefslogtreecommitdiff
path: root/variable.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2013-05-13 04:29:35 -0400
committerPaul Smith <psmith@gnu.org>2013-05-13 04:30:20 -0400
commit58dae243526bd322ae6bec0c4394a117a5fe0171 (patch)
tree921c2f73d7ef59e149880a44472ccd54106aca1c /variable.c
parentc7732bd5add31b38fea113c9ab4ad4d97a0870c7 (diff)
downloadgunmake-58dae243526bd322ae6bec0c4394a117a5fe0171.tar.gz
[Savannah #20501] Handle adding -r/-R to MAKEFLAGS in the makefile.
If -R is set in the makefile and not the command line, then go through all the default variables and undefine them. If -r is set in the makefile and not in the command line, then remove all .SUFFIX prefixes (unless the user set it) and SUFFIX variable setting. In -p mode don't print builtins.
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c43
1 files changed, 20 insertions, 23 deletions
diff --git a/variable.c b/variable.c
index 51f936b..5415f05 100644
--- a/variable.c
+++ b/variable.c
@@ -280,7 +280,21 @@ define_variable_in_set (const char *name, unsigned int length,
variable (makefile, command line or environment). */
static void
-free_variable_name_and_value (const void *item);
+free_variable_name_and_value (const void *item)
+{
+ struct variable *v = (struct variable *) item;
+ free (v->name);
+ free (v->value);
+}
+
+void
+free_variable_set (struct variable_set_list *list)
+{
+ hash_map (&list->set->table, free_variable_name_and_value);
+ hash_free (&list->set->table, 1);
+ free (list->set);
+ free (list);
+}
void
undefine_variable_in_set (const char *name, unsigned int length,
@@ -305,17 +319,17 @@ undefine_variable_in_set (const char *name, unsigned int length,
if (! HASH_VACANT (v))
{
if (env_overrides && v->origin == o_env)
- /* V came from in the environment. Since it was defined
- before the switches were parsed, it wasn't affected by -e. */
- v->origin = o_env_override;
+ /* V came from in the environment. Since it was defined
+ before the switches were parsed, it wasn't affected by -e. */
+ v->origin = o_env_override;
/* If the definition is from a stronger source than this one, don't
undefine it. */
if ((int) origin >= (int) v->origin)
- {
+ {
hash_delete_at (&set->table, var_slot);
free_variable_name_and_value (v);
- }
+ }
}
}
@@ -643,23 +657,6 @@ create_new_variable_set (void)
return setlist;
}
-static void
-free_variable_name_and_value (const void *item)
-{
- struct variable *v = (struct variable *) item;
- free (v->name);
- free (v->value);
-}
-
-void
-free_variable_set (struct variable_set_list *list)
-{
- hash_map (&list->set->table, free_variable_name_and_value);
- hash_free (&list->set->table, 1);
- free (list->set);
- free (list);
-}
-
/* Create a new variable set and push it on the current setlist.
If we're pushing a global scope (that is, the current scope is the global
scope) then we need to "push" it the other way: file variable sets point