Boost logo

Boost-Build :

From: Reece Dunn (msclrhd_at_[hidden])
Date: 2005-11-08 02:48:27


Schnyder Franz wrote:
>> What you want is CPP -> LST -> OBJ and C -> LST -> OBJ, correct? When
>> compiling a C file with VxWorks, I'm assuming you don't need to "munch"
>> it. If so, why don't you have C -> OBJ as normal, and
>
> No not exactly, sorry I did explain ist very precise in my fist mail.
>
> So I created the the composing list rule 'OBJ -> LST' which collects all
> Objects and since muching doesn't care if there are also Objects from C
> files in the list I just added all objects. Then created the munch rule
> 'LST -> C'. I compiled the resulting file and then linked all the
> objects from the lst file and the additional object from the munching
> into an "executable".

Ok. I think I understand now. With what you have above, you are going to
run into problems because you have:

    CPP -> LST -> OBJ
    C ---/ \-> C -> OBJ
                   ^^^^^^^^ ambiguity here

So, now IIUC VxWorks needs to compile a C++ program into C code and C
code can be compiled into object form, so you have:

    generators.register-standard vxworks.compile.c++
       : CPP : C : <toolset>vxworks ; # C++ -> C
    generators.register-standard vxworks.compile.c++
       : C : OBJ : <toolset>vxworks ; # C -> OBJ

Now you have a set of object files that need munching. You can use a
standard link generator/rule, but instead of...

action link
{
    linker <object-files> output
}

...you will have...

action link
{
    @($(STDOUT):E=$(nl)"$(>)") > "$(<[1]).lst"
    munch "$(<[1]).lst" "$(<[1])_munched.c"
    compile "$(<[1])_munched.c"
    link "$(>)" "$(<[1])_munched.obj"
}

where line:
1 -- generate the list file from the object file inputs;
2 -- munch that list into a C file;
3 -- compile the munch file;
4 -- link in the object files with the munchable file.

This way, you break the ambiguity, but still do the munching.

HTH,
- Reece

 


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk