$(TARGET): build $(OBJECTS)
ar rcs $@ $(OBJECTS)
ranlib $@
什么是“ ar rcs”和“ ranlib”?
ar
用于创建库(包含编译代码的档案)
man ar:
ar -- create and maintain library archives
...
-r Replace or add the specified files to the archive
-c Whenever an archive is created, an informational message to that effect is written to standard error. If the -c option is speci-
fied, ar creates the archive silently.
-s Write an object-file index into the archive, or update an existing one, even if no other change is made to the archive. You may
use this modifier flag either with any operation, or alone. Running `ar s' on an archive is equivalent to running `ranlib' on
it.
第一个参数是结果库的名称,其他是要在其中插入的目标文件。
[ranlib
生成对档案内容的索引,并将其存储在档案中。