简体   繁体   English

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

[英]how to add a flag in any make file

I have a program and I want to measure it performance but using gprof.now I want to add a -pg flag in it. 我有一个程序,我想测量它的性能,但是现在使用gprof.now,我想在其中添加-pg标志。 I have many different files makefile.am makefile.in configure 我有许多不同的文件makefile.am makefile.in配置

I install the program using following steps 我使用以下步骤安装程序

./configure
make
make install

Now I have read somewhere that: 现在我在某处读到了:

  • automake gererates Makefile.in from Makefile.am automake从Makefile.am继承Makefile.in
  • configure generates Makefile from Makefile.in 配置从Makefile.in生成Makefile

I am totally confused and want to ask two question 我很困惑,想问两个问题

  1. In which file and where do I add -pg flag? 在哪个文件中以及-pg标志在哪里添加? In makefile.in or makefile.am as they both have different types of flag options? 在makefile.in或makefile.am中,因为它们都有不同类型的标志选项?
  2. If configure generates makefile from makefile.in and automake generates makefile.in from makefile.am then shoud'nt we be using make before ./configure? 如果configure从makefile.in生成makefile,而automake从makefile.am生成makefile.in,那么我们应该在./configure之前使用make吗? what the hierarchy? 什么层次?

man gcc: man 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.

It says it needs to be in CPPFLAGS (used for both C and C++ code) and LDFLAGS (unless non-standard variables are used). 它说它必须使用CPPFLAGS (用于C和C ++代码)和LDFLAGS (除非使用非标准变量)。 The standard way is to pass flags to configure script: 标准方法是传递标志以configure脚本:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM