-
Notifications
You must be signed in to change notification settings - Fork 1
/
Build.hs
41 lines (33 loc) · 1.23 KB
/
Build.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import Development.Shake
import Development.Shake.Command
import Development.Shake.FilePath
import Development.Shake.Util
ottFile = "Gen/ott-rules.tex"
doc = "Thesis"
ottFlags = "-tex_wrap false -tex_show_meta false"
main :: IO ()
main =
shakeArgs shakeOptions {shakeFiles = "_build"} $ do
want [doc <.> "pdf"]
"*.pdf" %> \_ -> do
texSource <- getDirectoryFiles "" ["/*.tex", "Sources//*.tex"]
codeSource <- getDirectoryFiles "" ["examples/*.sl"]
genFiles <-
(\mngSource ->
["Gen" </> (dropDirectory1 c -<.> "tex") | c <- mngSource]) <$>
getDirectoryFiles "" ["Sources//*.mngtex"]
need $ [ottFile] ++ genFiles ++ texSource ++ codeSource
cmd "latexmk" [doc -<.> "tex"]
"Gen//*.tex" %> \out -> do
ottSource <- getDirectoryFiles "" ["spec/*.ott"]
let dep = "Sources" </> dropDirectory1 out -<.> ".mngtex"
need $ dep : ottSource
cmd "ott" ottSource ottFlags "-tex_filter" [dep] [out]
ottFile %> \out -> do
ottSource <- getDirectoryFiles "" ["spec/*.ott"]
need ottSource
cmd "ott" ottSource ottFlags "-o" [out]
phony "clean" $ do
putNormal "Cleaning files in _build"
removeFilesAfter "_build" ["//*"]
cmd "latexmk -c"