Controlling rebuilds

By default, Shake rebuilds everything that has changed. However, sometimes you want to rebuild things that haven't changed, or not rebuild things that have changed. To support this workflow Shake provides three modes:

To set these flags in the ShakeOptions structure there is a field shakeRebuild of type [(Rebuild, FilePattern)].

By default all files are set to RebuildNormal. To set all .o files to rebuild regardless you can set shakeRebuild to [(RebuildNow, "**/*.o")]. Where a file patches multiple patterns, the last one is applied.

To set these flags on the command line use --rebuild=PAT (for RebuildNow), --skip=PAT (for RebuildLater) and --no-rebuild (for RebuildNormal). For example, to rebuild all .o files pass --rebuild=**/*.o. If you omit the pattern it defaults to **, which matches everything.

There is currently no RebuildNever flag to permanently mark a file as up-to-date. Such a flag could cause inconsistent builds, but more relevantly, it hasn't been implemented yet.

Comparison to Make

The make tool has a number of features to force rebuilds or skip rebuilds, all fundamentally modelled on file modification times forming an order, which is quite a different model to Shake.