【问题标题】:Is there a way to get the name of the makefile where a make variable was defined?有没有办法获取定义了make变量的makefile的名称?
【发布时间】:2021-09-16 17:02:52
【问题描述】:

出于调试目的,当包含许多 make 文件时,打印 makefile 的完整路径很有用,其中首先定义了当前 makefile 中的特定变量。有没有办法做到这一点?

【问题讨论】:

    标签: c++ c makefile build compilation


    【解决方案1】:

    只需运行make -p。 Make 将打印其内部数据库,包括所有可见的目标和变量以及设置它们的文件名和行号。

    【讨论】:

      【解决方案2】:

      这可能很乏味,但您可以转到每个 makefile 并回显 makefile 的位置和文件名。然后,您可以在 makefile 运行时定义变量时继续打印。 这是另一篇更详细地介绍打印变量的帖子。

      How to print out a variable in makefile

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-02-13
        • 2022-01-26
        • 1970-01-01
        • 2013-01-08
        • 1970-01-01
        相关资源
        最近更新 更多