WAF, a Popular Automation Tool


WAF is one among the various popular automation tools like Apache Ant, Bazel, CMake, and Make. Automation tools are used to facilitate the compilation and installation of an application/software/package in a system. The importance of automation can be best explained through an imaginary situation like 100 coded files required to be compiled to complete the installation of an application. It may be easy to compile these 100 files manually, but it won’t be easy to recompile these 100 files again, if any changes have been effected on any of these files. In any automation tool, there will be a new file created for managing the compilation and installation of the application, which we called as executable file or binary file. We already know about the executable files with extension like .exe in windows and .elf in Linux.

WAF is developed using the language Python. Thomas Nagy, the developer published it as open source software and also released the source code using new BSD licence. The documentation related to WAF is also published but it prohibits commercial reuse and modification. The installation of WAF is quick and simple and you can get the source file from the WAF official page. Although, it is easy to install using executable files, don’t forget to setup the environment variables accordingly.

In order to elaborate the working of WAF, let us consider a common scenario of GCC compiler. There are three files to be compiled before the installation of an application. The files include car.c, which is the main function and the two sub functions are blue.c and red.c.

Car.c :

void red();

void blue();

int car()




return 0;


Red.c :

#include <stdio.h>

void red()


printf (“I Have a red benz car”);




Blue.c :

#include <stdio.h>

void blue()


Printf (“ I have a blue Royal Enfield bike”);


Now these three files can be compiled using GCC as follows by creating object code before generating executable file.

gcc –c car.c

gcc –c red.c

gcc –c blue.c

gcc car.o red.o blue.o –o vehicle

Here it is simple as there are only three files, but consider the case of 100. With 100 files this compilation process will be very difficult. The same above thing can be built in WAF as follows:

top = ‘.’ ——— Working directory ‘.’ means current directory

out = ‘.’ ———- Output directory

def options(op);


def configure(co);


def build(bl)

bl.program(source=’car.c’, target=’vehicle’, use=’red blue’)

bl.objects(source=’red.c’, target=’red’)



All the above compilation purpose can be integrated in a single WAF file, which should be saved with the file name wscript. Now, execute the below command to run the application

WAF configure


In simple words, WAF will recompile files that have made modifications and not the entire files. But remember, options are available to compile all these source files forcefully.

Written by admin

Leave a Reply

Your email address will not be published. Required fields are marked *