【问题标题】:how to add a flag in any make file如何在任何make文件中添加标志
【发布时间】:2012-02-03 08:15:33
【问题描述】:

我有一个程序,我想测量它的性能,但使用 gprof.now 我想在其中添加一个 -pg 标志。我有很多不同的文件 makefile.am makefile.in configure

我使用以下步骤安装程序

./configure
make
make install

现在我在某处读到:

  • automake 从 Makefile.am 生成 Makefile.in
  • configure 从 Makefile.in 生成 Makefile

我很困惑,想问两个问题

  1. 在哪个文件中以及在哪里添加-pg 标志?在 makefile.in 或 makefile.am 中,因为它们都有不同类型的标志选项?
  2. 如果 configure 从 makefile.in 生成 makefile 而 automake 从 makefile.am 生成 makefile.in 那么我们是否应该在 ./configure 之前使用 make?什么层次结构?

【问题讨论】:

    标签: gcc makefile configure


    【解决方案1】:

    人 gcc:

       -pg Generate extra code to write profile information suitable for the
           analysis program gprof.  You must use this option when compiling
           the source files you want data about, and you must also use it when
           linking.
    

    它说它需要在CPPFLAGS(用于C 和C++ 代码)和LDFLAGS(除非使用非标准变量)。标准方式是将标志传递给configure 脚本:

    $ ./configure CPPFLAGS=-pg LDFLAGS=-pg
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-12
      相关资源
      最近更新 更多