When Makefile target name is directory name

Apparently using a target name that is also a directory name means something special to Make.

Please explain the significance of a target name that is a directory name.
I did not find an answer in the GNU make manual http://www.gnu.org/software/make/manual/make.html

In the following Makefile example, "sub" is a directory name.
Makefile prints "*** subdir is not a directory name":
1
2
3
4
5
6
7
all: sub subdir

sub:
	@echo "*** sub is a directory name"

subdir:
	@echo "*** subdir is not a directory name"


Thank you.
Last edited on
the makefile requires directory names when the compiler/linker is searching for files that don't have an absolute path. Like include files or libraries
Thanks code777. Sorry I didn't make the question clear.
The following is basically the same question and example, but stated more clearly.

Make does not enter a rule if the target name is the same as a directory name.
What is the purpose of such behavior?

Makefile:
1
2
3
4
5
6
7
8
all: not_a_directory is_a_directory

not_a_directory:
	@echo "*** not_a_directory ***"

is_a_directory:
	@echo "*** is_a_directory ***"


output:

D:\wolf\Documents\teensy\demo_MinGW\demo_make>ls
Makefile  is_a_directory

D:\wolf\Documents\teensy\demo_MinGW\demo_make>make
*** not_a_directory ***
Last edited on
Topic archived. No new replies allowed.