Autotools指定静态库安装路径
Autotools specifying install path of static library
如何将库安装到 $(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.*
有什么想法吗?
由于您尝试实现的操作不符合标准,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
注意 当您在配置脚本所在的同一目录中调用 configure
时,$(srcdir)
和 $(builddir)
是相同的。什么时候
你从另一个目录 buildir
调用 configure
并且 srcdir
会
不同。
链接
如何将库安装到 $(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/
.
有什么想法吗?
由于您尝试实现的操作不符合标准,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
注意 当您在配置脚本所在的同一目录中调用 configure
时,$(srcdir)
和 $(builddir)
是相同的。什么时候
你从另一个目录 buildir
调用 configure
并且 srcdir
会
不同。