mirror of
https://git.savannah.gnu.org/git/make.git
synced 2025-01-12 16:45:35 +00:00
[SV 40657] Don't create pattern rules for suffix rules with deps.
* NEWS: Update with a backward-compatibility warning. * src/rule.c (convert_to_pattern): If a suffix rule has dependencies, do not create a pattern rule for it. According to the manual suffix rules with prerequisites are treated as normal targets. * tests/scrips/features/suffixrules: Create some regression tests for .SUFFIXES and suffix rules.
This commit is contained in:
parent
a1bb739165
commit
67e6d81256
3 changed files with 87 additions and 1 deletions
5
NEWS
5
NEWS
|
@ -43,6 +43,11 @@ http://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=108&set
|
||||||
N-processor systems without fear of overload.
|
N-processor systems without fear of overload.
|
||||||
Patch provided by Sven C. Dack <sven.c.dack@sky.com>
|
Patch provided by Sven C. Dack <sven.c.dack@sky.com>
|
||||||
|
|
||||||
|
* WARNING: Backward-incompatibility!
|
||||||
|
Contrary to the documentation, suffix rules with prerequisites were being
|
||||||
|
treated BOTH as simple targets AND as pattern rules. Behavior now matches
|
||||||
|
the documentation, and pattern rules are no longer created in this case.
|
||||||
|
|
||||||
* Makefiles can now specify the '-j' option in their MAKEFLAGS variable and
|
* Makefiles can now specify the '-j' option in their MAKEFLAGS variable and
|
||||||
this will cause make to enable that parallelism mode.
|
this will cause make to enable that parallelism mode.
|
||||||
|
|
||||||
|
|
|
@ -252,7 +252,10 @@ convert_to_pattern (void)
|
||||||
|
|
||||||
memcpy (rulename + slen, dep_name (d2), s2len + 1);
|
memcpy (rulename + slen, dep_name (d2), s2len + 1);
|
||||||
f = lookup_file (rulename);
|
f = lookup_file (rulename);
|
||||||
if (f == 0 || f->cmds == 0)
|
|
||||||
|
/* No target, or no commands, or it has deps: it can't be a
|
||||||
|
suffix rule. */
|
||||||
|
if (f == 0 || f->cmds == 0 || f->deps != 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (s2len == 2 && rulename[slen] == '.' && rulename[slen + 1] == 'a')
|
if (s2len == 2 && rulename[slen] == '.' && rulename[slen + 1] == 'a')
|
||||||
|
|
78
tests/scripts/features/suffixrules
Normal file
78
tests/scripts/features/suffixrules
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
# -*-perl-*-
|
||||||
|
|
||||||
|
$description = "Test suffix rules.";
|
||||||
|
|
||||||
|
$details = "";
|
||||||
|
|
||||||
|
# TEST #0: Clear all suffixes
|
||||||
|
|
||||||
|
touch('foo.c');
|
||||||
|
|
||||||
|
run_make_test(q!
|
||||||
|
.SUFFIXES:
|
||||||
|
all: foo.o ; @echo $@ $<
|
||||||
|
!,
|
||||||
|
'', "#MAKE#: *** No rule to make target 'foo.o', needed by 'all'. Stop.\n", 512);
|
||||||
|
|
||||||
|
unlink('foo.c');
|
||||||
|
|
||||||
|
# Test #1: Add a simple suffix rule
|
||||||
|
|
||||||
|
touch('foo.baz');
|
||||||
|
|
||||||
|
run_make_test(q!
|
||||||
|
.SUFFIXES: .biz .baz
|
||||||
|
|
||||||
|
.baz.biz: ; @echo make $@
|
||||||
|
!,
|
||||||
|
'foo.biz', "make foo.biz\n");
|
||||||
|
|
||||||
|
unlink('foo.baz');
|
||||||
|
|
||||||
|
# Test #2: Make sure the defaults still work
|
||||||
|
|
||||||
|
touch('foo.c');
|
||||||
|
|
||||||
|
run_make_test(undef, 'foo.o COMPILE.c=@echo OUTPUT_OPTION=', "foo.c\n");
|
||||||
|
|
||||||
|
unlink('foo.c');
|
||||||
|
|
||||||
|
# Test #3: Replacing all suffixes
|
||||||
|
|
||||||
|
touch('foo.baz');
|
||||||
|
|
||||||
|
run_make_test(q!
|
||||||
|
.SUFFIXES:
|
||||||
|
.SUFFIXES: .biz .baz
|
||||||
|
|
||||||
|
.baz.biz: ; @echo make $@
|
||||||
|
!,
|
||||||
|
'foo.biz', "make foo.biz\n");
|
||||||
|
|
||||||
|
unlink('foo.baz');
|
||||||
|
|
||||||
|
# Test #4: Suffix rules with deps are not suffix rules
|
||||||
|
|
||||||
|
touch('foo.bar');
|
||||||
|
|
||||||
|
run_make_test(q!
|
||||||
|
.SUFFIXES:
|
||||||
|
.SUFFIXES: .biz .baz
|
||||||
|
|
||||||
|
.baz.biz: foo.bar ; @echo make $@ from $<
|
||||||
|
!,
|
||||||
|
'.baz.biz', "make .baz.biz from foo.bar\n");
|
||||||
|
|
||||||
|
unlink('foo.bar');
|
||||||
|
|
||||||
|
# Test #5: Should not create pattern rules for it either
|
||||||
|
|
||||||
|
touch('foo.baz');
|
||||||
|
|
||||||
|
run_make_test(undef,
|
||||||
|
'foo.biz', "#MAKE#: *** No rule to make target 'foo.biz'. Stop.\n", 512);
|
||||||
|
|
||||||
|
unlink('foo.baz');
|
||||||
|
|
||||||
|
# Complete
|
||||||
|
1;
|
Loading…
Reference in a new issue