From 58dae243526bd322ae6bec0c4394a117a5fe0171 Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Mon, 13 May 2013 04:29:35 -0400 Subject: [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. --- file.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'file.c') diff --git a/file.c b/file.c index b36edcb..444a81d 100644 --- a/file.c +++ b/file.c @@ -177,7 +177,10 @@ enter_file (const char *name) file_slot = (struct file **) hash_find_slot (&files, &file_key); f = *file_slot; if (! HASH_VACANT (f) && !f->double_colon) - return f; + { + f->builtin = 0; + return f; + } new = xcalloc (sizeof (struct file)); new->name = new->hname = name; @@ -213,6 +216,7 @@ rehash_file (struct file *from_file, const char *to_hname) struct file *f; /* If it's already that name, we're done. */ + from_file->builtin = 0; file_key.hname = to_hname; if (! file_hash_cmp (from_file, &file_key)) return; @@ -321,6 +325,7 @@ rehash_file (struct file *from_file, const char *to_hname) MERGE (ignore_vpath); #undef MERGE + to_file->builtin = 0; from_file->renamed = to_file; } @@ -917,6 +922,13 @@ print_file (const void *item) { const struct file *f = item; + /* If we're not using builtin targets, don't show them. + + Ideally we'd be able to delete them altogether but currently there's no + facility to ever delete a file once it's been added. */ + if (no_builtin_rules_flag && f->builtin) + return; + putchar ('\n'); if (f->cmds && f->cmds->recipe_prefix != cmd_prefix) @@ -944,6 +956,8 @@ print_file (const void *item) puts (_("# Command line target.")); if (f->dontcare) puts (_("# A default, MAKEFILES, or -include/sinclude makefile.")); + if (f->builtin) + puts (_("# Builtin rule")); puts (f->tried_implicit ? _("# Implicit rule search has been done.") : _("# Implicit rule search has not been done.")); -- cgit v1.2.3