[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #63359] patsubst messes up functions in replacement
From: |
Paul D. Smith |
Subject: |
[bug #63359] patsubst messes up functions in replacement |
Date: |
Sun, 13 Nov 2022 12:38:07 -0500 (EST) |
Update of bug #63359 (project make):
Status: None => Not A Bug
Open/Closed: Open => Closed
Component Version: SCM => 4.4
_______________________________________________________
Follow-up Comment #1:
You are misunderstanding how expansion happens.
All the expansion of variables _inside_ the function happen first, before the
function is run. So:
$(info $(patsubst %/c,$(notdir %),$(FOO)))
First the macros `$(notdir %)` and `$(FOO)` are expanded, giving this:
$(info $(patsubst %/c,%,a/b/c))
Note that `$(notdir %)` is `%` because it treats the pattern as the literal
character `%`. Similarly:
$(info $(patsubst %/c,$(dir %),$(FOO)))
yields:
$(info $(patsubst %/c,.,a/b/c))
because `$(dir %)` yields `.`.
Instead, you want to apply the function to the `$(FOO)` variable, like this:
FOO = a/b/c
$(info $(patsubst %/c,%,$(FOO)))
$(info $(patsubst %/c,%,$(notdir $(FOO))))
$(info $(patsubst %/c,%,$(dir $(FOO))))
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?63359>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/