Shake is...
- 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:
- Standard Chartered have been using Shake since 2009, as described in the section 6 of the academic paper.
- factis research GmbH use Shake to compile their Checkpad MED application, as described in their blog post.
- Samplecount have been using Shake since 2012, as mentioned in their tweet, producing several open-source projects for working with Shake.
- CovenantEyes use Shake to build their Windows client, as mentioned in their tweet.
- Keystone Tower Systems has a robotic welder with a Shake build system plus Haskell code running in the control system, as mentioned in their tweet.
- FP Complete use Shake to create Docker images.
- codebender use Shake to manage JavaScript packages that implement Arduino protocols and handle communication between the browser and Arduino devices.
- Swift Navigation use Shake for their release process, as described by their presentation.
- NoRedInk use Shake to build stuff.
- Digital Asset use Shake as part of their DAML SDK IDE, as can be seen in the central module.
There are several libraries providing pre-made rules and extending Shake:
- shake-plus wraps all of Shake to use the Path library,
ReaderT
wrappers and the Text library. - shake-language-c allows cross-compiling C, C++ and Objective-C code to various target platforms.
- shake-cpp is an abstraction layer for Shake, providing simple C++ rules.
- kansas-lava-shake provides a set of rules to work with Kansas Lava and compile down to Xilinx chips.
- avr-shake provides rules for building things with AVR Crosspack.
- shake-minify uses native Haskell code (no external
$PATH
dependencies) to minify CSS and JS files. - shake-pack uses bz2 lib on the system to tar and bzip compress given files.
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:
- GHC uses a Shake-based build system named Hadrian.
- Shakebook uses Shake and Pandoc to provide a website generator.
- ToolCabal is a rewrite of Cabal using Shake as the dependency engine.
- ghc-make uses Shake to build programs with GHC, speeding up checking if the build is clean.
- Ghcide is a Haskell IDE which uses Shake as its core.
- shake-install helps build a set of cabal packages in the correct order.
- OpenSUSE Haskell packaging makes use of Shake to convert a Stack project to OBS.
- Pier is an alternative to Stack using Shake as the dependency engine.
Here are a few tutorials and blog posts:
- Many articles from the author of Shake, covering ongoing development.
- Writing a simple Blog with Shake and Pandoc.
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
.