Makefile revision 1.341
11.341Srillig#	$NetBSD: Makefile,v 1.341 2025/06/04 06:01:59 rillig Exp $
21.95Scjs
31.193Slukem#
41.95Scjs# This is the top-level makefile for building NetBSD. For an outline of
51.95Scjs# how to build a snapshot or release, as well as other release engineering
61.221Ssalo# information, see http://www.NetBSD.org/developers/releng/index.html
71.95Scjs#
81.95Scjs# Not everything you can set or do is documented in this makefile. In
91.95Scjs# particular, you should review the files in /usr/share/mk (especially
101.95Scjs# bsd.README) for general information on building programs and writing
111.95Scjs# Makefiles within this structure, and see the comments in src/etc/Makefile
121.95Scjs# for further information on installation and release set options.
131.95Scjs#
141.95Scjs# Variables listed below can be set on the make command line (highest
151.95Scjs# priority), in /etc/mk.conf (middle priority), or in the environment
161.95Scjs# (lowest priority).
171.95Scjs#
181.95Scjs# Variables:
191.101Ssommerfe#   DESTDIR is the target directory for installation of the compiled
201.101Ssommerfe#	software. It defaults to /. Note that programs are built against
211.101Ssommerfe#	libraries installed in DESTDIR.
221.214Slukem#   MKMAN, if `no', will prevent building of manual pages.
231.214Slukem#   MKOBJDIRS, if not `no', will build object directories at
241.101Ssommerfe#	an appropriate point in a build.
251.214Slukem#   MKSHARE, if `no', will prevent building and installing
261.95Scjs#	anything in /usr/share.
271.214Slukem#   MKUPDATE, if not `no', will avoid a `make cleandir' at the start of
281.339Sgutterid#	`make build', as well as having the effects listed in mk.conf(5).
291.125Smrg#   NOCLEANDIR, if defined, will avoid a `make cleandir' at the start
301.178Senami#	of the `make build'.
311.119Stoddpw#   NOINCLUDES will avoid the `make includes' usually done by `make build'.
321.319Schristos#   NOBINARIES will not build binaries, only includes and libraries
331.95Scjs#
341.214Slukem#   See mk.conf(5) for more details.
351.214Slukem#
361.214Slukem#
371.95Scjs# Targets:
381.137Stv#   build:
391.196Slukem#	Builds a full release of NetBSD in DESTDIR, except for the
401.196Slukem#	/etc configuration files.
411.196Slukem#	If BUILD_DONE is set, this is an empty target.
421.196Slukem#   distribution:
431.196Slukem#	Builds a full release of NetBSD in DESTDIR, including the /etc
441.196Slukem#	configuration files.
451.196Slukem#   buildworld:
461.196Slukem#	As per `make distribution', except that it ensures that DESTDIR
471.196Slukem#	is not the root directory.
481.196Slukem#   installworld:
491.196Slukem#	Install the distribution from DESTDIR to INSTALLWORLDDIR (which
501.196Slukem#	defaults to the root directory).  Ensures that INSTALLWORLDDIR
511.291Sabs#	is not the root directory if cross compiling.
521.137Stv#   release:
531.240Slukem#	Does a `make distribution', and then tars up the DESTDIR files
541.252Slukem#	into ${RELEASEDIR}/${RELEASEMACHINEDIR}, in release(7) format.
551.196Slukem#	(See etc/Makefile for more information on this.)
561.137Stv#   regression-tests:
571.137Stv#	Runs the regression tests in "regress" on this host.
581.206Slukem#   sets:
591.252Slukem#	Populate ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets
601.252Slukem#	from ${DESTDIR}
611.206Slukem#   sourcesets:
621.206Slukem#	Populate ${RELEASEDIR}/source/sets from ${NETBSDSRCDIR}
631.241Sapb#   syspkgs:
641.252Slukem#	Populate ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/syspkgs
651.252Slukem#	from ${DESTDIR}
661.243Sapb#   iso-image:
671.311Ssnj#	Create CD-ROM image in RELEASEDIR/images.
681.243Sapb#	RELEASEDIR must already have been populated by `make release'
691.243Sapb#	or equivalent.
701.248Sjnemeth#   iso-image-source:
711.311Ssnj#	Create CD-ROM image with source in RELEASEDIR/images.
721.248Sjnemeth#	RELEASEDIR must already have been populated by
731.248Sjnemeth#	`make release sourcesets' or equivalent.
741.290Stsutsui#   live-image:
751.290Stsutsui#	Create bootable live image for emulators or USB stick etc.
761.290Stsutsui#	in RELEASEDIR/liveimage.
771.290Stsutsui#	RELEASEDIR must already have been populated by `make release'
781.290Stsutsui#	or equivalent.
791.290Stsutsui#   install-image:
801.290Stsutsui#	Create bootable installation image for USB stick etc.
811.290Stsutsui#	in RELEASEDIR/installimage.
821.290Stsutsui#	RELEASEDIR must already have been populated by `make release'
831.290Stsutsui#	or equivalent.
841.123Smrg#
851.137Stv# Targets invoked by `make build,' in order:
861.155Stv#   cleandir:        cleans the tree.
871.261Sapb#   do-top-obj:      creates the top level object directory.
881.260Sapb#   do-tools-obj:    creates object directories for the host toolchain.
891.260Sapb#   do-tools:        builds host toolchain.
901.336Slukem#   params:          create params file with various make(1) parameters.
911.336Slukem#   show-params:     show various make(1) parameters.
921.137Stv#   obj:             creates object directories.
931.208Slukem#   do-distrib-dirs: creates the distribution directories.
941.208Slukem#   includes:        installs include files.
951.326Smartin#   do-lib:          builds and installs prerequisites from lib.
961.299Sjoerg#   do-compat-lib:   builds and installs prerequisites from compat/lib
971.262Smrg#                    if ${MKCOMPAT} != "no".
981.320Suwe#   do-x11:          builds and installs X11 tools and libraries
991.320Suwe#                    from src/external/mit/xorg if ${MKX11} != "no".
1001.137Stv#   do-build:        builds and installs the entire system.
1011.222Slukem#   do-obsolete:     installs the obsolete sets (for the postinstall-* targets).
1021.193Slukem#
1031.32Scgd
1041.146Stv.if ${.MAKEFLAGS:M${.CURDIR}/share/mk} == ""
1051.146Stv.MAKEFLAGS: -m ${.CURDIR}/share/mk
1061.146Stv.endif
1071.163Stv
1081.193Slukem#
1091.163Stv# If _SRC_TOP_OBJ_ gets set here, we will end up with a directory that may
1101.163Stv# not be the top level objdir, because "make obj" can happen in the *middle*
1111.163Stv# of "make build" (long after <bsd.own.mk> is calculated it).  So, pre-set
1121.163Stv# _SRC_TOP_OBJ_ here so it will not be added to ${.MAKEOVERRIDES}.
1131.193Slukem#
1141.163Stv_SRC_TOP_OBJ_=
1151.148Sjmc
1161.146Stv.include <bsd.own.mk>
1171.4Scgd
1181.193Slukem#
1191.137Stv# Sanity check: make sure that "make build" is not invoked simultaneously
1201.137Stv# with a standard recursive target.
1211.193Slukem#
1221.137Stv
1231.137Stv.if make(build) || make(release) || make(snapshot)
1241.137Stv.for targ in ${TARGETS:Nobj:Ncleandir}
1251.137Stv.if make(${targ}) && !target(.BEGIN)
1261.137Stv.BEGIN:
1271.137Stv	@echo 'BUILD ABORTED: "make build" and "make ${targ}" are mutually exclusive.'
1281.137Stv	@false
1291.137Stv.endif
1301.137Stv.endfor
1311.137Stv.endif
1321.58Stv
1331.261Sapb#
1341.261Sapb# _SUBDIR is used to set SUBDIR, after removing directories that have
1351.261Sapb# BUILD_${dir}=no, or that have no ${dir}/Makefile.
1361.261Sapb#
1371.329Skamil_SUBDIR=	tools .WAIT lib
1381.329Skamil.if ${MKLLVM} != "no"
1391.329Skamil_SUBDIR+=	external/bsd/compiler_rt
1401.329Skamil.endif
1411.333Suwe_SUBDIR+=	include external crypto/external bin
1421.325Smaya_SUBDIR+=	games libexec sbin usr.bin
1431.303Sjoerg_SUBDIR+=	usr.sbin share sys etc tests compat
1441.303Sjoerg_SUBDIR+=	.WAIT rescue .WAIT distrib regress
1451.105Sassar
1461.137Stv.for dir in ${_SUBDIR}
1471.261Sapb.if "${dir}" == ".WAIT" \
1481.261Sapb	|| (${BUILD_${dir}:Uyes} != "no" && exists(${dir}/Makefile))
1491.137StvSUBDIR+=	${dir}
1501.36Sexplorer.endif
1511.137Stv.endfor
1521.21Scgd
1531.13Sbrezak.if exists(regress)
1541.242Sdslregression-tests: .PHONY .MAKE
1551.10Scgd	@echo Running regression tests...
1561.232Slukem	${MAKEDIRTARGET} regress regress
1571.13Sbrezak.endif
1581.20Scgd
1591.214Slukem.if ${MKUNPRIVED} != "no"
1601.179SthorpejNOPOSTINSTALL=	# defined
1611.179Sthorpej.endif
1621.179Sthorpej
1631.242Sdslafterinstall: .PHONY .MAKE
1641.137Stv.if ${MKMAN} != "no"
1651.232Slukem	${MAKEDIRTARGET} share/man makedb
1661.137Stv.endif
1671.214Slukem.if (${MKUNPRIVED} != "no" && ${MKINFO} != "no")
1681.317Schristos	${MAKEDIRTARGET} external/gpl2/texinfo/bin/install-info infodir-meta
1691.176Slukem.endif
1701.179Sthorpej.if !defined(NOPOSTINSTALL)
1711.232Slukem	${MAKEDIRTARGET} . postinstall-check
1721.159Sperry.endif
1731.170Slukem
1741.327Smartin_POSTINSTALL=	${:!cd ${.CURDIR}/usr.sbin/postinstall && \
1751.341Srillig			${MAKE} -B -v .OBJDIR!}/postinstall  \
1761.308Sapb		-m ${MACHINE} -a ${MACHINE_ARCH}
1771.295Sapb_POSTINSTALL_ENV= \
1781.295Sapb	AWK=${TOOL_AWK:Q}		\
1791.295Sapb	DB=${TOOL_DB:Q}			\
1801.298Sapb	HOST_SH=${HOST_SH:Q}		\
1811.295Sapb	MAKE=${MAKE:Q}			\
1821.297Sapb	PWD_MKDB=${TOOL_PWD_MKDB:Q}	\
1831.307Sapb	SED=${TOOL_SED:Q}		\
1841.297Sapb	STAT=${TOOL_STAT:Q}
1851.239Slukem
1861.313Smartin.if ${MKX11} != "no"
1871.313Smartin_POSTINSTALL_X11=-x ${X11SRCDIR:Q}
1881.313Smartin.endif
1891.313Smartin
1901.228Slukempostinstall-check: .PHONY
1911.169Slukem	@echo "   === Post installation checks ==="
1921.338Sriastrad	${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR:C/^\/$//}/ check; if [ $$? -gt 1 ]; then exit 1; fi
1931.171Slukem	@echo "   ================================"
1941.171Slukem
1951.228Slukempostinstall-fix: .NOTMAIN .PHONY
1961.171Slukem	@echo "   === Post installation fixes ==="
1971.338Sriastrad	${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR:C/^\/$//}/ fix
1981.212Slukem	@echo "   ==============================="
1991.212Slukem
2001.228Slukempostinstall-fix-obsolete: .NOTMAIN .PHONY
2011.212Slukem	@echo "   === Removing obsolete files ==="
2021.338Sriastrad	${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR:C/^\/$//}/ fix obsolete
2031.212Slukem	@echo "   ==============================="
2041.169Slukem
2051.309Sapbpostinstall-fix-obsolete_stand: .NOTMAIN .PHONY
2061.309Sapb	@echo "   === Removing obsolete files ==="
2071.338Sriastrad	${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR:C/^\/$//}/ fix obsolete_stand
2081.338Sriastrad	${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR:C/^\/$//}/ fix obsolete_stand_debug
2091.309Sapb	@echo "   ==============================="
2101.309Sapb
2111.108Serh
2121.193Slukem#
2131.137Stv# Targets (in order!) called by "make build".
2141.193Slukem#
2151.156StvBUILDTARGETS+=	check-tools
2161.214Slukem.if ${MKUPDATE} == "no" && !defined(NOCLEANDIR)
2171.155StvBUILDTARGETS+=	cleandir
2181.155Stv.endif
2191.261Sapb.if ${MKOBJDIRS} != "no"
2201.261SapbBUILDTARGETS+=	do-top-obj
2211.261Sapb.endif
2221.261Sapb.if ${USETOOLS} == "yes"	# {
2231.149Stv.if ${MKOBJDIRS} != "no"
2241.260SapbBUILDTARGETS+=	do-tools-obj
2251.123Smrg.endif
2261.152StvBUILDTARGETS+=	do-tools
2271.261Sapb.endif # USETOOLS		# }
2281.300SapbBUILDTARGETS+=	params
2291.260Sapb.if ${MKOBJDIRS} != "no"
2301.260SapbBUILDTARGETS+=	obj
2311.260Sapb.endif
2321.270SapbBUILDTARGETS+=	clean_METALOG
2331.137Stv.if !defined(NODISTRIBDIRS)
2341.137StvBUILDTARGETS+=	do-distrib-dirs
2351.131Stv.endif
2361.137Stv.if !defined(NOINCLUDES)
2371.137StvBUILDTARGETS+=	includes
2381.131Stv.endif
2391.281SplunkyBUILDTARGETS+=	do-lib
2401.299SjoergBUILDTARGETS+=	do-compat-lib
2411.328Skamil.if ${MKLLVM} != "no"
2421.329SkamilBUILDTARGETS+=	do-sanitizer
2431.328Skamil.if ${MKSANITIZER:Uno} == "yes"
2441.328SkamilBUILDTARGETS+=	do-sanitizer-tools
2451.328Skamil.endif
2461.328Skamil.endif
2471.263Smrg.if ${MKX11} != "no"
2481.227SlukemBUILDTARGETS+=	do-x11
2491.227Slukem.endif
2501.321Suwe.if !defined(NOBINARIES)
2511.312SjoergBUILDTARGETS+=	do-build
2521.200SlukemBUILDTARGETS+=	do-obsolete
2531.319Schristos.endif
2541.131Stv
2551.193Slukem#
2561.137Stv# Enforce proper ordering of some rules.
2571.193Slukem#
2581.123Smrg
2591.137Stv.ORDER:		${BUILDTARGETS}
2601.228Slukemincludes-lib:	.PHONY includes-include includes-sys
2611.123Smrg
2621.193Slukem#
2631.300Sapb# Record the values of variables that might affect the build.
2641.300Sapb# If no values have changed, avoid updating the timestamp
2651.300Sapb# of the params file.
2661.300Sapb#
2671.300Sapb# This is referenced by _NETBSD_VERSION_DEPENDS in <bsd.own.mk>.
2681.300Sapb#
2691.302Sapb.include "${NETBSDSRCDIR}/etc/Makefile.params"
2701.300SapbCLEANDIRFILES+= params
2711.300Sapbparams: .EXEC
2721.300Sapb	${_MKMSG_CREATE} params
2731.340Srillig	@${:D make}${PRINT_PARAMS} >${.TARGET}.new
2741.300Sapb	@if cmp -s ${.TARGET}.new ${.TARGET} > /dev/null 2>&1; then \
2751.300Sapb		: "params is unchanged" ; \
2761.300Sapb		rm ${.TARGET}.new ; \
2771.300Sapb	else \
2781.300Sapb		: "params has changed or is new" ; \
2791.300Sapb		mv ${.TARGET}.new ${.TARGET} ; \
2801.300Sapb	fi
2811.300Sapb
2821.300Sapb#
2831.302Sapb# Display current make(1) parameters
2841.302Sapb#
2851.302Sapbshow-params: .PHONY .MAKE
2861.302Sapb	@${PRINT_PARAMS}
2871.302Sapb
2881.302Sapb#
2891.137Stv# Build the system and install into DESTDIR.
2901.193Slukem#
2911.123Smrg
2921.191SlukemSTART_TIME!=	date
2931.191Slukem
2941.242Sdslbuild: .PHONY .MAKE
2951.137Stv.if defined(BUILD_DONE)
2961.137Stv	@echo "Build already installed into ${DESTDIR}"
2971.137Stv.else
2981.191Slukem	@echo "Build started at: ${START_TIME}"
2991.145Stv.for tgt in ${BUILDTARGETS}
3001.232Slukem	${MAKEDIRTARGET} . ${tgt}
3011.145Stv.endfor
3021.232Slukem	${MAKEDIRTARGET} etc install-etc-release
3031.191Slukem	@echo   "Build started at:  ${START_TIME}"
3041.172Sbjh21	@printf "Build finished at: " && date
3051.71Smycroft.endif
3061.160Sthorpej
3071.193Slukem#
3081.160Sthorpej# Build a full distribution, but not a release (i.e. no sets into
3091.193Slukem# ${RELEASEDIR}).  "buildworld" enforces a build to ${DESTDIR} != /
3101.193Slukem#
3111.160Sthorpej
3121.242Sdsldistribution buildworld: .PHONY .MAKE
3131.194Slukem.if make(buildworld) && \
3141.194Slukem    (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/")
3151.193Slukem	@echo "Won't make ${.TARGET} with DESTDIR=/"
3161.193Slukem	@false
3171.193Slukem.endif
3181.232Slukem	${MAKEDIRTARGET} . build NOPOSTINSTALL=1
3191.232Slukem	${MAKEDIRTARGET} etc distribution INSTALL_DONE=1
3201.181Sthorpej.if defined(DESTDIR) && ${DESTDIR} != "" && ${DESTDIR} != "/"
3211.232Slukem	${MAKEDIRTARGET} . postinstall-fix-obsolete
3221.309Sapb	${MAKEDIRTARGET} . postinstall-fix-obsolete_stand
3231.340Srillig	${:D make}${MAKEDIRTARGET} distrib/sets checkflist
3241.181Sthorpej.endif
3251.192Slukem	@echo   "make ${.TARGET} started at:  ${START_TIME}"
3261.185Slukem	@printf "make ${.TARGET} finished at: " && date
3271.123Smrg
3281.193Slukem#
3291.193Slukem# Install the distribution from $DESTDIR to $INSTALLWORLDDIR (defaults to `/')
3301.193Slukem# If installing to /, ensures that the host's operating system is NetBSD and
3311.193Slukem# the host's `uname -m` == ${MACHINE}.
3321.193Slukem#
3331.193Slukem
3341.193SlukemHOST_UNAME_S!=	uname -s
3351.193SlukemHOST_UNAME_M!=	uname -m
3361.193Slukem
3371.242Sdslinstallworld: .PHONY .MAKE
3381.194Slukem.if (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/")
3391.193Slukem	@echo "Can't make ${.TARGET} to DESTDIR=/"
3401.193Slukem	@false
3411.193Slukem.endif
3421.193Slukem.if !defined(INSTALLWORLDDIR) || \
3431.193Slukem    ${INSTALLWORLDDIR} == "" || ${INSTALLWORLDDIR} == "/"
3441.193Slukem.if (${HOST_UNAME_S} != "NetBSD")
3451.193Slukem	@echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_S} to NetBSD with INSTALLWORLDDIR=/"
3461.193Slukem	@false
3471.193Slukem.endif
3481.193Slukem.if (${HOST_UNAME_M} != ${MACHINE})
3491.193Slukem	@echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_M} to ${MACHINE} with INSTALLWORLDDIR=/"
3501.193Slukem	@false
3511.193Slukem.endif
3521.193Slukem.endif
3531.232Slukem	${MAKEDIRTARGET} distrib/sets installsets \
3541.282Sjym		INSTALLDIR=${INSTALLWORLDDIR:U/} INSTALLSETS=${INSTALLSETS:Q}
3551.232Slukem	${MAKEDIRTARGET} . postinstall-check DESTDIR=${INSTALLWORLDDIR}
3561.193Slukem	@echo   "make ${.TARGET} started at:  ${START_TIME}"
3571.193Slukem	@printf "make ${.TARGET} finished at: " && date
3581.199Slukem
3591.199Slukem#
3601.287Sjmcneill# Install modules from $DESTDIR to $INSTALLMODULESDIR
3611.287Sjmcneill#
3621.287Sjmcneillinstallmodules: .PHONY .MAKE
3631.287Sjmcneill.if (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/")
3641.287Sjmcneill	@echo "Can't make ${.TARGET} to DESTDIR=/"
3651.287Sjmcneill	@false
3661.287Sjmcneill.endif
3671.287Sjmcneill.if !defined(INSTALLMODULESDIR) || \
3681.287Sjmcneill    ${INSTALLMODULESDIR} == "" || ${INSTALLMODULESDIR} == "/"
3691.287Sjmcneill.if (${HOST_UNAME_S} != "NetBSD")
3701.287Sjmcneill	@echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_S} to NetBSD with INSTALLMODULESDIR=/"
3711.287Sjmcneill	@false
3721.287Sjmcneill.endif
3731.287Sjmcneill.if (${HOST_UNAME_M} != ${MACHINE})
3741.287Sjmcneill	@echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_M} to ${MACHINE} with INSTALLMODULESDIR=/"
3751.287Sjmcneill	@false
3761.287Sjmcneill.endif
3771.287Sjmcneill.endif
3781.288Sjmcneill	${MAKEDIRTARGET} sys/modules install DESTDIR=${INSTALLMODULESDIR:U/}
3791.287Sjmcneill	@echo   "make ${.TARGET} started at:  ${START_TIME}"
3801.287Sjmcneill	@printf "make ${.TARGET} finished at: " && date
3811.287Sjmcneill
3821.287Sjmcneill#
3831.206Slukem# Create sets from $DESTDIR or $NETBSDSRCDIR into $RELEASEDIR
3841.199Slukem#
3851.199Slukem
3861.241Sapb.for tgt in sets sourcesets syspkgs
3871.242Sdsl${tgt}: .PHONY .MAKE
3881.232Slukem	${MAKEDIRTARGET} distrib/sets ${tgt}
3891.206Slukem.endfor
3901.193Slukem
3911.193Slukem#
3921.240Slukem# Build a release or snapshot (implies "make distribution").  Note that
3931.181Sthorpej# in this case, the set lists will be checked before the tar files
3941.181Sthorpej# are made.
3951.193Slukem#
3961.123Smrg
3971.242Sdslrelease snapshot: .PHONY .MAKE
3981.240Slukem	${MAKEDIRTARGET} . distribution
3991.240Slukem	${MAKEDIRTARGET} etc release DISTRIBUTION_DONE=1
4001.192Slukem	@echo   "make ${.TARGET} started at:  ${START_TIME}"
4011.185Slukem	@printf "make ${.TARGET} finished at: " && date
4021.123Smrg
4031.193Slukem#
4041.243Sapb# Create a CD-ROM image.
4051.243Sapb#
4061.243Sapb
4071.243Sapbiso-image: .PHONY
4081.247Sbouyer	${MAKEDIRTARGET} distrib iso_image
4091.243Sapb	${MAKEDIRTARGET} etc iso-image
4101.243Sapb	@echo   "make ${.TARGET} started at:  ${START_TIME}"
4111.243Sapb	@printf "make ${.TARGET} finished at: " && date
4121.243Sapb
4131.248Sjnemethiso-image-source: .PHONY
4141.248Sjnemeth	${MAKEDIRTARGET} distrib iso_image CDSOURCE=true
4151.248Sjnemeth	${MAKEDIRTARGET} etc iso-image
4161.248Sjnemeth	@echo   "make ${.TARGET} started at:  ${START_TIME}"
4171.248Sjnemeth	@printf "make ${.TARGET} finished at: " && date
4181.248Sjnemeth
4191.243Sapb#
4201.290Stsutsui# Create bootable live images.
4211.290Stsutsui#
4221.290Stsutsui
4231.290Stsutsuilive-image: .PHONY
4241.290Stsutsui	${MAKEDIRTARGET} etc live-image
4251.290Stsutsui	@echo   "make ${.TARGET} started at:  ${START_TIME}"
4261.290Stsutsui	@printf "make ${.TARGET} finished at: " && date
4271.290Stsutsui
4281.290Stsutsui#
4291.290Stsutsui# Create bootable installation images.
4301.290Stsutsui#
4311.290Stsutsui
4321.290Stsutsuiinstall-image: .PHONY
4331.290Stsutsui	${MAKEDIRTARGET} etc install-image
4341.290Stsutsui	@echo   "make ${.TARGET} started at:  ${START_TIME}"
4351.290Stsutsui	@printf "make ${.TARGET} finished at: " && date
4361.290Stsutsui
4371.290Stsutsui#
4381.137Stv# Special components of the "make build" process.
4391.193Slukem#
4401.156Stv
4411.228Slukemcheck-tools: .PHONY
4421.223Slukem.if ${TOOLCHAIN_MISSING} != "no" && !defined(EXTERNAL_TOOLCHAIN)
4431.187Sthorpej	@echo '*** WARNING:  Building on MACHINE=${MACHINE} with missing toolchain.'
4441.187Sthorpej	@echo '*** May result in a failed build or corrupt binaries!'
4451.187Sthorpej.elif defined(EXTERNAL_TOOLCHAIN)
4461.187Sthorpej	@echo '*** Using external toolchain rooted at ${EXTERNAL_TOOLCHAIN}.'
4471.156Stv.endif
4481.123Smrg
4491.270Sapb# Delete or sanitise a leftover METALOG from a previous build.
4501.270Sapbclean_METALOG: .PHONY .MAKE
4511.270Sapb.if ${MKUPDATE} != "no"
4521.270Sapb	${MAKEDIRTARGET} distrib/sets clean_METALOG
4531.270Sapb.endif
4541.270Sapb
4551.242Sdsldo-distrib-dirs: .PHONY .MAKE
4561.147Sjmc.if !defined(DESTDIR) || ${DESTDIR} == ""
4571.232Slukem	${MAKEDIRTARGET} etc distrib-dirs DESTDIR=/
4581.147Sjmc.else
4591.232Slukem	${MAKEDIRTARGET} etc distrib-dirs DESTDIR=${DESTDIR}
4601.147Sjmc.endif
4611.190Slukem
4621.190Slukem.for targ in cleandir obj includes
4631.228Slukemdo-${targ}: .PHONY ${targ}
4641.190Slukem	@true
4651.190Slukem.endfor
4661.123Smrg
4671.301Sjoergdo-tools: .PHONY .MAKE
4681.301Sjoerg	${MAKEDIRTARGET} tools build_install
4691.184Slukem
4701.299Sjoergdo-lib: .PHONY .MAKE
4711.299Sjoerg	${MAKEDIRTARGET} lib build_install
4721.299Sjoerg
4731.299Sjoergdo-compat-lib: .PHONY .MAKE
4741.299Sjoerg	${MAKEDIRTARGET} compat build_install BOOTSTRAP_SUBDIRS="../../../lib"
4751.276Smrg
4761.329Skamildo-sanitizer: .PHONY .MAKE
4771.331Skamil	${MAKEDIRTARGET} external/bsd/compiler_rt build_install
4781.328Skamil
4791.328Skamildo-sanitizer-tools: .PHONY .MAKE
4801.329Skamil.if !exists(${TOOLDIR}/lib/clang) && ${HAVE_LLVM:Uno} == "yes"
4811.328Skamil	mkdir -p ${TOOLDIR}/lib/clang
4821.328Skamil	cd ${DESTDIR}/usr/lib/clang && \
4831.328Skamil		${TOOL_PAX} -rw . ${TOOLDIR}/lib/clang
4841.328Skamil.endif
4851.328Skamil
4861.261Sapbdo-top-obj: .PHONY .MAKE
4871.261Sapb	${MAKEDIRTARGET} . obj NOSUBDIR=
4881.261Sapb
4891.260Sapbdo-tools-obj: .PHONY .MAKE
4901.260Sapb	${MAKEDIRTARGET} tools obj
4911.260Sapb
4921.242Sdsldo-build: .PHONY .MAKE
4931.154Stv.for targ in dependall install
4941.232Slukem	${MAKEDIRTARGET} . ${targ} BUILD_tools=no BUILD_lib=no
4951.154Stv.endfor
4961.200Slukem
4971.242Sdsldo-x11: .PHONY .MAKE
4981.263Smrg.if ${MKX11} != "no"
4991.312Sjoerg	${MAKEDIRTARGET} external/mit/xorg/tools all
5001.312Sjoerg	${MAKEDIRTARGET} external/mit/xorg/lib build_install
5011.315Smatt.if ${MKCOMPATX11} != "no"
5021.314Smatt	${MAKEDIRTARGET} compat build_install BOOTSTRAP_SUBDIRS="../../../external/mit/xorg/lib"
5031.314Smatt.endif
5041.263Smrg.else
5051.263Smrg	@echo "MKX11 is not enabled"
5061.257Slukem	@false
5071.254Smrg.endif
5081.227Slukem
5091.242Sdsldo-obsolete: .PHONY .MAKE
5101.232Slukem	${MAKEDIRTARGET} etc install-obsolete-lists
5111.87Scjs
5121.193Slukem#
5131.137Stv# Speedup stubs for some subtrees that don't need to run these rules.
5141.137Stv# (Tells <bsd.subdir.mk> not to recurse for them.)
5151.193Slukem#
5161.129Stv
5171.292Sveego.for dir in bin etc distrib games libexec regress sbin usr.bin usr.sbin tools
5181.228Slukemincludes-${dir}: .PHONY
5191.152Stv	@true
5201.152Stv.endfor
5211.152Stv.for dir in etc distrib regress
5221.228Slukeminstall-${dir}: .PHONY
5231.152Stv	@true
5241.152Stv.endfor
5251.152Stv
5261.193Slukem#
5271.152Stv# XXX this needs to change when distrib Makefiles are recursion compliant
5281.193Slukem# XXX many distrib subdirs need "cd etc && make snap_pre snap_kern" first...
5291.193Slukem#
5301.228Slukemdependall-distrib depend-distrib all-distrib: .PHONY
5311.136Snathanw	@true
5321.130Stv
5331.151Stv.include <bsd.obj.mk>
5341.209Slukem.include <bsd.kernobj.mk>
5351.146Stv.include <bsd.subdir.mk>
5361.322Smrg.include <bsd.clean.mk>
537