The ${VAR:pattern%.o=replacement%.c} variable modifier syntax is very useful for portable makefiles because GNU make supports the same syntax. But I just noticed a bug: if the pattern starts with 't', make prints an error rather than performing the substitution. I think the parser is looking for one of the :t modifiers (:tl, :tu, etc.) $ cat Makefile foo: @echo ${@:f%=b%} test: @echo ${@:t%=b%} $ make foo boo $ make test make: Bad modifier ":t%=b%" for variable "@" =b%}
A sysV style modifier can be mistaken for any of bmake's other modifiers, a possible tweak to address this has collateral fallout - needs to be assessed.
> A sysV style modifier can be mistaken for any of bmake's other modifiers, > a possible tweak to address this has collateral fallout - needs to be assessed. True, I see that ${@:M%=b%} treats `%=b%` as a pattern rather than doing the substitution. That's a pretty gnarly ambiguity. At least the :t ones could look ahead for an `=` or something, but something like this looks impossible to me: ${@:S/%.c=O/%/g} Is that S / %.c=O / % /g or S/%.c = O/%/g ?
The next version of bmake (>= 20250330) will allow sysV style modifiers to take precedence in POSIX mode (ie. first non-comment line in the Makefile is `.POSIX:`) This is about the only sane way to expect random sysV modifiers to work as expected.