Shake Build System

1 hour ago 2
  • A build system – an alternative to make, Scons, Ant etc.
  • Reliable and robust – having been relied on commercially for over five years.
  • Powerful – letting you express the problem precisely and directly.
  • Fast to run – both to build from scratch and to rebuild.

Large build systems written using Shake tend to be significantly simpler, while also running faster. If your project can use a canned build system (e.g. Visual Studio, cabal) do that; if your project is very simple use a Makefile; otherwise use Shake.

The original motivation behind the creation of Shake was to allow rules to discover additional dependencies after running previous rules, allowing the build system to generate files and then examine them to determine their dependencies – something that cannot be expressed directly in most build systems. However, now Shake is a suitable build tool even if you do not require that feature.

Click to read about why you should use Shake.

Using Shake

To try Shake you need to install the Haskell Stack, then type stack install shake, then run stack exec -- shake --demo. The final step will create a sample Shake build system and run it (you should see this output).

To write your own Shake build system, read the user manual and refer to the API documentation. Further documentation on specific topics, including more examples, is available from the FAQ. Shake build systems are Haskell programs, but can be treated as a powerful version of make with slightly funny syntax. The build system requires no significant Haskell knowledge, and is designed so that most features are accessible by learning the "Shake syntax", without any appreciation of what the underlying Haskell means.

Click to read the user manual.

Asking questions

Stuck? Confused? Frustrated? Please get in contact! If in doubt, just email the mailing list.

You can ask questions on StackOverflow using the tag shake-build-system. You can email the mailing list with anything about Shake. If you find a bug you can report it at the GitHub issue tracker. If your question needs to remain confidential you can email me, although any insights from your question won't be public, so the other approaches are preferred.

What else?

Shake can execute Ninja files, allowing integration with CMake and Meson. Shake can predict completion time, profile build systems and sanity check builds. Shake is based on a robust underlying theory from this academic paper. Shake is an open source project under the BSD license hosted on GitHub with a range of contributors.

Who uses Shake?

Shake is used by lots of companies, but only a few have declared so publicly:

There are several libraries providing pre-made rules and extending Shake:

Some libraries push Shake into specific domains:

  • bioshake lets users define bioinformatics pipelines in a DSL that is executed in conjunction with Shake, also including support for cluster execution. There is also a paper describing the system.
  • neuron is a note-taking tool based on the Zettelkasten method, that uses Shake to monitor and rebuild as the Markdown note files change.
  • Slick is a static site generator written and configured using Haskell. Slick provides a small set of tools and combinators for building static websites on top of the Shake build system.
  • Rib is a library for writing your own static site generator, prioritizing the use of existing tools over reinventing them and thereby enabling the user to compose them together.

Several open-source projects make key use of Shake:

Here are a few tutorials and blog posts:

Finally, the ideas behind Shake have helped inspire other systems:

  • swift-llbuild used Shake as the inspiration for the mechanism llbuild uses to allow additional work to be discovered on the fly.

Do you have a link that should be included above? Let me know with a tweet to @ndm_haskell.

Read Entire Article