Re: Possible to get prerequisite path with secondary expansion when VPATH is employed?

Glen Huang <[email protected]>
Newsgroups gmane.comp.gnu.make.general
Message-ID <[email protected]>
> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.