> Source files
> ```
> foo/1.tpl
> foo/1.data
> bar/2.tpl
> bar/2.data
> baz/3
> ```
>
> Makefile
> ```
> .SECONDEXPANSION:
> VPATH := foo bar baz
> build/%: %.tpl $$(patsubst %.tpl,%.data,$$<)
> render --data $(word 2,$^) $< $@
> build/%: %
> cp $< $@
> ```
Sorry, the source files are actually structured like this:
Source files
```
foo/1.tpl
foo/data
bar/2.tpl
bar/data
baz/3
```
And I wish the Makefile could be like this:
Makefile
```
.SECONDEXPANSION:
VPATH := foo bar baz
build/%: %.tpl $$(dir $$<)data
render --data $(word 2,$^) $< $@
build/%: %
cp $< $@
```
Previously, the pattern rule could simply be "build/%: %.tpl %.data”, but it
won’t work for my actual case.
Regards.
Glen