简体   繁体   English

Makefile.in和变量替换

[英]Makefile.in and variable substitution

In Makefile.in I see variable definition where an external variable name is enclosed between two @ symbols Makefile.in我看到变量定义,其中外部变量名称包含在两个@符号之间

# @configure_input@

package = @PACKAGE_NAME@

Where those external variables come from? 那些外部变量来自哪里? Also, I couldn't find in GNU manual what does exactly enclosing a variable between two @ symbols mean? 另外,我在GNU手册中找不到两个@符号之间的变量是什么意思? Is it something specific to Makefile.in? 它是Makefile.in特有的东西吗?

Thank you. 谢谢。

It's an autoconf thing. 这是一个autoconf的事情。

When ./configure finishes running, it generates and executes a file called config.status , which is a shell script that has the final value of the variable substitutions (anything declared with AC_SUBST ). ./configure完成运行时,它会生成并执行一个名为config.status的文件,该文件是一个shell脚本,它具有变量替换的最终值(使用AC_SUBST声明的任何AC_SUBST )。

Anything that is declared in AC_CONFIG_FILES is processed by config.status , usually by turning foo.in into foo . AC_CONFIG_FILES声明的任何内容都由config.status处理,通常是将foo.in转换为foo

When automake processes Makefile.am into Makefile.in , any AC_SUBST variable is automatically made available (using a declaration like FOO = @FOO@ ), unless it's suppressed by a call to AM_SUBST_NOTMAKE . 当automake将Makefile.am处理为Makefile.in ,任何AC_SUBST变量都会自动AC_SUBST可用(使用类似FOO = @FOO@的声明),除非通过调用AM_SUBST_NOTMAKE来抑制它。

(I am not an expert, but) Yes they are specific to Makefile.in, and configure replaces them when assembling the Makefile , see the Autoconf Manual, section 4.8 . (我不是专家,但是)是的,它们特定于Makefile.in,并且configure在组装Makefile时替换它们,请参阅Autoconf Manual,第4.8节 For example, @PACKAGE_NAME@ is defined by AC_INIT . 例如, @PACKAGE_NAME@AC_INIT定义。

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

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