I want to know the recommended way to use shake and ghc --make
together. In my project, the shake rules are used to compile C source code into their *.o
files (which I call cobjects
), and these objects are linked together into my haskell program by calling ghc --make
. During this command, ghc
figures out for itself when it needs to rebuild my haskell files.
The example below isn't correctly written to integrate the two tools. If a .hs
file changes then rerunning the shake script won't re-invoke ghc --make
. I understand why shake doesn't know to rebuild, but I don't know the recommended fix.
main = shake shakeOptions $ do
want [main_exe]
main_exe *> \out -> do
need cobjects
cmd "ghc --make" hs_compileFlags cobjects "main.hs"
cobjects **> ...