diff --git a/boost_build_v2.html b/boost_build_v2.html index 1e3060aaf..75ecd7398 100644 --- a/boost_build_v2.html +++ b/boost_build_v2.html @@ -22,12 +22,12 @@ div.alert { color: red } table { align: center; border: thin; } - + + - build request, build request expansion and directly requested targets + - conditional properties + -->
It is slighly better way is to copy new/user-config.jam
+ into one of the locations where it can be found (given in this table). This prevent you from
+ accidentally overwriting your config when updating.
-
-
+
+
- This document
-
-
Other documents
+
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
Installation
@@ -138,12 +178,12 @@
bjam there. A simple application will be built. You can also
play with other projects in examples-v2.
+ it somewhere.
+
+
Main target is a user-defined named entity + which can be build, for example a named executable file. Declaring a main + target is usually done using one of main + target rules. The user can also declare custom main target rules.
+ +Most main targets rules in Boost.Build use similiar syntax:
++ rule-name main-target-name + : sources + : requirements + : default-build + : usage-requirements + ; + ++ +
Some main target rules have shorter list of parameters, and you should + consult their documentation for details.
+ +Building of the same main target can differ greatly from platform to + platform. For example, you might have different list of sources for + different compilers. Therefore it is possible to invoke main target rules + several times for a single main target. For example:
++ exe a : a_gcc.cpp : <toolset> ; + exe a : a.cpp ; ++ Each call to the 'exe' rule defines a new main target + alternative for the main target a. In this case, the first + alternative will be used for the gcc toolset, while the second + alternative will be used in other cases. TODO: document the exact + selection method under "Build process" below. + +
Sometime a main target is really needed only by some other main + target. E.g. a rule that declared test-suite uses a main target that + represent test, but those main targets are rarely needed by themself.
+ +It possible to declare target inline, i.e. the "sources" parameter may + include call to other main rules. For example:
++ exe hello : hello.cpp + [ obj helpers : helpers.cpp : <optimization>off ] ; + ++ Will cause "helpers.cpp" to be always compiled without optimization. It's + possible to request main targets declared inline, but since they are + considered local, they are renamed to + "parent-main-target_name..main-target-name". In the example above, to + build only helpers, one should run "bjam hello..helpers". + +
Boost.Build considers every software it build as organized into + projects — modules which declare targets. Projects are + organized in a hierarchical structure, so each project may have a single + parent project and a number of subprojects.
+ +Most often, projects are created as result of loading Jamfile + — files which are specially meant to describe projects. Boost.Build + will implicitly load Jamfile in the invocation directory, and all + Jamfiles referred by the first one, creating the hierarchy of + projects.
+ +The exact name of file that describes project is configurable. By + default, it's Jamfile, but can be changed by setting global + variables JAMFILE, for example in boost-build.jam file. + The value of the variable is a list of regex patterns that are used when + searching for Jamfile in a directory.
+ +Every Boost.Build modules can decide to act as project and be able to + declare targets. For example, the site-config.jam module can + declare libraries available on a given host, as described here.
+ +There are three things that can be put in Jamfile: declarations of + main targets, calls to a number of predefined rules, and arbitrary user + code. The predefined rules are listed below:
+ +| Rule | + +Semantic | +
|---|---|
| project | + +Define project attributes. | +
| use-project | + +Make another project known. | +
| build-project | + +Build another project when this one is built. | +
| explicit | + +States that the target should be built only by explicit + request. | +
Each project is also associated with project root. That's a + root for a tree of projects, which specifies some global properties.
+ +To facilitate declaration of simple projects, Jamfile and project-root + can be merged together. To achieve this effect, the project root file + should call the project rule. The semantic is precisely the same + as if the call was made in Jamfile, except that project-root.jam will + start serve as Jamfile. The Jamfile in the directory of project-root.jam + will be ignored, and project-root.jam will be able to declare main + targets as usual.
+ +For each project, there are several attributes.
+ +Project id is a short way to denote a project, as opposed to + the Jamfile's pathname. It is a hierarchical path, unrelated to + filesystem, such as "boost/thread". Target + references make use of project ids to specify a target.
+ +Source location specifies the directory where sources for the + project are located.
+ +Project requirements are requirements that apply to all the + targets in the projects as well as all subprojects.
+ +Default build is the build request that should be used when + no build request is specified explicitly.
+ +The default values for those attributes are given in + the table below. In order to affect them, Jamfile may call the + project rule. The rule has this syntax:
++ project id : <attributes> ; + ++ Here, attributes is a sequence of (attribute-name, attribute-value) + pairs. The list of attribute names along with its handling is also shown + in the table below. For example, it it possible to write: +
+ project tennis + : requirements <threading>multi + : default-build release + ; + ++ +
| Attribute | + +Name for the 'project' rule | + +Default value | + +Handling by the 'project' rule | +
|---|---|---|---|
| Project id | + +none | + +none | + +Assigned from the first parameter of the 'project' rule. It is + assumed to denote absolute project id. | +
| Source location | + +source-location | + +The location of jamfile for the project | + +Sets to the passed value | +
| Requirements | + +requirements | + +The parent's requirements | + +The parent's requirements are refined with the passed requirement + and the result is used as the project requirements. | +
| Default build | + +default-build | + +none | + +Sets to the passed value | +
| Build directory | + +build-dir | + +If parent has a build dir set, the value of it, joined with the + relative path from parent to the current project. Otherwise, + empty | + +Sets to the passed value, interpreted as relative to the + project's location. | +
There are three kinds of project relationships.
+ +First is parent-child. This relationship is established implicitly: + parent directories of a project are searched, and the first found Jamfile + is assumed to define the parent project. The parent-child relationship + affects only attribute values for the child project.
+ +Second is build relationship. Some project may + request to recursively build other projects. Those project need not be + child projects. The build-project rule is used for that:
++ build-project src ; ++ +
The third kind is the 'use' relationship. In + means that one project uses targets from another. It is possible to just + refer to target in other projects using target id. However, if target id + uses project id, it is required that the project id is known. The + use-project rule is employed to guarantee that.
++ use-project ( id : location ) + ++ It loads the project at the specified location, which makes its project + id available in the project which invokes the rule. It is required that + the id parameter passed to the use-project rule be + equal to the id that the loaded project declared. At this moment, the + id paremeter should be absolute project id. + +
Target identifier is used to denote a target. There are two + syntaxes for it. First is the preferred one, described below. The second + is older syntax, which is retained to backward compatibility reasons, but + will be removed in a future release. It is not documented
+ +The current syntax is
++ target-id -> (project-id | target-name | file-name ) + | (project-id | directory-name) "//" target-name + project-id -> path + target-name -> path + file-name -> path + directory-name -> path ++ This grammar allows some elements to be recognized as either + +
+ a -- target in current project + lib/b.cpp -- regular file + /boost/thread -- project "/boost/thread" + /home/ghost/build/lr_library//parser -- target in specific project ++ +
Rationale:Target is separated from project by special separator + (not just slash), because:
+ +Target reference is used to specify a + source target, and may additionally specify desired properties for that + target. It has this syntax:
++ target-reference -> target-id [ "/" requested-properties ] + requested-properties -> property-path ++ For example, +
+ exe compiler : compiler.cpp libs/cmdline/<optimization>space ; ++ would cause the version of cmdline library, optimized for space, + to be linked in even if the compiler executable is build with + optimization for speed. +
Boost.Build considers every software it build as organized into - projects — modules which declare targets. Projects are - organized in a hierarchical structure, so each project may have a single - parent project and a number of subprojects.
- -Most often, projects are created as result of loading Jamfile - — files which are specially meant to describe projects. Boost.Build - will implicitly load Jamfile in the invocation directory, and all - Jamfiles referred by the first one, creating the hierarchy of - projects.
- -The exact name of file that describes project is configurable. By - default, it's Jamfile, but can be changed by setting global - variables JAMFILE, for example in boost-build.jam file. - The value of the variable is a list of regex patterns that are used when - searching for Jamfile in a directory.
- -Every Boost.Build modules can decide to act as project and be able to - declare targets. For example, the site-config.jam module can - declare libraries available on a given host, as described here.
- -There are three things that can be put in Jamfile: declarations of - main targets, calls to a number of predefined rules, and arbitrary user - code. The predefined rules are listed below:
- -| Rule | - -Semantic | -
|---|---|
| project | - -Define project attributes. | -
| use-project | - -Make another project known. | -
| build-project | - -Build another project when this one is built. | -
| explicit | - -States that the target should be built only by explicit - request. | -
Each project is also associated with project root. That's a - root for a tree of projects, which specifies some global properties.
- -To facilitate declaration of simple projects, Jamfile and project-root - can be merged together. To achieve this effect, the project root file - should call the project rule. The semantic is precisely the same - as if the call was made in Jamfile, except that project-root.jam will - start serve as Jamfile. The Jamfile in the directory of project-root.jam - will be ignored, and project-root.jam will be able to declare main - targets as usual.
- -For each project, there are several attributes.
- -Project id is a short way to denote a project, as opposed to - the Jamfile's pathname. It is a hierarchical path, unrelated to - filesystem, such as "boost/thread". Target - references make use of project ids to specify a target.
- -Source location specifies the directory where sources for the - project are located.
- -Project requirements are requirements that apply to all the - targets in the projects as well as all subprojects.
- -Default build is the build request that should be used when - no build request is specified explicitly.
- -The default values for those attributes are given in - the table below. In order to affect them, Jamfile may call the - project rule. The rule has this syntax:
-- project id : <attributes> ; - -- Here, attributes is a sequence of (attribute-name, attribute-value) - pairs. The list of attribute names along with its handling is also shown - in the table below. For example, it it possible to write: -
- project tennis - : requirements <threading>multi - : default-build release - ; - -- -
| Attribute | - -Name for the 'project' rule | - -Default value | - -Handling by the 'project' rule | -
|---|---|---|---|
| Project id | - -none | - -none | - -Assigned from the first parameter of the 'project' rule. It is - assumed to denote absolute project id. | -
| Source location | - -source-location | - -The location of jamfile for the project | - -Sets to the passed value | -
| Requirements | - -requirements | - -The parent's requirements | - -The parent's requirements are refined with the passed requirement - and the result is used as the project requirements. | -
| Default build | - -default-build | - -none | - -Sets to the passed value | -
| Build directory | - -build-dir | - -If parent has a build dir set, the value of it, joined with the - relative path from parent to the current project. Otherwise, - empty | - -Sets to the passed value, interpreted as relative to the - project's location. | -
There are three kinds of project relationships.
- -First is parent-child. This relationship is established implicitly: - parent directories of a project are searched, and the first found Jamfile - is assumed to define the parent project. The parent-child relationship - affects only attribute values for the child project.
- -Second is build relationship. Some project may - request to recursively build other projects. Those project need not be - child projects. The build-project rule is used for that:
-- build-project src ; -- -
The third kind is the 'use' relationship. In - means that one project uses targets from another. It is possible to just - refer to target in other projects using target id. However, if target id - uses project id, it is required that the project id is known. The - use-project rule is employed to guarantee that.
-- use-project ( id : location ) - -- It loads the project at the specified location, which makes its project - id available in the project which invokes the rule. It is required that - the id parameter passed to the use-project rule be - equal to the id that the loaded project declared. At this moment, the - id paremeter should be absolute project id. - -
There are two user-visible kinds of targets in Boost.Build. First are - "abstract" — they correspond to things declared by user, for - example, projects and executable files. The primary thing about abstract - target is that it's possible to request them to be build with a - particular values of some properties. Each combination of properties may - possible yield different set of real file, so abstract target do not have - a direct correspondence with files.
- -File targets, on the contary, are associated with concrete files. - Dependency graphs for abstract targets with specific properties are - constructed from file targets. User has no was to create file targets, - however it can specify rules that detect file type for sources, and also - rules for transforming between file targets of different types. That - information is used in constructing dependency graph, as desribed in the - next section. Note:File targets are not - the same as targets in Jam sense; the latter are created from file - targets at the latest possible moment. Note:"File target" is a - proposed name for what we call virtual targets. It it more understandable - by users, but has one problem: virtual targets can potentially be - "phony", and not correspond to any file.
- -Main target is a named entity which can be - build, for example a named executable file. To declare a main target, - user invokes some of the main target - rules, passing it things like list of sources and requirements.
- -It is possible to have different list of sources for different - toolsets, therefore it is possible to invoke main target rules several - times for a single main target. For example:
-- exe a : a_gcc.cpp : <toolset> ; - exe a : a.cpp ; -- Each call to the 'exe' rule defines a new main target - alternative for the main target a.exe. In this case, the - first alternative will be used for the gcc toolset, while the - second alternative will be used in other cases. TODO: document the exact - selection method under "Build process" below. - -
Target identifier is used to denote a target. There are two - syntaxes for it. First is the preferred one, described below. The second - is older syntax, which is retained to backward compatibility reasons, but - will be removed in a future release. It is not documented
- -The current syntax is
-- target-id -> (project-id | target-name | file-name ) - | (project-id | directory-name) "//" target-name - project-id -> path - target-name -> path - file-name -> path - directory-name -> path -- This grammar allows some elements to be recognized as either - -
- a -- target in current project - lib/b.cpp -- regular file - /boost/thread -- project "/boost/thread" - /home/ghost/build/lr_library//parser -- target in specific project -- -
Rationale:Target is separated from project by special separator - (not just slash), because:
- -Target reference is used to specify a - source target, and may additionally specify desired properties for that - target. It has this syntax:
-- target-reference -> target-id [ "/" requested-properties ] - requested-properties -> property-path -- For example, -
- exe compiler : compiler.cpp libs/cmdline/<optimization>space ; -- would cause the version of cmdline library, optimized for space, - to be linked in even if the compiler executable is build with - optimization for speed. - -
To distinguish targets build with different properties, they are put - in different directories. Rules for determining target paths are given - below:
- -For example, we might have these paths:
-- debug/optimization-off - debug/main-target-a - --
Last modified: June 16, 2003
+Last modified: Jule 3, 2003
© Copyright Vladimir Prus 2002-2003. Permission to copy, use, modify, sell and distribute this document is granted provided this diff --git a/doc/architecture.html b/doc/architecture.html index 4a32a6f66..bf00cae21 100644 --- a/doc/architecture.html +++ b/doc/architecture.html @@ -21,12 +21,12 @@ br.clear { clear: left } div.alert { color: red } table { align: center; border: thin; } - + + - build request, build request expansion and directly requested targets + - conditional properties + -->
This document is work-in progress. Don't expect much from it
+ yet. There are two user-visible kinds of targets in Boost.Build. First are
+ "abstract" — they correspond to things declared by user, for
+ example, projects and executable files. The primary thing about abstract
+ target is that it's possible to request them to be build with a
+ particular values of some properties. Each combination of properties may
+ possible yield different set of real file, so abstract target do not have
+ a direct correspondence with files. File targets, on the contary, are associated with concrete files.
+ Dependency graphs for abstract targets with specific properties are
+ constructed from file targets. User has no was to create file targets,
+ however it can specify rules that detect file type for sources, and also
+ rules for transforming between file targets of different types. That
+ information is used in constructing dependency graph, as desribed in the
+ next section. Note:File targets are not
+ the same as targets in Jam sense; the latter are created from file
+ targets at the latest possible moment. Note:"File target" is a
+ proposed name for what we call virtual targets. It it more understandable
+ by users, but has one problem: virtual targets can potentially be
+ "phony", and not correspond to any file. Dependency scanning is the process of finding implicit dependencies
@@ -208,6 +236,58 @@
bound via LOCATE_TARGET to "build" and we'll call INCLUDE on that found
target, instread of creating a completely unrelated one.
+
+
+
+ Targets
+
+ Dependency scanning
File targets
+ As described above, file targets corresponds to files that Boost.Build
+ manages. User's may be concerned about file targets in three ways: when
+ declaring file target types, when declaring transformations between
+ types, and when determining where file target will be placed. File
+ targets can also be connected with actions, that determine how the target
+ is created. Both file targets and actions are implemented in the
+ virtual-target module.
+
+ Types
+ A file target can be given a file, which determines what transformations
+ can be applied to the file. The type.register rule declares new
+ types. File type can also be assigned a scanner, which is used to find
+ implicit dependencies. See dependency
+ scanning below.
+
+
To distinguish targets build with different properties, they are put + in different directories. Rules for determining target paths are given + below:
+ +For example, we might have these paths:
++ debug/optimization-off + debug/main-target-a + +
Last modified: June 30, 2003
diff --git a/doc/extending.html b/doc/extending.html new file mode 100644 index 000000000..84749a524 --- /dev/null +++ b/doc/extending.html @@ -0,0 +1,154 @@ + + + + + + + + + +This document explains how to extend Boost.Build to accomodate your + local requirements. Let's start with quite simple, but realistic + example.
+ +Say you're writing an application which generates C++ code. If you + ever did this, you know that it's not nice. Embedding large portions of + C++ code in string literals is very awkward. A much better solution + is:
+ +It's quite easy to archive. You write special verbatim files, which + are just C++, except that the very first line of the file gives a name of + variable that should be generated. A simple tool is created which takes + verbatim file and creates a cpp file with a single char* variable, which + name is taken from the first line of verbatim file, and which value is + properly quoted content of the verbatim file.
+ +Let's see what Boost.Build can do.
+ +First off, Boost.Build has no idea about "verbatim files". So, you + must register a new type. The following code does it:
++ import type ; + type.register VERBATIM : verbatim ; + ++ +
The first parameter to 'type.register' gives the name of declared + type. By convention, it's uppercase. The second parameter is suffix for + this type. So, if Boost.Build sees "code.verbatim" in the list of + sources, it knows that it's of type VERBATIM.
+ +Lastly, you need to tool to convert verbatim files to C++. Say you've + stetched such a tool in Python. Then, you have to inform Boost.Build + about the tool. The Boost.Build concept which represent tool is + generator.
+ +First, you say that generator 'inline-file' is able to convert + VERBATIM type into C++:
++ import generators ; + generators.register-standard verbatim.inline-file : VERBATIM : CPP ; + ++ +
Second, you must specify the commands to be run to actually perform + convertion:
+
+ actions inline-file
+ {
+ ./inline-file.py $(<) $(>)
+ }
+
+
+
+
+ Now, we're ready to tie it all together. Put all the code above in + file "verbatim.jam", add "import verbatim ;" to "project-root.jam", and + it's possible to write the following in Jamfile:
++ exe codegen : codegen.cpp class_template.verbatim usage.verbatim ; + ++ The verbatim files will be automatically converted into C++ and linked + it. + +
The complete code is available in examples-v2/customization + directory.
+ +Last modified: Jule 3, 2003
+ +© Copyright Vladimir Prus 2002-2003. Permission to copy, use, + modify, sell and distribute this document is granted provided this + copyright notice appears in all copies. This document is provided ``as + is'' without express or implied warranty, and with no claim as to its + suitability for any purpose.
+ + + + diff --git a/doc/tools.html b/doc/tools.html index 907abe68b..a24a601c0 100644 --- a/doc/tools.html +++ b/doc/tools.html @@ -3,7 +3,7 @@ + "HTML Tidy for Linux/x86 (vers 1st April 2002), see www.w3.org"> @@ -14,52 +14,66 @@
-
- The following compilers pass Boost.Build tests: -
The following compilers pass Boost.Build tests:
+ +Some important libraries have special support in Boost.Build: +
Some important libraries have special support in Boost.Build:
-© Copyright Vladimir Prus 2003. Permission to - copy, use, modify, sell and distribute this document is granted provided - this copyright notice appears in all copies. This document is provided - "as is" without express or implied warranty, and with no claim as to its - suitability for any purpose.
+© Copyright Vladimir Prus 2003. Permission to copy, use, modify, + sell and distribute this document is granted provided this copyright + notice appears in all copies. This document is provided "as is" without + express or implied warranty, and with no claim as to its suitability for + any purpose.
Revised 26 Apr, 2003 + -->Jule 3, 2003 + -->
diff --git a/v2/boost_build_v2.html b/v2/boost_build_v2.html index 1e3060aaf..75ecd7398 100644 --- a/v2/boost_build_v2.html +++ b/v2/boost_build_v2.html @@ -22,12 +22,12 @@ div.alert { color: red } table { align: center; border: thin; } - + + - build request, build request expansion and directly requested targets + - conditional properties + -->It is slighly better way is to copy new/user-config.jam
+ into one of the locations where it can be found (given in this table). This prevent you from
+ accidentally overwriting your config when updating.
-
-
+
+
- This document
-
-
Other documents
+
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
Installation
@@ -138,12 +178,12 @@
bjam there. A simple application will be built. You can also
play with other projects in examples-v2.
+ it somewhere.
+
+
Main target is a user-defined named entity + which can be build, for example a named executable file. Declaring a main + target is usually done using one of main + target rules. The user can also declare custom main target rules.
+ +Most main targets rules in Boost.Build use similiar syntax:
++ rule-name main-target-name + : sources + : requirements + : default-build + : usage-requirements + ; + ++ +
Some main target rules have shorter list of parameters, and you should + consult their documentation for details.
+ +Building of the same main target can differ greatly from platform to + platform. For example, you might have different list of sources for + different compilers. Therefore it is possible to invoke main target rules + several times for a single main target. For example:
++ exe a : a_gcc.cpp : <toolset> ; + exe a : a.cpp ; ++ Each call to the 'exe' rule defines a new main target + alternative for the main target a. In this case, the first + alternative will be used for the gcc toolset, while the second + alternative will be used in other cases. TODO: document the exact + selection method under "Build process" below. + +
Sometime a main target is really needed only by some other main + target. E.g. a rule that declared test-suite uses a main target that + represent test, but those main targets are rarely needed by themself.
+ +It possible to declare target inline, i.e. the "sources" parameter may + include call to other main rules. For example:
++ exe hello : hello.cpp + [ obj helpers : helpers.cpp : <optimization>off ] ; + ++ Will cause "helpers.cpp" to be always compiled without optimization. It's + possible to request main targets declared inline, but since they are + considered local, they are renamed to + "parent-main-target_name..main-target-name". In the example above, to + build only helpers, one should run "bjam hello..helpers". + +
Boost.Build considers every software it build as organized into + projects — modules which declare targets. Projects are + organized in a hierarchical structure, so each project may have a single + parent project and a number of subprojects.
+ +Most often, projects are created as result of loading Jamfile + — files which are specially meant to describe projects. Boost.Build + will implicitly load Jamfile in the invocation directory, and all + Jamfiles referred by the first one, creating the hierarchy of + projects.
+ +The exact name of file that describes project is configurable. By + default, it's Jamfile, but can be changed by setting global + variables JAMFILE, for example in boost-build.jam file. + The value of the variable is a list of regex patterns that are used when + searching for Jamfile in a directory.
+ +Every Boost.Build modules can decide to act as project and be able to + declare targets. For example, the site-config.jam module can + declare libraries available on a given host, as described here.
+ +There are three things that can be put in Jamfile: declarations of + main targets, calls to a number of predefined rules, and arbitrary user + code. The predefined rules are listed below:
+ +| Rule | + +Semantic | +
|---|---|
| project | + +Define project attributes. | +
| use-project | + +Make another project known. | +
| build-project | + +Build another project when this one is built. | +
| explicit | + +States that the target should be built only by explicit + request. | +
Each project is also associated with project root. That's a + root for a tree of projects, which specifies some global properties.
+ +To facilitate declaration of simple projects, Jamfile and project-root + can be merged together. To achieve this effect, the project root file + should call the project rule. The semantic is precisely the same + as if the call was made in Jamfile, except that project-root.jam will + start serve as Jamfile. The Jamfile in the directory of project-root.jam + will be ignored, and project-root.jam will be able to declare main + targets as usual.
+ +For each project, there are several attributes.
+ +Project id is a short way to denote a project, as opposed to + the Jamfile's pathname. It is a hierarchical path, unrelated to + filesystem, such as "boost/thread". Target + references make use of project ids to specify a target.
+ +Source location specifies the directory where sources for the + project are located.
+ +Project requirements are requirements that apply to all the + targets in the projects as well as all subprojects.
+ +Default build is the build request that should be used when + no build request is specified explicitly.
+ +The default values for those attributes are given in + the table below. In order to affect them, Jamfile may call the + project rule. The rule has this syntax:
++ project id : <attributes> ; + ++ Here, attributes is a sequence of (attribute-name, attribute-value) + pairs. The list of attribute names along with its handling is also shown + in the table below. For example, it it possible to write: +
+ project tennis + : requirements <threading>multi + : default-build release + ; + ++ +
| Attribute | + +Name for the 'project' rule | + +Default value | + +Handling by the 'project' rule | +
|---|---|---|---|
| Project id | + +none | + +none | + +Assigned from the first parameter of the 'project' rule. It is + assumed to denote absolute project id. | +
| Source location | + +source-location | + +The location of jamfile for the project | + +Sets to the passed value | +
| Requirements | + +requirements | + +The parent's requirements | + +The parent's requirements are refined with the passed requirement + and the result is used as the project requirements. | +
| Default build | + +default-build | + +none | + +Sets to the passed value | +
| Build directory | + +build-dir | + +If parent has a build dir set, the value of it, joined with the + relative path from parent to the current project. Otherwise, + empty | + +Sets to the passed value, interpreted as relative to the + project's location. | +
There are three kinds of project relationships.
+ +First is parent-child. This relationship is established implicitly: + parent directories of a project are searched, and the first found Jamfile + is assumed to define the parent project. The parent-child relationship + affects only attribute values for the child project.
+ +Second is build relationship. Some project may + request to recursively build other projects. Those project need not be + child projects. The build-project rule is used for that:
++ build-project src ; ++ +
The third kind is the 'use' relationship. In + means that one project uses targets from another. It is possible to just + refer to target in other projects using target id. However, if target id + uses project id, it is required that the project id is known. The + use-project rule is employed to guarantee that.
++ use-project ( id : location ) + ++ It loads the project at the specified location, which makes its project + id available in the project which invokes the rule. It is required that + the id parameter passed to the use-project rule be + equal to the id that the loaded project declared. At this moment, the + id paremeter should be absolute project id. + +
Target identifier is used to denote a target. There are two + syntaxes for it. First is the preferred one, described below. The second + is older syntax, which is retained to backward compatibility reasons, but + will be removed in a future release. It is not documented
+ +The current syntax is
++ target-id -> (project-id | target-name | file-name ) + | (project-id | directory-name) "//" target-name + project-id -> path + target-name -> path + file-name -> path + directory-name -> path ++ This grammar allows some elements to be recognized as either + +
+ a -- target in current project + lib/b.cpp -- regular file + /boost/thread -- project "/boost/thread" + /home/ghost/build/lr_library//parser -- target in specific project ++ +
Rationale:Target is separated from project by special separator + (not just slash), because:
+ +Target reference is used to specify a + source target, and may additionally specify desired properties for that + target. It has this syntax:
++ target-reference -> target-id [ "/" requested-properties ] + requested-properties -> property-path ++ For example, +
+ exe compiler : compiler.cpp libs/cmdline/<optimization>space ; ++ would cause the version of cmdline library, optimized for space, + to be linked in even if the compiler executable is build with + optimization for speed. +
Boost.Build considers every software it build as organized into - projects — modules which declare targets. Projects are - organized in a hierarchical structure, so each project may have a single - parent project and a number of subprojects.
- -Most often, projects are created as result of loading Jamfile - — files which are specially meant to describe projects. Boost.Build - will implicitly load Jamfile in the invocation directory, and all - Jamfiles referred by the first one, creating the hierarchy of - projects.
- -The exact name of file that describes project is configurable. By - default, it's Jamfile, but can be changed by setting global - variables JAMFILE, for example in boost-build.jam file. - The value of the variable is a list of regex patterns that are used when - searching for Jamfile in a directory.
- -Every Boost.Build modules can decide to act as project and be able to - declare targets. For example, the site-config.jam module can - declare libraries available on a given host, as described here.
- -There are three things that can be put in Jamfile: declarations of - main targets, calls to a number of predefined rules, and arbitrary user - code. The predefined rules are listed below:
- -| Rule | - -Semantic | -
|---|---|
| project | - -Define project attributes. | -
| use-project | - -Make another project known. | -
| build-project | - -Build another project when this one is built. | -
| explicit | - -States that the target should be built only by explicit - request. | -
Each project is also associated with project root. That's a - root for a tree of projects, which specifies some global properties.
- -To facilitate declaration of simple projects, Jamfile and project-root - can be merged together. To achieve this effect, the project root file - should call the project rule. The semantic is precisely the same - as if the call was made in Jamfile, except that project-root.jam will - start serve as Jamfile. The Jamfile in the directory of project-root.jam - will be ignored, and project-root.jam will be able to declare main - targets as usual.
- -For each project, there are several attributes.
- -Project id is a short way to denote a project, as opposed to - the Jamfile's pathname. It is a hierarchical path, unrelated to - filesystem, such as "boost/thread". Target - references make use of project ids to specify a target.
- -Source location specifies the directory where sources for the - project are located.
- -Project requirements are requirements that apply to all the - targets in the projects as well as all subprojects.
- -Default build is the build request that should be used when - no build request is specified explicitly.
- -The default values for those attributes are given in - the table below. In order to affect them, Jamfile may call the - project rule. The rule has this syntax:
-- project id : <attributes> ; - -- Here, attributes is a sequence of (attribute-name, attribute-value) - pairs. The list of attribute names along with its handling is also shown - in the table below. For example, it it possible to write: -
- project tennis - : requirements <threading>multi - : default-build release - ; - -- -
| Attribute | - -Name for the 'project' rule | - -Default value | - -Handling by the 'project' rule | -
|---|---|---|---|
| Project id | - -none | - -none | - -Assigned from the first parameter of the 'project' rule. It is - assumed to denote absolute project id. | -
| Source location | - -source-location | - -The location of jamfile for the project | - -Sets to the passed value | -
| Requirements | - -requirements | - -The parent's requirements | - -The parent's requirements are refined with the passed requirement - and the result is used as the project requirements. | -
| Default build | - -default-build | - -none | - -Sets to the passed value | -
| Build directory | - -build-dir | - -If parent has a build dir set, the value of it, joined with the - relative path from parent to the current project. Otherwise, - empty | - -Sets to the passed value, interpreted as relative to the - project's location. | -
There are three kinds of project relationships.
- -First is parent-child. This relationship is established implicitly: - parent directories of a project are searched, and the first found Jamfile - is assumed to define the parent project. The parent-child relationship - affects only attribute values for the child project.
- -Second is build relationship. Some project may - request to recursively build other projects. Those project need not be - child projects. The build-project rule is used for that:
-- build-project src ; -- -
The third kind is the 'use' relationship. In - means that one project uses targets from another. It is possible to just - refer to target in other projects using target id. However, if target id - uses project id, it is required that the project id is known. The - use-project rule is employed to guarantee that.
-- use-project ( id : location ) - -- It loads the project at the specified location, which makes its project - id available in the project which invokes the rule. It is required that - the id parameter passed to the use-project rule be - equal to the id that the loaded project declared. At this moment, the - id paremeter should be absolute project id. - -
There are two user-visible kinds of targets in Boost.Build. First are - "abstract" — they correspond to things declared by user, for - example, projects and executable files. The primary thing about abstract - target is that it's possible to request them to be build with a - particular values of some properties. Each combination of properties may - possible yield different set of real file, so abstract target do not have - a direct correspondence with files.
- -File targets, on the contary, are associated with concrete files. - Dependency graphs for abstract targets with specific properties are - constructed from file targets. User has no was to create file targets, - however it can specify rules that detect file type for sources, and also - rules for transforming between file targets of different types. That - information is used in constructing dependency graph, as desribed in the - next section. Note:File targets are not - the same as targets in Jam sense; the latter are created from file - targets at the latest possible moment. Note:"File target" is a - proposed name for what we call virtual targets. It it more understandable - by users, but has one problem: virtual targets can potentially be - "phony", and not correspond to any file.
- -Main target is a named entity which can be - build, for example a named executable file. To declare a main target, - user invokes some of the main target - rules, passing it things like list of sources and requirements.
- -It is possible to have different list of sources for different - toolsets, therefore it is possible to invoke main target rules several - times for a single main target. For example:
-- exe a : a_gcc.cpp : <toolset> ; - exe a : a.cpp ; -- Each call to the 'exe' rule defines a new main target - alternative for the main target a.exe. In this case, the - first alternative will be used for the gcc toolset, while the - second alternative will be used in other cases. TODO: document the exact - selection method under "Build process" below. - -
Target identifier is used to denote a target. There are two - syntaxes for it. First is the preferred one, described below. The second - is older syntax, which is retained to backward compatibility reasons, but - will be removed in a future release. It is not documented
- -The current syntax is
-- target-id -> (project-id | target-name | file-name ) - | (project-id | directory-name) "//" target-name - project-id -> path - target-name -> path - file-name -> path - directory-name -> path -- This grammar allows some elements to be recognized as either - -
- a -- target in current project - lib/b.cpp -- regular file - /boost/thread -- project "/boost/thread" - /home/ghost/build/lr_library//parser -- target in specific project -- -
Rationale:Target is separated from project by special separator - (not just slash), because:
- -Target reference is used to specify a - source target, and may additionally specify desired properties for that - target. It has this syntax:
-- target-reference -> target-id [ "/" requested-properties ] - requested-properties -> property-path -- For example, -
- exe compiler : compiler.cpp libs/cmdline/<optimization>space ; -- would cause the version of cmdline library, optimized for space, - to be linked in even if the compiler executable is build with - optimization for speed. - -
To distinguish targets build with different properties, they are put - in different directories. Rules for determining target paths are given - below:
- -For example, we might have these paths:
-- debug/optimization-off - debug/main-target-a - --
Last modified: June 16, 2003
+Last modified: Jule 3, 2003
© Copyright Vladimir Prus 2002-2003. Permission to copy, use, modify, sell and distribute this document is granted provided this diff --git a/v2/doc/architecture.html b/v2/doc/architecture.html index 4a32a6f66..bf00cae21 100644 --- a/v2/doc/architecture.html +++ b/v2/doc/architecture.html @@ -21,12 +21,12 @@ br.clear { clear: left } div.alert { color: red } table { align: center; border: thin; } - + + - build request, build request expansion and directly requested targets + - conditional properties + -->
This document is work-in progress. Don't expect much from it
+ yet. There are two user-visible kinds of targets in Boost.Build. First are
+ "abstract" — they correspond to things declared by user, for
+ example, projects and executable files. The primary thing about abstract
+ target is that it's possible to request them to be build with a
+ particular values of some properties. Each combination of properties may
+ possible yield different set of real file, so abstract target do not have
+ a direct correspondence with files. File targets, on the contary, are associated with concrete files.
+ Dependency graphs for abstract targets with specific properties are
+ constructed from file targets. User has no was to create file targets,
+ however it can specify rules that detect file type for sources, and also
+ rules for transforming between file targets of different types. That
+ information is used in constructing dependency graph, as desribed in the
+ next section. Note:File targets are not
+ the same as targets in Jam sense; the latter are created from file
+ targets at the latest possible moment. Note:"File target" is a
+ proposed name for what we call virtual targets. It it more understandable
+ by users, but has one problem: virtual targets can potentially be
+ "phony", and not correspond to any file. Dependency scanning is the process of finding implicit dependencies
@@ -208,6 +236,58 @@
bound via LOCATE_TARGET to "build" and we'll call INCLUDE on that found
target, instread of creating a completely unrelated one.
+
+ Targets
+
+ Dependency scanning
To distinguish targets build with different properties, they are put + in different directories. Rules for determining target paths are given + below:
+ +For example, we might have these paths:
++ debug/optimization-off + debug/main-target-a + +
Last modified: June 30, 2003
diff --git a/v2/doc/extending.html b/v2/doc/extending.html new file mode 100644 index 000000000..84749a524 --- /dev/null +++ b/v2/doc/extending.html @@ -0,0 +1,154 @@ + + + + + + + + + +This document explains how to extend Boost.Build to accomodate your + local requirements. Let's start with quite simple, but realistic + example.
+ +Say you're writing an application which generates C++ code. If you + ever did this, you know that it's not nice. Embedding large portions of + C++ code in string literals is very awkward. A much better solution + is:
+ +It's quite easy to archive. You write special verbatim files, which + are just C++, except that the very first line of the file gives a name of + variable that should be generated. A simple tool is created which takes + verbatim file and creates a cpp file with a single char* variable, which + name is taken from the first line of verbatim file, and which value is + properly quoted content of the verbatim file.
+ +Let's see what Boost.Build can do.
+ +First off, Boost.Build has no idea about "verbatim files". So, you + must register a new type. The following code does it:
++ import type ; + type.register VERBATIM : verbatim ; + ++ +
The first parameter to 'type.register' gives the name of declared + type. By convention, it's uppercase. The second parameter is suffix for + this type. So, if Boost.Build sees "code.verbatim" in the list of + sources, it knows that it's of type VERBATIM.
+ +Lastly, you need to tool to convert verbatim files to C++. Say you've + stetched such a tool in Python. Then, you have to inform Boost.Build + about the tool. The Boost.Build concept which represent tool is + generator.
+ +First, you say that generator 'inline-file' is able to convert + VERBATIM type into C++:
++ import generators ; + generators.register-standard verbatim.inline-file : VERBATIM : CPP ; + ++ +
Second, you must specify the commands to be run to actually perform + convertion:
+
+ actions inline-file
+ {
+ ./inline-file.py $(<) $(>)
+ }
+
+
+
+
+ Now, we're ready to tie it all together. Put all the code above in + file "verbatim.jam", add "import verbatim ;" to "project-root.jam", and + it's possible to write the following in Jamfile:
++ exe codegen : codegen.cpp class_template.verbatim usage.verbatim ; + ++ The verbatim files will be automatically converted into C++ and linked + it. + +
The complete code is available in examples-v2/customization + directory.
+ +Last modified: Jule 3, 2003
+ +© Copyright Vladimir Prus 2002-2003. Permission to copy, use, + modify, sell and distribute this document is granted provided this + copyright notice appears in all copies. This document is provided ``as + is'' without express or implied warranty, and with no claim as to its + suitability for any purpose.
+ + + + diff --git a/v2/doc/tools.html b/v2/doc/tools.html index 907abe68b..a24a601c0 100644 --- a/v2/doc/tools.html +++ b/v2/doc/tools.html @@ -3,7 +3,7 @@ + "HTML Tidy for Linux/x86 (vers 1st April 2002), see www.w3.org"> @@ -14,52 +14,66 @@
-
- The following compilers pass Boost.Build tests: -
The following compilers pass Boost.Build tests:
+ +Some important libraries have special support in Boost.Build: +
Some important libraries have special support in Boost.Build:
-© Copyright Vladimir Prus 2003. Permission to - copy, use, modify, sell and distribute this document is granted provided - this copyright notice appears in all copies. This document is provided - "as is" without express or implied warranty, and with no claim as to its - suitability for any purpose.
+© Copyright Vladimir Prus 2003. Permission to copy, use, modify, + sell and distribute this document is granted provided this copyright + notice appears in all copies. This document is provided "as is" without + express or implied warranty, and with no claim as to its suitability for + any purpose.
Revised 26 Apr, 2003 + -->Jule 3, 2003 + -->