Gcc 如何在任何make文件中添加标志

Gcc 如何在任何make文件中添加标志,gcc,makefile,configure,Gcc,Makefile,Configure,我有一个程序,我想测量它的性能,但使用gprof。现在我想在其中添加一个-pg标志。我有许多不同的文件makefile.am makefile.in configure 我使用以下步骤安装程序 ./configure make make install 现在我在某个地方读到: 从Makefile.am自动生成Makefile.in 配置从Makefile.in生成Makefile 我完全糊涂了,想问两个问题 在哪个文件和哪里添加-pg标志?在makefile.In或makefile.am中

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

我使用以下步骤安装程序

./configure
make
make install
现在我在某个地方读到:

  • 从Makefile.am自动生成Makefile.in
  • 配置从Makefile.in生成Makefile
我完全糊涂了,想问两个问题

  • 在哪个文件和哪里添加
    -pg
    标志?在makefile.In或makefile.am中,因为它们都有不同类型的标志选项
  • 如果configure从makefile.in生成makefile.in,automake从makefile.am生成makefile.in,那么我们不应该使用make before./configure吗?什么是等级制度
  • 曼恩:

       -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.
    

    它需要在 CPPPFLAGs/code >(用于C和C++代码)和 LDFLAGs(除非使用非标准变量)。标准方法是将标志传递给

    configure
    脚本:

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