| 3 | | This page has moved to [wiki:Building/Files]. |
| | 4 | = Layout of important files and directories = |
| | 5 | |
| | 6 | Everything starts with the main GHC repository (see [wiki:Building/GettingTheSources]). The buld system calls that directory `$(TOP)`. All the paths below are relative to `$(TOP)`. |
| | 7 | |
| | 8 | == Files in `$(TOP)` == |
| | 9 | |
| | 10 | '''`darcs-all`''':: |
| | 11 | This script allows you to get or pull all the additional repositories that you need to build GHC. The command-line interface is documented in the file itself. |
| | 12 | |
| | 13 | '''`Makefile`''':: Top-level {{{Makefile}}}; {{{make}}} by itself does a full 2-stage |
| | 14 | bootstrap of GHC, there are also targets for building source and |
| | 15 | binary distributions. GHC requires |
| | 16 | [http://www.gnu.org/software/make/ GNU make]. |
| | 17 | |
| | 18 | '''`packages`''':: |
| | 19 | Lists the packages that `darcs-all` should get or pull. `packages` is looked at only by `darcs-all`. |
| | 20 | |
| | 21 | '''`validate`''':: Run `validate` (a shell script) before committing (see [wiki:TestingPatches]). The script is documented in the file itself. |
| | 22 | |
| | 23 | '''Documentation files''':: `README`, `ANNOUNCE`, `HACKING`, `LICENSE` |
| | 24 | |
| | 25 | '''GNU autoconf machinery''':: `aclocal.m4`, `config.guess`, `config.sub`, `configure.ac`, `install-sh` |
| | 26 | |
| | 27 | '''`ghc.spec.in`''':: the RPM spec file |
| | 28 | |
| | 29 | == `libraries/` == |
| | 30 | |
| | 31 | The `libraries/` directory contains all the packages that GHC needs to build. It has one sub-directory for each package repository (e.g. `base`, `haskell98`, `random`). Usually each such repository builds just one package but sometimes more than one (e.g DPH). |
| | 32 | |
| | 33 | * '''`libraries/cabal-bin.hs`''' is a little program we use for building the libraries. It's similar to cabal-install, but without the dependencies on `http` etc. |
| | 34 | * '''`libraries/ifBuildable/`''' is a utility that we use in the build system. It allows the build to continue if an extralib is not buildable (e.g., if we are missing a C library that an extralib depends on then we can still build the compiler). We expect this to disappear soon, when extralibs are removed. |
| | 35 | * '''`libraries/bootstrapping/`''': In order to build `cabal-bin` we need to compile `cabal-bin.hs`, as well as a few libraries that we can't rely on the bootstrapping compiler having. We put the `.hi` and `.o` files that result from this in `bootstrapping/`. |
| | 36 | |
| | 37 | == `compiler/`, `docs/`, `ghc/` == |
| | 38 | |
| | 39 | These directories contain the main GHC compiler and documentation. |
| | 40 | The `compiler/` directory contains the ghc package, which is linked |
| | 41 | into an executable in the `ghc/` directory. |
| | 42 | |
| | 43 | * '''`compiler/ghc.cabal`''': the Cabal file for GHC. If you add a module to GHC's source code, you must add it in the `ghc.cabal` file too, else you'll get link errors. |
| | 44 | |
| | 45 | == `rts/` == |
| | 46 | |
| | 47 | Sources for the runtime system; see [wiki:Commentary/SourceTree/Rts]. |
| | 48 | |
| | 49 | == `includes/` == |
| | 50 | |
| | 51 | Header files for the runtime system; see [wiki:Commentary/SourceTree/Includes]. |
| | 52 | |
| | 53 | == `utils/`, `libffi/` == |
| | 54 | |
| | 55 | The `utils` directory contains support utilities that GHC uses. Some of these are themselves separate repositories that `darcs-all` pulls; others are part of the main GHC repository. |
| | 56 | |
| | 57 | These utils may be built with the bootstrapping compiler, for use during the build, or with the stage2 compiler, for installing. Some of them are built with both; we can't install the utils built with the bootstrapping compiler as they may use different versions of C libraries. The reason we use stage2 rather than stage1 is that some utils, e.g. haddock, need the GHC API package. The file `utils/Makefile` controls all this. |
| | 58 | |
| | 59 | ''Why isn't libffi in utils/?'' |
| | 60 | |
| | 61 | == `testsuite/`, `nofib/` == |
| | 62 | |
| | 63 | The `testsuite/` and `nofib/` directories contain apparatus for testing GHC. Each is a separate repository, which can be gotten with `darcs-all`. |
| | 64 | |
| | 65 | == `mk/` == |
| | 66 | |
| | 67 | The `mk/` directory contains all the build system Makefile boilerplate. Some particular files are interesting: |
| | 68 | * '''`mk/build.mk`''': contains Makefile settings that control your build. Details [wiki:Building/Hacking here]. The file `mk/build.mk.sample` contains a starting point that you can copy to `mk/build.mk` if you want. |
| | 69 | * '''`mk/are-validating.mk`''': this file records the fact that you are doing [wiki:TestingPatches validation], by containing the single line `Validating=YES`. That in turn means the the build system gets its settings from `mk/validate-settings.mk` instead of from `mk/build.mk`. Remove the file to stop validating. |
| | 70 | |
| | 71 | == `distrib/` == |
| | 72 | |
| | 73 | Micellaneous files for building distributions. |
| | 74 | |
| | 75 | == Stuff that appears only in a build tree == |
| | 76 | |
| | 77 | * '''`ghc/stage1-inplace/`, `ghc/stage2-inplace/`''' |
| | 78 | The in-place installations of GHC, so you can use the compiler in a build tree. |
| | 79 | |
| | 80 | * '''`compiler/stage1/`, `ghc/stage2plus/`''' |
| | 81 | These directories contain `ghc_boot_platform.h`, which contains various `#define`s needed when building GHC. These are different depending on whether we are building stage1 or a later stage. |
| | 82 | |
| | 83 | * '''`.../dist*/`''' |
| | 84 | In many directories, `dist*` subdirectories appear. These are where Cabal puts all of the files generated while building. |