Commit Diff


commit - 077542bba7acfefa404a7e21eac89899f62c2503
commit + d7049d35a611e6576ace39f4904b26ecf209967e
blob - 60b1abe6f2de664b24315821a249eaf4b228a380
blob + a5a7d210f473a315351d07c837ab873c03fc92cb
--- make/TODO.md
+++ make/TODO.md
@@ -53,10 +53,6 @@ Maybe consider something like this too: `.SUBDIRS: may
 ## Optional: `${@F}`, `${@D}`, `${<F}`, `${<F}`, `${*F}`, `${*D}`, `${^F}`, `${^D}`
 Filename or Directory portions of the variables.
 
-## `${.MAKEFILES}`
-Gives a list of all ancestor makefiles.
-This does not include brother, uncle or child makefiles.
-
 # Special targets
 ## `.TOP:` to stop the upward recursion
 This must be defined at the top of the file.
blob - c94aa231b98f645efc834ce2499d078387c7858a
blob + 46f64ae61f36f07450d219bc8248dabc5ed82d6d
--- make/make.c
+++ make/make.c
@@ -819,6 +819,7 @@ struct expand_ctx *ctx;
 	struct scope *sub;
 	struct macro *m;
 	struct dep *dep;
+	int i, j;
 
 	/* TODO: .SUBDIRS, .EXPORTS */
 
@@ -881,6 +882,14 @@ struct expand_ctx *ctx;
 		str_putc (out, '.');
 		for (sub = sc->parent; sub != NULL; sub = sub->parent)
 			str_puts (out, "/..");
+	} else if (strcmp (name, ".MAKEFILES") == 0) {
+		for (i = 0, sub = sc; sub != NULL; ++i, sub = sub->parent) {
+			for (j = 0; j < i; ++j)
+				str_puts (out, "../");
+			str_puts (out, sub->makefile);
+			str_putc (out, ' ');
+		}
+		str_pop (out);
 	}
 	return 0;
 }