summaryrefslogtreecommitdiff
path: root/file.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 /file.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 'file.c')
-rw-r--r--file.c16
1 files changed, 15 insertions, 1 deletions
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."));