gsrunion
gsrunion

Reputation: 419

Using make target name in generated prerequisite

All I am wanting to do something along the lines of...

some_file.out : ..... ver_$(basename $@).ver:
   .....

The $@ does not expand as expected but only in the rule header. Inside the body of the rule all uses of ver_$(basename $@).ver expand as desired. How would I modify this to make it work as desired?

Upvotes: 0

Views: 505

Answers (1)

MadScientist
MadScientist

Reputation: 101051

You have ellipses eliding too many important parts of your example to provide a full solution. However, one option is to use static pattern rules, like this:

some_file.out : %.out : ver_%.ver
        ...

If that isn't sufficient you can use secondary expansion, but that's a bigger hammer.

Upvotes: 3

Related Questions