Post-build step for multiple targets

折月煮酒 提交于 2019-12-04 12:14:09

You have to write a different rule for each one, unfortunately. But you can make it simpler with a static pattern rule:

html pdf txt: %: real-%
        do-post-build-stuff

real-html: data.dat
        generate-html data.dat

real-pdf: data.dat
        generate-pdf data.dat

real-txt: data.dat
        generate-txt data.dat

This creates targets html, pdf, and txt which depend on the real- versions. The real- versions do the actual work, then after they're done the post-build stuff is done as a recipe in the base target (html, pdf, and txt).

That rule is just a shorthand so you don't have to write it all out; the result is identical:

html: real-html
        do-post-build-stuff

pdf: real-pdf
        do-post-build-stuff

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