Skip to main content

Documentation 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.

The framework is distributed as a directory of plain GNU Make files. There is no package manager, no compiled binary, and no installer — you copy mkframework/ into your project root and it is ready to use. This page covers what your system needs, what the framework checks on startup, and how to obtain and place the files.

System requirements

Required

GNU Make 3.81 or later is the minimum supported version. The framework uses features — in particular $(eval ...), $(value ...), and canned directives — that are not available in older versions. Run make --version to confirm.
ComponentMinimum versionNotes
GNU Make3.81Must be invoked as make or gmake
GCC (cc)Any recent versionControlled by the CC variable; clang also works
POSIX shell/bin/shRequired for $(shell ...) calls inside the makefiles
GNU coreutilsAnycut, expr, false, mkdir, mv, printf, rm, rmdir, sort, test, touch, tr, true, uname
GNU findutilsAnyfind
awkAny POSIX awkUsed in cleaning targets
sedAny POSIX sedUsed in source and flag discovery

Optional

These tools are only needed if you use the corresponding features:
ToolPurposeMake targets
BisonParser generator for .y grammar filesall (when .y sources are present)
FlexScanner generator for .l scanner filesall (when .l sources are present)
GDBSource-level debuggergdb-<program>
ValgrindMemory and thread analysisvalgrind-<tool>-<program>
arStatic library archiverall (when BIN_LIBRARIES is set)
ranlibStatic library index generatorall (when BIN_LIBRARIES is set)

Startup checks

When STARTUP_CHECKS is enabled (it is enabled by default — STARTUP_CHECKS=X), the framework validates your environment before attempting any build. These checks run during makefile parsing, so failures appear immediately when you invoke make. The checks are defined in mkframework/header/core.mk and cover:
  1. Shell existence — verifies that the path in SHELL (default /bin/sh) points to an actual file
  2. Shell function — confirms that GNU Make’s $(shell ...) function executes correctly; on some Windows configurations this can silently fail
  3. Incompatible flags — detects -n / --just-print / --dry-run / --recon, which disable $(shell ...) and would silently break source discovery
  4. GNU coreutils — checks that each command in MKFWK_COREUTILS_CORE_COMMANDS resolves via command -v
  5. GNU findutils — checks that find resolves via command -v
  6. Standalone utilities — checks that awk and sed resolve via command -v
Startup checks add a small overhead on every Make invocation because they use $(shell ...) calls during parsing. If you are running Make in a tight CI loop and your environment is known-good, you can disable them by passing STARTUP_CHECKS= on the command line or setting it empty in your makefile before the footer expansion.
To disable startup checks:
make all STARTUP_CHECKS=

Obtaining the framework

Clone the full repository and copy the mkframework/ directory into your project:
git clone https://github.com/fernandodanielmaqueda/gcc-bison-flex-GNUmakefile.git
cp -r gcc-bison-flex-GNUmakefile/mkframework/ your-project/
You can also add the repository as a Git submodule if you want to track upstream changes:
cd your-project
git submodule add https://github.com/fernandodanielmaqueda/gcc-bison-flex-GNUmakefile.git vendor/gcc-bison-flex-GNUmakefile
ln -s vendor/gcc-bison-flex-GNUmakefile/mkframework mkframework

Framework directory layout

After copying, mkframework/ contains the following files:
mkframework/
├── main.mk               ← entry point; include this from your GNUmakefile
├── header/
│   ├── chars.mk          ← character and whitespace definitions
│   ├── core.mk           ← startup checks and core command definitions
│   └── sysconfig.mk      ← OS detection and EXEEXT handling
├── footer/
│   ├── base.mk           ← directory creation and base rules
│   ├── central.mk        ← per-program and per-library rule generation
│   ├── cleaning.mk       ← clean, mostlyclean, distclean, maintainer-clean, cleandirs
│   ├── executing.mk      ← run-<program>, gdb-<program>, valgrind-*-<program>
│   ├── making.mk         ← all, must-make, and related targets
│   └── void.mk           ← fallback rules for undefined targets
└── lang/
    ├── en_US/            ← English message strings
    │   ├── unskippable.mk
    │   ├── verbose.mk
    │   ├── must_make.mk
    │   ├── startup_checks.mk
    │   └── runtime_checks.mk
    └── es_AR/            ← Spanish (Argentina) message strings
        └── (same files)
The language directory (lang/) contains message string makefiles. The active locale is controlled by MKFWK_CODE_DIR (default en_US/). You can switch to Spanish messages by setting MKFWK_CODE_DIR=es_AR/ before the framework is included.

Where to place mkframework/

Place mkframework/ in the same directory as your GNUmakefile (your project root). The default include path in main.mk is:
$(if $(MKFWK_MAIN_MAKEFILE),$(eval include $(MKFWK_MAIN_MAKEFILE)),$(eval include mkframework/main.mk))
If you need to store the framework elsewhere, set MKFWK_MAIN_MAKEFILE to the actual path on the command line or in an environment variable:
make all MKFWK_MAIN_MAKEFILE=/opt/shared/mkframework/main.mk
Do not rename main.mk or move individual files within mkframework/ without updating the corresponding path variables. The internal includes between header and footer files use paths relative to main.mk’s location.

What gets created in your project

The first make all invocation creates these directories alongside your source files:
DirectoryVariableCleaned by
bin/BINDIRcleandirs
obj/OBJDIRcleandirs
.deps/DEPDIRcleandeps, then cleandirs
These directories are never created by the framework during makefile parsing — only when a build target actually runs. The cleaning targets remove files progressively:
  • cleandeps — removes .d dependency files
  • mostlyclean — removes programs and .o/.s/.i intermediate files
  • clean — also removes library files (.a, .so)
  • distclean / realclean / clobber — available for project-specific extensions
  • maintainer-clean — also removes Bison- and Flex-generated C files
  • cleandirs — removes the bin/, obj/, and .deps/ directories themselves

Windows note

On Linux, macOS, and other POSIX systems, no extra configuration is needed. The EXEEXT variable is empty and programs are placed in bin/ without a file extension.
make all
# produces: bin/myprogram

Next steps

Quickstart

Build your first program with the framework end to end.

Framework structure

Detailed walkthrough of the header/footer architecture.

Configuration variables

Full reference for all variables you can set to control the build.

C-only project guide

Step-by-step guide for a plain C project with no grammar files.

Build docs developers (and LLMs) love