[SV 54161] Fix second expansion of $* for paths

If the stem matches a path containing a directory not just a
filename, make sure the second expansion of $* in the
prerequisites matches $* in the recipe.  This requires using
$(*F) when replacing % in the first expansion to preserve the
simple filename.

* src/implicit.c (pattern_search): If lastslash is set prepend
the directory onto the stem.  Then use $(*F) when expanding %.
* tests/scripts/features/se_implicit: Add a test case
This commit is contained in:
Jouke Witteveen
2019-10-26 12:24:15 +02:00
committed by Paul Smith
parent c72205b28b
commit 86f2f8bcb5
2 changed files with 47 additions and 17 deletions

View File

@@ -254,5 +254,13 @@ foo: $$(info $$<)
!,
'', "bar\n#MAKE#: Nothing to be done for 'foo'.\n");
# SV 54161: Expand $$* properly when it contains a path
run_make_test(q!
.SECONDEXPANSION:
%x: $$(info $$*); @echo '$*'
!,
'q/ux', "q/u\nq/u\n");
# This tells the test driver that the perl test script executed properly.
1;