如何设置automake中库的顺序?
如何设置automake中库的顺序?
在我的 am 文件中,我有类似的内容:
myprog_DEPENDENCIES = adhoc-target
myprog_SOURCES = myprog.c
myprog_LDADD = libmine.la
myprog_LDFLAGS = -static -L/home/user/lib -ladhoc
现在,当我编译时,我也得到类似的编译行:
gcc -static myprog-myprog.o -o myprog -L/home/user/lib -ladhoc ./.libs/libmine.a
问题是 libmine.a 依赖于 libadhoc.a,因此编译行应该是:
gcc -static myprog-myprog.o -o myprog ./.libs/libmine.a -L/home/user/lib -ladhoc
How do you set the order of templates在汽车制造商? (或者可能是一个解决方法;如何在编译行中重复所有库。这就是我在自定义 Makefile 中所做的。)
How do you set the order of libraries in automake?
In my am file I have something like:
myprog_DEPENDENCIES = adhoc-target
myprog_SOURCES = myprog.c
myprog_LDADD = libmine.la
myprog_LDFLAGS = -static -L/home/user/lib -ladhoc
Now, when I compile I get this compile line similar too:
gcc -static myprog-myprog.o -o myprog -L/home/user/lib -ladhoc ./.libs/libmine.a
The problem is that libmine.a depends on libadhoc.a, therefore the compile line should be:
gcc -static myprog-myprog.o -o myprog ./.libs/libmine.a -L/home/user/lib -ladhoc
How do you set the order of libraries in automake? (Or maybe a work around; how do you repeat all the libraries in the compile line. That's what I do in my custom Makefiles.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
来自 Automake 手册(主要是 §8.1.2 但也 < a href="https://www.gnu.org/software/automake/manual/html_node/Program-and-Library-Variables.html" rel="noreferrer">§8.4):
这意味着您可以(但实际上您应该)在
LDADD
中使用-l
和-L
,而不是在LDFLAGS
中。换句话说,你的Makefile.am
应该简单地读取From the Automake manual (mostly §8.1.2 but also §8.4):
That implies you can (but actually you should) use
-l
and-L
inLDADD
, not inLDFLAGS
. In other words yourMakefile.am
should simply readautomake 书中的一个想法 (http://sources.redhat.com/autobook/autobook /autobook_92.html):从 libmine 和 libadhoc 创建一个方便的库,并将 myprog 链接到它。
One idea from the automake book (http://sources.redhat.com/autobook/autobook/autobook_92.html): create a convenience library out of libmine and libadhoc, and link myprog against that.