CFLAGS

来源:互联网 发布:阿里云设置mx记录 编辑:程序博客网 时间:2024/05/17 03:07

C语言编译器参数。
CFLAGS and CXXFLAGS are either the name of environment variables or of Makefile 
variables that can be set to specify additional switches to be passed to a compi
ler in the process of building computer software.

These variables are usually set inside a Makefile and are then appended to the
 command line when the compiler is invoked. If they are not specified in the 
 Makefile, then they will be read from the environment, if present. Tools like a
 utoconf's ./configure script will usually pick them up from the environment and 
 write them into the generated Makefiles. 
CFLAGS allows to add switches for the C compiler, while CXXFLAGS is meant to be
 used when invoking a C++ compiler. Similarly, a variable CPPFLAGS 
 exists with switches to be passed to the C preprocessor. 
These variables are most commonly used to specify optimization or debugging 
switches to a compiler, as for example -g, -O2 or (GCC-specific) -march=athlon.

因此,如果我们在环境变量中设置了“CFLAGS”环境变量,那么我们就可以在所有的Makefi
le中使用这个变量了。这对于我们使用统一的编译参数有比较大的好处。如果Makefile中定
义了CFLAGS,那么则会使用Makefile中的这个变量,如果没有定义则使用系统环境变量的值
,一个共性和个性的统一,很像“全局变量”和“局部变量”的特性。

转至:http://blog.csdn.net/q472599451/article/details/7961948

原创粉丝点击