Boost logo

Boost-Build :

From: Jurko Gospodnetić (jurko.gospodnetic_at_[hidden])
Date: 2008-05-22 12:19:29


   Hi Divye.

> I was just looking for a way to run a python script before and
> after building a target. As it was a one time job, I had a look at
> http://www.boost.org/doc/tools/build/doc/html/bbv2/builtins/raw.html
> on the recommendation of Darren Garvy on the cpp-netlib list. However,
> the notfile rule doesn't seem built in and I haven't been able to find
> any working example of this anywhere else.
> Am I missing something as I still on the learning curve with this tool?

   notfile rule is implemented in the tools/notfile.jam script which you
need to import first.

   Here's a working Jamroot.jam example:

import notfile ;
notfile aaa : @my-action ;
actions my-action { echo "Halelya!" }

> Also, is there any other way to just ask for the execution of a python
> script (or any shell command) at specific points in the build process?

   Errr... and how would you define that 'specific point'? Boost Build
only knows about targets, dependencies and actions needing to be invoked
for those targets to be considered built... and it uses that information
to build all the requested targets.

   If you want some action done you need to either embed it inside some
existing target's build action or you need to add a new target whose
target does what you want and insert it at the appropriate location in
the dependency tree.

   notfile rule actually creates a new top-level target whose action
does what you want. You can now set that as a source dependency for some
other target B in case you want your action executed before building
target B. You can also set some other target A as a source for your
notfile target to get that target A built before executing your custom
action. To do that simply list A as the third parameter to the notfile
rule, as in 'notfile aaa : @my-action : A ;'.

   Hope this helps.

   Best regards,
     Jurko Gospodnetić


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