Subject: archive DEPENDENCIES incorrectly depends on ordering

From: Mike Frysinger <[email-masked]>
Date: Mon, 2 Jan 2023 23:32:24 -0500

i have a project that generates a bunch of arch-specific archives.  i also have
an intermediate archive for holding common objects (so only need to build them
once).  i noticed that while (ab)using LIBADD & OBJECTS variables, Automake
incorrectly omits propagating OBJECTS variables from LIBADD to DEPENDENCIES if
the library using the OBJECTS comes before the library defining the OBJECTS.

attaching a testcase to run against current git that triggers the bug that
hopefully makes it a little clearer:
* libmMID.a defines a bunch of common objects
* libaFIRST.a and libzLAST.a adds libmMID.a's objects to its libadd
* libaFIRST.a's dependency is *missing* the objects, but libzLAST.a has them

$ ./pre-inst-env ./runtest t/ar-dep.sh
...
+ grep _a_DEPENDENCIES = Makefile.in
libaFIRST_a_DEPENDENCIES =
libzLAST_a_DEPENDENCIES = $(libmMID_a_OBJECTS)
+ grep ^libzLAST_a_DEPENDENCIES = $(libmMID_a_OBJECTS) Makefile.in
libzLAST_a_DEPENDENCIES = $(libmMID_a_OBJECTS)
+ grep ^libaFIRSTT_a_DEPENDENCIES = $(libmMID_a_OBJECTS) Makefile.in
+ am_exit_trap 1
...
-mike