Fix a crash I introduced last-minute.

Try to avoid extraneous rebuilds of template files.
This commit is contained in:
Paul Smith 2005-10-26 16:06:30 +00:00
parent 11095a90f1
commit 82103b1a49
5 changed files with 36 additions and 28 deletions

View File

@ -1,3 +1,9 @@
2005-10-26 Paul Smith <psmith@gnu.org>
* read.c (record_files): Don't set deps flags if there are no deps.
* maintMakefile: We only need to build the templates when we are
creating a distribution, so don't do it for "all".
2005-10-24 Paul D. Smith <psmith@gnu.org> 2005-10-24 Paul D. Smith <psmith@gnu.org>
Make secondary expansion optional: its enabled by declaring the Make secondary expansion optional: its enabled by declaring the

View File

@ -484,13 +484,13 @@ pattern_search (struct file *file, int archive,
unsigned int order_only = 0; /* Set if '|' was seen. */ unsigned int order_only = 0; /* Set if '|' was seen. */
/* In an ideal world we would take the dependency line, /* In an ideal world we would take the dependency line,
substitute the stem, re-expand the whole line and substitute the stem, re-expand the whole line and chop it
chop it into individual prerequisites. Unfortunately into individual prerequisites. Unfortunately this won't work
this won't work because of the "check_lastslash" twist. because of the "check_lastslash" twist. Instead, we will
Instead, we will have to go word by word, taking $()'s have to go word by word, taking $()'s into account, for each
into account, for each word we will substitute the stem, word we will substitute the stem, re-expand, chop it up, and,
re-expand, chop it up, and, if check_lastslash != 0, if check_lastslash != 0, add the directory part to each
add the directory part to each resulting prerequisite. */ resulting prerequisite. */
p = get_next_word (dep->name, &len); p = get_next_word (dep->name, &len);
@ -555,8 +555,8 @@ pattern_search (struct file *file, int archive,
1), sizeof (struct idep)); 1), sizeof (struct idep));
/* @@ It would be nice to teach parse_file_seq or /* @@ It would be nice to teach parse_file_seq or
multi_glob to add prefix. This would save us multi_glob to add prefix. This would save us some
some reallocations. */ reallocations. */
if (order_only || add_dir || had_stem) if (order_only || add_dir || had_stem)
{ {
@ -612,10 +612,9 @@ pattern_search (struct file *file, int archive,
if (file_impossible_p (name)) if (file_impossible_p (name))
{ {
/* If this dependency has already been ruled /* If this dependency has already been ruled "impossible",
"impossible", then the rule fails and don't then the rule fails and don't bother trying it on the
bother trying it on the second pass either second pass either since we know that will fail too. */
since we know that will fail too. */
DBS (DB_IMPLICIT, DBS (DB_IMPLICIT,
(d->had_stem (d->had_stem
? _("Rejecting impossible implicit prerequisite `%s'.\n") ? _("Rejecting impossible implicit prerequisite `%s'.\n")
@ -632,10 +631,9 @@ pattern_search (struct file *file, int archive,
? _("Trying implicit prerequisite `%s'.\n") ? _("Trying implicit prerequisite `%s'.\n")
: _("Trying rule prerequisite `%s'.\n"), name)); : _("Trying rule prerequisite `%s'.\n"), name));
/* If this prerequisite also happened to be explicitly /* If this prerequisite also happened to be explicitly mentioned
mentioned for FILE skip all the test below since it for FILE skip all the test below since it it has to be built
it has to be built anyway, no matter which implicit anyway, no matter which implicit rule we choose. */
rule we choose. */
for (expl_d = file->deps; expl_d != 0; expl_d = expl_d->next) for (expl_d = file->deps; expl_d != 0; expl_d = expl_d->next)
if (strcmp (dep_name (expl_d), name) == 0) break; if (strcmp (dep_name (expl_d), name) == 0) break;
@ -675,9 +673,9 @@ pattern_search (struct file *file, int archive,
} }
/* We could not find the file in any place we should look. /* We could not find the file in any place we should look. Try
Try to make this dependency as an intermediate file, to make this dependency as an intermediate file, but only on
but only on the second pass. */ the second pass. */
if (intermed_ok) if (intermed_ok)
{ {

View File

@ -13,7 +13,8 @@ TEMPLATES = README README.DOS README.W32 README.OS2 \
config.ami configh.dos config.h.W32 config.h-vms config.ami configh.dos config.h.W32 config.h-vms
MTEMPLATES = Makefile.DOS SMakefile MTEMPLATES = Makefile.DOS SMakefile
all-am: $(TEMPLATES) $(MTEMPLATES) build.sh.in # These are built as a side-effect of the dist rule
#all-am: $(TEMPLATES) $(MTEMPLATES) build.sh.in
# General rule for turning a .template into a regular file. # General rule for turning a .template into a regular file.
# #

12
read.c
View File

@ -1969,7 +1969,8 @@ record_files (struct nameseq *filenames, char *pattern, char *pattern_percent,
the last one. It is not safe for the same deps to go in more the last one. It is not safe for the same deps to go in more
than one place in the database. */ than one place in the database. */
this = nextf != 0 ? copy_dep_chain (deps) : deps; this = nextf != 0 ? copy_dep_chain (deps) : deps;
this->need_2nd_expansion = second_expansion; this->need_2nd_expansion = (second_expansion
&& strchr (this->name, '$'));
} }
if (!two_colon) if (!two_colon)
@ -2129,9 +2130,12 @@ record_files (struct nameseq *filenames, char *pattern, char *pattern_percent,
{ {
targets[target_idx] = 0; targets[target_idx] = 0;
target_percents[target_idx] = 0; target_percents[target_idx] = 0;
deps->need_2nd_expansion = second_expansion; if (deps)
/* We set this to indicate we've not yet parsed the prereq string. */ {
deps->staticpattern = 1; deps->need_2nd_expansion = second_expansion;
/* We set this to indicate the prereq string hasn't been parsed. */
deps->staticpattern = 1;
}
create_pattern_rule (targets, target_percents, two_colon, deps, cmds, 1); create_pattern_rule (targets, target_percents, two_colon, deps, cmds, 1);
free ((char *) target_percents); free ((char *) target_percents);
} }

View File

@ -48,10 +48,9 @@ run_make_test(q!
%.foo : baz$$bar ; @echo 'done $<' %.foo : baz$$bar ; @echo 'done $<'
%.foo : bar$$baz ; @echo 'done $<' %.foo : bar$$baz ; @echo 'done $<'
test.foo: test.foo:
fox: baz baz$$bar bar$$baz: ; @echo '$@'
.DEFAULT baz$$bar bar$$baz: ; @echo '$@'
!, !,
'', '',
'done bar'); "baz\$bar\ndone baz\$bar");
1; 1;