Prev - Index - Next

Miscellaneous tools

A successful [software] tool is one that was used to do something undreamed of by its author.

S. C. Johnson

There is a wide variety of support tools that are designed for software development (but are often of use to system administrators and other computer users).

Here, in a nutshell, are the more important tools...
For more information, have a read of the relevant man and info pages.


The Linux 2.0.36 kernel had ~940 C files and ~910 .h header files, spanning some 130 subdirectories (and this does not count other source, such as assembler files). Clearly this is not a project that you would want to recompile manually.

make uses a Makefile (which typically resides in the same directory as the source code) to detail dependencies between source code files so that recompilation only involves files that have been modified.

make also has macros, supports multiple targets (allowing you to make different programs from the one makefile), it has default rules for making files, and can be used for other associated tasks, such as documentation formatting and installing software.

The following example is taken from the GNU make manual:

Here is a straightforward makefile that describes the way an executable file called edit depends on eight object files which, in turn, depend on eight C source and three header files.

In this example, all the C files include defs.h, but only those defining editing commands include command.h, and only low level files that change the editor buffer include buffer.h.

        edit : main.o kbd.o command.o display.o \
               insert.o search.o files.o utils.o
               cc -o edit main.o kbd.o command.o display.o \
                           insert.o search.o files.o utils.o

        main.o : main.c defs.h
                cc -c main.c
        kbd.o : kbd.c defs.h command.h
                cc -c kbd.c
        command.o : command.c defs.h command.h
                cc -c command.c
        display.o : display.c defs.h buffer.h
                cc -c display.c
        insert.o : insert.c defs.h buffer.h
                cc -c insert.c
        search.o : search.c defs.h buffer.h
                cc -c search.c
        files.o : files.c defs.h buffer.h command.h
                cc -c files.c
        utils.o : utils.c defs.h
                cc -c utils.c
        clean :
                rm edit main.o kbd.o command.o display.o \
                   insert.o search.o files.o utils.o

We split each long line into two lines using backslash-newline; this is like using one long line, but is easier to read.

To use this makefile to create the executable file called edit, type:


To use this makefile to delete the executable file and all the object files from the directory, type:

        make clean


diff will list the differences between two text files. This is a useful way of isolating the changes between two versions of a source code file.

Many text editors have diff support built-in.


patch is used to intelligently apply diff files to one version of a file, generating a new version of the file.

Using diff and patch to upgrade software is useful when the software tarball is megabytes big, but the changes between two versions amount to only a few kilobytes. This is the low-bandwidth way to upgrade the Linux kernel!

Consider upgrading from 2.2.0 to 2.2.2. You could download a 13M tarball, or a 23k patch to 2.2.1 and then a 93k patch to 2.2.2:

    -r--r--r--   1 0        0        13080195 Jan 26 00:41 linux-2.2.0.tar.gz
    -r--r--r--   1 0        0        13098205 Jan 28 19:56 linux-2.2.1.tar.gz
    -r--r--r--   1 0        0        13112203 Feb 23 01:58 linux-2.2.2.tar.gz
    -r--r--r--   1 0        0           24433 Jan 28 19:56 patch-2.2.1.gz
    -r--r--r--   1 0        0           95815 Feb 23 01:58 patch-2.2.2.gz

patch can cope with errors (with .rej files), and has the facility to reverse an applied patch. It will also backup the original file (as a .orig file) in case of problems.


autoconf is a collection of tools designed to make your Unix code easy to port to other Unix platforms.

The autoconf tools will make intelligent guesses and tests to ensure that code developed on any Unix platform will run on almost any other Unix system.

In the "good" old days, porting Unix software would often require a large amount of effort, modifying makefiles and source files.

These days, a typical porting effort for an autoconf-ed program is:

    make install

The following section of the output from the configure tool indicates the number of different checks and portability problems that autoconf automatically handles for you (this example is from Guile 1.3):

    checking for ld used by GCC... /usr/bin/ld
    checking if the linker (/usr/bin/ld) is GNU ld... yes
    checking for BSD-compatible nm... /usr/bin/nm -B
    checking whether ln -s works... yes
    checking for gcc option to produce PIC... -fPIC
    checking if gcc PIC flag -fPIC works... yes
    checking if gcc static flag -static works... -static
    checking if the linker (/usr/bin/ld) is GNU ld... yes
    checking whether the linker (/usr/bin/ld) supports shared libraries... yes
    checking command to parse /usr/bin/nm -B output... yes
    checking how to hardcode library paths into programs... immediate
    checking for /usr/bin/ld option to reload object files... -r
    checking dynamic linker characteristics... Linux
    checking if libtool supports shared libraries... yes
    checking whether to build shared libraries... yes
    checking whether to build static libraries... yes
    checking for objdir... .libs
    creating libtool
    checking for AIX... no
    checking for POSIXized ISC... no
    checking for minix/config.h... no
    checking for working const... yes
    checking for inline... inline
    checking for ANSI C header files... yes

If you are writing C/C++ code for general release, then you should use autoconf - it will greatly simplify the task of porting the code to other Linux distributions and Unix variants.

There is an autoconf tutorial, which is a useful starting point for new autoconf users.


automake is an adjunct utility to autoconf, automatically generating the makefile templates ( for autoconf.

If you are not using autoconf, then you will probably not need automake.

There is a comprehensive automake tutorial available on the web.

Yacc and Lex

yacc and lex are used to generate text parsers; for example, to process configuration files and when writing compilers.

There are GNU replacements, called bison and flex respectively, which are drop-in replacements offering some useful additional features.

George Hansper gave two LUV talks in 1998 on these two programs: check the notes from those talks for more information.


indent is a source code formatter for C that will reformat C code in a wide variety of common (or customised) styles.

indent is invaluable for reformatting files with poor coding styles, or enforcing a certain style across a project involving a number of different programmers.

For example, indent can turn the following horror:

        #include <stdio.h>
        #include <stdlib.h>

        int main(int argc,
        char **argv) {int i; double j; for (i = 0; i < 100; i++ 
          ){ j = i * i * 3.1415; printf("i = %d -> j = %f\n", i, j);
          } exit(EXIT_SUCCESS); }

into something that is readable:

        #include <stdio.h>
        #include <stdlib.h>

        main (int argc, char **argv)
          int i;
          double j;
          for (i = 0; i < 100; i++) 
            j = i * i * 3.1415;
            printf ("i = %d -> j = %f\n", i, j);
          exit (EXIT_SUCCESS);

Other tools

There are a number of other development tools not covered here, including profilers, CASE tools, documentation tools, pretty printers, source code formatters, cross references, flow tools, UI designers and programming libraries.

Prev - Index - Next