Libtool has a widely used feature called Libtool Convenience Libraries.
Today we discovered an not-very-expected side effect of using this feature – it breaks make -n.
This happens because when Makefile.am contains
libxxx_la_LIBADD = dir/libyyy.la
generated Makefile gets libxxx.la dependent on dir/libyyy.la.
On normal build, subdirs get processed first and dir/libyyy.la is generated, so at the moment when make starts processing libxxx.la goal, this dependency is already satisfied.
However, if running make -n, nothing is generated. So dependency on dir/libyyy.la is not satisfied. Since local Makefile has no information on how to build non-local goals, make aborts with a dependency error.
Btw, something similar could happen on parallel builds? Likely make and/or autotools use some magic to workaround that. And the dependency on dir/libyyy.la may be a part of that magic – don’t know.
Anyway, if make -n functionality is needed, it may be restored by removing such dependencies from generated Makefile’s. Physically, these dependences look like references to variables $(libxxx_la_DEPENDENCIES). And these variables are used only for these dependences – so it is safe to just remove them.
So the command to restore make -n is
find . -name Makefile | xargs sed -i 's/\$([^ ]*_la_DEPENDENCIES)//'
Once done with make -n, Makefile’s may be regenerated by running config.status script.
english
русский
Leave a Reply