This cannot be done using the simple * .a middleware library. This is because the middleware is never linked, so LDFLAGS doesn't make sense to it. An intermediate library is just an archive archive, which is just a collection of object files. There is no place in the ar archive for writing flags that will need to be used to bind the final object.
The normal solution is what William Pursell offers: add the necessary LDFLAGS to the final executables or shared libraries that you create during the build process.
Another possibility is to create your intermediate libraries as libtool * .la libraries, although you will only use them as intermediate libraries. When you do this, the assembly system will generate a shared object (which you ultimately do not use, since you will combine the base object files into the actual assembly artifact), but more importantly, it will create a * .la file that has space for recording such kind of dependency information. The Automake manual calls it the Libtool Convenience Library. To do this, you need to use libtool, of course, and switch to calling this libfoo.la in Makefile.am and list it in noinst_LTLIBRARIES . But if you are not already using libtool, this is probably more of a problem than it costs.
source share