[klibc] can I create lib.a from dir/lib.a?

Luc Van Oostenryck lkml at looxix.net
Sun Jul 9 10:27:12 PDT 2006

Sam Ravnborg wrote:
> In an attempt to solve some of the dependency issues when building klibc
> library I started to do a modular build of klibc library.
> The priciple is simple. build all sub-directories specified with
> lib-y := dir/ before the final lib.a
> But reading "man ar" it was not obvious if:
> ar cp lib.a dir/lib.a dir2/lib.a file1.o file2.o
> would produce the desired result.
> The linux kernel uses lr -r instead, but thats not libraries.
> I could try it out but thought asking the list could reveal some
> pratical experiences.
> 	Sam

It can be done with "MRI scripts" (described in ar.info).
Something like the following should do the job:
ar -M << EOF
CREATE lib.a
ADDLIB dir/lib.a
ADDLIB dir2/lib.a

Luc Van Oostenryck

More information about the klibc mailing list