[haiku-3rdparty-dev] Re: Makefile-Engine with multiple, dependant targets

  • From: Pete Goodeve <pete.goodeve@xxxxxxxxxxxx>
  • To: haiku-3rdparty-dev@xxxxxxxxxxxxx
  • Date: Thu, 6 Oct 2016 12:49:55 -0700

On Thu, Oct 06, 2016 at 12:32:51PM +0200, Stefano Ceccherini wrote:

2016-10-06 3:48 GMT+02:00 Pete Goodeve <pete.goodeve@xxxxxxxxxxxx>:

First, you have to put your rules *after* the makefile-engine include,
as the main target is in the engine.  If you satisfy a rule before the
engine, it just thinks it's done, and quits.  'make' itself takes care
of doing things in the right order, so the header will get built before
the main project is compiled.

You also have to make sure you put in necessary dependencies,
because those set up by the engine don't take into account added
needs.  For example, if your source includes a header that doesn't yet
exist, the mkdepend command in the engine just ignores that header.

Thank you very much! That worked perfectly!

Great!  I realized on the way to bed, though, that the example wasn't
complete.  It works fine if you're starting from scratch, or after a clean,
but if, in my example, you'd modified only MyHeader.src, MyHeader.h
would get updated OK, but the main source would not get recompiled.

Instead of the dependency "HeaderTest.cpp : MyHeader.h", it should
be "$(OBJ_DIR)/HeaderTest.o : MyHeader.h".  That seems to work.
(OBJ_DIR is defined in the engine, of course.)

Sorry.

        -- Pete --

Other related posts: