%% John Paden <[EMAIL PROTECTED]> writes:

  jp> I tested this a bit I think it's a bug.  However, I'm not
  jp> completely familiar with make so I could have overlooked
  jp> something.

Your makefile has a bug.

  jp> all: $(LIBNAME)($(OBJS))

  jp> $(LIBNAME)($(OBJS)) : $(OBJS)

This last line is not necessary and, indeed, is causing your problems.

Expanding the variables, this line says:

  libtest.a(first.o second.o): first.o second.o

This is exactly the same thing as saying:

  libtest.a(first.o): first.o second.o
  libtest.a(second.o): first.o second.o

You're saying that every time _either_ first.o _or_ second.o is newer
than libtest.a(first.o), make should re-archive first.o.  Ditto for
second.o.  And, that's exactly what make is doing, but obviously that's
not what you want; you don't want to re-archive first.o when second.o
changes!

Just remove that rule.  It doesn't say what you want and it isn't
necessary.  You can just say:

  all: $(LIBNAME)($(OBJS))

This expands to:

  all: libtest.a(first.o second.o)

which is equivalent to:

  all: libtest.a(first.o) libtest.a(second.o)

When make wants to build libtest.a(first.o), it can figure out for
itself, using its builtin rules, that it needs to build the .o from the
.c then archive it.  You don't have to explicitly list that dependency
relationship.  Ditto for second.o.

If you really want to make it explicit, you must do it separately, like
this:

  libtest.a(first.o): first.o
  libtest.a(second.o): second.o

but again, this isn't necessary.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <[EMAIL PROTECTED]>          Find some GNU make tips at:
 http://www.gnu.org                      http://www.ultranet.com/~pauld/gmake/
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

Reply via email to