You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Say, I have Haskell modules, filepath extension is .hs. Most modules are written by hand, but some are generated by a preprocessor from files with extension, say .lhs. My problem is not exactly about Literate Haskell, I only want to describe the general problem.
In a Makefile I can declare the rule:
%.hs: %.lhs
preprocess-lhs $< $@
If a .hs module is present without a .lhs, then make is happy and does not try to generate .hs. If an .lhs is present but older than .hs, make will also not try to regenerate the .hs. However, if .lhs is present and newer than .hs, then .hs is rebuild.
How can I teach shake this behavior?
In Shakefile.hs I can write:
"//*.hs" %> \dst -> do
let src = dst -<.> "lhs"
need [src]
cmd_ "preprocess-lhs" [src, dst]
However, if .hs is handwritten and no .lhs available, then shake will refuse to run.
I can write instead:
"//*.hs" %> \dst ->
let src = dst -<.> "lhs"
available <- doesFileExist src
when available $ cmd_ "preprocess-lhs" [src, dst]
Now, shake no longer complains about missing .lhs, but instead it does not rebuild .hs after editing .lhs.
That problem sounds pretty much like a FAQ, but I have not found it there.
The text was updated successfully, but these errors were encountered:
Say, I have Haskell modules, filepath extension is
.hs
. Most modules are written by hand, but some are generated by a preprocessor from files with extension, say.lhs
. My problem is not exactly about Literate Haskell, I only want to describe the general problem.In a
Makefile
I can declare the rule:If a
.hs
module is present without a.lhs
, thenmake
is happy and does not try to generate.hs
. If an.lhs
is present but older than.hs
, make will also not try to regenerate the.hs
. However, if.lhs
is present and newer than.hs
, then.hs
is rebuild.How can I teach shake this behavior?
In
Shakefile.hs
I can write:However, if
.hs
is handwritten and no.lhs
available, thenshake
will refuse to run.I can write instead:
Now,
shake
no longer complains about missing.lhs
, but instead it does not rebuild.hs
after editing.lhs
.That problem sounds pretty much like a FAQ, but I have not found it there.
The text was updated successfully, but these errors were encountered: