Questions about makefile

I looked some makefiles wrote by others. There are some questions about arguments.
1. Sometimes I saw -I. is used. As I know -I is used to include a path which has the header files needed. what does mean of "-I." ?

2. When we need to use a library, I mean .a file. It seems there is two ways :
(1) directly add library as a flag : libmine.a
(2) use -l as : -lpthread
Is there difference between them ?

3. How do I include a share library (.so) in makefile? Do I only need to add the path using -L but no need use -l to specify the exact library I need ?


Thank you in advance.
. is the current working directory, from where you execute make. I think that it should be on the included path by default, so shouldn't be needed.


From the man
The only difference between using an -l option and specifying a file name
is that -l surrounds library with lib and .a and searches several
directories.


you link *.so (dynamic) in the same as *.a (static)
http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html (3.5)
The only difference between using an -l option and specifying a file name
is that -l surrounds library with lib and .a and searches several
directories.


OK, so that is why -l is usually used for system library like -lpthread, as I saw.

Thank you very much!
Last edited on
Topic archived. No new replies allowed.