How to get the full path and directory of a Makefile itself like finding Bash script’s own path?
This 2 lines in Makefile get the full path and dir of the Makefile itself:
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) mkfile_dir := $(dir $(mkfile_path))
The piece of code gets you Makefile, finds its absolute path and the directory. It does not rely on your work directory at all.