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.
加载中,请稍侯......
精彩评论