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 FreeBSDInstall from pkg (boost 1.72):
pkg install boost_build b2 --help b2 --help project b2 --help project.JAMFILE
Using B2 to Build Project
# filename: Jamfile exe hello : main.cpp tool.cpp : <include>/usr/local/include <cxxflags>"-std=c++20" <threading>multi : <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.