20

In the GNU Make documentation, variables LDLIBS and LOADLIBES are not documented in its corresponding section. I've read that these variables exists only for compatibility purposes, and that they are equivalents (same meaning). But, LDLIBS is still used spreadly.

Could it be said that LDLIBS is a deprecated variable, or would it be safe using it? If not, why is LDLIBS ignored by its documentation?

2 Answers 2

40

It seems LOADLIBES is deprecated, but LDLIBS is not. Thus, manual says:

LDFLAGS: Extra flags to give to compilers when they are supposed to invoke the linker, ld, such as -L. Libraries (-lfoo) should be added to the LDLIBS variable instead.

LDLIBS: Library flags or names given to compilers when they are supposed to invoke the linker, ld. LOADLIBES is a deprecated (but still supported) alternative to LDLIBS. Non-library linker flags, such as -L, should go in the LDFLAGS variable.

2
  • 3
    Many thanks for pasting this excerpt. I just need this differentiation between LDFLAGS and LDLIBS .
    – gpanda
    Commented Dec 30, 2015 at 6:10
  • 4
    I had a very complex make system and along the way I double-guessed myself several times about the relationship of these variables... needless to say I found myself back here each time. Thank you brother. :) For any future visitor, it's as simple as you might guess it is - you put down flags (LDFLAGS) directing traffic before you do any construction (LDLIBS). Maybe you can think of a better analogy/mnemonic, it's deliberately uninspired.
    – John P
    Commented Mar 24, 2018 at 8:10
11

The GNU make manual says, in http://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html:

The following tables describe of some of the more commonly-used predefined variables. This list is not exhaustive

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.