I find this issue is seen only when I am building shared libraries.
Here is the exact issue: In main.mk:
lib_LTLIBRARIES += libone.la
libone_la_LIBADD =
In dir-one/automake.mk:
...
libone_la_LIBADD += libtwo.la
...
In dir-two/automake.mk:
...
libone_la_LIBADD += libthree.la
...
In Makefile.am:
include main.mk
include dir-one/automake.mk
include dir-two/automake.mk
While make runs fine, make install
complains that linker cannot find -ltwo
and -lthree
.
So:
lib_LTLIBRARIES += libthree.la libtwo.la libone.la
should give you the right install order.