Suppose you want to have a makefile that shall generate one file named after the parent directory. One way to do that is to hard-code the target name but that's not very "generic", e.g.
TARGET := dirname.pdf
$(TARGET): $(TARGET:.pdf=.tex)
pdflatex $(@:.pdf=.tex)
It would be much nicer to retrieve the directory name via make functions. There are various questions (and answers) on SA on how to retrieve the full path of a makefile (e.g., https://stackoverflow.com/a/18137056/1905491) but not the name of the parent directory...
What's the most efficient and portable way to do that in GNU make?