Table of Contents
Waf commands are functions defined on the top-level wscript file, for example, with the following wscript file:
srcdir = '.'
blddir = 'build'
def configure(conf):
print('configure')
def foo(ctx):
"""help string for the command foo"""
print('test')
executing the script with "foo" as argument will produce the following output
$ waf foo test
The parameter ctx in the function foo above is provided to enable recursion and sharing data with the scripts. In the following example, the script subdir/wscript_foo will be looked up, and executed if found. Else, the script subdir/wscript will be looked up and loaded as a module. If successfully loaded, the function foo will be executed, else an exception is raised.
def foo(ctx):
"""help string for the command foo"""
ctx.recurse('subdir')
For backward compatibility reasons, the commands init, shutdown, dist and distcheck do not accept a context as parameter yet.