Changes between Version 30 and Version 31 of Building/Hacking


Ignore:
Timestamp:
Jul 1, 2010 3:26:55 PM (4 years ago)
Author:
simonmar
Comment:

Reorganise a bit

Legend:

Unmodified
Added
Removed
Modified
  • Building/Hacking

    v30 v31  
    55 
    66There is more complete documentation for the build system later on in this guide (see [wiki:Building/Using]), but this page gives a quick overview of how to get around the GHC build system. 
     7 
     8== Before starting your build == 
     9 
     10You need to configure your build: which things to build, how much optimisation to use, whether to build profiling libraries, and so on.  If you don't do this, then you get ''everything'', and it will be ''optimised to the hilt'', which means the build will take a Very Long Time.  This is fine if you wanted to build GHC for installation and use, but not if you're building GHC to do some development work on it. 
     11 
     12To configure your build, create the file {{{mk/build.mk}}} from the sample: 
     13 
     14{{{ 
     15$ cp mk/build.mk.sample mk/build.mk 
     16}}} 
     17 
     18and then edit {{{mk/build.mk}}} to select the build you want.  If you're not sure what you 
     19want, just uncommenting this line 
     20 
     21{{{ 
     22#BuildFlavour = quick 
     23}}} 
     24 
     25is usually a good choice.  For more information on what you can do with `build.mk`, see [wiki:Building/Using#Buildconfiguration Build configuration].  In particular, you might want to [wiki:Building/Using#HowtomakeGHCbuildquickly make GHC build quickly]. 
     26 
     27== Starting the build == 
     28 
     29To build the whole thing (compiler, libraries, compiler again), do this: 
     30 
     31{{{ 
     32$ perl boot 
     33$ ./configure 
     34$ make 
     35}}} 
     36 
     37There are more configuration settings that you can use when running the configure script, see [wiki:Building/Using#Runtheconfigurescript Run the configure script]. 
     38 
     39assuming everything goes according to plan, this should leave you with a compiler that you can run: {{{inplace/bin/ghc-stage2}}}. 
    740 
    841== Building after making changes == 
     
    2558{{{ 
    2659$ cd ghc 
    27 $ make stage=2 
     60$ make 2 
    2861}}} 
    2962 
     
    5588The 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. 
    5689 
    57 == Controlling your build == 
    58  
    59 The build is controlled in two ways: 
    60  
    61  * Flags given to `./configure`.  See [wiki:Building/Using#Runtheconfigurescript Run the configure script]. 
    62  
    63  * 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 [wiki:Building/Using#Buildconfiguration Build configuration].  In particular, you might want to [wiki:Building/Using#HowtomakeGHCbuildquickly make GHC build quickly]. 
    64  
    6590== Running GHC from the build tree == 
    6691