From 0e6c4f5b0ed4183bbdb8cdce168dcbd1bc9cf182 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 9 Dec 2005 16:46:19 +0000 Subject: Fixed bug #13022 by setting is_target flag on files that this implicit pattern rule also makes. --- ChangeLog | 6 ++++++ implicit.c | 5 +++++ tests/ChangeLog | 4 ++++ tests/scripts/features/patternrules | 30 ++++++++++++++++++++++++++++++ 4 files changed, 45 insertions(+) diff --git a/ChangeLog b/ChangeLog index 5d30cff..917a304 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-12-09 Boris Kolpackov + + * implicit.c (pattern_search): Mark other files that this rule + builds as targets so that they are not treated as intermediates + by the pattern rule search algorithm. Fixes bug #13022. + 2005-12-07 Boris Kolpackov * remake.c (notice_finished_file): Propagate the change of diff --git a/implicit.c b/implicit.c index ad873f1..cfd6629 100644 --- a/implicit.c +++ b/implicit.c @@ -928,6 +928,11 @@ pattern_search (struct file *file, int archive, if (f && f->precious) new->file->precious = 1; + /* Set the is_target flag so that this file is not treated + as intermediate by the pattern rule search algorithm and + file_exists_p cannot pick it up yet. */ + new->file->is_target = 1; + file->also_make = new; } diff --git a/tests/ChangeLog b/tests/ChangeLog index 93cac87..e222ef1 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,7 @@ +2005-12-09 Boris Kolpackov + + * scripts/features/patternrules: Add a test for bug #13022. + 2005-12-07 Boris Kolpackov * scripts/features/double_colon: Add a test for bug #14334. diff --git a/tests/scripts/features/patternrules b/tests/scripts/features/patternrules index 1753d4d..90525ae 100644 --- a/tests/scripts/features/patternrules +++ b/tests/scripts/features/patternrules @@ -115,5 +115,35 @@ $(dir)/foo.bar: unlink("$dir/foo.bar"); + +# TEST #5: make sure targets of a macthed implicit pattern rule never +# never considered intermediate (Savannah bug #13022). +# +run_make_test(' +.PHONY: all +all: foo.c foo.o + +%.h %.c: %.in + touch $*.h + touch $*.c + +%.o: %.c %.h + echo $+ >$@ + +%.o: %.c + @echo wrong rule + +foo.in: + touch $@ + +', +'', +'touch foo.in +touch foo.h +touch foo.c +echo foo.c foo.h >foo.o'); + +unlink('foo.in', 'foo.h', 'foo.c', 'foo.o'); + # This tells the test driver that the perl test script executed properly. 1; -- cgit v1.2.3