labm8.make

Wrapper for invoking Makefiles.

exception labm8.make.Error

Module-level error class.

exception labm8.make.MakeError

Thrown if make command fails.

exception labm8.make.NoMakefileError

Thrown if a directory does not contain a Makefile.

exception labm8.make.NoTargetError

Thrown if there is no rule for the requested target.

labm8.make.clean(**kwargs)

Run make clean.

Equivalent to invoking make() with target=”clean”.

Parameters:

**kwargs (optional) – Any additional arguments to be passed to make().

Returns:

The first element is the return code of the

make command. The second and third elements are the stdout and stderr of the process.

Return type:

(int, str, str)

Raises:
  • NoMakefileError – In case a Makefile is not found in the target directory.
  • NoTargetError – In case the Makefile does not support the requested target.
  • MakeError – In case the target rule fails.
labm8.make.make(target='all', dir='.', **kwargs)

Run make.

Parameters:
  • target (str, optional) – Name of the target to build. Defaults to “all”.
  • dir (str, optional) – Path to directory containing Makefile.
  • **kwargs (optional) – Any additional arguments to be passed to system.run().
Returns:

The first element is the return code of the

make command. The second and third elements are the stdout and stderr of the process.

Return type:

(int, str, str)

Raises:
  • NoMakefileError – In case a Makefile is not found in the target directory.
  • NoTargetError – In case the Makefile does not support the requested target.
  • MakeError – In case the target rule fails.