先安装shake:
cabal install shake
root@AR:~# /root/.cabal/bin/shake --version
Shake build system, version 0.15.10
root@AR:~# echo "export PATH=$PATH:/root/.cabal/bin/" >> /etc/profile
root@AR:~# . /etc/profile
root@AR:~# shake --version
Shake build system, version 0.15.10
root@AR:~#
这样,shake就安装好了。
Shake
Shake is a tool for writing build systems - an alternative to make, Scons, Ant etc. Shake has been used commercially for over five years, running thousands of builds per day. The website for Shake users is at shakebuild.com.Documentation
- Why use Shake? Shake lets you write large robust build systems, which deal properly with generated source files and run quickly. If you are writing a custom build system of any moderate size (more than a few rules) you should use Shake. The advantages over other build systems are detailed in the document Why choose Shake?.
- How do I use Shake? Shake is a Haskell library that you use to define your rules. The Shake manual provides a walk through of a small but realistic example, assuming no Haskell knowledge.
- Generated documentation for all functions, includes lots of examples.
- Blog posts detailing ongoing development work.
- Academic paper on the underlying principles behind Shake.
Other links
- Download the Haskell package from Hackage and install it using Cabal.
- Mailing list for any questions/bugs/thoughts on Shake. If you need more information and aren't sure where to start, use the mailing list.
- Questions can be asked on StackOverflow with the tag
shake-build-system
.
@ndm_haskell
) and I'll include a link on the website.from https://github.com/ndmitchell/shake/
----------
The code under https://github.com/ndmitchell/shake/tree/master/website combines fragments from https://github.com/ndmitchell/shake/tree/master/website/parts along with documentation from https://github.com/ndmitchell/shake/tree/master/docs to produce pages. Mostly custom code in the end, with Markdown to parse and convert the pages, followed by TagSoup to tweak them.
from https://github.com/ndmitchell/shake/issues/139
-----------
https://hackage.haskell.org/package/shake
http://hackage.haskell.org/package/shake-0.15.10/docs/Development-Shake.html
-----------
"ghc --make" reimplemented with Shake
ghc-shake This is a reimplementation of ghc --make using Shake. It's entirely one process, so unlike out-of-process Shake, you won't see any slowdown compared to --make if you compile with only one core. # What's the benefit? 1. You get faster rebuild checking, because Shake doesn't recompute the entire dependency graph (ghc --make must preprocess and parse all source code every time it loads.) 2. You can keep going even when one file fails to compile, making sure that anything can be built, is built. 3. You get all the nice Shake features, e.g. unchanging rebuilds and profiling. The profiling is really handy! # How do I use it? You'll need these two (somewhat hard to get) items: - GHC 8.0 - A customized version of Shake: https://github.com/ezyang/shake - Appropriately patched copies of all of Shake's dependencies to work with GHC 8.0. If you wait, these will probably work out; but at the time of writing I needed to pass --allow-newer=base,transformers,process to cabal to get all of the dependencies to install. One way to to get everything installed (assuming GHC 8.0 is in your path) is to run: git clone https://github.com/ezyang/shake (cd shake && cabal install --allow-newer=base,transformers,process) git clone https://github.com/ezyang/ghc-shake (cd ghc-shake && cabal install --allow-newer=base,transformers,process) This will enable usage of `ghc --frontend GhcShake`. We have a sample script 'ghc-shake' in our source directory which you can pass to Cabal as a `--with-ghc` argument, which will override the meaning of `--make` (however, you'll need to edit the `-plugin-package-db` arguments to accurately reflect your installation. If you're not building ghc-shake in place, deleting them should be good enough.) # What doesn't work 1. Re-linking detection across packages. See https://ghc.haskell.org/trac/ghc/ticket/10161 2. Profiling. See https://ghc.haskell.org/trac/ghc/ticket/11293 3. Linking things that are not executables 4. Recompilation after package database changes. (We do correctly pick up changes to external interface files, however.) 5. ghc-shake is not really lib-ified properly (it should be namespaced and given explicit exports). I'll do this eventually. 6. hs-boot loops don't work; we don't properly invalidate the EPS when we successfully compile the replacement for an hs file. If you need something, shout and I'll try to implement it.
from https://github.com/ezyang/ghc-shake
---------------------------
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.
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 typestack 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.
- Genomics Plc use Shake for the build system, their first major use of Haskell in the company.
- codebender use Shake to manage JavaScript packages that implement Arduino protocols and handle communication between the browser and Arduino devices.
- 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.
- 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.
- GHC is in the process of migrating to a Shake-based build system.
- shake-install helps build a set of cabal packages in the correct order.
- Many articles from the author of Shake, covering ongoing development.
- Writing a simple Blog with Shake and Pandoc.
------------------
I'm a Haskell programmer who lives in Cambridge with my wife Emily and son Henry (who has grown up a little since the photo on the right was taken). I have a PhD in Computer Science from York University, working on making functional programs shorter, faster and safer. Since then I've worked with F# at Credit Suisse and Haskell/F#/C++ at Standard Chartered, taking the lessons of functional programming and applying them in finance. I'm a strong believer in the functional approach, finding the combination of conciseness, static-typing and testability to offer significant advantages. I've got a blog mostly about Haskell, and I'm also on Twitter, LinkedIn and GitHub. To get in touch email me at ndmitchell@gmail.com.
Open Source Projects
I develop a number of open source Haskell projects, all of which can be found at my Github page or on Hackage. I welcome both contributions via pull requests and bug reports via the GitHub issue trackers. Some of my more popular projects include:- Shake - a library for writing build systems, an alternative to
make
. - Hoogle - a Haskell API search engine, searching the standard Haskell libraries by function name and type signature.
- HLint - a tool that suggests stylistic improvements to Haskell code.
Papers and talks
All papers and talks are listed below, most recent first. Show all abstracts or citations.Talk: Defining your own build system with Shake
How to define your own build system using Shake.
Talk: Shake 'n' Bake
Talk: Building stuff with Shake
A tutorial on Shake, with lots of standalone examples.
Talk: Gluing things together with Haskell
A tour of some of my projects designed to glue code together, replacing shell scripts and Makefiles. Covers Shake, NSIS and Bake.
Talk: Colin's Industrial Influence
A joint talk with Malcolm Wallace covering some projects influenced by Colin Runciman. My slides cover Uniplate and Hoogle.
Paper: Shake Before Building - Replacing Make with Haskell
An introduction to Shake, focusing on the theoretical side.
Talk: Hoogle: Finding Functions from Types
An overview of how type-search works in Hoogle v1 to v4.
Talk: Shake: A Better Make
Early details about the design of Shake.
Paper: Rethinking Supercompilation
Thoughts about making supercompilation faster, based on my experiments with Supero.
Paper: Deriving a Relationship from a Single Example
Paper, slides, citation, abstract from Approaches and Applications of Inductive Programming 2009, 04 Sep 2009.
Assuming you have a single example of a type class, what
should the data type be, and what range of instances can be described.
Implemented in the Derive tool.
Paper: Losing Functions without Gaining Data
An algorithm for making higher-order programs
first-order without introducing new data types (e.g. without doing
Reynold's style defunctionalisation). The resulting program may have
worse time complexity, but that's fine for certain types of analysis.
Implemented as Firstify and used in Catch.
Talk: Supercompilation for Haskell
Details of how to apply supercompilation to Haskell.
Paper: Hoogle Overview
An overview of Hoogle, including both the algorithms and code structure.
Paper: Not All Patterns, But Enough - an automatic verifier for partial but sufficient pattern matching
A static analysis for automatically proving a program will not raise an error at runtime, implemented as Catch. The analysis was able to detect 3 bugs in the HsColour program.
Talk: Hoogle: Fast Type Searching
An early overview of how both type and text search works in Hoogle.
Thesis: Transformation and Analysis of Functional Programs
My PhD thesis, covering a generics library (Uniplate), a supercompiler (Supero), a defunctionalisation algorithm (Firstify) and a pattern-match safety verifier (Catch).
Talk: Instances for Free
Generating Haskell instances from examples, as found in the Derive tool.
Paper: A Supercompiler for Core Haskell
An early design of the Supero supercompiler. This paper won the Peter Landin prize for the best paper presented at the symposium that year, as selected by the programme committee.
Talk: Detecting Pattern-Match Failures in Haskell
Details about Catch, including worked examples.
Paper: Deriving Generic Functions by Example
An early version of the generic deriving work from Derive.
Paper: Uniform Boilerplate and List Processing
Details of the Uniplate generics library, including information on how to use the Uniplate operations.
Paper: Supero: Making Haskell Faster
A very early version of Supero, before it was an actual supercompiler.
Talk: Yhc: Past, Present, Future
The history behind Yhc, along with future plans and intentions.
Talk: Faster Haskell
Early work on Supercompilation.
Talk: Transformation and Analysis of Haskell Source Code
Slides giving a very quick overview of my thesis.
Talk: Fastest Lambda First
Details of a whole-program optimiser for Haskell, early work on Supero.
Paper: Yhc.Core - from Haskell to Core
Information about the Yhc core language, its constructors and semantics.
Talk: First Order Haskell
An early version of a mechanism for defunctionalising Haskell programs, which later became Firstify.
Talk: Ada: Generics
First-year lecture notes on generics in Ada.
Paper: A Static Checker for Safe Pattern Matching in Haskell
An early version of Catch.
Talk: Playing with Haskell Data
Generic traversals and transformations over Haskell data types, what would later become Uniplate.
Talk: Haskell With Go Faster Stripes
How to make Haskell faster.
Talk: Hat: Windows and WIMP
Thoughts about how the Hat tools could benefit from GUI elements.
Talk: Catch, A Practical Tool
Very early notes on Catch.
Talk: Catch, Lazy Termination
Discussions about what termination means in a lazy language, and how to detect it.
Talk: Hoogle
An early introduction to Hoogle.
Paper: Visual Hat
Thoughts on how to make the Hat tools work in a GUI.
Paper: Unfailing Haskell: A Static Checker for Pattern Matching
A very early version of Catch.
Paper: Qualifying Dissertation: Unfailing Haskell
Discussions of total functional programming, an an early prototype of Catch.
Talk: Total Pasta
An algorithm for automatically proving totality of a simple pointer-based programming language.
Talk: Termination checking for a lazy functional language
A review of the literature around termination checking, particular in lazy languages.
Talk: A New Parser
Thoughts about an alternative way to do parsing.from http://ndmitchell.com/