Hi, I've found these surprising behaviours (in make v4.3). Are there any chance to see them changed?
1. Second expansion is not applied to .EXTRA_PREREQS 2. Setting .EXTRA_PREREQS as pattern-specific variable is not supported 3. In setting pattern-specific variables, patterns with no slash are not matched by first removing dir names. (As one finds out iff reading the doc carefully — "The directories are ignored only for the purpose of finding an implicit rule to use, not in the application of that rule.") See a previous surprised user here <https://lists.gnu.org/archive/html/bug-make/2017-08/msg00016.html>. As a consequence, I've no good solution to the following two problems. 1. How to add a prerequisite to all targets matching some pattern — in particular, their parent directory? This does not work as hoped: .SECONDEXPANSION: %.ext: .EXTRA_PREREQS = | $$(@D)/ %/: ; mkdir -p $@ 2. How to set a variable for all targets matching <dirs>/prefix_<stem>? %_suffix: var = OK this matches target dir/stem_suffix prefix_%: var = NO this won't match dir/prefix_stem For context, I thought one could write a library of pattern rules of the form <prefix_dirs>/rule_type_<suffix_id> and deriving various parameters from prefix dirs and suffix id. I guess I'll have to rewrite it as <prefix_dirs>/<prefix_id>_rule_type or use global variables, and make parent dirs explicitly. Thanks for your comments, Daniel Gerber