I assume that the basename(1) command has two orthogonal functions - deleting stripping, deleting sections of leading directories - and GNU authors make it possible to call each functionality separately. And of course, only one concept can get the name basename.
Of course, in a makefile it is useful to be able to convert foo / bar / baz.c to foo / bar / baz so that you can bind a new suffix at the end to build the associated file name in the same directory as the source file.
In the comments to @ire_and_curses, answer that $(notdir $(CURDIR)) not enough for your purposes, since (being a directory) CURDIR can be specified as
CURDIR = /foo/bar/
and notdir removes all this due to a trailing slash. To enable this way of writing the directory path, you need to explicitly disable the trailing slash, for example. $(notdir $(CURDIR:%/=%)) .
source share