24.2. Dependencies and Platform Compatibility

As you can see, any given build item may build on one more platforms. When build item A depends on build item B, that dependency must be satisfied separately for each platform on which A builds. So if A and B both build on platforms p1 and p2, then the actual situation is that A on p1 depends on B on p1, and A on p2 depends on B on p2. This case of A and B building on the same platforms is simple and common, but there are cases in which things don't work out so easily. For this, abuild has two concepts: platform compatibility and explicit cross-platform dependencies. We discuss platform compatibility here and explicit cross-platform dependencies in the next section. These sections describe these concepts in basic terms. For the complete story with all the details, please refer to Section 33.6, “Construction of the Build Graph”.

The rules for platform compatibility are fairly straightforward. Specifically, a platform p in a platform type pt is compatible with all other platforms in pt and also with all platforms in pt's parent platform type, and by extension, all the way up the hierarchy of platform types. Starting with abuild 1.1.4, when a platform type is declared, it can optionally be declared to have a parent platform type. In all versions of abuild, any platform type declared without a parent has the platform type indep as an implicit parent. This means that all platforms are compatible with indep, which is how any build item of any platform type can depend on a build item of type indep.

For example, suppose you are creating a plugin to define platform types for the VxWorks embedded operating system, and you are creating separate platform types for different embedded boards that have different vendor-supplied board support packages. Suppose you also have a body of code that will work for all VxWorks boards and don't contain anything that depends on a specific board support package. To implement this, you could create a common platform type for the specific version of VxWorks and then also create child platform types for each specific board. For example, you could have a base type called vxworks-6_8-base and child types vxworks-6_8-bsp1 and vxworks-6_8-bsp2. Now if you had a build item Q of type vxworks-6_8-bsp1 and a build item R of type vxworks-6_8-bsp2, both build items could depend on item S of type vxworks-6_8-base since all platforms in the two board-specific platform types are compatible with the platforms in the base type. Additionally, if there were a build item T of type indep, all three of the other build items could depend on T because indep is compatible with all other platform types. For further discussion of creating platform types, see Section 29.3.1, “Adding Platform Types”.