Skip to content

Instantly share code, notes, and snippets.

@kokobd
Created March 13, 2019 04:01
Show Gist options
  • Save kokobd/a73e76323b86559863875f681da93f98 to your computer and use it in GitHub Desktop.
Save kokobd/a73e76323b86559863875f681da93f98 to your computer and use it in GitHub Desktop.
Shake build file for Latex
#!/usr/bin/env stack
{- stack
script
--resolver lts-13.12
--package shake
-}
import Development.Shake
import Development.Shake.Command
import Development.Shake.FilePath
import Development.Shake.Util
buildDir :: FilePath
buildDir = "build"
main :: IO ()
main = shakeArgs shakeOptions{shakeFiles=buildDir} $ do
want [buildDir </> "report.pdf"]
phony "clean" $ do
removeFilesAfter "build" ["//*"]
buildDir </> "report.pdf" %> \out -> do
texFiles <- getDirectoryFiles "" ["//*.tex"]
need texFiles
images <- getDirectoryFiles "" ["images//*.png"]
need images
cmd_ "latexmk -pdf -bibtex -xelatex -interaction=nonstopmode"
("-outdir=" ++ buildDir)
"-shell-escape"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment