Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make: LDLIBS, deprecated?

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?

like image 830
Peregring-lk Avatar asked Jun 11 '13 19:06

Peregring-lk


People also ask

What is Ldlibs in Makefile?

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 .

What does $$ mean in a Makefile?

6.1 Basics of Variable References This special significance of ' $ ' is why you must write ' $$ ' to have the effect of a single dollar sign in a file name or recipe. Variable references can be used in any context: targets, prerequisites, recipes, most directives, and new variable values.

What is $@ in Makefile?

The file name of the target of the rule. If the target is an archive member, then ' $@ ' is the name of the archive file. In a pattern rule that has multiple targets (see Introduction to Pattern Rules), ' $@ ' is the name of whichever target caused the rule's recipe to be run.

What is Cflags and Ldflags in Makefile?

The make-specific variables (the ones in capital letters) follow a name convention such that: CC refers to the compiler (gcc in this case); CFLAGS contains compiler directives/options; and LDFLAGS is a list of link (or "load") directives (here, instructions to link with the C math library).


2 Answers

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.

like image 189
Jérôme Pouiller Avatar answered Oct 11 '22 20:10

Jérôme Pouiller


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

like image 43
MadScientist Avatar answered Oct 11 '22 20:10

MadScientist