|Version 20 (modified by 8 years ago) (diff),|
Layout of important files and directories
This page summarises the overall file and directory structure of GHC. We include both source files and generated files; the latter are always identified "build-tree only".
Everything starts with the main GHC repository (see Building/GettingTheSources). The biuld system calls that directory
$(TOP). All the paths below are relative to
- 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.
Lists the packages that
darcs-allshould get or pull.
packagesis looked at only by
validate(a shell script) before committing (see TestingPatches). The script is documented in the file itself.
- Documentation files
- GNU autoconf machinery
- the RPM spec file
libraries/ directory contains all the packages that GHC needs to build. It has one sub-directory for each package repository (e.g.
random). Usually each such repository builds just one package but sometimes more than one (e.g DPH).
NOT RIGHT: PLEASE FIX
libraries/cabal-bin.hsis a little program we use for building the libraries. It's similar to cabal-install, but without the dependencies on
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.
libraries/bootstrapping/: In order to build
cabal-binwe 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
.ofiles that result from this in
These directories contain the main GHC compiler and documentation.
compiler/ directory contains the ghc package, which is linked
into an executable in the
There is documentation of the intended module dependency structure of the
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.cabalfile too, else you'll get link errors. LIES ALL LIES
The following directories appear only in the build tree:
compiler/stage1: generated files for the stage1 build of GHC. There are a handful of files (
ghc_boot_platform.hetc), and a directory
compiler/stage1/build/that contains all the
.hifiles for the compiler.
- `compiler/stage2: similarly stage2.
You can't run a binary from here: look in the
inplace/ directory below for that.
Sources for the runtime system; see Commentary/SourceTree/Rts.
Header files for the runtime system; see Commentary/SourceTree/Includes.
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.
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.
Why isn't libffi in utils/?
nofib/ directories contain apparatus for testing GHC. Each is a separate repository, which can be gotten with
rules.mk directories contains all the build system Makefile boilerplate; see GHC Build System Architecture. Some particular files are interesting:
mk/build.mk: contains Makefile settings that control your build. Details here. The file
mk/build.mk.samplecontains a starting point that you can copy to
mk/build.mkif you want.
mk/are-validating.mk: this file records the fact that you are doing validation, by containing the single line
Validating=YES. That in turn means the the build system gets its settings from
mk/validate-settings.mkinstead of from
mk/build.mk. Remove the file to stop validating.
mk/validate.mk: just like
build.mk, but applies when validating. Use this file to override the default settings for validation, which are in
inplace/ directory (build tree only) is where we "install" stage1 and stage2 compilers when they are built, and GHC's utility programs, entirely locally to the tree. The layout is exactly the same as that of an installed GHC on the host platform.
inplace/bin/: executables, including
inplace/lib/: suppporting libraries for the above.
Micellaneous files for building distributions.
Stuff that appears only in a build tree
THIS WHOLE SECTION SHOULD GO AWAY
.../dist*/In many directories,
dist*subdirectories appear. These are where Cabal puts all of the files generated while building. IS THIS STILL TRUE?