sriramn
sriramn

Reputation: 2378

Makefile -L command

If I have this line in the make file:\

libpqxx_Libs = -L/share/home/cb -lpqxx-2.6.9 -lpq

Does this indicate the compiler to use the lpqxx-2.6.9.so shared object file or does this indciate the compiler to use all the .so in the foler lpqxx-2.6.9? Or is this something else altogether?

Thanks for the help!

Upvotes: 0

Views: 1144

Answers (2)

pb2q
pb2q

Reputation: 59617

-L in this context is an argument to the linker, that adds the specified directory to the list of directories that the linker will search for necessary libraries, e.g. libraries that you've specified using -l.

It isn't a makefile command, even though it's usually seen in makefiles for C projects.

Upvotes: 1

Reinier Torenbeek
Reinier Torenbeek

Reputation: 17383

The -L is actually not a makefile command (as you state it in the title of your question).

What actually happens in this line is an assignment of a value to the variable libpqxx_Libs -- nothing more and nothing less. You will have to search in your makefile where that variable is used via $(libpqxx_Libs) or ${libpqxx_Libs}. That is most likely as a argument in a link command, or a compile command that includes linking.

In that context, the meaning of -L and -l can be found in, for example, the gcc man pages, which state that

-llibrary
   Use the library named library when linking.

   The linker searches a standard list of directories  for  the  li-
   brary, which is actually a file named `liblibrary.a'.  The linker
   then uses this file as if it  had  been  specified  precisely  by
   name.

   The directories searched include several standard  system  direc-
   tories plus any that you specify with `-L'. 

Upvotes: 1

Related Questions