make remade
Find a file
2013-03-04 00:06:24 -08:00
expand.go Prettier printing. 2013-03-03 18:57:14 -08:00
graph.go Implement -a and -p arguments. 2013-03-04 00:06:24 -08:00
lex.go Prettier printing. 2013-03-03 18:57:14 -08:00
mk.go Implement -a and -p arguments. 2013-03-04 00:06:24 -08:00
parse.go Prettier printing. 2013-03-03 18:57:14 -08:00
README.md Some more work on string expansion. 2013-02-28 22:49:34 -08:00
recipe.go Prettier printing. 2013-03-03 18:57:14 -08:00
rules.go ruleset.go -> rules.go 2013-03-03 23:32:36 -08:00

Mk

Mk is a reboot of the Plan 9 mk command, which itself is a replacement for make. This tool is for anyone who loves make, but hates all its stupid bullshit.

Why Plan 9 mk is better than make

Plan 9 mk blows make out of the water. Yet tragically, few use or have even heard of it. Put simply, mk takes make, keeps its simple direct syntax, but fixes basically everything that's annoyed you over the years. To name a few things:

  1. Recipes are delimited by any indentation, not tab characters in particular.
  2. Phony targets are handled separately from file targets. Your mkfile won't be broken by having a file named 'clean'.
  3. Attributes instead of weird special targets like .SECONDARY:.
  4. Special variables like $target, $prereq, and $stem in place of make's pointlessly cryptic $@, $^, and $*.
  5. In addition to suffix rules (e.g. %.o: %.c), mk has more powerful regular expression rules.
  6. Sane handling of rules with multiple targets.
  7. An optional attribute to delete targets when a recipe fails, so you aren't left with corrupt output.
  8. Plan 9 mkfiles can not only include other mkfiles, but pipe in the output of recipes. Your mkfile can configure itself by doing something like <|sh config.sh.
  9. A generalized mechanism to determine if a target is out of date, for when timestamps won't cut it.
  10. Variables are expanded in recipes only if they are defined. They way you usually don't have to escape $.

And much more! For more, read the original mk paper: "Mk: a successor to make".

Improvements over Plan 9 mk

This mk stays mostly faithful to Plan 9, but makes a few (in my opinion) improvements.

  1. A clean, modern implementation in go, that doesn't depend on the whole plan 9 for userspace stack.
  2. Use go regular expressions, which are perl-like. The original mk used plan9 regex, which few people know or care to learn.
  3. Allow blank lines in recipes. A recipe is any indented block of text, and continues until a non-indented character or the end of the file.
  4. Add an 'S' attribute to execute recipes with programs other than sh. This way, you don't have to separate your six line python script into its own file. Just stick it in the mkfile.
  5. Use sh syntax for command insertion (i.e. backticks) rather than rc shell syntax.

Current State

Totally non-functional. Check back later!