Skip to content

[Build System::Jamfile] B2 Engine on FreeBSD

B2 User Manual

What is the difference between B2, b2, bjam and Perforce Jam?


B2 is the name of the complete build system. The executable that runs it is b2. That executable is written in C and implements performance-critical algorithms, like traversal of dependency graph and executing commands. It also implements an interpreted language used to implement the rest of B2. This executable is formally called "B2 engine".

The B2 engine is derived from an earlier build tool called Perforce Jam. Originally, there were just minor changes, and the filename was bjam. Later on, with more and more changes, the similarity of names became a disservice to users, and as of Boost 1.47.0, the official name of the executable was changed to b2. A copy named bjam is still created for compatibility, but you are encouraged to use the new name in all cases.

Perforce Jam was an important foundation, and we gratefully acknowledge its influence, but for users today, these tools share only some basics of the interpreted language.

B2 on FreeBSD

Install from pkg (boost 1.72):
pkg install boost_build
b2 --help
b2 --help project
b2 --help project.JAMFILE
Build by yourself (Latest, boost 1.76)

Using B2 to Build Project

# filename: Jamfile
exe hello
        : main.cpp tool.cpp
        : <include>/usr/local/include
        : <optimization>off

After puting the Jamfile to your project directory, type b2 to build your project. b2 will look for Jamfile in current directory, and continue looking for from up directory, until Jamroot is found, ... and stop looking for.

But if you type b2 in the top directory that contains Jamroot, it does not look for sub directory. To let it look for sub directory, put "build-project subdir1 ;" in your Jamroot:

build-project subdir1 ;

Jamfile and Jamroot


When we refer to a “Jamfile,” set in normal type, we mean a file called either Jamfile or Jamroot. When we need to be more specific, the filename will be set as “Jamfile” or “Jamroot.”

List Dependent Libraries


Some other build system have special syntax for listing dependent libraries, for example LIBS variable. In B2, you just add the library to the list of sources.





No Trackbacks


Display comments as Linear | Threaded

No comments

Add Comment

E-Mail addresses will not be displayed and will only be used for E-Mail notifications.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.

Form options

Submitted comments will be subject to moderation before being displayed.