简体   繁体   中英

What does it means @CPPFLAGS@ in Makefile.in?

I have a Makefile.in file that generate a Makefile.am by configure. After that with automake the Makefile.am create the Makefile .

Now i want to add a define in the geneated Makefile. The problem is that in the generated Makefile i found a list of flags in variable CPPFLAGS , but in the definition of CPPFLAGS in the Makefile.in i found only a line that is write in the following way:

CPPFLAGS = @CPPFLAGS@

What does it means @CPPFLAGS@ ? And how i can set a new flag in the generated Makefile?

CPPFLAGS stands for C Pre Processor flags.

You can set it as an environmental variable or via the commandline:

CPPFLAGS="-g -Wall -O0" automake

or

CPPFLAGS="-g -Wall -O0" make

From the gnu Make manual:

CPPFLAGS

Extra flags to give to the C preprocessor and programs that use it (the C and Fortran compilers).

The string @CPPFLAGS@ is expanded by the configure script to be the value of CPPFLAGS at the time configure is executed. In other words, if you run configure CPPFLAGS=foo , then @CPPFLAGS@ will be expanded to the string foo .

Automake was run long before configure is invoked. All automake did was add the string @CPPFLAGS@ to Makefile.in when it built that file.

As the project maintainer, you should not edit these values. This is the mechanism by which the user is able to add flags to the build at configure time.

If you want to add flags, you should assign to AM_CPPFLAGS in Makefile.am. But chances are you don't really want to do that. It's hard to say, and will depend on what flags you think you want to add.

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