Summary: I've released ghc-make, which is an alternative to ghc --make.
I've just released v0.2 of ghc-make (on Hackage, on Github). This package provides an alternative to ghc --make which supports parallel compilation of modules and runs faster when nothing needs compiling. To unpack that:
- Parallel compilation: Call
ghc-make -j4and your program will build by running up to fourghc -cprograms simultaneously. You usually need at parallel factor of 2x-3x to matchghc --makeon a single core, sinceghc --makedoes a lot of caching that is unavailable toghc-make. If you use-j1, or omit a-jflag, the compilation will be based onghc --makeand should take the same time to compile. - Faster when nothing needs rebuilding: If
ghc --makeis slow when there is nothing to rebuild, and most of your executions do no rebuilding,ghc-makewill make things go faster. On Windows I have one project whereghc --maketakes 23 seconds andghc-maketakes 0.2 seconds (more than 100x faster). Particularly useful for scripts that doghc --make Main && ./Main.
See the README for full details.
How do I use it?
Install ghc-make (cabal update && cabal install ghc-make). Then replace your calls to ghc my -arguments with ghc-make my -arguments. Almost all arguments and flags supported by ghc are supported by ghc-make - it is intended as a drop-in replacement. Let me know about any bugs on the bug tracker.
To use ghc-make with Cabal, try cabal build --with-ghc=ghc-make --ghc-options=-j4. (This technique is due to the ghc-parmake project, which also does parallel ghc --make compiles.)
How is it implemented?
This program uses the Shake library for dependency tracking and ghc --make for building. The actual ghc-make project itself only contains 4 modules, and the largest of those is the test suite.
To pass options to the underlying Shake build system prefix them with --shake, for example --shake--report=- will write a profile report to stdout and --shake--help will list the available Shake options.

2 comments:
your bugtracker link starts with file:///S://
;)
Jan-Philip: Thanks, now fixed - I managed to drop the http in an https:// somehow!
Post a Comment