Search code examples
haskellshake-build-system

Is there a way to get Shake (build system) to show all the Rules that were generated


I have a lot of rules i'm generating via calling functions with parameters (similar rules that vary slightly depending on which project to build) and when no parameters are passed or a "show_all" is passed as a target I'd like to list out all the generated rules.

How can I do that or is it impossible?


Solution

  • Using Shake v0.17.6 you can run --help which prints out something like:

    Usage: my-shake-builder [options] [target] ...
    
    Standard options:
      -a FULL=SHORT, --abbrev=FULL=SHORT
                                  Use abbreviation in status messages.
      ... snip ...
      --no-print-directory        Turn off -w, even if it was turned on implicitly.
    
    Extra options:
      --clean                     Clean before building.
      --sleep                     Pause before executing.
      --usepredicate              Use &?> in preference to &%>
    
    Targets:
      - Main.exe
      - **/*.deps
      - **/*.dep
      - **/*.o
      - **/*.hi
      - .pkgs
    

    By default all rules with a name or pattern, e.g. phony, %>, &%> etc, are added as names, but you can control that through the addTarget function. You can get a list or targets by passing --help or using the function getTargets (which is what --help uses under the hood).