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 provides eight cleaning targets organized as a strict dependency chain: each target depends on the previous one, so running a deeper target always performs all the cleaning steps above it. Choosing the right level lets you remove exactly what needs to go without discarding files that are expensive to regenerate.

Cleaning target hierarchy

The targets form this chain:
cleandeps → mostlyclean → clean → distclean → realclean → clobber → maintainer-clean → cleandirs
Removes all files associated with automatic dependency generation under .deps/:
  • .deps/*.d
  • .deps/*.d.tmp.1
  • .deps/*.d.tmp.2
  • .deps/*.d.timestamp
The .tmp.* variants are transient files left behind if dependency generation was interrupted. Removing .d.timestamp files forces Make to regenerate the dependency information on the next build, which effectively triggers a full recompilation without touching any binaries or object files.
make cleandeps
cleandeps alone is useful when you want to force a full recompile — for example after modifying CPPFLAGS or switching a header file — without deleting the binaries themselves.
Depends on cleandeps. Additionally removes:
  • Programs: bin/<name> (all entries in BIN_PROGRAMS)
  • Object files: obj/*.o
  • Assembly files: obj/*.s
  • Preprocessed files: obj/*.i
This covers the outputs of every compilation stage for .c sources, as well as the Yacc- and Flex-derived .tab.o and .lex.yy.o objects.
make mostlyclean
Depends on mostlyclean. Additionally removes:
  • Static libraries: bin/lib*.a
  • Shared libraries: bin/lib*.so
This is the conventional everyday cleaning target — it leaves grammar-generated source files (.tab.c, .lex.yy.c) intact so they do not need to be regenerated on the next make all.
make clean
Depends on clean. The framework defines this target with an empty recipe by default. It is intended for removing any files that would not be distributed in a source tarball — for example, generated configuration files or editor backup files.Add your own cleanup logic in your project Makefile by appending a recipe or prerequisite to the distclean target after the framework footer.
make distclean
Depends on distclean. Also empty by default and available for your own use. Conventionally used for cleaning files that distclean leaves behind but that a developer might still want removed.
make realclean
Depends on realclean. Also empty by default. Conventionally removes everything that a source control checkout would not restore — useful for verifying that a build is fully reproducible from source.
make clobber
Depends on clobber. Additionally removes the source files generated by YACC and Flex, which are normally not distributed and must be regenerated from the grammar sources:
  • obj/*.tab.c — Yacc parser implementation
  • obj/*.tab.h — Yacc token definitions header
  • obj/*.output — Yacc parser report
  • obj/*.lex.yy.c — Flex scanner implementation
After running maintainer-clean, the next make all invocation will re-run YACC and Flex to regenerate these files before compiling.
make maintainer-clean
After maintainer-clean you must have YACC (Bison) and Flex installed and on your PATH, or the next build will fail. This target is intended for maintainers, not end users building from a source distribution.
Depends on maintainer-clean. Additionally removes the target directories themselves:
  • bin/
  • obj/
  • .deps/
Directories are removed in depth-sorted order (deepest first) to satisfy filesystem constraints. After cleandirs, the next make all recreates all directories from scratch as order-only prerequisites.
make cleandirs
cleandirs is the most destructive cleaning target. Everything in bin/, obj/, and .deps/ is gone. Use this only when you need a guaranteed clean slate — for example, when debugging a Makefile rule for directory creation itself.

MUST_MAKE with cleaning targets

Like build targets, cleaning targets respect the MUST_MAKE option. When set, Make prints which targets would be cleaned without actually removing anything:
make MUST_MAKE=X clean
Output example:
  * [target "cleandeps"]. Prerequisites newer than target: ...
  * [target "mostlyclean"]. Prerequisites newer than target: cleandeps
  * [target "clean"]. Prerequisites newer than target: mostlyclean
This is useful for verifying what a cleaning pass will affect before committing to it.

When to use which target

SituationCommand
Normal rebuild after source changesmake clean && make all
Force full recompile without deleting binariesmake cleandeps && make all
After changing grammar files (.y or .l)make maintainer-clean && make all
Full reset including directory structuremake cleandirs && make all
Remove everything except grammar-generated sourcesmake clean
Remove everything a user should not need to regeneratemake distclean
make clean && make all is the most common workflow. Use make maintainer-clean && make all whenever you modify a .y or .l file and want to ensure the generated .tab.c or .lex.yy.c files are regenerated cleanly rather than updated in place.

Build docs developers (and LLMs) love