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.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.
Cleaning target hierarchy
The targets form this chain:cleandeps — remove dependency tracking files
cleandeps — remove dependency tracking files
Removes all files associated with automatic dependency generation under
.deps/:.deps/*.d.deps/*.d.tmp.1.deps/*.d.tmp.2.deps/*.d.timestamp
.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.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.mostlyclean — also remove programs and compilation outputs
mostlyclean — also remove programs and compilation outputs
Depends on
cleandeps. Additionally removes:- Programs:
bin/<name>(all entries inBIN_PROGRAMS) - Object files:
obj/*.o - Assembly files:
obj/*.s - Preprocessed files:
obj/*.i
.c sources, as well as the Yacc- and Flex-derived .tab.o and .lex.yy.o objects.clean — also remove library files
clean — also remove library files
Depends on
mostlyclean. Additionally removes:- Static libraries:
bin/lib*.a - Shared libraries:
bin/lib*.so
.tab.c, .lex.yy.c) intact so they do not need to be regenerated on the next make all.distclean — customizable distribution cleanup
distclean — customizable distribution cleanup
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.realclean — customizable extended cleanup
realclean — customizable extended cleanup
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.clobber — customizable full wipe
clobber — customizable full wipe
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.maintainer-clean — also remove Yacc- and Flex-generated files
maintainer-clean — also remove Yacc- and Flex-generated files
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 implementationobj/*.tab.h— Yacc token definitions headerobj/*.output— Yacc parser reportobj/*.lex.yy.c— Flex scanner implementation
maintainer-clean, the next make all invocation will re-run YACC and Flex to regenerate these files before compiling.cleandirs — also remove the target directories
cleandirs — also remove the target directories
Depends on
maintainer-clean. Additionally removes the target directories themselves:bin/obj/.deps/
cleandirs, the next make all recreates all directories from scratch as order-only prerequisites.MUST_MAKE with cleaning targets
Like build targets, cleaning targets respect theMUST_MAKE option. When set, Make prints which targets would be cleaned without actually removing anything:
When to use which target
| Situation | Command |
|---|---|
| Normal rebuild after source changes | make clean && make all |
| Force full recompile without deleting binaries | make cleandeps && make all |
After changing grammar files (.y or .l) | make maintainer-clean && make all |
| Full reset including directory structure | make cleandirs && make all |
| Remove everything except grammar-generated sources | make clean |
| Remove everything a user should not need to regenerate | make 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.