| Home | Libraries | People | FAQ | More

### Writing Jamfiles

Probably one of the most important differences in V2 Jamfiles is the use of project requirements. In V1, if several targets had the same requirements (for example, a common `#include` path), it was necessary to manually write the requirements or use a helper rule or template target. In V2, the common properties can be specified with the `requirements` project attribute, as documented in the section called “Projects”.

Usage requirements also help to simplify Jamfiles. If a library requires all clients to use specific `#include` paths or macros when compiling code that depends on the library, that information can be cleanly represented.

The difference between `lib` and `dll` targets in V1 is completely eliminated in V2. There's only one library target type, `lib`, which can create either static or shared libraries depending on the value of the `<link>` feature. If your target should be only built in one way, you can add `<link>shared` or `<link>static` to its requirements.

The syntax for referring to other targets was changed a bit. While in V1 one would use:

    exe a : a.cpp <lib>../foo/bar ;

the V2 syntax is:

    exe a : a.cpp ../foo//bar ;

Note that you don't need to specify the type of other target, but the last element should be separated from the others by a double slash to indicate that you're referring to target `bar` in project `../foo`, and not to project `../foo/bar`.