CFLAGS
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 compiler in the process of building computer software. FFLAGS fulfills a similar role. 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 autoconf's ./configure script will usually pick them up from the environment and write them into the generated Makefiles. Some package install scripts, like SDL, allow CFLAGS settings to override their normal settings (instead of append to them), so setting CFLAGS can cause harm in this case. CFLAGS enables the addition of 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 or C++ preprocessor. Similarly, FFLAGS enables the addition of switches for a Fortran compiler. 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 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 compiler in the process of building computer software. FFLAGS fulfills a similar role. 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 autoconf's ./configure script will usually pick them up from the environment and write them into the generated Makefiles. Some package install scripts, like SDL, allow CFLAGS settings to override their normal settings (instead of append to them), so setting CFLAGS can cause harm in this case. CFLAGS enables the addition of 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 or C++ preprocessor. Similarly, FFLAGS enables the addition of switches for a Fortran compiler. 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 . ==See also== Compiler optimization ==References== ==External links== GNU optimization page Gentoo Wiki CFLAG guide Gentoo Wiki guide to safe CFLAGS Linux Review page on optimized gcc compiling
References
- Stallman, McGrath & Smith 2020 , sec.10.3. Wikipedia revision 1284469999, retrieved 2026-11-18 · retrieved 2026-11-17 · rev 1284469999
Cite this reference
MLA "Stallman, McGrath & Smith 2020 , sec.10.3. Wikipedia revision 1284469999, retrieved 2026-11-18." Stallman, McGrath & Smith 2020 , sec. 2026-11-17. https://en.wikipedia.org/w/index.php?oldid=1284469999. Accessed 24 November 2026.
Chicago "Stallman, McGrath & Smith 2020 , sec.10.3. Wikipedia revision 1284469999, retrieved 2026-11-18." Stallman, McGrath & Smith 2020 , sec. 2026-11-17. https://en.wikipedia.org/w/index.php?oldid=1284469999.
APA Stallman, McGrath & Smith 2020 , sec. (2026). Stallman, McGrath & Smith 2020 , sec.10.3. Wikipedia revision 1284469999, retrieved 2026-11-18. Retrieved November 24, 2026, from https://en.wikipedia.org/w/index.php?oldid=1284469999
Cite this article
MLA
"CFLAGS." encyclopegia.org, 2025, https://encyclopegia.org/wiki/cflags. Accessed 24 November 2026.
Chicago
"CFLAGS." encyclopegia.org. Accessed November 24, 2026. https://encyclopegia.org/wiki/cflags.
APA
encyclopegia.org. (2025). CFLAGS. Retrieved November 24, 2026, from https://encyclopegia.org/wiki/cflags
Accessed November 24, 2026 · CC BY-SA 4.0 · citation page · JSON