简体   繁体   English

Makefile.in 中的@CPPFLAGS@ 是什么意思?

[英]What does it means @CPPFLAGS@ in Makefile.in?

I have a Makefile.in file that generate a Makefile.am by configure.我有一个Makefile.in文件,它通过配置生成一个Makefile.am After that with automake the Makefile.am create the Makefile .之后使用 automake Makefile.am 创建Makefile

Now i want to add a define in the geneated Makefile.现在我想在生成的 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:问题是,在生成的 Makefile 中,我在变量CPPFLAGS 中找到了一个标志列表,但在 Makefile.in 中 CPPFLAGS 的定义中,我只找到了以下列方式写入的一行:

CPPFLAGS = @CPPFLAGS@

What does it means @CPPFLAGS@ ? @CPPFLAGS@是什么意思? And how i can set a new flag in the generated Makefile?以及如何在生成的 Makefile 中设置新标志?

CPPFLAGS stands for C Pre Processor flags. CPPFLAGS 代表 C 预处理器标志。

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:从 gnu Make 手册:

CPPFLAGS CPPF标志

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.该字符串@CPPFLAGS@由配置脚本扩展为CPPFLAGS当时值configure被执行。 In other words, if you run configure CPPFLAGS=foo , then @CPPFLAGS@ will be expanded to the string foo .换句话说,如果您运行configure CPPFLAGS=foo ,那么@CPPFLAGS@将被扩展为字符串foo

Automake was run long before configure is invoked. Automake 在调用 configure 之前就已经运行很久了。 All automake did was add the string @CPPFLAGS@ to Makefile.in when it built that file. automake 所做的只是在构建该文件时将字符串@CPPFLAGS@添加到 Makefile.in 中。

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.如果你想添加标志,你应该在 Makefile.am 中分配给AM_CPPFLAGS 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.这很难说,这取决于您认为要添加的标志。

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

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