对 ar 命令的学习

学习makefile的写法的时候,遇到了 ar 命令。

进行了学习。下面的网址写得非常好:

http://www.thegeekstuff.com/2010/08/ar-command-examples/

还是通过例子来学习,来得比较快。此文很完美,暂时记录以作备忘。

再回头来 看 makefile 的说法:

复制代码
Archive Members as Targets

An individual member of an archive file can be used as a target or dependency in make. You specify the member named member in archive file archive as follows:

archive(member)
This construct is available only in targets and dependencies, not in commands! Most programs that you might use in commands do not support this syntax and cannot act directly on archive members. Only ar and other programs specifically designed to operate on archives can do so. Therefore, valid commands to update an archive member target probably must use ar. For example, this rule says to create a member `hack.o' in archive `foolib' by copying the file `hack.o':

foolib(hack.o) : hack.o
        ar cr foolib hack.o
In fact, nearly all archive member targets are updated in just this way and there is an implicit rule to do it for you. Note: The `c' flag to ar is required if the archive file does not already exist.

To specify several members in the same archive, you can write all the member names together between the parentheses. For example:

foolib(hack.o kludge.o)
is equivalent to:

foolib(hack.o) foolib(kludge.o)
You can also use shell-style wildcards in an archive member reference. See section Using Wildcard Characters in File Names. For example, `foolib(*.o)' expands to all existing members of the `foolib' archive whose names end in `.o'; perhaps `foolib(hack.o) foolib(kludge.o)'.
复制代码

本文转自健哥的数据花园博客园博客,原文链接:http://www.cnblogs.com/gaojian/archive/2012/09/18/2690629.html,如需转载请自行联系原作者

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值