linux - 使用 autotools 在替换文件中执行替换

标签 linux makefile autotools

我试着环顾四周,似乎找不到正确的信息。我想在 AC_SUBST_FILE 使用的文件中替换 @srcdir@。这可能吗?

最佳答案

AC_OUTPUT 不允许您执行两个替换步骤,所以我认为这是不可能的。但是,您可以这样做:

我的替换文件:

srcdir is %srcdir%

配置文件:

AC_PROG_SED
file=my_substitution_file
AC_SUBST_FILE([file])
AC_CONFIG_FILES([my_file.in])
AC_OUTPUT

生成文件.am:

my_file: my_file.in Makefile
    $(AM_V_GEN)$(SED) -e s,%srcdir%,$(srcdir), <$< >$@

我的文件.in.in:

Here is what my_substitution_file has to say: @file@

总而言之,这应该会产生一个名为 my_file 的文件,其内容为:

Here is what my_substitution_file has to say: srcdir is /path/to/your/source

关于linux - 使用 autotools 在替换文件中执行替换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29178614/

相关文章:

用于处理和解析 express 邮件服务器格式的 php 类

linux - Linux下的权限问题

php - 通过 FTP 检索的文件编码不良

c++ - Visual Studio 2013 将 EXEC 前缀添加到 makefile 输出

CMake 从 Autoconf 生成 config.h

release - autogen.sh 应该包含在 tarball 中吗?

html - Firefox linux (centos) 响应式设计图像缩放

c - Linux Kernel Makefile.build 构建外部模块时的奇怪行为

c++ - undefined reference to with inheritance, makefile 问题?

autotools - 如何解决 "Possibly undefined macro: AC_MSG_ERROR"