I'm in the process of converting a Makefile into a Shakefile, and I'm not sure how to handle PHONY make targets (clean
, install
, etc.). I tried something like:
main = shake shakeOptions $ do
want ["install"]
"install" *> \_ -> do
need ["mytarget"]
system' "ln" ["-s", "mytarget", "linkname"]
It succeeds at create the symlinks, but reports an error "Error, rule "install" failed to build file: install".
So, if not with the "want" action, how do I declare that the default target I want to run is a phony one?
In shake-0.10.1 and above you can use the phony
function to write:
main = shake shakeOptions $ do
want ["install"]
phony "install" $ do
need ["mytarget"]
system' "ln" ["-s", "mytarget", "linkname"]
This should do exactly what you want, and does not require a fake file to be produced. In addition, you may want to use shakeArgs
rather than shake
so that the user can select install
from the command line, or chose another target such as clean.