Additional functions are usually provided in the top-level wscript file:
We will now provide a more complicated wscript file, execute the typical commands, and look at the output:
VERSION='0.0.1' APPNAME='test' srcdir = '.' blddir = 'build' def init(): print(' init called') def set_options(opt): print(' set_options') def configure(conf): print(' calling the configuration') def build(bld): print(' building') def shutdown(): print(' shutdown called')
The output will be:
$ waf Project not configured (run 'waf configure' first) $ waf configure set_options init called calling the configuration Configuration finished successfully (00:00:00); project is now ready to build. $ waf set_options init called building Compilation finished successfully (00:00:00) shutdown called $ waf dist set_options init called Your archive is ready -> test-0.0.1.tar.bz2
A few files will be produced by Waf, let us look at them now:
. |-- build | |-- c4che | | |-- build.config.py | | `-- default.cache.py | |-- config.log | `-- default |-- test-0.0.1.tar.bz2 `-- wscript
A build directory was created with the name given in the wscript file. It contains a configuration log, and various cache files. The last command produced a tarball of the project (an archive) containing the source files. For now it only contains the wscript file.
The execution can be summed up in the following diagram: