Re: Make and Archives.
From: Larry Lindstrom (larryl@aracnet.com)
Date: 04/15/03
- Next message: Skeedo: "Find me an open source PPC Search Engine and I'll pay you!"
- Previous message: Michael B. Allen: "Re: Make and Archives."
- In reply to: Michael B. Allen: "Re: Make and Archives."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
From: Larry Lindstrom <larryl@aracnet.com> Date: Tue, 15 Apr 2003 20:56:11 GMT
"Michael B. Allen" wrote:
>
> On Mon, 14 Apr 2003 20:10:16 -0400, Larry Lindstrom wrote:
>
> > Hi Experts;
> >
> > I've decided to stop leaving piles of object
> > files around and use make to compile from source to library.
> >
> > My problem is that this always compiles my
> > source and inserts the object in the archive. Even when the archive is
> > up to date.
> >
> > Here is my makefile:
> >
> > $ cat makefile
> >
> > libtest(test.o): test.cpp
> > echo
> > ar -tv libtest.a
> > echo
> > ls -l test.cpp
> > echo
> >
> > g++ -c test.cpp -o test.o
> >
> > ar -r libtest.a test.o
> >
> > rm -f test.o
>
> Make will only skip a procedure if the right hand side of the production
> is "up to date". So I think you want something like:
Thanks Mike:
I believe he procedure skipped if the left side of
the ":" is newer than the right.
> libtest.a: test.o
> ar rv libtest.a test.o
> test.o: test.c
> cc ...
I don't think so.
What happens if another object was added to libtest.a
that makes libtest.a newer than test.o? If many object
files are built in a project, can't libtest.a could be
newer than a fresh test.o that hasn't yet been archived.
I'm trying to test against the date on the object's
image inside the library, not the library's date.
> Here's a fairly complete Makefile that creates a .so, .a, and may be
> used with RPM:
>
> http://www.ioplex.com/~miallen/libmba/dl/Makefile
>
> Maybe you can gleen some useful information from it.
I see the following dependency line in your
example:
$(SONAME): $(ARNAME)($(OBJS)) $(OBJS)
Which I believe is saying, "If $SOMNAME is older
than the image of $OBJS in the library $ARNAME, or
the file $OBJS, perform the task"
Isn't this the same as the "libtest(test.o)"
syntax I'm using in my dependency line? My use has
that syntax on the left side of the ":". The
samples in O'Reilly's "Managing Projects with make",
pages 35-37, show the syntax on both sides of the
":"
in the dependency line.
I appreciate your advice, but I don't understand
why the statements following
libtest(test.o): test.cpp
are being executed if
ar -tv libtest.a
shows that test.o in libtest.a is newer than
test.cpp.
I've noticed in my example, the make will fail
if the library doesn't exist. If you want to test
what I'm doing, comment out the offending "ar -tv"
statement until the archive is created.
Thanks
Larry
- Next message: Skeedo: "Find me an open source PPC Search Engine and I'll pay you!"
- Previous message: Michael B. Allen: "Re: Make and Archives."
- In reply to: Michael B. Allen: "Re: Make and Archives."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|