[openbeos] Re: need help with jam

  • From: Ingo Weinhold <bonefish@xxxxxxxxxxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Fri, 04 Jun 2004 00:28:25 +0200

On 2004-06-03 at 12:07:35 [+0200], Jérome DUVAL wrote:
> 
> i'm trying to build gnu bash using jam and i have little problems.
> 
> there is a build tool named 'mkbuiltins' which is built with a BinCommand
> rule and it builds successfully.
> This build tool is used to compile .def files to .c files.
> 
> I tried to add the following to the Jamfile (based on the rc stuff in
> Jamrules) to have .def files compiled to .c files :
> 
> BinCommand mkbuiltins : mkbuiltins.c
> 
> rule MkBuiltinsComp
> {
> # MkBuiltins <c file> : <def file> ;
> #
> # <c file> and <def file> must be gristed.
> SetupObjectsDir ;
> SEARCH on $(2) += $(SEARCH_SOURCE) ;
> MakeLocate $(1) : $(LOCATE_TARGET) ;
> Depends $(1) : $(2) mkbuiltins ;
> LocalClean clean : $(1) ;
> MkBuiltins1 $(1) : mkbuiltins $(2) ;
> }
> 
> actions MkBuiltins1
> {
> $(2[1]) -o $(1) $(2[2-])
> }
> 
> MkBuiltinsComp kill.c : kill.def ;
> 
> Did i miss something ? How can debug things ?

In principle it looks quite OK. As Andrew already wrote, it would be 
helpful, if you gave a bit more info what exactly your problem is. 

Regarding debugging, that's not so simple. If you suspect a problem with 
dependencies, you can run jam with the `-d3' option, which prints the 
dependency tree. `-d5' additionally gives you a rule processing trace, 
which, due to the size of our build system, is huge.

> Do i need to grist kill.c and kill.def somewhere ? How to do this btw ?

Given the comment in your rule, you need apparently to grist the 
parameters. :-P

Grist is used to make create globally unique target identifiers. Most rules 
that come with jam (like Main) automatically add grist to source file 
names. So, if in your example you feed `kill.c' to such a rule, it will 
actually try to find something like `<src!...>kill.c', while, as you use it 
now,  MkBuiltinsComp generates `kill.c'. Hence there's a good chance that 
things won't work properly. You either have to add grist to the parameter 
you pass to the rule MkBuiltinsComp or you let the rule itself add the 
grist, which make the invocations look less ugly. The second parameter 
doesn't necessarily need grist, but it doesn't harm to add it. The rule 
would thus read:

rule MkBuiltinsComp
{
        # MkBuiltinsComp <c file> : <def file> ;
        #
        # The rule adds grist to <c file> and <def file>.
        #
        local cFile = [ FGristFiles $(1) ] ;
        local defFile = [ FGristFiles $(2) ] ;

        SetupObjectsDir ;
        SEARCH on $(defFile) += $(SEARCH_SOURCE) ;
        MakeLocate $(cFile) : $(LOCATE_SOURCE) ;
        Depends $(cFile) : $(defFile) mkbuiltins ;
        LocalClean clean : $(cFile) ;
        MkBuiltinsComp1 $(cFile) : mkbuiltins $(defFile) ;
}

> Additionally, i'd need to have the build tool 'mkbuiltins' not present in
> the distro folder. In fact, it is only used as a bash build tool.

Although that's not so nice, you can just insert a

        MakeLocate mkbuiltins : $(LOCATE_TARGET) ;

after the BinCommand invocation, which will place the file in `objects/...' 
instead.

CU, Ingo

Other related posts: