summaryrefslogtreecommitdiff
path: root/main.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 /main.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 'main.c')
-rw-r--r--main.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/main.c b/main.c
index 8eed56d..5823840 100644
--- a/main.c
+++ b/main.c
@@ -1767,13 +1767,33 @@ main (int argc, char **argv, char **envp)
}
#endif /* __MSDOS__ || __EMX__ */
- /* Decode switches again, in case the variables were set by the makefile. */
- decode_env_switches (STRING_SIZE_TUPLE ("GNUMAKEFLAGS"));
- decode_env_switches (STRING_SIZE_TUPLE ("MAKEFLAGS"));
+ {
+ int old_builtin_rules_flag = no_builtin_rules_flag;
+ int old_builtin_variables_flag = no_builtin_variables_flag;
+
+ /* Decode switches again, for variables set by the makefile. */
+ decode_env_switches (STRING_SIZE_TUPLE ("GNUMAKEFLAGS"));
+ decode_env_switches (STRING_SIZE_TUPLE ("MAKEFLAGS"));
#if 0
- decode_env_switches (STRING_SIZE_TUPLE ("MFLAGS"));
+ decode_env_switches (STRING_SIZE_TUPLE ("MFLAGS"));
#endif
+ /* If we've disabled builtin rules, get rid of them. */
+ if (no_builtin_rules_flag && ! old_builtin_rules_flag)
+ {
+ if (suffix_file->builtin)
+ {
+ free_dep_chain (suffix_file->deps);
+ suffix_file->deps = 0;
+ }
+ define_variable_cname ("SUFFIXES", "", o_default, 0);
+ }
+
+ /* If we've disabled builtin variables, get rid of them. */
+ if (no_builtin_variables_flag && ! old_builtin_variables_flag)
+ undefine_default_variables ();
+ }
+
#if defined (__MSDOS__) || defined (__EMX__)
if (job_slots != 1
# ifdef __EMX__