-# 1. Complain.
-# 2. Clear out the errors and exit code so we don't replay them.
-# Otherwise:
-# 1. Store the command.
-# 2. Run the command, storing errors.
-# 3. Store exit code.
-# 4. Update the real files as applicable.
-# 5. Read the new genfile.
-define mg-commands
- $(if $(filter $(abspath $(target)),$?),\
+# 1. Complain. (Should we stop "`bar' is up to date" using @:; ?)
+# 2. Clear out the warnings so we don't replay them.
+# Otherwise, check prereqs, command, and nonexistence to decide whether bar
+# needs to be regenerated. If so:
+# 1. Set a flag so Mage knows to reread the genfile when make runs target
+# "bar".
+# 2. Echo the command being run.
+# On error, skip to 8:
+# 3. Open the new genfile bar.g.tmp for writing.
+# 4. Store the command in bar.g.tmp.
+# 5. Run the command to bar.tmp, storing warnings in bar.g.tmp.
+# 6. If bar.tmp differs from bar:
+# a. Clear and touch bar.g (so bar doesn't become an override if we're
+# killed between steps 6b and 7).
+# b. Move in the new bar.
+# 7. Now that bar is known to be up to date, move in the new bar.g.
+# 8. Defensively remove both temporary files and exit with the exit code
+# from before the removal. (trap EXIT)
+define mg-generate
+ $(call gload,$(target))\
+ $(if $(filter /./proc/self/cwd/$(target),$?),\