Follow-up Comment #3, bug #66490 (group make): Hi,
Thanks for the explanations about how this is the intended result. However the reason I created a bug report is that I think in that case the documentation deserves some clarification. > a pattern match means: the "%" matches any set of characters and the rest of > the string must match exactly. This makes perfect sense in static pattern rules and this is already stated in the documentation (4.12.1 §4). It makes sense there because, among other reasons, a prerequisite pattern without % has to match exactly anyway. With patsubst however, that is documented right below subst that matches substrings (and I was subject to anchoring bias there), one may expect the pattern to match parts of the words as opposed to entire words, as that's also usually how pattern substitution works in other tools. Repeating the example in the documentation could help to prevent such mistakes. e.g.: > As in static pattern rules, the pattern must match the entire word. For > example, the pattern %.o matches the word foo.o but not foo.out. The actual use case here was to strip version numbers to keep only the major version. The example in comment #1 is unapplicable as the suffix is not known in advance. basename may work for a limited number of version components if repeated, e.g. $(basename $(basename $(basename (1.2.3.4)))). I ended up using $(shell ...) but now thinking about some split function I realized that this could be done using the example preceding subst (8.1) and firstword: empty := space := $(empty) $(empty) B := $(firstword $(subst ., $(space), $(A))) %: echo $(B) Cheers, -- Julien Plissonneau Duquène _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?66490> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/
signature.asc
Description: PGP signature