This section contains the list of all rules that can be used in Jamfile—both rules that define new targets and auxiliary rules.
exeCreates an executable file. See the section called “Programs”.
libCreates an library file. See the section called “Libraries”.
installInstalls built targets and other files. See the section called “Installing”.
aliasCreates an alias for other targets. See the section called “Alias”.
unit-testCreates an executable that will be automatically run. See the section called “Testing”.
-
compile,compile-fail,link,link-fail,run,run-fail Specialized rules for testing. See the section called “Testing”.
objCreates an object file. Useful when a single source file must be compiled with special properties.
preprocessedCreates an preprocessed source file. The arguments follow the common syntax.
glob-
The
globrule takes a list shell pattern and returns the list of files in the project's source directory that match the pattern. For example:lib tools : [ glob *.cpp ] ;It is possible to also pass a second argument—the list of exclude patterns. The result will then include the list of files patching any of include patterns, and not matching any of the exclude patterns. For example:
lib tools : [ glob *.cpp : file_to_exclude.cpp bad*.cpp ] ; -
glob-tree -
The
glob-treeis similar to theglobexcept that it operates recursively from the directory of the containing Jamfile. For example:ECHO [ glob-tree *.cpp : .svn ] ;will print the names of all C++ files in your project. The
.svnexclude pattern prevents theglob-treerule from entering administrative directories of the Subversion version control system. projectDeclares project id and attributes, including project requirements. See the section called “Projects”.
use-projectAssigns a symbolic project ID to a project at a given path. This rule must be better documented!
explicitThe
explicitrule takes a single parameter—a list of target names. The named targets will be marked explicit, and will be built only if they are explicitly requested on the command line, or if their dependents are built. Compare this to ordinary targets, that are built implicitly when their containing project is built.always-
The
alwaysfunciton takes a single parameter—a list of metatarget names. The top-level targets produced by the named metatargets will be always considered out of date. Consider this example:exe hello : hello.cpp ; exe bye : bye.cpp ; always hello ;
If a build of
hellois requested, then the binary will always be relinked. The object files will not be recompiled, though. Note that if a build ofhellois not requested, for example you specify justbyeon the command line,hellowill not be relinked. constant-
Sets project-wide constant. Takes two parameters: variable name and a value and makes the specified variable name accessible in this Jamfile and any child Jamfiles. For example:
constant VERSION : 1.34.0 ; path-constant-
Same as
constantexcept that the value is treated as path relative to Jamfile location. For example, if bjam is invoked in the current directory, and Jamfile inhelpersubdirectory has:path-constant DATA : data/a.txt ;then the variable
DATAwill be set tohelper/data/a.txt, and if bjam is invoked from thehelperdirectory, then the variableDATAwill be set todata/a.txt. build-projectCause some other project to be built. This rule takes a single parameter—a directory name relative to the containing Jamfile. When the containing Jamfile is built, the project located at that directory will be built as well. At the moment, the parameter to this rule should be a directory name. Project ID or general target references are not allowed.
test-suiteThis rule is deprecated and equivalent to
alias.