Makefile options CFLAGS, LDFLAGS, LIBS, cflagsldflags
Makefile options CFLAGS, LDFLAGS, LIBS
CFLAGS indicates the options used in the C compiler,
CXXFLAGS indicates the options used for the C ++ compiler.
These two variables actually cover the compilation and compilation steps.
CFLAGS: Specifies the path of the header file (. h file), for example, CFLAGS =-I/usr/include-I/path/include. Similarly, when installing a package, an include directory will be created in the installation path. When there is a problem during the installation process, try to add the include directory of the previously installed package to this variable.
LDFLAGS: Gcc and other compiler will use some optimization parameters, you can also specify the location of the library file in it. Usage: LDFLAGS =-L/usr/lib-L/path/to/your/lib. Each package is installed with a lib directory. If a package is obviously installed, and when another package is installed, it cannot be found. You can try using the LDFALGS added to the lib path of the package.
LIBS: Tell the linker which library files to link, such as LIBS =-lpthread-liconv
To put it simply, LDFLAGS tells the linker where to find the library file, while LIBS tells the linker which library files to link. However, these two parameters are added during the link phase, so even if you swap these two values, there is no problem.
Sometimes, although LDFLAGS specify-L to allow the linker to find the library and link it to, the runtime linker cannot find this library. If you want to extend the path of the library file during software runtime, then we need to add these two libraries to "-Wl, R ":
LDFLAGS =-L/var/xxx/lib-L/opt/mysql/lib-Wl, R/var/xxx/lib-Wl, R/opt/mysql/lib
If. /configure previously set the environment variable export LDFLAGS = "-L/var/xxx/lib-L/opt/mysql/lib-Wl, R/var/xxx/lib-Wl, r/opt/mysql/lib ". Note that no space is allowed on both sides of the environment variable equal sign and quotation marks must be added (shell usage ). After configure is executed, Makefile will set this option. This parameter will be used during the link, and the library file search path of the compiled executable program will be extended.
Http://www.cnblogs.com/taskiller/archive/2012/12/14/2817650.html