Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!brl-adm!seismo!mcvax!inria!axis!mickey From: mickey@axis.UUCP Newsgroups: comp.unix.questions Subject: make Message-ID: <210@axis.fr> Date: Thu, 26-Mar-87 15:41:52 EST Article-I.D.: axis.210 Posted: Thu Mar 26 15:41:52 1987 Date-Received: Sat, 28-Mar-87 08:32:00 EST Organization: LERS: soon to be something else! Lines: 41 Keywords: make, libraries, ar, Schaubl Sorry about this going to the world but my email bounced. The original question was how to get to make to update object file archives (.a's containing .o's) from src aechives (.ar's containing .c's) The standard version of make (AT&T make) does this, I think it has always done it but the first time it was documented was with System 5 (perhaps 3 I can't remember the doc for system III). Basically the trick is to define rules as normal except all objects should be given as 'arguments' to the archive file - clear as mud eh? here's an example with just the .o's in an archive: libwotsit.a: libwotsit.a(src1.o) libwotsit.a(src2.o) echo Done this example is the simples because make has the default rules for building archive members (of the .o type) from .c files. Your example is of the form: libobj.a: libobj.a(a.o) libobj.a(b.o) echo Wow libobj.a(a.o): libsrc.ar(a.c) ar x libsrc.ar a.c cc -c $(CFLAGS) a.c ar r libobj.a a.o rm -f a.o libobj.a(b.o): libsrc.ar(b.c) ar x libsrc.ar b.c cc -c $(CFLAGS) b.c ar r libobj.a b.o rm -f b.o ps this conforms to SVID VOL 2 pp 360 - 365 (the 'standard' make) pps i tested this and it works ok, if you find a way of generalising these rules please let me know as I failed to think of way (I think that the .a suffix is special to make, .ar is thus not so special and a rule of the form .a.a confuses me let alone make!