Changes between Version 39 and Version 40 of Building/Using


Ignore:
Timestamp:
Jul 3, 2009 8:49:35 AM (5 years ago)
Author:
simonmar
Comment:

add info about FAST=YES

Legend:

Unmodified
Added
Removed
Modified
  • Building/Using

    v39 v40  
    456456if all you wanted to do was to test a small change to GHC. 
    457457 
    458 === Rebuilding the GHC binary after making changes === 
    459  
    460 Suppose you want to make a small change to GHC itself and test it. 
    461 Assuming that your tree is already up to date, the best way to do this 
    462 is as follows: 
    463  
    464 {{{ 
    465 $ cd ghc 
    466 $ make stage=2 
    467 }}} 
    468  
    469 This will bring the stage 2 compiler up to date only.  Setting `stage=2` has the effect of disabling all the 
    470 rules that build the stage 1 compiler, so the build system will ignore the fact that the stage 1 compiler is also out of date, and hence all the libraries are also potentially out of date.  If you did `make` 
    471 from the top-level, all of these dependencies would be taken into 
    472 account, and a lot of rebuilding would probably ensue.  There's another target 
    473 that takes an even quicker shortcut: 
    474  
    475 {{{ 
    476 $ cd ghc 
    477 $ make 2 
    478 }}} 
    479  
    480 This is like `make stage=2`, except that it omits the dependency-building phase.  If you have changed the imports in any modules, those new dependencies will not be taken into account by the build system, so you might get a build failure.  On the other hand, this shortcut usually works and the few seconds it saves can make GHC development a much more interactive experience.  There are also `make 1` and `make 3` targets to make the stage 1 and stage 3 compilers respectively.  These targets work in both the `ghc` and `compiler` subdirectories. 
    481  
    482458=== Building a single sub-component === 
    483459 
     
    515491command at the top of the tree of the form `make clean_libraries/base`. 
    516492 
     493=== Rebuilding the GHC binary after making changes === 
     494 
     495Suppose you want to make a small change to GHC itself and test it. 
     496Assuming that your tree is already up to date, the best way to do this 
     497is as follows: 
     498 
     499{{{ 
     500$ cd ghc 
     501$ make stage=2 
     502}}} 
     503 
     504This will bring the stage 2 compiler up to date only.  Setting `stage=2` has the effect of disabling all the 
     505rules that build the stage 1 compiler, so the build system will ignore the fact that the stage 1 compiler is also out of date, and hence all the libraries are also potentially out of date.  If you did `make` 
     506from the top-level, all of these dependencies would be taken into 
     507account, and a lot of rebuilding would probably ensue.  There's another target 
     508that takes an even quicker shortcut: 
     509 
     510{{{ 
     511$ cd ghc 
     512$ make 2 
     513}}} 
     514 
     515This is like `make stage=2`, except that it omits the dependency-building phase (`make 2` is in fact just shorthand for `make stage=2 FAST=YES`; see [#Fastrebuilding Fast Rebuilding] below).  If you have changed the imports in any modules, those new dependencies will not be taken into account by the build system, so you might get a build failure.  On the other hand, this shortcut usually works and the few seconds it saves can make GHC development a much more interactive experience.  There are also `make 1` and `make 3` targets to make the stage 1 and stage 3 compilers respectively.  These targets work in both the `ghc` and `compiler` subdirectories. 
     516 
    517517=== Building a single file === 
    518518 
     
    538538 
    539539you could also cut-and-paste the command-line to add flags, but sometimes the `EXTRA_HC_OPTS` method is more convenient. 
     540 
     541=== Fast rebuilding === 
     542 
     543Often when you're working in a particular part of the tree, the rest of the tree is up to date, and you just want to rebuild the component you're working on after making changes.  To speed things up, we'd like to avoid having `make` check that everything else in the tree is up-to-date before building the component we're working on.  So the GHC build system provides a couple of ways to do this: 
     544 
     545 `make FAST=YES`:: 
     546   Only has an effect in a subdirectory.  Setting `FAST=YES` causes `make` to omit rebuilding the `.depend` file (if any), 
     547   and also omits some of the [wiki:Building/Architecture/Idiom/PhaseOrdering phases].  `FAST=YES` is allowed in conjunction 
     548   with any other target; for example, it makes sense when rebuilding a single file, as in the previous section. 
     549 
     550 `make fast`:: 
     551   Shorthand for `make all FAST=YES`. 
    540552 
    541553== Installing extra packages ==