... | ... | @@ -130,59 +130,53 @@ communicates these snippets of information in two ways: |
|
|
to get a list of the available arguments. Here are some of
|
|
|
the ones you might need:
|
|
|
|
|
|
<table><tr><th>`--host=<platform>`</th>
|
|
|
<td>
|
|
|
Set the "host platform" (see [platform names](building/architecture/idiom/platform-names)).
|
|
|
- **`--host=<platform>`**
|
|
|
|
|
|
Set the "host platform" (see [platform names](building/architecture/idiom/platform-names)).
|
|
|
Usually only necessary if cross-compiling.
|
|
|
</td></tr></table>
|
|
|
|
|
|
<table><tr><th>`--target=<platform>`</th>
|
|
|
<td>
|
|
|
Set the "target platform" (see [platform names](building/architecture/idiom/platform-names)).
|
|
|
- **`--target=<platform>`**
|
|
|
|
|
|
Set the "target platform" (see [platform names](building/architecture/idiom/platform-names)).
|
|
|
Usually only necessary if cross-compiling.
|
|
|
</td></tr></table>
|
|
|
|
|
|
<table><tr><th>`--with-ghc=<path>`</th>
|
|
|
<td>
|
|
|
Specifies the path to an installed GHC which you would like to use.
|
|
|
- **`--with-ghc=<path>`**
|
|
|
|
|
|
Specifies the path to an installed GHC which you would like to use.
|
|
|
This compiler will be used for compiling GHC-specific code (eg. GHC
|
|
|
itself). This option *cannot* be specified using `build.mk`
|
|
|
(see later), because `configure` needs to auto-detect the
|
|
|
version of GHC you're using. The default is to look for a compiler
|
|
|
named `ghc` in your `$PATH`.
|
|
|
</td></tr></table>
|
|
|
|
|
|
<table><tr><th>`--with-gcc=<path>`</th>
|
|
|
<td>
|
|
|
Specifies the path to the installed GCC. This compiler will be used
|
|
|
- **`--with-gcc=<path>`**
|
|
|
|
|
|
Specifies the path to the installed GCC. This compiler will be used
|
|
|
to compile all C files, *except* any generated by the installed
|
|
|
Haskell compiler, which will have its own idea of which C compiler
|
|
|
(if any) to use. The default is to use `gcc`. On Windows, this
|
|
|
should be set to the gcc that comes with MinGW, which by default
|
|
|
is `c:/mingw/bin/gcc`.
|
|
|
</td></tr></table>
|
|
|
|
|
|
<table><tr><th>`--with-ld=<path>`</th>
|
|
|
<td>
|
|
|
Specifies which `ld` program to use. Normally only necessary on
|
|
|
- **`--with-ld=<path>`**
|
|
|
|
|
|
Specifies which `ld` program to use. Normally only necessary on
|
|
|
Windows, where you should set it to the `ld` that comes with MinGW,
|
|
|
which is usually `c:/mingw/bin/ld`.
|
|
|
</td></tr></table>
|
|
|
|
|
|
<table><tr><th>`--prefix`</th>
|
|
|
<td>
|
|
|
Tells the build system where you would like GHC to be eventually
|
|
|
- **`--prefix`**
|
|
|
|
|
|
Tells the build system where you would like GHC to be eventually
|
|
|
installed. You don't have to install GHC in order to use it: it is
|
|
|
entirely possible to work on GHC and test it without ever modifying
|
|
|
anything outside the build tree. However, if you do want to install
|
|
|
GHC, then the `--prefix` directory is the root of the install tree.
|
|
|
Typically on Unix systems the default for `--prefix` is
|
|
|
`/usr/local`. See also [Building/Installing](building/installing) for more details.
|
|
|
</td></tr></table>
|
|
|
|
|
|
<table><tr><th>`--enable-tarballs-autodownload`</th>
|
|
|
<td>
|
|
|
On Windows in order to build GHC and to be able to create a binary
|
|
|
- **`--enable-tarballs-autodownload`**
|
|
|
|
|
|
On Windows in order to build GHC and to be able to create a binary
|
|
|
distribution package some extra binaries are needed. These binaries
|
|
|
only have to be downloaded once. This flag serves as
|
|
|
[consent](https://phabricator.haskell.org/D339#7799) to allow the
|
... | ... | @@ -223,138 +217,122 @@ The following are some common variables that you might want to set in |
|
|
your `mk/build.mk`. For other variables that you can override,
|
|
|
take a look in [mk/config.mk.in](/ghc/ghc/tree/master/ghc/mk/config.mk.in).
|
|
|
|
|
|
<table><tr><th>`SRC_HC_OPTS`</th>
|
|
|
<td>
|
|
|
(default: `-H32m -O`)
|
|
|
- **`SRC_HC_OPTS`**
|
|
|
|
|
|
Options passed to GHC for all Haskell compilations.
|
|
|
</td></tr></table>
|
|
|
(default: `-H32m -O`)
|
|
|
|
|
|
Options passed to GHC for all Haskell compilations.
|
|
|
|
|
|
<table><tr><th>`GhcHcOpts`</th>
|
|
|
<td>
|
|
|
(default: `-Rghc-timing`)
|
|
|
- **`GhcHcOpts`**
|
|
|
|
|
|
Options added when compiling GHC (all
|
|
|
(default: `-Rghc-timing`)
|
|
|
|
|
|
Options added when compiling GHC (all
|
|
|
[stages](building/architecture/idiom/stages))
|
|
|
</td></tr></table>
|
|
|
|
|
|
> `-Rghc-timing` prints out a line of timing info about each compilation. It is not set when `V=0`, but handy to keep an eye on otherwise.
|
|
|
|
|
|
<table><tr><th>`GhcStage1HcOpts`</th>
|
|
|
<td>
|
|
|
(default: *empty*)
|
|
|
- `-Rghc-timing` prints out a line of timing info about each compilation. It is not set when `V=0`, but handy to keep an eye on otherwise.
|
|
|
|
|
|
Options added when compiling the stage 1 GHC.
|
|
|
</td></tr></table>
|
|
|
- **`GhcStage1HcOpts`**
|
|
|
|
|
|
<table><tr><th>`GhcStage2HcOpts`</th>
|
|
|
<td>
|
|
|
(default: `-O2`)
|
|
|
(default: *empty*)
|
|
|
|
|
|
Options added when compiling the stage 2 GHC.
|
|
|
</td></tr></table>
|
|
|
Options added when compiling the stage 1 GHC.
|
|
|
|
|
|
<table><tr><th>`GhcStage3HcOpts`</th>
|
|
|
<td>
|
|
|
(default: `-O2`)
|
|
|
- **`GhcStage2HcOpts`**
|
|
|
|
|
|
Options added when compiling the stage 3 GHC.
|
|
|
</td></tr></table>
|
|
|
(default: `-O2`)
|
|
|
|
|
|
<table><tr><th>`GhcLibHcOpts`</th>
|
|
|
<td>
|
|
|
(default: `-O2`)
|
|
|
Options added when compiling the stage 2 GHC.
|
|
|
|
|
|
Options added when compiling the libraries.
|
|
|
</td></tr></table>
|
|
|
- **`GhcStage3HcOpts`**
|
|
|
|
|
|
<table><tr><th>`GhcProfiled`</th>
|
|
|
<td>
|
|
|
(default: `NO`)
|
|
|
(default: `-O2`)
|
|
|
|
|
|
Set to `YES` to enable profiling for GHC itself (stage 2). You'll also need to add `GhcLibWays += p` to make this work.
|
|
|
</td></tr></table>
|
|
|
Options added when compiling the stage 3 GHC.
|
|
|
|
|
|
- **`GhcLibHcOpts`**
|
|
|
|
|
|
(default: `-O2`)
|
|
|
|
|
|
Options added when compiling the libraries.
|
|
|
|
|
|
- **`GhcProfiled`**
|
|
|
|
|
|
(default: `NO`)
|
|
|
|
|
|
Set to `YES` to enable profiling for GHC itself (stage 2). You'll also need to add `GhcLibWays += p` to make this work.
|
|
|
|
|
|
- **`GhcDebugged`**
|
|
|
|
|
|
<table><tr><th>`GhcDebugged`</th>
|
|
|
<td>
|
|
|
(default: `NO`)
|
|
|
(default: `NO`)
|
|
|
|
|
|
Set to `YES` to pass `-debug` when building GHC (stage 1, 2 and 3).
|
|
|
Set to `YES` to pass `-debug` when building GHC (stage 1, 2 and 3).
|
|
|
This links GHC (stage 1, 2 and 3) with the [debugging RTS](debugging/runtime-system).
|
|
|
(It does not imply `GhcStage2HcOpts+=-DDEBUG`, see below for that)
|
|
|
</td></tr></table>
|
|
|
|
|
|
<table><tr><th>`GhcLibWays`</th>
|
|
|
<td>
|
|
|
(default: `v p`)
|
|
|
- **`GhcLibWays`**
|
|
|
|
|
|
(default: `v p`)
|
|
|
|
|
|
Ways in which to build the libraries. Must contain
|
|
|
Ways in which to build the libraries. Must contain
|
|
|
at least `v` ([the vanilla way](building/architecture/idiom/vanilla-way)). Also contains `p` by default (profiling). For other
|
|
|
ways, see `mk/ways.mk`.
|
|
|
</td></tr></table>
|
|
|
|
|
|
<table><tr><th>`SplitObjs`</th>
|
|
|
<td>
|
|
|
(default: `YES` if supported, `NO` otherwise)
|
|
|
- **`SplitObjs`**
|
|
|
|
|
|
(default: `YES` if supported, `NO` otherwise)
|
|
|
|
|
|
When set to `YES`, static library object files are split into smaller
|
|
|
When set to `YES`, static library object files are split into smaller
|
|
|
pieces. This means that less of the library code needs to be linked
|
|
|
into the final application, which makes smaller binaries. It takes
|
|
|
longer to build libraries this way, though.
|
|
|
</td></tr></table>
|
|
|
|
|
|
<table><tr><th>`LAX_DEPENDENCIES`</th>
|
|
|
<td>
|
|
|
(default: `NO`)
|
|
|
- **`LAX_DEPENDENCIES`**
|
|
|
|
|
|
(default: `NO`)
|
|
|
|
|
|
When set to `YES`, dependencies on the ghc executable will be turned into
|
|
|
When set to `YES`, dependencies on the ghc executable will be turned into
|
|
|
order-only dependencies (c.f. [relevant make documentation](http://www.gnu.org/software/make/manual/html_node/Prerequisite-Types.html)).
|
|
|
What this means in practice is that less needless recompilation will be
|
|
|
done while you are making changes to ghc's sources, but for certain types
|
|
|
of changes it means the build will fail.
|
|
|
</td></tr></table>
|
|
|
|
|
|
<table><tr><th>`HADDOCK_DOCS`</th>
|
|
|
<td>
|
|
|
(default: `YES`)
|
|
|
- **`HADDOCK_DOCS`**
|
|
|
|
|
|
Build `haddock` and run it on the compiler and libraries source?
|
|
|
</td></tr></table>
|
|
|
(default: `YES`)
|
|
|
|
|
|
<table><tr><th>`BUILD_SPHINX_HTML`</th>
|
|
|
<td></td></tr>
|
|
|
<tr><th>`BUILD_SPHINX_PDF`</th>
|
|
|
<td>
|
|
|
(default: `YES` if supported, `NO` otherwise)
|
|
|
Build `haddock` and run it on the compiler and libraries source?
|
|
|
|
|
|
When set to `YES`, these build the sphinx documentation (e.g. the
|
|
|
- **`BUILD_SPHINX_HTML`**
|
|
|
|
|
|
- **`BUILD_SPHINX_PDF`**
|
|
|
|
|
|
(default: `YES` if supported, `NO` otherwise)
|
|
|
|
|
|
When set to `YES`, these build the sphinx documentation (e.g. the
|
|
|
users guide) as HTML and PDF respectively.
|
|
|
</td></tr></table>
|
|
|
|
|
|
<table><tr><th>`INTEGER_LIBRARY`</th>
|
|
|
<td>
|
|
|
By default this is set to `integer-gmp`, which means Integer is implemented
|
|
|
- **`INTEGER_LIBRARY`**
|
|
|
|
|
|
By default this is set to `integer-gmp`, which means Integer is implemented
|
|
|
on top of the C GMP library. If you set it to `integer-simple` then a
|
|
|
simple, BSD-licensed Haskell implementation will be used instead.
|
|
|
</td></tr></table>
|
|
|
|
|
|
<table><tr><th>`BUILD_DPH`</th>
|
|
|
<td>
|
|
|
(default: `NO`)
|
|
|
Enable building of DPH libraries (no longer supported since GHC 8.6)
|
|
|
</td></tr></table>
|
|
|
- **`BUILD_DPH`**
|
|
|
|
|
|
<table><tr><th>`BUILD_EXTRA_PKGS`</th>
|
|
|
<td>
|
|
|
(default: `NO`)
|
|
|
Enable building of the extra libraries: those packages that have an `'extra'` tag in the `./packages` file. To quick way to see what those packages are, is to run `make show VALUE=PACKAGES_STAGE2 BUILD_EXTRA_PKGS=YES` (although `BUILD_DPH=YES` adds packages to that list as well).
|
|
|
</td></tr></table>
|
|
|
(default: `NO`)
|
|
|
Enable building of DPH libraries (no longer supported since GHC 8.6)
|
|
|
|
|
|
<table><tr><th>`V`</th>
|
|
|
<td>
|
|
|
(default: `1`)
|
|
|
Set `V=0` to get prettier build output. See [Building/Using\#Verbosebuild](building/using#verbose-build) below.
|
|
|
</td></tr></table>
|
|
|
- **`BUILD_EXTRA_PKGS`**
|
|
|
|
|
|
(default: `NO`)
|
|
|
Enable building of the extra libraries: those packages that have an `'extra'` tag in the `./packages` file. To quick way to see what those packages are, is to run `make show VALUE=PACKAGES_STAGE2 BUILD_EXTRA_PKGS=YES` (although `BUILD_DPH=YES` adds packages to that list as well).
|
|
|
|
|
|
- **`V`**
|
|
|
|
|
|
(default: `1`)
|
|
|
Set `V=0` to get prettier build output. See [Building/Using\#Verbosebuild](building/using#verbose-build) below.
|
|
|
|
|
|
## Building things
|
|
|
|
... | ... | @@ -401,12 +379,10 @@ Here is a high level view of what happens when you build GHC: |
|
|
from source code in `ghc/`. This source code is just a small Haskell
|
|
|
program that depends on package `ghc`.
|
|
|
|
|
|
>
|
|
|
> The resulting executable is
|
|
|
> called the "stage 1" compiler (see
|
|
|
> [stages](building/architecture/idiom/stages)). You can run the
|
|
|
> stage 1 compiler by invoking `inplace/bin/ghc-stage1`. The stage 1
|
|
|
> build of GHC happens in `compiler/stage1`.
|
|
|
- The resulting executable is called the "stage 1" compiler (see
|
|
|
[stages](building/architecture/idiom/stages)). You can run the
|
|
|
stage 1 compiler by invoking `inplace/bin/ghc-stage1`. The stage 1
|
|
|
build of GHC happens in `compiler/stage1`.
|
|
|
|
|
|
- The stage 1 compiler is now used to build all the packages in the
|
|
|
`libraries` subdirectory, and the runtime system in `rts`.
|
... | ... | @@ -517,15 +493,14 @@ build fast, and suitable for working on the stage2 compiler. |
|
|
|
|
|
Here's the reasoning behind some of the `devel2` settings:
|
|
|
|
|
|
<table><tr><th>`GhcStage1HcOpts = -O`</th>
|
|
|
<td>
|
|
|
Build stage 1 optimised: we're going to be rebuilding stage 2 a lot,
|
|
|
- **`GhcStage1HcOpts = -O`**
|
|
|
|
|
|
Build stage 1 optimised: we're going to be rebuilding stage 2 a lot,
|
|
|
so we want the compiler that does the building to be fast.
|
|
|
</td></tr></table>
|
|
|
|
|
|
<table><tr><th>`GhcStage2HcOpts = -O0 -DDEBUG`</th>
|
|
|
<td>
|
|
|
We turn off optimisation here, assuming you'll be modifying and
|
|
|
- **`GhcStage2HcOpts = -O0 -DDEBUG`**
|
|
|
|
|
|
We turn off optimisation here, assuming you'll be modifying and
|
|
|
testing stage 2. With optimisation off, rebuilding GHC after
|
|
|
modifying it will be *much* quicker, not only because the
|
|
|
individual compilations will be quicker, but also there will be
|
... | ... | @@ -536,27 +511,23 @@ Also we turn on `-DDEBUG`, because that enables assertions and |
|
|
debugging code in the compiler itself (Haskell source files only,
|
|
|
use `GhcDebugged=YES` to link GHC with the debugging RTS, see above).
|
|
|
Turning on DEBUG makes the compiler about 30% slower.
|
|
|
</td></tr></table>
|
|
|
|
|
|
<table><tr><th>`GhcLibHcOpts = -O -dcore-lint`</th>
|
|
|
<td>
|
|
|
You almost certainly want optimisation *on* when building
|
|
|
- **`GhcLibHcOpts = -O -dcore-lint`**
|
|
|
|
|
|
You almost certainly want optimisation *on* when building
|
|
|
libraries, otherwise the code you build with this compiler
|
|
|
goes really slowly.
|
|
|
|
|
|
When building the libraries, also turn on heavyweight intra-pass
|
|
|
When building the libraries, also turn on heavyweight intra-pass
|
|
|
sanity-checking within GHC, at the Core level.
|
|
|
</td></tr></table>
|
|
|
|
|
|
### Working on an optimized stage 2 compiler.
|
|
|
|
|
|
>
|
|
|
> If you are going to rebuild an optimized stage 2 compiler more often
|
|
|
> you should use -O2 to speed up the build.
|
|
|
If you are going to rebuild an optimized stage 2 compiler more often
|
|
|
you should use -O2 to speed up the build.
|
|
|
|
|
|
>
|
|
|
> A full build with `GhcStage1HcOpts = -O2` and `GhcStage2HcOpts = -O` will be slower by \~3% than the default.
|
|
|
> But each rebuild off stage2 afterwards will be faster.
|
|
|
A full build with `GhcStage1HcOpts = -O2` and `GhcStage2HcOpts = -O` will be slower by \~3% than the default.
|
|
|
But each rebuild off stage2 afterwards will be faster.
|
|
|
|
|
|
### Building a single sub-component
|
|
|
|
... | ... | |