Makefile revision 1.338
11.338Sriastrad#	$NetBSD: Makefile,v 1.338 2023/09/08 12:01:56 riastradh 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.178Senami#	`make build', as well as having the effects listed in
291.178Senami#	/usr/share/mk/bsd.README.
301.125Smrg#   NOCLEANDIR, if defined, will avoid a `make cleandir' at the start
311.178Senami#	of the `make build'.
321.119Stoddpw#   NOINCLUDES will avoid the `make includes' usually done by `make build'.
331.319Schristos#   NOBINARIES will not build binaries, only includes and libraries
341.95Scjs#
351.214Slukem#   See mk.conf(5) for more details.
361.214Slukem#
371.214Slukem#
381.95Scjs# Targets:
391.137Stv#   build:
401.196Slukem#	Builds a full release of NetBSD in DESTDIR, except for the
411.196Slukem#	/etc configuration files.
421.196Slukem#	If BUILD_DONE is set, this is an empty target.
431.196Slukem#   distribution:
441.196Slukem#	Builds a full release of NetBSD in DESTDIR, including the /etc
451.196Slukem#	configuration files.
461.196Slukem#   buildworld:
471.196Slukem#	As per `make distribution', except that it ensures that DESTDIR
481.196Slukem#	is not the root directory.
491.196Slukem#   installworld:
501.196Slukem#	Install the distribution from DESTDIR to INSTALLWORLDDIR (which
511.196Slukem#	defaults to the root directory).  Ensures that INSTALLWORLDDIR
521.291Sabs#	is not the root directory if cross compiling.
531.137Stv#   release:
541.240Slukem#	Does a `make distribution', and then tars up the DESTDIR files
551.252Slukem#	into ${RELEASEDIR}/${RELEASEMACHINEDIR}, in release(7) format.
561.196Slukem#	(See etc/Makefile for more information on this.)
571.137Stv#   regression-tests:
581.137Stv#	Runs the regression tests in "regress" on this host.
591.206Slukem#   sets:
601.252Slukem#	Populate ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets
611.252Slukem#	from ${DESTDIR}
621.206Slukem#   sourcesets:
631.206Slukem#	Populate ${RELEASEDIR}/source/sets from ${NETBSDSRCDIR}
641.241Sapb#   syspkgs:
651.252Slukem#	Populate ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/syspkgs
661.252Slukem#	from ${DESTDIR}
671.243Sapb#   iso-image:
681.311Ssnj#	Create CD-ROM image in RELEASEDIR/images.
691.243Sapb#	RELEASEDIR must already have been populated by `make release'
701.243Sapb#	or equivalent.
711.248Sjnemeth#   iso-image-source:
721.311Ssnj#	Create CD-ROM image with source in RELEASEDIR/images.
731.248Sjnemeth#	RELEASEDIR must already have been populated by
741.248Sjnemeth#	`make release sourcesets' or equivalent.
751.290Stsutsui#   live-image:
761.290Stsutsui#	Create bootable live image for emulators or USB stick etc.
771.290Stsutsui#	in RELEASEDIR/liveimage.
781.290Stsutsui#	RELEASEDIR must already have been populated by `make release'
791.290Stsutsui#	or equivalent.
801.290Stsutsui#   install-image:
811.290Stsutsui#	Create bootable installation image for USB stick etc.
821.290Stsutsui#	in RELEASEDIR/installimage.
831.290Stsutsui#	RELEASEDIR must already have been populated by `make release'
841.290Stsutsui#	or equivalent.
851.123Smrg#
861.137Stv# Targets invoked by `make build,' in order:
871.155Stv#   cleandir:        cleans the tree.
881.261Sapb#   do-top-obj:      creates the top level object directory.
891.260Sapb#   do-tools-obj:    creates object directories for the host toolchain.
901.260Sapb#   do-tools:        builds host toolchain.
911.336Slukem#   params:          create params file with various make(1) parameters.
921.336Slukem#   show-params:     show various make(1) parameters.
931.137Stv#   obj:             creates object directories.
941.208Slukem#   do-distrib-dirs: creates the distribution directories.
951.208Slukem#   includes:        installs include files.
961.326Smartin#   do-lib:          builds and installs prerequisites from lib.
971.299Sjoerg#   do-compat-lib:   builds and installs prerequisites from compat/lib
981.262Smrg#                    if ${MKCOMPAT} != "no".
991.320Suwe#   do-x11:          builds and installs X11 tools and libraries
1001.320Suwe#                    from src/external/mit/xorg if ${MKX11} != "no".
1011.137Stv#   do-build:        builds and installs the entire system.
1021.222Slukem#   do-obsolete:     installs the obsolete sets (for the postinstall-* targets).
1031.193Slukem#
1041.32Scgd
1051.146Stv.if ${.MAKEFLAGS:M${.CURDIR}/share/mk} == ""
1061.146Stv.MAKEFLAGS: -m ${.CURDIR}/share/mk
1071.146Stv.endif
1081.163Stv
1091.193Slukem#
1101.163Stv# If _SRC_TOP_OBJ_ gets set here, we will end up with a directory that may
1111.163Stv# not be the top level objdir, because "make obj" can happen in the *middle*
1121.163Stv# of "make build" (long after <bsd.own.mk> is calculated it).  So, pre-set
1131.163Stv# _SRC_TOP_OBJ_ here so it will not be added to ${.MAKEOVERRIDES}.
1141.193Slukem#
1151.163Stv_SRC_TOP_OBJ_=
1161.148Sjmc
1171.146Stv.include <bsd.own.mk>
1181.4Scgd
1191.193Slukem#
1201.137Stv# Sanity check: make sure that "make build" is not invoked simultaneously
1211.137Stv# with a standard recursive target.
1221.193Slukem#
1231.137Stv
1241.137Stv.if make(build) || make(release) || make(snapshot)
1251.137Stv.for targ in ${TARGETS:Nobj:Ncleandir}
1261.137Stv.if make(${targ}) && !target(.BEGIN)
1271.137Stv.BEGIN:
1281.137Stv	@echo 'BUILD ABORTED: "make build" and "make ${targ}" are mutually exclusive.'
1291.137Stv	@false
1301.137Stv.endif
1311.137Stv.endfor
1321.137Stv.endif
1331.58Stv
1341.261Sapb#
1351.261Sapb# _SUBDIR is used to set SUBDIR, after removing directories that have
1361.261Sapb# BUILD_${dir}=no, or that have no ${dir}/Makefile.
1371.261Sapb#
1381.329Skamil_SUBDIR=	tools .WAIT lib
1391.329Skamil.if ${MKLLVM} != "no"
1401.329Skamil_SUBDIR+=	external/bsd/compiler_rt
1411.329Skamil.endif
1421.333Suwe_SUBDIR+=	include external crypto/external bin
1431.325Smaya_SUBDIR+=	games libexec sbin usr.bin
1441.303Sjoerg_SUBDIR+=	usr.sbin share sys etc tests compat
1451.303Sjoerg_SUBDIR+=	.WAIT rescue .WAIT distrib regress
1461.105Sassar
1471.137Stv.for dir in ${_SUBDIR}
1481.261Sapb.if "${dir}" == ".WAIT" \
1491.261Sapb	|| (${BUILD_${dir}:Uyes} != "no" && exists(${dir}/Makefile))
1501.137StvSUBDIR+=	${dir}
1511.36Sexplorer.endif
1521.137Stv.endfor
1531.21Scgd
1541.13Sbrezak.if exists(regress)
1551.242Sdslregression-tests: .PHONY .MAKE
1561.10Scgd	@echo Running regression tests...
1571.232Slukem	${MAKEDIRTARGET} regress regress
1581.13Sbrezak.endif
1591.20Scgd
1601.214Slukem.if ${MKUNPRIVED} != "no"
1611.179SthorpejNOPOSTINSTALL=	# defined
1621.179Sthorpej.endif
1631.179Sthorpej
1641.242Sdslafterinstall: .PHONY .MAKE
1651.137Stv.if ${MKMAN} != "no"
1661.232Slukem	${MAKEDIRTARGET} share/man makedb
1671.137Stv.endif
1681.214Slukem.if (${MKUNPRIVED} != "no" && ${MKINFO} != "no")
1691.317Schristos	${MAKEDIRTARGET} external/gpl2/texinfo/bin/install-info infodir-meta
1701.176Slukem.endif
1711.179Sthorpej.if !defined(NOPOSTINSTALL)
1721.232Slukem	${MAKEDIRTARGET} . postinstall-check
1731.159Sperry.endif
1741.170Slukem
1751.327Smartin_POSTINSTALL=	${:!cd ${.CURDIR}/usr.sbin/postinstall && \
1761.334Srillig			${MAKE} -v .OBJDIR!}/postinstall  \
1771.308Sapb		-m ${MACHINE} -a ${MACHINE_ARCH}
1781.295Sapb_POSTINSTALL_ENV= \
1791.295Sapb	AWK=${TOOL_AWK:Q}		\
1801.295Sapb	DB=${TOOL_DB:Q}			\
1811.298Sapb	HOST_SH=${HOST_SH:Q}		\
1821.295Sapb	MAKE=${MAKE:Q}			\
1831.297Sapb	PWD_MKDB=${TOOL_PWD_MKDB:Q}	\
1841.307Sapb	SED=${TOOL_SED:Q}		\
1851.297Sapb	STAT=${TOOL_STAT:Q}
1861.239Slukem
1871.313Smartin.if ${MKX11} != "no"
1881.313Smartin_POSTINSTALL_X11=-x ${X11SRCDIR:Q}
1891.313Smartin.endif
1901.313Smartin
1911.228Slukempostinstall-check: .PHONY
1921.169Slukem	@echo "   === Post installation checks ==="
1931.338Sriastrad	${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR:C/^\/$//}/ check; if [ $$? -gt 1 ]; then exit 1; fi
1941.171Slukem	@echo "   ================================"
1951.171Slukem
1961.228Slukempostinstall-fix: .NOTMAIN .PHONY
1971.171Slukem	@echo "   === Post installation fixes ==="
1981.338Sriastrad	${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR:C/^\/$//}/ fix
1991.212Slukem	@echo "   ==============================="
2001.212Slukem
2011.228Slukempostinstall-fix-obsolete: .NOTMAIN .PHONY
2021.212Slukem	@echo "   === Removing obsolete files ==="
2031.338Sriastrad	${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR:C/^\/$//}/ fix obsolete
2041.212Slukem	@echo "   ==============================="
2051.169Slukem
2061.309Sapbpostinstall-fix-obsolete_stand: .NOTMAIN .PHONY
2071.309Sapb	@echo "   === Removing obsolete files ==="
2081.338Sriastrad	${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR:C/^\/$//}/ fix obsolete_stand
2091.338Sriastrad	${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR:C/^\/$//}/ fix obsolete_stand_debug
2101.309Sapb	@echo "   ==============================="
2111.309Sapb
2121.108Serh
2131.193Slukem#
2141.137Stv# Targets (in order!) called by "make build".
2151.193Slukem#
2161.156StvBUILDTARGETS+=	check-tools
2171.214Slukem.if ${MKUPDATE} == "no" && !defined(NOCLEANDIR)
2181.155StvBUILDTARGETS+=	cleandir
2191.155Stv.endif
2201.261Sapb.if ${MKOBJDIRS} != "no"
2211.261SapbBUILDTARGETS+=	do-top-obj
2221.261Sapb.endif
2231.261Sapb.if ${USETOOLS} == "yes"	# {
2241.149Stv.if ${MKOBJDIRS} != "no"
2251.260SapbBUILDTARGETS+=	do-tools-obj
2261.123Smrg.endif
2271.152StvBUILDTARGETS+=	do-tools
2281.261Sapb.endif # USETOOLS		# }
2291.300SapbBUILDTARGETS+=	params
2301.260Sapb.if ${MKOBJDIRS} != "no"
2311.260SapbBUILDTARGETS+=	obj
2321.260Sapb.endif
2331.270SapbBUILDTARGETS+=	clean_METALOG
2341.137Stv.if !defined(NODISTRIBDIRS)
2351.137StvBUILDTARGETS+=	do-distrib-dirs
2361.131Stv.endif
2371.137Stv.if !defined(NOINCLUDES)
2381.137StvBUILDTARGETS+=	includes
2391.131Stv.endif
2401.281SplunkyBUILDTARGETS+=	do-lib
2411.299SjoergBUILDTARGETS+=	do-compat-lib
2421.328Skamil.if ${MKLLVM} != "no"
2431.329SkamilBUILDTARGETS+=	do-sanitizer
2441.328Skamil.if ${MKSANITIZER:Uno} == "yes"
2451.328SkamilBUILDTARGETS+=	do-sanitizer-tools
2461.328Skamil.endif
2471.328Skamil.endif
2481.263Smrg.if ${MKX11} != "no"
2491.227SlukemBUILDTARGETS+=	do-x11
2501.227Slukem.endif
2511.321Suwe.if !defined(NOBINARIES)
2521.312SjoergBUILDTARGETS+=	do-build
2531.200SlukemBUILDTARGETS+=	do-obsolete
2541.319Schristos.endif
2551.131Stv
2561.193Slukem#
2571.137Stv# Enforce proper ordering of some rules.
2581.193Slukem#
2591.123Smrg
2601.137Stv.ORDER:		${BUILDTARGETS}
2611.228Slukemincludes-lib:	.PHONY includes-include includes-sys
2621.123Smrg
2631.193Slukem#
2641.300Sapb# Record the values of variables that might affect the build.
2651.300Sapb# If no values have changed, avoid updating the timestamp
2661.300Sapb# of the params file.
2671.300Sapb#
2681.300Sapb# This is referenced by _NETBSD_VERSION_DEPENDS in <bsd.own.mk>.
2691.300Sapb#
2701.302Sapb.include "${NETBSDSRCDIR}/etc/Makefile.params"
2711.300SapbCLEANDIRFILES+= params
2721.300Sapbparams: .EXEC
2731.300Sapb	${_MKMSG_CREATE} params
2741.302Sapb	@${PRINT_PARAMS} >${.TARGET}.new
2751.300Sapb	@if cmp -s ${.TARGET}.new ${.TARGET} > /dev/null 2>&1; then \
2761.300Sapb		: "params is unchanged" ; \
2771.300Sapb		rm ${.TARGET}.new ; \
2781.300Sapb	else \
2791.300Sapb		: "params has changed or is new" ; \
2801.300Sapb		mv ${.TARGET}.new ${.TARGET} ; \
2811.300Sapb	fi
2821.300Sapb
2831.300Sapb#
2841.302Sapb# Display current make(1) parameters
2851.302Sapb#
2861.302Sapbshow-params: .PHONY .MAKE
2871.302Sapb	@${PRINT_PARAMS}
2881.302Sapb
2891.302Sapb#
2901.137Stv# Build the system and install into DESTDIR.
2911.193Slukem#
2921.123Smrg
2931.191SlukemSTART_TIME!=	date
2941.191Slukem
2951.242Sdslbuild: .PHONY .MAKE
2961.137Stv.if defined(BUILD_DONE)
2971.137Stv	@echo "Build already installed into ${DESTDIR}"
2981.137Stv.else
2991.191Slukem	@echo "Build started at: ${START_TIME}"
3001.145Stv.for tgt in ${BUILDTARGETS}
3011.232Slukem	${MAKEDIRTARGET} . ${tgt}
3021.145Stv.endfor
3031.232Slukem	${MAKEDIRTARGET} etc install-etc-release
3041.191Slukem	@echo   "Build started at:  ${START_TIME}"
3051.172Sbjh21	@printf "Build finished at: " && date
3061.71Smycroft.endif
3071.160Sthorpej
3081.193Slukem#
3091.160Sthorpej# Build a full distribution, but not a release (i.e. no sets into
3101.193Slukem# ${RELEASEDIR}).  "buildworld" enforces a build to ${DESTDIR} != /
3111.193Slukem#
3121.160Sthorpej
3131.242Sdsldistribution buildworld: .PHONY .MAKE
3141.194Slukem.if make(buildworld) && \
3151.194Slukem    (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/")
3161.193Slukem	@echo "Won't make ${.TARGET} with DESTDIR=/"
3171.193Slukem	@false
3181.193Slukem.endif
3191.232Slukem	${MAKEDIRTARGET} . build NOPOSTINSTALL=1
3201.232Slukem	${MAKEDIRTARGET} etc distribution INSTALL_DONE=1
3211.181Sthorpej.if defined(DESTDIR) && ${DESTDIR} != "" && ${DESTDIR} != "/"
3221.232Slukem	${MAKEDIRTARGET} . postinstall-fix-obsolete
3231.309Sapb	${MAKEDIRTARGET} . postinstall-fix-obsolete_stand
3241.232Slukem	${MAKEDIRTARGET} distrib/sets checkflist
3251.181Sthorpej.endif
3261.192Slukem	@echo   "make ${.TARGET} started at:  ${START_TIME}"
3271.185Slukem	@printf "make ${.TARGET} finished at: " && date
3281.123Smrg
3291.193Slukem#
3301.193Slukem# Install the distribution from $DESTDIR to $INSTALLWORLDDIR (defaults to `/')
3311.193Slukem# If installing to /, ensures that the host's operating system is NetBSD and
3321.193Slukem# the host's `uname -m` == ${MACHINE}.
3331.193Slukem#
3341.193Slukem
3351.193SlukemHOST_UNAME_S!=	uname -s
3361.193SlukemHOST_UNAME_M!=	uname -m
3371.193Slukem
3381.242Sdslinstallworld: .PHONY .MAKE
3391.194Slukem.if (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/")
3401.193Slukem	@echo "Can't make ${.TARGET} to DESTDIR=/"
3411.193Slukem	@false
3421.193Slukem.endif
3431.193Slukem.if !defined(INSTALLWORLDDIR) || \
3441.193Slukem    ${INSTALLWORLDDIR} == "" || ${INSTALLWORLDDIR} == "/"
3451.193Slukem.if (${HOST_UNAME_S} != "NetBSD")
3461.193Slukem	@echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_S} to NetBSD with INSTALLWORLDDIR=/"
3471.193Slukem	@false
3481.193Slukem.endif
3491.193Slukem.if (${HOST_UNAME_M} != ${MACHINE})
3501.193Slukem	@echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_M} to ${MACHINE} with INSTALLWORLDDIR=/"
3511.193Slukem	@false
3521.193Slukem.endif
3531.193Slukem.endif
3541.232Slukem	${MAKEDIRTARGET} distrib/sets installsets \
3551.282Sjym		INSTALLDIR=${INSTALLWORLDDIR:U/} INSTALLSETS=${INSTALLSETS:Q}
3561.232Slukem	${MAKEDIRTARGET} . postinstall-check DESTDIR=${INSTALLWORLDDIR}
3571.193Slukem	@echo   "make ${.TARGET} started at:  ${START_TIME}"
3581.193Slukem	@printf "make ${.TARGET} finished at: " && date
3591.199Slukem
3601.199Slukem#
3611.287Sjmcneill# Install modules from $DESTDIR to $INSTALLMODULESDIR
3621.287Sjmcneill#
3631.287Sjmcneillinstallmodules: .PHONY .MAKE
3641.287Sjmcneill.if (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/")
3651.287Sjmcneill	@echo "Can't make ${.TARGET} to DESTDIR=/"
3661.287Sjmcneill	@false
3671.287Sjmcneill.endif
3681.287Sjmcneill.if !defined(INSTALLMODULESDIR) || \
3691.287Sjmcneill    ${INSTALLMODULESDIR} == "" || ${INSTALLMODULESDIR} == "/"
3701.287Sjmcneill.if (${HOST_UNAME_S} != "NetBSD")
3711.287Sjmcneill	@echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_S} to NetBSD with INSTALLMODULESDIR=/"
3721.287Sjmcneill	@false
3731.287Sjmcneill.endif
3741.287Sjmcneill.if (${HOST_UNAME_M} != ${MACHINE})
3751.287Sjmcneill	@echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_M} to ${MACHINE} with INSTALLMODULESDIR=/"
3761.287Sjmcneill	@false
3771.287Sjmcneill.endif
3781.287Sjmcneill.endif
3791.288Sjmcneill	${MAKEDIRTARGET} sys/modules install DESTDIR=${INSTALLMODULESDIR:U/}
3801.287Sjmcneill	@echo   "make ${.TARGET} started at:  ${START_TIME}"
3811.287Sjmcneill	@printf "make ${.TARGET} finished at: " && date
3821.287Sjmcneill
3831.287Sjmcneill#
3841.206Slukem# Create sets from $DESTDIR or $NETBSDSRCDIR into $RELEASEDIR
3851.199Slukem#
3861.199Slukem
3871.241Sapb.for tgt in sets sourcesets syspkgs
3881.242Sdsl${tgt}: .PHONY .MAKE
3891.232Slukem	${MAKEDIRTARGET} distrib/sets ${tgt}
3901.206Slukem.endfor
3911.193Slukem
3921.193Slukem#
3931.240Slukem# Build a release or snapshot (implies "make distribution").  Note that
3941.181Sthorpej# in this case, the set lists will be checked before the tar files
3951.181Sthorpej# are made.
3961.193Slukem#
3971.123Smrg
3981.242Sdslrelease snapshot: .PHONY .MAKE
3991.240Slukem	${MAKEDIRTARGET} . distribution
4001.240Slukem	${MAKEDIRTARGET} etc release DISTRIBUTION_DONE=1
4011.192Slukem	@echo   "make ${.TARGET} started at:  ${START_TIME}"
4021.185Slukem	@printf "make ${.TARGET} finished at: " && date
4031.123Smrg
4041.193Slukem#
4051.243Sapb# Create a CD-ROM image.
4061.243Sapb#
4071.243Sapb
4081.243Sapbiso-image: .PHONY
4091.247Sbouyer	${MAKEDIRTARGET} distrib iso_image
4101.243Sapb	${MAKEDIRTARGET} etc iso-image
4111.243Sapb	@echo   "make ${.TARGET} started at:  ${START_TIME}"
4121.243Sapb	@printf "make ${.TARGET} finished at: " && date
4131.243Sapb
4141.248Sjnemethiso-image-source: .PHONY
4151.248Sjnemeth	${MAKEDIRTARGET} distrib iso_image CDSOURCE=true
4161.248Sjnemeth	${MAKEDIRTARGET} etc iso-image
4171.248Sjnemeth	@echo   "make ${.TARGET} started at:  ${START_TIME}"
4181.248Sjnemeth	@printf "make ${.TARGET} finished at: " && date
4191.248Sjnemeth
4201.243Sapb#
4211.290Stsutsui# Create bootable live images.
4221.290Stsutsui#
4231.290Stsutsui
4241.290Stsutsuilive-image: .PHONY
4251.290Stsutsui	${MAKEDIRTARGET} etc live-image
4261.290Stsutsui	@echo   "make ${.TARGET} started at:  ${START_TIME}"
4271.290Stsutsui	@printf "make ${.TARGET} finished at: " && date
4281.290Stsutsui
4291.290Stsutsui#
4301.290Stsutsui# Create bootable installation images.
4311.290Stsutsui#
4321.290Stsutsui
4331.290Stsutsuiinstall-image: .PHONY
4341.290Stsutsui	${MAKEDIRTARGET} etc install-image
4351.290Stsutsui	@echo   "make ${.TARGET} started at:  ${START_TIME}"
4361.290Stsutsui	@printf "make ${.TARGET} finished at: " && date
4371.290Stsutsui
4381.290Stsutsui#
4391.137Stv# Special components of the "make build" process.
4401.193Slukem#
4411.156Stv
4421.228Slukemcheck-tools: .PHONY
4431.223Slukem.if ${TOOLCHAIN_MISSING} != "no" && !defined(EXTERNAL_TOOLCHAIN)
4441.187Sthorpej	@echo '*** WARNING:  Building on MACHINE=${MACHINE} with missing toolchain.'
4451.187Sthorpej	@echo '*** May result in a failed build or corrupt binaries!'
4461.187Sthorpej.elif defined(EXTERNAL_TOOLCHAIN)
4471.187Sthorpej	@echo '*** Using external toolchain rooted at ${EXTERNAL_TOOLCHAIN}.'
4481.156Stv.endif
4491.123Smrg
4501.270Sapb# Delete or sanitise a leftover METALOG from a previous build.
4511.270Sapbclean_METALOG: .PHONY .MAKE
4521.270Sapb.if ${MKUPDATE} != "no"
4531.270Sapb	${MAKEDIRTARGET} distrib/sets clean_METALOG
4541.270Sapb.endif
4551.270Sapb
4561.242Sdsldo-distrib-dirs: .PHONY .MAKE
4571.147Sjmc.if !defined(DESTDIR) || ${DESTDIR} == ""
4581.232Slukem	${MAKEDIRTARGET} etc distrib-dirs DESTDIR=/
4591.147Sjmc.else
4601.232Slukem	${MAKEDIRTARGET} etc distrib-dirs DESTDIR=${DESTDIR}
4611.147Sjmc.endif
4621.190Slukem
4631.190Slukem.for targ in cleandir obj includes
4641.228Slukemdo-${targ}: .PHONY ${targ}
4651.190Slukem	@true
4661.190Slukem.endfor
4671.123Smrg
4681.301Sjoergdo-tools: .PHONY .MAKE
4691.301Sjoerg	${MAKEDIRTARGET} tools build_install
4701.184Slukem
4711.299Sjoergdo-lib: .PHONY .MAKE
4721.299Sjoerg	${MAKEDIRTARGET} lib build_install
4731.299Sjoerg
4741.299Sjoergdo-compat-lib: .PHONY .MAKE
4751.299Sjoerg	${MAKEDIRTARGET} compat build_install BOOTSTRAP_SUBDIRS="../../../lib"
4761.276Smrg
4771.329Skamildo-sanitizer: .PHONY .MAKE
4781.331Skamil	${MAKEDIRTARGET} external/bsd/compiler_rt build_install
4791.328Skamil
4801.328Skamildo-sanitizer-tools: .PHONY .MAKE
4811.329Skamil.if !exists(${TOOLDIR}/lib/clang) && ${HAVE_LLVM:Uno} == "yes"
4821.328Skamil	mkdir -p ${TOOLDIR}/lib/clang
4831.328Skamil	cd ${DESTDIR}/usr/lib/clang && \
4841.328Skamil		${TOOL_PAX} -rw . ${TOOLDIR}/lib/clang
4851.328Skamil.endif
4861.328Skamil
4871.261Sapbdo-top-obj: .PHONY .MAKE
4881.261Sapb	${MAKEDIRTARGET} . obj NOSUBDIR=
4891.261Sapb
4901.260Sapbdo-tools-obj: .PHONY .MAKE
4911.260Sapb	${MAKEDIRTARGET} tools obj
4921.260Sapb
4931.242Sdsldo-build: .PHONY .MAKE
4941.154Stv.for targ in dependall install
4951.232Slukem	${MAKEDIRTARGET} . ${targ} BUILD_tools=no BUILD_lib=no
4961.154Stv.endfor
4971.200Slukem
4981.242Sdsldo-x11: .PHONY .MAKE
4991.263Smrg.if ${MKX11} != "no"
5001.312Sjoerg	${MAKEDIRTARGET} external/mit/xorg/tools all
5011.312Sjoerg	${MAKEDIRTARGET} external/mit/xorg/lib build_install
5021.315Smatt.if ${MKCOMPATX11} != "no"
5031.314Smatt	${MAKEDIRTARGET} compat build_install BOOTSTRAP_SUBDIRS="../../../external/mit/xorg/lib"
5041.314Smatt.endif
5051.263Smrg.else
5061.263Smrg	@echo "MKX11 is not enabled"
5071.257Slukem	@false
5081.254Smrg.endif
5091.227Slukem
5101.242Sdsldo-obsolete: .PHONY .MAKE
5111.232Slukem	${MAKEDIRTARGET} etc install-obsolete-lists
5121.87Scjs
5131.193Slukem#
5141.137Stv# Speedup stubs for some subtrees that don't need to run these rules.
5151.137Stv# (Tells <bsd.subdir.mk> not to recurse for them.)
5161.193Slukem#
5171.129Stv
5181.292Sveego.for dir in bin etc distrib games libexec regress sbin usr.bin usr.sbin tools
5191.228Slukemincludes-${dir}: .PHONY
5201.152Stv	@true
5211.152Stv.endfor
5221.152Stv.for dir in etc distrib regress
5231.228Slukeminstall-${dir}: .PHONY
5241.152Stv	@true
5251.152Stv.endfor
5261.152Stv
5271.193Slukem#
5281.152Stv# XXX this needs to change when distrib Makefiles are recursion compliant
5291.193Slukem# XXX many distrib subdirs need "cd etc && make snap_pre snap_kern" first...
5301.193Slukem#
5311.228Slukemdependall-distrib depend-distrib all-distrib: .PHONY
5321.136Snathanw	@true
5331.130Stv
5341.151Stv.include <bsd.obj.mk>
5351.209Slukem.include <bsd.kernobj.mk>
5361.146Stv.include <bsd.subdir.mk>
5371.322Smrg.include <bsd.clean.mk>
538