开发者

Duplicated $(info) Calls

开发者 https://www.devze.com 2023-03-29 07:46 出处:网络
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 -

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

精彩评论

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