开发者

Duplicated $(info) Calls

I have a makefile that displays a couple of information to the user using $(info) function calls. How开发者_如何转开发ever, the makefile also includes auto-generated dependency files updated via gcc -M. Whenever such a dependency needs to be remade, GNU Make reparses everything again, thus duplicating the output generated with $(info) and similar calls.

Is there a way to determine whether GNU Make is performing the first or the second such pass in a makefile, in order to avoid duplication of $(info) lines?


I just found it myself: the MAKE_RESTARTS variable is defined if GMake has restarted in the above circumstances. For example, the construct:

ifndef MAKE_RESTARTS
    $(info Hello!)
endif

will only display the forementioned message in the first such pass of Make.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜