The framework separates compiler configuration into several layers: the tool pathnames themselves, global flags that apply to every invocation, per-source-type flags applied only when compiling a specific kind of source (plainDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/fernandodanielmaqueda/gcc-bison-flex-GNUmakefile/llms.txt
Use this file to discover all available pages before exploring further.
.c, Bison-generated, or Flex-generated), and linker flags. All of these variables are defined in main.mk and can be overridden in your GNUmakefile before the $(eval $(value MKFWK_FOOTER)) call, or from the command line.
Tool pathnames
By default the framework uses the conventional names for each tool. Override any of these to point at a specific installation path.| Variable | Default | Description |
|---|---|---|
CC | gcc | C compiler |
YACC | bison | Parser generator |
LEX | flex | Scanner generator |
AR | ar | Static archive maintainer |
RANLIB | ranlib | Archive index generator |
GDB | gdb | Debugger |
VALGRIND | valgrind | Dynamic analysis tool |
VERBOSE is enabled:
| Variable | Default |
|---|---|
CC_VERSION_FLAG | --version |
YACC_VERSION_FLAG | --version |
LEX_VERSION_FLAG | --version |
AR_VERSION_FLAG | -V |
RANLIB_VERSION_FLAG | --version |
GDB_VERSION_FLAG | --version |
VALGRIND_VERSION_FLAG | --version |
Global compiler flags
These variables apply to all sources of their respective tool.CPPFLAGS — global preprocessing flags
CPPFLAGS — global preprocessing flags
CC_DEBUG option appends either -DDEBUG=1 (when enabled) or -DDEBUG=0 (when disabled) to this variable automatically.CFLAGS — global C compiler flags
CFLAGS — global C compiler flags
-fdiagnostics-color=always -std=c17 -O0After applying the CC_WARNINGS and CC_DEBUG options, the effective default becomes:+=::= or simple assignment:YFLAGS — Bison flags
YFLAGS — Bison flags
--report=state --report=itemset --report=lookaheadThese flags instruct Bison to emit detailed parser reports. After applying options:YACC_WARNINGS=X(default) appends-WallYACC_DEBUG=Xappends-t(enable Bison parser tracing)
LFLAGS — Flex flags
LFLAGS — Flex flags
LEX_DEBUG=Xappends-d(enable Flex debug output at runtime)
ASFLAGS — global assembly flags
ASFLAGS — global assembly flags
LDFLAGS — linker flags
LDFLAGS — linker flags
-L paths and other linker options). Per-binary -L flags discovered from $(binary)_LIBDIR are appended to the per-binary $(binary)_LDFLAGS, not here.LDLIBS — libraries to link
LDLIBS — libraries to link
-lmLibrary flags (-l) appended at link time. -ly and -lfl are added automatically by the framework whenever .y or .l source files are present in any declared binary, so you do not need to add them manually.liby.a or libfl.a, add the directory containing them to LDFLAGS with -L'dir'.Per-source-type flags
These variables let you pass flags to CC only when compiling a specific category of source file, without affecting others. They are layered on top of the corresponding global flags.CC_CPPFLAGS / CC_CFLAGS / CC_ASFLAGS — plain .c files only
CC_CPPFLAGS / CC_CFLAGS / CC_ASFLAGS — plain .c files only
.c source files (files that are not Bison-generated *.tab.c or Flex-generated *.lex.yy.c).YACC_CPPFLAGS / YACC_CFLAGS / YACC_ASFLAGS — Bison-generated files only
YACC_CPPFLAGS / YACC_CFLAGS / YACC_ASFLAGS — Bison-generated files only
YACC_CPPFLAGS)Applied exclusively when compiling Bison-generated *.tab.c files. YACC_CPPFLAGS is always augmented automatically:YACC_DEBUG=X→ appends-DYYDEBUG=1YACC_DEBUG=(default) → appends-DYYDEBUG=0
YYDEBUG is always explicitly defined so Bison’s runtime debugging facilities are either fully compiled in or fully compiled out.LEX_CPPFLAGS / LEX_CFLAGS / LEX_ASFLAGS — Flex-generated files only
LEX_CPPFLAGS / LEX_CFLAGS / LEX_ASFLAGS — Flex-generated files only
*.lex.yy.c files.Valgrind configuration
VALGRIND_FLAGS — global Valgrind options
VALGRIND_FLAGS — global Valgrind options
--verboseFlags passed to every valgrind-* target invocation before tool-specific flags.VALGRIND_TOOLS — which Valgrind tools get targets
VALGRIND_TOOLS — which Valgrind tools get targets
none memcheck helgrindA space-separated list of Valgrind tool names. The framework generates a valgrind-<tool>-<program> target for each combination of tool and program. none means run Valgrind with no --tool flag (uses its default, memcheck).Per-tool flag variables
Per-tool flag variables
| Variable | Default value |
|---|---|
VALGRIND_NONE_FLAGS | (empty) |
VALGRIND_MEMCHECK_FLAGS | --leak-check=full --track-origins=yes |
VALGRIND_HELGRIND_FLAGS | (empty) |
VALGRIND_TOOLS, define a corresponding VALGRIND_<TOOL>_FLAGS variable. The tool name is uppercased.Archive tool flags
| Variable | Default | Description |
|---|---|---|
ARFLAGS | -r -v | Flags passed to ar when creating or updating static libraries |
-r flag inserts/replaces members and -v produces verbose output. RANLIB is invoked after ar when it is available (the framework treats it as a dispensable command and gracefully skips it when absent).