From f09feade03d21831c1aebf878d716099efbdf656 Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Sat, 6 Jan 2007 16:16:38 +0000 Subject: [PATCH] Merge docs from HEAD [SVN r36618] --- doc/src/tasks.xml | 57 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 43 insertions(+), 14 deletions(-) diff --git a/doc/src/tasks.xml b/doc/src/tasks.xml index c4d06b0f9..131ecdfbe 100644 --- a/doc/src/tasks.xml +++ b/doc/src/tasks.xml @@ -403,13 +403,27 @@ unit-test helpers_test
- Raw commands: 'make' and 'notfile' + Custom commands - Sometimes, the builtin target types are not enough, and you - want Boost.Build to just run specific commands. There are two main - target rules that make it possible: make - and notfile. - + When you use most of main target rules, Boost.Build automatically + figures what commands to run and it what order. As soon as you want + to use new file types, or support new tools, one approach is to + extend Boost.Build to smoothly support them, as documented in + . However, if there's a single + place where the new tool is used, it might be easier to just + explicitly specify the commands to run. + + Three main target rules can be used for that. The + make rule allows you to construct + a single file from any number of source file, by running a + command you specify. The notfile rule + allows you to run an arbitrary command, without creating any files. + Finaly, the generate rule allows you + to describe transformation using Boost.Build's virtual targets. + This is higher-level than file names that the make rule operates with, + and allows you to create more than one target, or create differently + named targets depending on properties, or use more than one + tool. The make rule is used when you want to create one file from a number of sources using some specific command. @@ -434,14 +448,6 @@ make file.out : file.in : @in2out ; see . - - - The make rule is useful to express custom - transformation that are used just once or twice in your project. For - transformations that are used often, you are advised to declare - new generator, as described in . - - It could be that you just want to run some command unconditionally, @@ -458,6 +464,29 @@ actions echo that the name of the target is not considered a name of a file, so Boost.Build will unconditionally run the action. + + The generate rule is used when + you want to express transformations using Boost.Build's virtual targets, + as opposed to just filenames. The generate + rule has the standard main target rule signature, but you are required + to specify the generating-rule property. The value + of the property should be in the form + @rule-name and the named + rule should have the following signature: + +rule generating-rule ( project name : property-set : sources * ) + + and will be called with an instance of the project-target + class, the name of the main target, an instance of the + property-set class containing build properties, + and the list of instances of the virtual-target class + corresponding to sources. + The rule must return a list of virtual-target instances. + The interface of the virtual-target class can be learned + by looking at the build/virtual-target.jam file. + The generate example in Boost.Build distribution + illustrates how the generate rule can be used. +