Using make target name in generated prerequisite

孤街醉人 提交于 2019-12-12 04:41:28

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/23252948/using-make-target-name-in-generated-prerequisite

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!