I need to reference the stem twice in the replacement for a variable substitution:
O23=$(OROOTS:%=$(ODIR)/overx-%2wk-%3wk.mlb)
I need to perform two replacements with the same stem, but the substitution uses patsubst
which only does the first. How can we accomplish both?
Finds whitespace-separated words in TEXT that match PATTERN and replaces them with REPLACEMENT. Here PATTERN may contain a % which acts as a wildcard, matching any number of any characters within a word.
A substitution reference substitutes the value of a variable with alterations that you specify. It has the form ' $( var : a = b ) ' (or ' ${ var : a = b } ') and its meaning is to take the value of the variable var , replace every a at the end of a word with b in that value, and substitute the resulting string.
= defines a recursively-expanded variable. := defines a simply-expanded variable.
MAKEFILE_LIST. Contains the name of each makefile that is parsed by make , in the order in which it was parsed. The name is appended just before make begins to parse the makefile. Thus, if the first thing a makefile does is examine the last word in this variable, it will be the name of the current makefile.
In fact, Jack got it almost right -- foreach
to the rescue! We know the full stem anyway and stick it into a var, and foreach
expands all occurrences of the var:
O23 := $(foreach root,$(OROOTS),$(ODIR)/overx-$(root)2wk-$(root)3wk.mlb)
I'll check Beta's anyway for the new perspective.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With