Comment 4 for bug 874588

Revision history for this message
Elliot Kendall (elliotkendall) wrote :

I agree it does seem preferable to use LDLIBS or LOADLIBES for libraries, but not necessarily incorrect to put them in LDFLAGS.

The GNU make manual defines LDFLAGS as "Extra flags to give to compilers when they are supposed to invoke the linker," which doesn't seem to exclude something like "-lz". It mentions LDLIBS and LOADLIBES, but doesn't define them. Mecklenburg's Managing Projects with GNU make says LDFLAGS "holds options for linking such as -L flags," while LDLIBS and LOADLIBES "contain lists of libraries to link against," which is a little clearer but still not great.

Would there be any harm in moving LDFLAGS in make's implicit rules?

And if it is strictly incorrect to put libraries in LDFLAGS, could make generate a warning when they appear there? At the very least, it would be nice to mention this in the manual.