Autotools指定静态库的安装路径

时间:2017-07-12 15:08:20

标签: c autotools automake

如何将库安装到$(top_srcdir)/lib/foo.a

如果我尝试使用:

noinst_LIBRARIES=$(top_srcdir)/lib/foo.a foo_a_SOURCES= foo.c foo.h bar.c, bar.h

我得到library has foo_a as canonical name (possible typo)

我在$(top_srcdir)/foobar/中有foo。*和bar。*。

任何想法?

1 个答案:

答案 0 :(得分:0)

由于您尝试实现的操作不是标准操作,因此GNU / Autotools不支持该功能。然而,GNU / Autotools让程序员通过使用扩展其Makefile规则功能的本地规则来调整他们的系统。

例如,要将您的库复制到特定位置,您可以写:

# Standard way
noinst_LDLIBRARIES = foo.a

# Here is where you tweak, all-local will be performed
# after compilation.
all-local:
  -cp $(builddir)/foo.* $(buildir)/libs

注意,当您在配置脚本所在的同一目录中调用$(srcdir)时,$(builddir)configure是相同的。什么时候 您从其他目录configurebuildir呼叫srcdir 不同。

链接