delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/20/12:52:38

Date: Fri, 20 Jun 1997 09:50:59 -0700 (PDT)
Message-Id: <199706201650.JAA09741@adit.ap.net>
Mime-Version: 1.0
To: djgpp AT delorie DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Using `make' to maintain libraries

Does anyone know of a way to have `make' rebuild only the changed members of
a .a library? For example, I have a library libfoo.a containing func1.o,
func2.o ... func(n).o. Each .o member is built from a .c source. The easy
way is to do this:
--cut--
OBJS = func1.o func2.o [...] func(n).o

libfoo.a : libfoo.a($(OBJS))
--cut--
and let implicit rules handle the rest. This is described in the Archives
section of the docs. But what happens when I make is, if the library is not
up-to-date, every source file is recompiled, and every member re-inserted.
This can take a loooong time if `n' is large.

So what I want is:
for (each source file newer than libfoo.a) do
        compile source file
                gcc -o funcx.o funcx.c
        re-insert member
                ar -r libfoo.a funcx.c

How do I get `make' to do this? Is it even possible?


Nate Eldredge
eldredge AT ap DOT net



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019