Fix running make in src directories without a Makefile giving confusing errors.

This fixes the following errors:
  make: don't know how to make bsd.README. Stop
  make: don't know how to make auto.obj.mk. Stop

This is easily seen in sys/dev/*.

The new behavior is now the expected output:
  make: no target to make.

This would happen as MAKESYSPATH (.../share/mk) is auto added to the -I list.
Any directory where make is ran in the src tree that has no local Makefile
would then try executing the target in share/mk/Makefile, which by default
was to build the first entry in FILES.  Of course, because bsd.README and
auto.obj.mk are not in the current directory the error is shown.

This check only works for bmake, but I will still MFC it with an extra
'!defined(.PARSEDIR) ||' guard for stable/10.

MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
This commit is contained in:
Bryan Drewery 2015-09-24 17:36:18 +00:00
parent 1ff8129a59
commit a00dbfa82b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=288179

View File

@ -1,6 +1,11 @@
# $FreeBSD$
# @(#)Makefile 8.1 (Berkeley) 6/8/93
# Only parse this if executing make in this directory, not in other places
# in src that lack a Makefile, such as sys/dev/*. Otherwise the MAKESYSPATH
# will read this Makefile since it auto includes it into -I.
.if ${.CURDIR} == ${.PARSEDIR}
.include <src.opts.mk>
FILES= \
@ -63,3 +68,4 @@ FILES+= tap.test.mk
.endif
.include <bsd.prog.mk>
.endif # CURDIR == PARSEDIR