Add a note on clean target
[ghc.git] / README.md
1 Shaking up GHC
2 ==============
3
4 [![Linux & OS X status](https://img.shields.io/travis/snowleopard/shaking-up-ghc/master.svg?label=Linux%20%26%20OS%20X)](https://travis-ci.org/snowleopard/shaking-up-ghc) [![Windows status](https://img.shields.io/appveyor/ci/snowleopard/shaking-up-ghc/master.svg?label=Windows)](https://ci.appveyor.com/project/snowleopard/shaking-up-ghc)
5
6 This is a new build system for the [Glasgow Haskell Compiler][ghc]. It is based
7 on [Shake][shake] and we hope that it will eventually replace the current
8 [`make`-based build system][make]. If you are curious about the rationale and initial
9 ideas behind the project you can find more details on the [wiki page][ghc-shake-wiki]
10 and in this [blog post][blog-post-1].
11
12 [Join us on #shaking-up-ghc on Freenode](irc://chat.freenode.net/#shaking-up-ghc).
13
14 Your first build
15 ----------------
16
17 Beware, the build system is in the alpha development phase. Things are shaky and often
18 break; there are numerous [known issues][issues]. Not afraid? Then put on the helmet and
19 follow these steps:
20
21 * If you have never built GHC before, start with the [preparation guide][ghc-preparation].
22
23 * This build system is written in Haskell (obviously) and depends on the following Haskell
24 packages, which need to be installed: `ansi-terminal`, `mtl`, `shake`, `QuickCheck`.
25
26 * Get the sources. It is important for the build system to be in the `shake-build` directory of the GHC source tree:
27
28     ```bash
29     git clone --recursive git://git.haskell.org/ghc.git
30     cd ghc
31     git clone git://github.com/snowleopard/shaking-up-ghc shake-build
32     ```
33 * Start your first build (you might want to enable parallelism with `-j`):
34
35     ```bash
36     shake-build/build.sh --configure
37     ```
38 On Windows, use `build.bat` instead and pass an extra flag to configure (also see [building on Windows][ghc-windows-quick-build]):
39     ```bash
40     shake-build/build.bat --configure=--enable-tarballs-autodownload
41     ```
42 If you are interested in building in a Cabal sandbox, have a look at `shake-build/build.cabal.sh`.
43
44 Using the build system
45 ----------------------
46 Once your first build is successful, simply run `shake-build/build.sh` or `shake-build/build.bat`
47 to rebuild (you no longer need to use the `--configure` flag). Most build artefacts are placed
48 into `.build` and `inplace` directories ([#113][build-artefacts-issue]).
49
50 #### Command line flags
51
52 In addition to standard Shake flags (try `--help`), the build system
53 currently supports several others:
54 * `--configure[=ARGS]`: run the `configure` script forwarding `ARGS` as command line
55 arguments; also run the `boot` script to create the `configure` script if necessary.
56 You do not have to use this functionality of the new build system; feel free to run
57 `boot` and `configure` scripts manually, as you do when using `make`.
58 * `--progress-info=STYLE`: choose how build progress info is printed. There are four
59 settings: `none`, `brief` (one line per build command), `normal` (typically a box per
60 build command; this is the default setting), and `unicorn` (when `normal` just won't do).
61 * `--split-objects`: generate split objects, which are switched off by default. Due to
62 a GHC [bug][ghc-split-objs-bug], you need a full clean rebuild when using this flag.
63
64 #### User settings
65
66 The `make`-based build system uses `mk/build.mk` to specify user build settings. We
67 use [`src/Settings/User.hs`][user-settings] for the same purpose. Feel free to
68 experiment following the Haddock comments.
69
70 #### Resetting the build
71
72 To reset the new build system run the build script with `-B` flag. This forces Shake
73 to rerun all rules, even if results of the previous build are still in the GHC tree.
74 To remove all build artefacts, run the build script with `clean` target. Note, we are
75 working towards a complete separation of GHC sources and build artefacts: [#113][build-artefacts-issue].
76
77 Current limitations
78 -------------------
79 The new build system still lacks many important features:
80 * We only build `vanilla` way: [#4][dynamic-issue], [#186][profiling-issue].
81 * Documentation is broken: [#98][haddock-issue].
82 * Validation is not implemented: [#187][validation-issue].
83 * Build flavours and conventional command line flags are not implemented: [#188][flavours-issue].
84 * Cross-compilation is not implemented: [#177][cross-compilation-issue].
85
86 Check out [milestones] to see when we hope to resolve the above limitations.
87
88 How to contribute
89 -----------------
90
91 The best way to contribute is to try the new build system, report the issues
92 you found, and attempt to fix them. Please note the codebase is very unstable
93 at present and we expect a lot of further refactoring. The documentation is
94 currently non-existent, but we are working on it: [#55][comments-issue],
95 [#56][doc-issue].
96
97 Acknowledgements
98 ----------------
99
100 I started this project as part of my 6-month research visit to Microsoft
101 Research Cambridge, which was funded by Newcastle University, EPSRC, and
102 Microsoft Research. I would like to thank Simon Peyton Jones, Neil Mitchell
103 and Simon Marlow for kick-starting the project and for their guidance. Last
104 but not least, big thanks to the project [contributors][contributors], who
105 helped me endure and enjoy the project.
106
107 [ghc]: https://en.wikipedia.org/wiki/Glasgow_Haskell_Compiler
108 [shake]: https://github.com/ndmitchell/shake/blob/master/README.md
109 [make]: https://ghc.haskell.org/trac/ghc/wiki/Building/Architecture
110 [ghc-shake-wiki]: https://ghc.haskell.org/trac/ghc/wiki/Building/Shake
111 [blog-post-1]: https://blogs.ncl.ac.uk/andreymokhov/shaking-up-ghc
112 [issues]: https://github.com/snowleopard/shaking-up-ghc/issues
113 [ghc-preparation]: https://ghc.haskell.org/trac/ghc/wiki/Building/Preparation
114 [ghc-windows-quick-build]: https://ghc.haskell.org/trac/ghc/wiki/Building/Preparation/Windows#AQuickBuild
115 [build-artefacts-issue]: https://github.com/snowleopard/shaking-up-ghc/issues/113
116 [ghc-split-objs-bug]: https://ghc.haskell.org/trac/ghc/ticket/11315
117 [user-settings]: https://github.com/snowleopard/shaking-up-ghc/blob/master/src/Settings/User.hs
118 [dynamic-issue]: https://github.com/snowleopard/shaking-up-ghc/issues/4
119 [profiling-issue]: https://github.com/snowleopard/shaking-up-ghc/issues/186
120 [haddock-issue]: https://github.com/snowleopard/shaking-up-ghc/issues/98
121 [validation-issue]: https://github.com/snowleopard/shaking-up-ghc/issues/187
122 [flavours-issue]: https://github.com/snowleopard/shaking-up-ghc/issues/188
123 [cross-compilation-issue]: https://github.com/snowleopard/shaking-up-ghc/issues/177
124 [milestones]: https://github.com/snowleopard/shaking-up-ghc/milestones
125 [comments-issue]: https://github.com/snowleopard/shaking-up-ghc/issues/55
126 [doc-issue]: https://github.com/snowleopard/shaking-up-ghc/issues/56
127 [contributors]: https://github.com/snowleopard/shaking-up-ghc/graphs/contributors