简体   繁体   中英

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. I have many different files makefile.am makefile.in configure

I install the program using following steps

./configure
make
make install

Now I have read somewhere that:

  • automake gererates Makefile.in from Makefile.am
  • configure generates Makefile from Makefile.in

I am totally confused and want to ask two question

  1. In which file and where do I add -pg flag? In makefile.in or makefile.am as they both have different types of flag options?
  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? what the hierarchy?

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). The standard way is to pass flags to configure script:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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