Debugging GNU make

后端 未结 7 1057
没有蜡笔的小新
没有蜡笔的小新 2020-12-22 18:33

Is there a command line way in make to find out which of the prerequisites of a target is not updated?

7条回答
  •  余生分开走
    2020-12-22 19:18

    What I usually do is not go using -d as previous answerers said.

    I either:

    1. Use -p to print the database, to see what rules have been created. This is handy if you have second expansion rules and are creating rules on the fly, especially recursive make.
    2. Heavy use of $(info) function.
    3. Use the tips and trick described in this DrDobbs article Debugging Makefiles

    Below is some code I'm using for printing out values:

    define pv
    $(info $(1) [$(origin $(1))] : >|$($(1))|<)
    endef
    
    define pva
    $(foreach t,$(1),$(call pv,$(t)))
    endef
    
    define itemizer
    $(foreach t,$($(1)),$(info $(t)))
    endef
    

提交回复
热议问题