Cleaning

there's also make distclean, which will clean files that are generated by configure, and make maintainer-clean, which cleans everything that is not in the source repository.

You can clean just a part of the tree, e.g. the RTS:

$ cd rts
$ make clean

Validating

Another way to build GHC is to run the validate script, which does a build of GHC from scratch (it does make distclean first), using standard settings.

Parallel builds

The GHC build system works with make's -j flag, which spawns multiple compile processes in parallel. Even on a single processor machine it's usually worthwhile using at least make -j2, because the I/O will be overlapped with compute-intensive compilation. On a multicore machine, higher -j values will speed up the build even more.

Controlling your build

The file mk/build.mk. This is a file you create yourself, containing various build settings. There's a sample file in mk/build.mk.sample that you can copy to mk/build.mk and use as a starting point. For more information on what you can do with build.mk, see Build configuration. In particular, you might want to make GHC build quickly.

Running GHC from the build tree

You don't need to install GHC to use it. After the build has completed, you can run GHC like this:

$ ./inplace/bin/ghc-stage2

and to start GHCi, just add the --interactive flag. You can also see what packages have been built: