Changes between Version 9 and Version 10 of Building/Modifying


Ignore:
Timestamp:
Jan 3, 2012 11:19:43 PM (4 years ago)
Author:
heisenbug
Comment:

fix typo, cleanups

Legend:

Unmodified
Added
Removed
Modified
  • Building/Modifying

    v9 v10  
    55Note that before making any non-trivial changes to the build system you should acquaint yourself with the overall [wiki:Building/Architecture architecture].  Even if you're already familiar with GNU make, the GHC build system is probably quite different from most `Makefile`-based build systems you've encountered before. 
    66
    7 Incedentally, it's a good idea to have a copy of the
     7Incidentally, it's a good idea to have a copy of the
    88[http://www.gnu.org/software/make/manual/make.html GNU make documentation] to hand when working with the build system.
    99
     
    2121
    2222 `$(warning ... message ...)`::
    23   equivalent to "printf-debugging` in a C program: this causes
     23  equivalent to "printf-debugging" in a C program: this causes
    2424  '''make''' to print a message when it reads the `$(warning ..)`
    2525  expression, and the message can include variable references.  Very
     
    3232
    3333 `make TRACE=1`::
    34   prints messages about certain macros that are called and their arguments.  This is basically a system of `$(warning)` calls enabled when the value of `$(TRACE)` is non-empty.  To see how it works, look at the file [[GhcFile(rules/trace.mk)]], and feel free to add trace calls to more places in the build system.
     34  prints messages about certain macros that are called and their arguments.  This is basically a system of `$(warning)` calls enabled when the value of `$(TRACE)` is non-empty.  To see how it works, look at the file [source:rules/trace.mk], and feel free to add trace calls to more places in the build system.
    3535
    3636 `make --debug=b --debug=m`::
     
    5656  * the `ghc` program itself, consists of a single `Main` module that imports the `ghc` package.  It is found in the `ghc` directory.
    5757
    58 Like any Cabal package, the `ghc` package has a `ghc.cabal` file, except that in this case the file is preprocessed by `configure` from the original: [[GhcFile(compiler/ghc.cabal.in)]].  Be careful not to modify the preprocessed version, `ghc.cabal`, as it will be overwritten next time you run `configure`.
     58Like any Cabal package, the `ghc` package has a `ghc.cabal` file, except that in this case the file is preprocessed by `configure` from the original: [source:compiler/ghc.cabal.in].  Be careful not to modify the preprocessed version, `ghc.cabal`, as it will be overwritten next time you run `configure`.
    5959
    6060To add a module to the `ghc` package:
    6161
    62  * Add your module to the `exposed-modules` section of [[GhcFile(compiler/ghc.cabal.in)]]
     62 * Add your module to the `exposed-modules` section of [source:compiler/ghc.cabal.in]
    6363 * {{{cd compiler; make stage2}}}
    6464
     
    6868
    6969  * Remove the working copy of the file (git will notice it is gone), or use {{{git rm}}}.
    70   * Remove the module from the list of modules in [[GhcFile(compiler/ghc.cabal.in)]].
    71   * To remove all mention of the file from derived dependency files, it is necessary to do something on the order of
    72 {{{
     70  * Remove the module from the list of modules in [source:compiler/ghc.cabal.in].
     71  * To remove all mention of the file from derived dependency files, it is necessary to do something on the
     72    order of
     73    {{{
    7374cd $TOP
    7475sh config.status
    7576make all_compiler_stage1
    76 }}}
     77    }}}
    7778    or {{{make all_compiler_stage2}}} if you prefer.
    7879
     
    9394Adding a new package is quite straightforward:
    9495
    95  * To arrange that the package is checked out by `sync-all`, add an entry to the [[GhcFile(packages)]] file.
     96 * To arrange that the package is checked out by `sync-all`, add an entry to the [source:packages] file.
    9697 * run `perl boot` to generate the `ghc.mk` and `GNUmakefile` files in your package's build.
    97  * Add an entry to the `PACKAGES` variable in [[GhcFile(ghc.mk)]].  The list in `PACKAGES` is kept in dependency order: each package must appear after the packages it depends on.
     98 * Add an entry to the `PACKAGES` variable in [source:ghc.mk].  The list in `PACKAGES` is kept in dependency order: each package must appear after the packages it depends on.
    9899
    99100That's it: doing a top-level `make` should now build your package and bring everything else up to date.
     
    146147}}}
    147148
    148 This is a call to the `build-prog` macro, whose definition can be found in [[GhcFile(rules/build-prog.mk)]].  This expands to the code for actually building the program, and it takes three arguments: the directory, the distdir, and the GHC stage to use for building (in this case we're using stage 1).  The `build-prog` macro expects to find certain variables defined, namely ''directory''_''distdir''`_PROG`, and ''directory''_''distdir''`_MODULES`.
     149This is a call to the `build-prog` macro, whose definition can be found in [source:rules/build-prog.mk].  This expands to the code for actually building the program, and it takes three arguments: the directory, the distdir, and the GHC stage to use for building (in this case we're using stage 1).  The `build-prog` macro expects to find certain variables defined, namely ''directory''_''distdir''`_PROG`, and ''directory''_''distdir''`_MODULES`.
    149150
    150151Finally, for programs that we want to install, we need to include the `ghc.mk` file in a binary distribution: