Collapsing unnecessary directory levels

You can collapse unnecessary components out of the directory tree.

The directory structure shown in the "Structure of a multiplatform source tree" section defines the complete tree; every possible directory level is shown. In the real world, however, some of these directory levels aren't required. For example, you may wish to build a particular module for an ARM in little-endian mode and never need to build it for anything else (perhaps due to hardware constraints). Therefore, it seems a waste to have a variant level that has only the directory o.le and a CPU level that has only the directory arm.

In this situation, you can collapse unnecessary directory components out of the tree. You do this by simply separating the name of the components with dashes (-) rather than slashes (/).

For example, in our source tree, let's look at the startup/boards/my_board/arm-le makefile:

include ../

In this case, we've specified both the variant (as "le" for little-endian) and the CPU (as "arm" for ARM) with a single directory.

Why did we do this? Because the my_board directory refers to a very specific board—it's not going to be useful for anything other than an ARM running in little-endian mode.

In this case, the makefile macros would have the following values:

Macro Value
VARIANT1 arm-le
CPU arm
OS nto (default)
SECTION my_board
PROJECT boards

The addvariant command knows how to create both the squashed and unsquashed versions of the directory tree. You should always use it when creating the OS, CPU, and variant levels of the tree.