|
Boost-Build : |
From: Vladimir Prus (ghost_at_[hidden])
Date: 2005-11-23 11:13:03
Hi Franz,
> I have some C++ source and header files which i would like to
> 'instrument' before they are compiled. The processing is done by a
> script and the resulting files are put in an other directory:
>
> sources = [ glob org/*.cpp org/*.hpp ] ;
>
> addDumpInfo instrumented_sources : $(sources) ;
>
> exe Appl : instrumented_sources ;
Should be possible. I have a pretty contrived pipeline which compiles C files
to assembler, then instruments assembler, then done other things.
>
> I couldn't figure out how to do this with BJam V2. Can I somehow write a
> generator where source type and the target type are the same?
>
> I tried to copy and modify the install rule but had the problem, that
> when an original header file was newer than one of the original source
> files with used that header, bjam always 'instrumented' that file.
BTW, in future it's good idea to include a project on which your problem
reproduces. With this specific problem I've guessed the problem, but it might
not work the next time.
Here's the problem: in implementation of install rule, file stage.jam, rule
copy-file has this code:
new-a = [ new action $(source) : common.copy : $(properties) ] ;
local source-root = [ $(properties).get <install-source-root> ] ;
The problem is that 'actualize' method of the 'action' class has default
behaviour of getting scanner for each source target (depending on type), and
using that scanner. That's a bug, it was supposed that "install" don't scan
header dependencies.
The fix and a test are in CVS now. I attach a patch for your reference -- I
hope you'll be able to adjust your own code to avoid reinstrumentation when
header changes.
Thanks,
Volodya
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