[haiku-development] Re: Jam dependency on generated header

  • From: Ingo Weinhold <ingo_weinhold@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Wed, 10 Sep 2014 10:27:10 +0200

On 10.09.2014 08:23, pulkomandy wrote:
On Wed, Sep 10, 2014 at 03:11:33PM +1200, Jessica Hamilton wrote:
In the Jamfile I have:

UseHeaders ] FDirName $(HAIKU_COMMON_PLATFORM_OBJECT_DIR) bin writembr ] ;

The opening "[" seems to have flipped.

And this sets up the include path correctly; but I have no idea for
making the generated MBR.h happen.

The KernelAddon rule works like this:
KernelAddon <name> : <sources> : <static-libraries> : <res> ;

There is no way to add a custom header dependency there. So, you'd need
to call Depends manually:

Depends [ FGristFiles intel ] : [ FGristFiles MBR.h ]

That is not correct for several reasons:

1. "intel" doesn't have grist.

2. The grist on MBR.h must match the one in of the subdir it was created from.

3. You don't want "intel" to depend on the header. Jam would make the header before linking the kernel module, but not necessarily before compiling the source file that includes the header.

The needed dependency should look like this:

  Includes [ FGristFiles SourceIncludingMBR.h.cpp ]
    : <src!bin!writembr>MBR.h ;

(Please check the grist on MBR.h, but I think that's the right one.)

However this isn't enough yet, because it would look for MBR.h in the
current directory, and that's not where it's located. So you first need
to tell Jam where to find that file:

LOCATE on [ FGristFiles MBR.h ]
        = [ FDirName $(HAIKU_COMMON_PLATFORM_OBJCT_DIR) bin writembr ] ;

That is not necessary.

[...]
There are examples of generated sources and headers in src/bin/gdb/bfd
and a few other places in our build tree.

One example matching the cross-directory nature of this case better would be:

* src/tools/gensyscalls/Jamfile: Generating headers <syscalls!$(architecture)>*.h.

* src/bin/debug/strace/Jamfile, src/system/kernel/Jamfile: Including some of the headers.

CU, Ingo


Other related posts: