%% "Rupal Desai" <[EMAIL PROTECTED]> writes:

  rd> $(OBJS):$(OBJDIR)/%.o: %.cpp $(OBJDIR)

This is (at least one of) your problem(s).

You've added OBJDIR as a prerequisite.  That means that any time OBJDIR
is newer than the target (xxxx.o), the .o file will be considered out of
date and rebuilt.

Well, on UNIX anyway, a directory's last modified timestamp is changed
whenever the directory is changed, which means whenever a file is added,
removed, or renamed in that directory.

So, every time a .o is created in that directory it becomes newer than
all the .o's that were already there, and they all rebuild.


For this reason it's virtually always a very bad idea to list a
directory as a normal prerequisite of a target.

You have two choices.  I personally prefer to simply always create the
directory immediately when make starts, like this:

    __dummy := $(shell [ -d "$(OBJDIR)" ] || mkdir -p "$(OBJDIR)")

or similar.

The alternative, if you have a sufficiently new version of GNU make, is
to use order-only prerequisites:

  $(OBJS):$(OBJDIR)/%.o: %.cpp | $(OBJDIR)

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


_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to