# HG changeset patch # User wbell # Date 1208115917 0 # Node ID fbd5bc3c2a48b3c4b49e958a0b1cdd2639aebabc # Parent ab4f39c2fae5434b39ab2eb16fea2091545d8ddf At long last, applying patch supplied by Xavier Duret for #207. Closes #207. Thanks for the patch. diff --git a/bitten/build/ctools.py b/bitten/build/ctools.py --- a/bitten/build/ctools.py +++ b/bitten/build/ctools.py @@ -14,6 +14,7 @@ import re import os import posixpath +import shlex from bitten.build import CommandLine, FileSet from bitten.util import xmlio @@ -94,7 +95,7 @@ if returncode != 0: ctxt.error('autoreconf failed (%s)' % returncode) -def make(ctxt, target=None, file_=None, keep_going=False): +def make(ctxt, target=None, file_=None, keep_going=False, directory=None, jobs=None, args=None): """Execute a Makefile target. :param ctxt: the build context @@ -102,19 +103,32 @@ :param file\_: name of the Makefile :param keep_going: whether make should keep going when errors are encountered + :param directory: directory in which to build; defaults to project source directory + :param jobs: number of concurrent jobs to run + :param args: command-line arguments to pass to the script """ executable = ctxt.config.get_filepath('make.path') or 'make' - args = ['--directory', ctxt.basedir] + if directory is None: + directory = ctxt.basedir + + margs = ['--directory', directory] + if file_: - args += ['--file', ctxt.resolve(file_)] + margs += ['--file', ctxt.resolve(file_)] if keep_going: - args.append('--keep-going') + margs.append('--keep-going') if target: - args.append(target) + margs.append(target) + if jobs: + margs += ['--jobs', jobs] + + if args: + if isinstance(args, basestring): + margs += shlex.split(args) from bitten.build import shtools - returncode = shtools.execute(ctxt, executable=executable, args=args) + returncode = shtools.execute(ctxt, executable=executable, args=margs) if returncode != 0: ctxt.error('make failed (%s)' % returncode) diff --git a/doc/commands.txt b/doc/commands.txt --- a/doc/commands.txt +++ b/doc/commands.txt @@ -127,9 +127,9 @@ :Common prefix: ``c`` ------------------ +------------------ ```` ------------------ +------------------ Executes ths autotool autoreconf. @@ -153,7 +153,8 @@ +--------------+-------------------------------------------------------------+ | ``symlink`` | Install symbolic links instead of copies | +--------------+-------------------------------------------------------------+ -| ``warnings`` | Report the warnings related to category (which can actually be a comma separated list) | +| ``warnings`` | Report the warnings related to category | +| | (which can actually be a comma separated list) | +--------------+-------------------------------------------------------------+ | ``prepend_include`` | Prepend directories to search path | +--------------+-------------------------------------------------------------+ @@ -259,6 +260,15 @@ | ``keep-going`` | Whether `make` should try to continue even after | | | encountering errors. | +----------------+-----------------------------------------------------------+ +| ``jobs`` | Number of parallel jobs used by make. | ++----------------+-----------------------------------------------------------+ +| ``directory`` | Path of the directory in which make should be called. | ++----------------+-----------------------------------------------------------+ +| ``args`` | Any space separated arguments to pass to the makefile. | +| | Usually in the form: | +| | ``"parameter1=value1 parameter2=value2"``. | ++----------------+-----------------------------------------------------------+ + Examples -------- @@ -270,6 +280,12 @@ Runs the target "compile" of the ``Makefile`` located in the sub-directory ``build``. +.. code-block:: xml + + + +Same as previous but execute the command in the ``work`` directory and call +the makefile with the command line argument ``coverage=1``. --------------- ````