### D.2 Building the Development Sources

In addition to all the tools (both optional and required) that are listed in Build Dependencies you will need:

Mercurial
  Distributed version control system (http://mercurial.selenic.com). Octave's sources are stored in a Mercurial archive.
Git
  Distributed version control system (http://git-scm.com). The gnulib sources that Octave depends on are stored in a Git archive.

Once you have the required tools installed, you can build Octave by doing

- Check out a copy of the Octave sources:

                hg clone http://hg.savannah.gnu.org/hgweb/octave

- Change to the top-level directory of the newly checked out sources:

                cd octave

- Generate the necessary configuration files:

                ./autogen.sh

- Create a build directory and change to it:

                mkdir build
                cd build

  By using a separate build directory, you will keep the source directory clean and it will be easy to completely remove all files generated by the build. You can also have parallel build trees for different purposes that all share the same sources. For example, one build tree may be configured to disable compiler optimization in order to allow for easier debugging while another may be configured to test building with other specialized compiler flags.

- Run Octave's configure script from the build directory:

                ../configure

- Run make in the build directory:

                make

Once the build is finished, you will see a message like the following:

         Octave successfully built.  Now choose from the following:

            ./run-octave    - to run in place to test before installing
            make check      - to run the tests
            make install    - to install (PREFIX=...)