[PATCH v2 5/6] Makefile: Order the top-level stamp files before the subdirectory fan-out

Adhemerval Zanella <[email protected]> Thu, 6 Aug 2026 14:07:59 -0300
Newsgroups gmane.comp.lib.glibc.alpha
Message-ID <[email protected]>
The archive rules in Makerules list every stamp file as a prerequisite,
including the top level's own, and the elf sub-make evaluates them to
build libc_pic.a for the librtld.map link.  A sub-make can only create
the stamp files of its own directory, so when the top-level ones do not
exist yet it fails with:

  make[2]: *** No rule to make target '.../stamp.os', needed by
  '.../libc_pic.a'.  Stop.

The serial recursion created them before the subdirectories through the
prerequisite order of subdir_lib; the parallel recursion (commit
7cac99621e96) does not.  Add them as prerequisites of the object-building
per-subdirectory targets.
---
 Makefile | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Makefile b/Makefile
index b9fac6f47c6..d559c428736 100644
--- a/Makefile
+++ b/Makefile
@@ -575,6 +575,14 @@ $(foreach t,$(+elf_last_subdir_targets),$(eval \
   elf/$(t): $(addsuffix /$(t),$(filter-out elf,$(subdirs)))))
 endif
 
+# The archive rules in Makerules list every stamp file as a
+# prerequisite of libc_pic.a, which the elf sub-make evaluates for the
+# librtld.map link, but a sub-make can only create its own directory's
+# stamps.  Create the top-level ones before the fan-out.
+$(foreach t,$(+elf_last_subdir_targets),$(eval \
+  $(addsuffix /$(t),$(subdirs)): \
+    $(foreach o,$(object-suffixes-for-libc),$(common-objpfx)stamp$(o))))
+
 # Pass barriers: a subdirectory 'others' build links programs against
 # the libraries, so the 'lib' pass (including the top-level libc.so
 # link) must have completed.
-- 
2.53.0