summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile85
1 files changed, 55 insertions, 30 deletions
diff --git a/Makefile b/Makefile
index b46d99e..1a1d885 100644
--- a/Makefile
+++ b/Makefile
@@ -133,12 +133,27 @@ TGTS= all all-man buildenv buildenvvars buildkernel buildworld \
create-world-packages create-kernel-packages create-packages \
packages installconfig real-packages sign-packages package-pkg
+# XXX: r156740: This can't work since bsd.subdir.mk is not included ever.
+# It will only work for SUBDIR_TARGETS in make.conf.
TGTS+= ${SUBDIR_TARGETS}
BITGTS= files includes
BITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/}
TGTS+= ${BITGTS}
+# Only some targets are allowed to use meta mode. Others get it
+# disabled. In some cases, such as 'install', meta mode can be dangerous
+# as a cookie may be used to prevent redundant installations (such as
+# for WORLDTMP staging). For DESTDIR=/ we always want to install though.
+# For other cases, such as delete-old-libs, meta mode may break
+# the interactive tty prompt. The safest route is to just whitelist
+# the ones that benefit from it.
+META_TGT_WHITELIST+= \
+ _* build32 buildfiles buildincludes buildkernel buildsoft \
+ buildworld everything kernel-toolchains kernels libraries \
+ native-xtools showconfig tinderbox toolchain toolchains universe \
+ worlds xdev xdev-build
+
.ORDER: buildworld installworld
.ORDER: buildworld distributeworld
.ORDER: buildworld buildkernel
@@ -194,14 +209,24 @@ SUB_MAKE= ${MAKE} -m ${.CURDIR}/share/mk
_MAKE= PATH=${PATH} ${SUB_MAKE} -f Makefile.inc1 TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH}
-# Must disable META_MODE when installing to avoid missing anything. The
-# main problem is that buildworld will create cookies for install targets
-# since they are being installed into WORLDTMP. This avoids unneeded and
-# redundant restaging but is dangerous for user install targets.
-.if make(distrib*) || make(*install*)
+# Only allow meta mode for the whitelisted targets. See META_TGT_WHITELIST
+# above.
+.for _tgt in ${META_TGT_WHITELIST}
+.if make(${_tgt})
+_CAN_USE_META_MODE?= yes
+.endif
+.endfor
+.if !defined(_CAN_USE_META_MODE)
_MAKE+= MK_META_MODE=no
.unexport META_MODE
-.endif
+.elif defined(MK_META_MODE) && ${MK_META_MODE} == "yes"
+.if !exists(/dev/filemon) && !defined(NO_FILEMON) && !make(showconfig)
+# Require filemon be loaded to provide a working incremental build
+.error ${.newline}ERROR: The filemon module (/dev/filemon) is not loaded. \
+ ${.newline}ERROR: WITH_META_MODE is enabled but requires filemon for an incremental build. \
+ ${.newline}ERROR: 'kldload filemon' or pass -DNO_FILEMON to suppress this error.
+.endif # !exists(/dev/filemon) && !defined(NO_FILEMON)
+.endif # !defined(_CAN_USE_META_MODE)
# Guess machine architecture from machine type, and vice versa.
.if !defined(TARGET_ARCH) && defined(TARGET)
@@ -274,7 +299,7 @@ CHECK_TIME!= find ${.CURDIR}/sys/sys/param.h -mtime -0s ; echo
# not included. One can argue that this target doesn't build everything
# then.
#
-world: upgrade_checks
+world: upgrade_checks .PHONY
@echo "--------------------------------------------------------------"
@echo ">>> make world started on ${STARTTIME}"
@echo "--------------------------------------------------------------"
@@ -300,7 +325,7 @@ world: upgrade_checks
@echo " (started ${STARTTIME})"
@echo "--------------------------------------------------------------"
.else
-world:
+world: .PHONY
@echo "WARNING: make world will overwrite your existing FreeBSD"
@echo "installation without also building and installing a new"
@echo "kernel. This can be dangerous. Please read the handbook,"
@@ -317,13 +342,13 @@ world:
#
# Short hand for `make buildkernel installkernel'
#
-kernel: buildkernel installkernel
+kernel: buildkernel installkernel .PHONY
#
# Perform a few tests to determine if the installed tools are adequate
# for building the world.
#
-upgrade_checks:
+upgrade_checks: .PHONY
.if defined(NEED_MAKE_UPGRADE)
@${_+_}(cd ${.CURDIR} && ${MAKE} ${WANT_MAKE:S,^f,,})
.endif
@@ -359,19 +384,19 @@ regress: .PHONY
tinderbox toolchains kernel-toolchains kernels worlds: upgrade_checks
-tinderbox:
+tinderbox: .PHONY
@cd ${.CURDIR}; ${SUB_MAKE} DOING_TINDERBOX=YES universe
-toolchains:
+toolchains: .PHONY
@cd ${.CURDIR}; ${SUB_MAKE} UNIVERSE_TARGET=toolchain universe
-kernel-toolchains:
+kernel-toolchains: .PHONY
@cd ${.CURDIR}; ${SUB_MAKE} UNIVERSE_TARGET=kernel-toolchain universe
-kernels:
+kernels: .PHONY
@cd ${.CURDIR}; ${SUB_MAKE} UNIVERSE_TARGET=buildkernel universe
-worlds:
+worlds: .PHONY
@cd ${.CURDIR}; ${SUB_MAKE} UNIVERSE_TARGET=buildworld universe
#
@@ -397,9 +422,9 @@ TARGET_ARCHES_${target}?= ${target}
# It does not build with the in-tree linker.
.if !exists(/usr/local/aarch64-freebsd/bin/ld) && empty(${TARGETS})
_UNIVERSE_TARGETS:= ${_UNIVERSE_TARGETS:Narm64}
-universe: universe_arm64_skip
-universe_epilogue: universe_arm64_skip
-universe_arm64_skip: universe_prologue
+universe: universe_arm64_skip .PHONY
+universe_epilogue: universe_arm64_skip .PHONY
+universe_arm64_skip: universe_prologue .PHONY
@echo ">> arm64 skipped - install aarch64-binutils port or package to build"
.endif
@@ -437,16 +462,16 @@ universe_prologue: .PHONY
.for target in ${_UNIVERSE_TARGETS}
universe: universe_${target}
universe_epilogue: universe_${target}
-universe_${target}: universe_${target}_prologue
-universe_${target}_prologue: universe_prologue
+universe_${target}: universe_${target}_prologue .PHONY
+universe_${target}_prologue: universe_prologue .PHONY
@echo ">> ${target} started on `LC_ALL=C date`"
-universe_${target}_worlds:
+universe_${target}_worlds: .PHONY
.if !defined(MAKE_JUST_KERNELS)
-universe_${target}_done: universe_${target}_worlds
+universe_${target}_done: universe_${target}_worlds .PHONY
.for target_arch in ${TARGET_ARCHES_${target}}
-universe_${target}_worlds: universe_${target}_${target_arch}
-universe_${target}_${target_arch}: universe_${target}_prologue .MAKE
+universe_${target}_worlds: universe_${target}_${target_arch} .PHONY
+universe_${target}_${target_arch}: universe_${target}_prologue .MAKE .PHONY
@echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} started on `LC_ALL=C date`"
@(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
${SUB_MAKE} ${JFLAG} ${UNIVERSE_TARGET} \
@@ -461,9 +486,9 @@ universe_${target}_${target_arch}: universe_${target}_prologue .MAKE
.endif # !MAKE_JUST_KERNELS
.if !defined(MAKE_JUST_WORLDS)
-universe_${target}_done: universe_${target}_kernels
-universe_${target}_kernels: universe_${target}_worlds
-universe_${target}_kernels: universe_${target}_prologue .MAKE
+universe_${target}_done: universe_${target}_kernels .PHONY
+universe_${target}_kernels: universe_${target}_worlds .PHONY
+universe_${target}_kernels: universe_${target}_prologue .MAKE .PHONY
.if exists(${KERNSRCDIR}/${target}/conf/NOTES)
@(cd ${KERNSRCDIR}/${target}/conf && env __MAKE_CONF=/dev/null \
${SUB_MAKE} LINT > ${.CURDIR}/_.${target}.makeLINT 2>&1 || \
@@ -479,7 +504,7 @@ universe_${target}: universe_${target}_done
universe_${target}_done:
@echo ">> ${target} completed on `LC_ALL=C date`"
.endfor
-universe_kernels: universe_kernconfs
+universe_kernels: universe_kernconfs .PHONY
.if !defined(TARGET)
TARGET!= uname -m
.endif
@@ -493,7 +518,7 @@ KERNCONFS!= cd ${KERNSRCDIR}/${TARGET}/conf && \
-type f -maxdepth 0 \
! -name DEFAULTS ! -name NOTES | \
${_THINNER}
-universe_kernconfs:
+universe_kernconfs: .PHONY
.for kernel in ${KERNCONFS}
TARGET_ARCH_${kernel}!= cd ${KERNSRCDIR}/${TARGET}/conf && \
config -m ${KERNSRCDIR}/${TARGET}/conf/${kernel} 2> /dev/null | \
@@ -527,7 +552,7 @@ universe_epilogue: .PHONY
.endif
.endif
-buildLINT:
+buildLINT: .PHONY
${MAKE} -C ${.CURDIR}/sys/${_TARGET}/conf LINT
.if defined(.PARSEDIR)
OpenPOWER on IntegriCloud