aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile15
-rw-r--r--share/man/man5/make.conf.510
2 files changed, 24 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index cf2cd387223e..b808c3fe378b 100644
--- a/Makefile
+++ b/Makefile
@@ -87,9 +87,22 @@ BINMAKE= \
_MAKE= PATH=${PATH} ${BINMAKE} -f Makefile.inc1
#
-# Handle the user-driven targets, using the source relative mk files.
+# Make sure we have an up-to-date make(1). Only world and buildworld
+# should do this as those are the initial targets used for upgrades.
+# The user can define ALWAYS_CHECK_MAKE to have this check performed
+# for all targets.
#
+.if defined(ALWAYS_CHECK_MAKE)
${TGTS} ${BITGTS}: upgrade_checks
+.else
+buildworld: upgrade_checks
+.endif
+
+#
+# Handle the user-driven targets, using the source relative mk files.
+#
+
+${TGTS} ${BITGTS}:
@cd ${.CURDIR}; \
${_MAKE} ${.TARGET}
diff --git a/share/man/man5/make.conf.5 b/share/man/man5/make.conf.5
index ebac979e945f..445edca99a46 100644
--- a/share/man/man5/make.conf.5
+++ b/share/man/man5/make.conf.5
@@ -93,6 +93,16 @@ that are used for all builds, or are used by the
.Pa makefiles
for things other than builds.
.Bl -tag -width Ar
+.It Va ALWAYS_CHECK_MAKE
+.Pq Vt bool
+Instructs the top-level makefile in the source tree (normally
+.Pa /usr/src )
+to always check if
+.Xr make 1
+is up-to-date.
+Normally this is only done for the world and buildworld targets to handle
+upgrades from older versions of
+.Fx .
.It Va CFLAGS
.Pq Vt str
Controls the compiler setting when compiling C code.