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 -j4
and your program will build by running up to fourghc -c
programs simultaneously. You usually need at parallel factor of 2x-3x to matchghc --make
on a single core, sinceghc --make
does a lot of caching that is unavailable toghc-make
. If you use-j1
, or omit a-j
flag, the compilation will be based onghc --make
and should take the same time to compile. - Faster when nothing needs rebuilding: If
ghc --make
is slow when there is nothing to rebuild, and most of your executions do no rebuilding,ghc-make
will make things go faster. On Windows I have one project whereghc --make
takes 23 seconds andghc-make
takes 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.
your bugtracker link starts with file:///S://
ReplyDelete;)
Jan-Philip: Thanks, now fixed - I managed to drop the http in an https:// somehow!
ReplyDelete