Creating build hosts files
The build hosts file is the client-side control file for parallel builds.
Build hosts files that you specify by using the CCASE_HOST_TYPE
environment
variable must be located in your home directory, and each file must have a name that begins
with .bldhost. Choose a file name extension for each build hosts file
that describes its intended use. For example:
- .bldhost.day
- List of hosts used to perform parallel builds during the workday
- .bldhost.night
- List of hosts used to perform overnight parallel builds
Build hosts files that you specify with the -B
option can be located anywhere
and do not have to have special names.
Your build environment determines whether you need multiple build hosts files. In a heterogeneous network, for example, architecture-specific builds might or might not need to be performed on hosts of that architecture. (You might have cross-compilers, which eliminates this restriction.)
When you start a parallel build, you can specify a certain build hosts file or have
clearmake select one by using the -B option. If you do
not specify -B
when running a parallel build, clearmake
does the following:
- Determines the host type.
- Looks in the password database to determine your home directory.
- Uses the file .bldhost.$CCASE_HOST_TYPE in your home directory.
For example, you can set up two build hosts files, for daytime and nighttime use, as follows:
- Create a build hosts file for daytime use. For daytime builds, you can use the list of hosts
that your system administrator has provided in /usr/local/lib, along with your
own host. To minimize the disruption to other work, you can specify that each host is to be used
only if it is not heavily loaded, that is, if it is at least 75% idle.
% cat > $HOME/.bldhost.day -idle 75 neptune #include /usr/local/lib/day_builds <CTRL+D>
- Create a build hosts file for overnight use. For overnight builds, you can use another list of
hosts provided by the system administrator.
% cat > $HOME/.bldhost.night #include /usr/local/lib/night_builds <CTRL+D>
Because this file does not include an
-idle
specification, clearmake uses a host only if it is at least 50% idle.
If CCASE_HOST_TYPE
is set, but clearmake cannot find or read
the build hosts file, it does not perform the build. (clearmake assumes that if
CCASE_HOST_TYPE
is set, you want to perform a parallel build. Because the parallel
build might use a host with a different architecture than the local host, performing the build on
the local host might yield incorrect results. Therefore, by default, clearmake
does not build on the local host if CCASE_HOST_TYPE
is set.)
clearmake does not use a host during a parallel build if your current view cannot be used on that host. (For example, the host might not be able to access the view's storage directory.)
You set the CCASE_HOST_TYPE
variable conditionally in your makefile, using
target-dependent variable bindings. If you set the variable on the
clearmake command line, in your process environment, or unconditionally
in your makefile, it applies to all targets.
For example, to ensure that the target x
is built on host neon
or saturn
:
x := CCASE_BLD_HOSTS = neon saturn
You can also use patterns in target names. For example, to build all .o
files on
host pluto
:
%.o := CCASE_BLD_HOSTS = pluto
clearmake applies CCASE_BLD_HOSTS
bindings to dependencies of
the specified targets. To apply CCASE_BLD_HOSTS
to the specified targets but not
their dependencies, add the following line to the built-ins file for your compatibility mode:
Mode | Location of built-ins file | Line to add |
---|---|---|
standard | versionvault-home-dir/etc/builtin.mk | % := CCASE_BLD_HOSTS = |
To determine the name of any .bldhost file clearmake reads during the build process, use the clearmake -v command.