| | 94 | == Idiom: interaction with Cabal == |
| | 95 | |
| | 96 | Many of the components of the GHC build system are also Cabal |
| | 97 | packages, with package metadata defined in a `foo.cabal` file. For the |
| | 98 | GHC build system we need to extract that metadata and use it to build |
| | 99 | the package. This is done by the program `ghc-cabal` (in `utils/ghc-cabal` |
| | 100 | in the GHC source tree). This program reads `foo.cabal` and produces |
| | 101 | `package-data.mk` containing the package metadata in the form of |
| | 102 | makefile bindings that we can use directly. |
| | 103 | |
| | 104 | We adhere to the following rule: '''`ghc-cabal` generates only |
| | 105 | makefile variable bindings''', such as |
| | 106 | {{{ |
| | 107 | HS_SRCS = Foo.hs Bar.hs |
| | 108 | }}} |
| | 109 | `ghc-cabal` never generates makefile rules, macro, macro invocations etc. |
| | 110 | All the makefile code is therefore contained in fixed, editable |
| | 111 | `.mk` files. |
| | 112 | |
| 187 | | * `package-data.mk`. Many of the components of the GHC build system |
| 188 | | are also Cabal packages, with package metadata defined in a |
| 189 | | `foo.cabal` file. For the GHC build system we need to extract that |
| 190 | | metadata and use it to build the package. This is done by the |
| 191 | | program `ghc-cabal` (in `utils/ghc-cabal` in the GHC source tree). |
| 192 | | This program reads `foo.cabal` and produces `package-data.mk` |
| 193 | | containing the package metadata in the form of makefile bindings |
| 194 | | that we can use directly. |
| 195 | | |
| 196 | | Now, we also want to be able to use make to build these files, since |
| 197 | | they have complex dependencies themselves (in order to build |
| 198 | | `package-data.mk` we need to first build `ghc-cabal` etc., and a `.depend` file needs to be re-generated if any of the source files have changed). |
| | 206 | * Makefile binding generated from `.cabal` package descriptions. See |
| | 207 | "Idiom: interaction with Cabal". |
| | 208 | |
| | 209 | Now, we also want to be able to use `make` to build these files, since |
| | 210 | they have complex dependencies themselves. For example, in order to build |
| | 211 | `package-data.mk` we need to first build `ghc-cabal` etc., and a `.depend` file needs to be re-generated if any of the source files have changed. |