Link binaries with -Wl,--as-needed to reduce library dependencies
authorSteven Luo <steven+maemo@steven676.net>
Mon, 22 Feb 2010 06:29:32 +0000 (22:29 -0800)
committerSteven Luo <steven+maemo@steven676.net>
Mon, 22 Feb 2010 06:29:32 +0000 (22:29 -0800)
commitd6e7a8bf0f28cdb7156b891ff565d5406047914a
tree3fa0d6211a11a65bd747a79401dd3da7d521cace
parent3fda8f516f04eb9c0a0f7622da4ed985c1a6a632
Link binaries with -Wl,--as-needed to reduce library dependencies

Using pkg-config --libs to get library link lines has the disadvantage
of bringing in many more library dependencies than actually necessary,
since that assumes that dependencies of libraries need to be specified
explicitly at link time (even when the library is itself linked against
those dependencies).  Using GNU ld's --as-needed option causes these
unnecessary dependencies to be omitted from the binary.

--as-needed needs to be specified after all the objects to be linked
into the binary and before the libraries, so some reordering of the link
command line is needed.
Makefile
config-ui/Makefile