+# TARGET OBFUSCATION
+
+# Mage uses two kinds of "obfuscated targets" (those that are not the simple
+# names of real files):
+# - An always-exists target like /.//. is used as a prerequisite of an implicit
+# rule. Since it exists, make doesn't second-expand its own prerequisites
+# until it is actually run. This way, a target's prerequisites can depend on
+# the results of previous command scripts.
+# - An alternative-name target like /.//./proc/self/cwd/bar is used to check the
+# mtime of a file without actually building it or introducing a circular
+# dependency.
+
+# $(newoid) allocates and returns a new obfuscation ID (oid). Example:
+# x:=$(newoid)
+# You can then refer to target $x or $x$(aname)bar (for any file bar).
+# Prerequisites and commands come from $($x@opr) and $($x@ocmd).
+# Target-specific variables $(oid) and $(otgt) (if alternate-name) are
+# available.
+
+opfx:=/./
+# TODO If the system doesn't support /proc/self/cwd, use something else.
+aname:=/proc/self/cwd/
+nextoid:=/./.
+newoid=$(nextoid)$(eval nextoid:=$(subst /.//////,//./,$(patsubst /.//////%,/././%,$(nextoid:.=/.))))
+
+# High-priority implicit rule for obfuscated targets. Works for both always-
+# exists and alternate-name targets.
+$(opfx)%: oid=$(word 1,$(subst $(aname), ,$@))
+$(opfx)%: otgt=$(word 2,$(subst $(aname), ,$@))
+$(opfx)%: $$($$(oid)@opr)
+ $($(oid)@ocmd)