Get the most recently parsed makefile path.

Section: Useful function recipes

Current makefile name

makefile
makefile
CURRENT_MK := $(lastword $(MAKEFILE_LIST))
Explanation

A practical use of `MAKEFILE_LIST`.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Useful function recipes
Use MAKECMDGOALS
Inspect requested goals.
OpenIn sheetmakefilesame section
Self-documenting help target
Extract target comments from the current makefile.
OpenIn sheetmakefilesame section
Define whitespace helpers
Create reusable space or comma variables.
OpenIn sheetmakefilesame section
subst replace text
Replace every occurrence of one string with another.
OpenIn sheetmakefile
if function
Select one of two expansions based on non-empty condition text.
OpenIn sheetmakefile
shell function
Capture shell command output at parse time.
OpenIn sheetmakefile