Makefile revision 1.334
11.334Srillig#	$NetBSD: Makefile,v 1.334 2022/03/19 14:35:13 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.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.300Sapb#   params:          record the values of variables that might affect the
921.300Sapb#                    build.
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.275Suebayasi#   do-extsrc:       builds and installs extsrc if ${MKEXTSRC} != "no".
1031.222Slukem#   do-obsolete:     installs the obsolete sets (for the postinstall-* targets).
1041.193Slukem#
1051.32Scgd
1061.146Stv.if ${.MAKEFLAGS:M${.CURDIR}/share/mk} == ""
1071.146Stv.MAKEFLAGS: -m ${.CURDIR}/share/mk
1081.146Stv.endif
1091.163Stv
1101.193Slukem#
1111.163Stv# If _SRC_TOP_OBJ_ gets set here, we will end up with a directory that may
1121.163Stv# not be the top level objdir, because "make obj" can happen in the *middle*
1131.163Stv# of "make build" (long after <bsd.own.mk> is calculated it).  So, pre-set
1141.163Stv# _SRC_TOP_OBJ_ here so it will not be added to ${.MAKEOVERRIDES}.
1151.193Slukem#
1161.163Stv_SRC_TOP_OBJ_=
1171.148Sjmc
1181.146Stv.include <bsd.own.mk>
1191.4Scgd
1201.193Slukem#
1211.137Stv# Sanity check: make sure that "make build" is not invoked simultaneously
1221.137Stv# with a standard recursive target.
1231.193Slukem#
1241.137Stv
1251.137Stv.if make(build) || make(release) || make(snapshot)
1261.137Stv.for targ in ${TARGETS:Nobj:Ncleandir}
1271.137Stv.if make(${targ}) && !target(.BEGIN)
1281.137Stv.BEGIN:
1291.137Stv	@echo 'BUILD ABORTED: "make build" and "make ${targ}" are mutually exclusive.'
1301.137Stv	@false
1311.137Stv.endif
1321.137Stv.endfor
1331.137Stv.endif
1341.58Stv
1351.261Sapb#
1361.261Sapb# _SUBDIR is used to set SUBDIR, after removing directories that have
1371.261Sapb# BUILD_${dir}=no, or that have no ${dir}/Makefile.
1381.261Sapb#
1391.329Skamil_SUBDIR=	tools .WAIT lib
1401.329Skamil.if ${MKLLVM} != "no"
1411.329Skamil_SUBDIR+=	external/bsd/compiler_rt
1421.329Skamil.endif
1431.333Suwe_SUBDIR+=	include external crypto/external bin
1441.325Smaya_SUBDIR+=	games libexec sbin usr.bin
1451.303Sjoerg_SUBDIR+=	usr.sbin share sys etc tests compat
1461.303Sjoerg_SUBDIR+=	.WAIT rescue .WAIT distrib regress
1471.105Sassar
1481.137Stv.for dir in ${_SUBDIR}
1491.261Sapb.if "${dir}" == ".WAIT" \
1501.261Sapb	|| (${BUILD_${dir}:Uyes} != "no" && exists(${dir}/Makefile))
1511.137StvSUBDIR+=	${dir}
1521.36Sexplorer.endif
1531.137Stv.endfor
1541.21Scgd
1551.13Sbrezak.if exists(regress)
1561.242Sdslregression-tests: .PHONY .MAKE
1571.10Scgd	@echo Running regression tests...
1581.232Slukem	${MAKEDIRTARGET} regress regress
1591.13Sbrezak.endif
1601.20Scgd
1611.214Slukem.if ${MKUNPRIVED} != "no"
1621.179SthorpejNOPOSTINSTALL=	# defined
1631.179Sthorpej.endif
1641.179Sthorpej
1651.242Sdslafterinstall: .PHONY .MAKE
1661.137Stv.if ${MKMAN} != "no"
1671.232Slukem	${MAKEDIRTARGET} share/man makedb
1681.137Stv.endif
1691.214Slukem.if (${MKUNPRIVED} != "no" && ${MKINFO} != "no")
1701.317Schristos	${MAKEDIRTARGET} external/gpl2/texinfo/bin/install-info infodir-meta
1711.176Slukem.endif
1721.179Sthorpej.if !defined(NOPOSTINSTALL)
1731.232Slukem	${MAKEDIRTARGET} . postinstall-check
1741.159Sperry.endif
1751.170Slukem
1761.327Smartin_POSTINSTALL=	${:!cd ${.CURDIR}/usr.sbin/postinstall && \
1771.334Srillig			${MAKE} -v .OBJDIR!}/postinstall  \
1781.308Sapb		-m ${MACHINE} -a ${MACHINE_ARCH}
1791.295Sapb_POSTINSTALL_ENV= \
1801.295Sapb	AWK=${TOOL_AWK:Q}		\
1811.295Sapb	DB=${TOOL_DB:Q}			\
1821.298Sapb	HOST_SH=${HOST_SH:Q}		\
1831.295Sapb	MAKE=${MAKE:Q}			\
1841.297Sapb	PWD_MKDB=${TOOL_PWD_MKDB:Q}	\
1851.307Sapb	SED=${TOOL_SED:Q}		\
1861.297Sapb	STAT=${TOOL_STAT:Q}
1871.239Slukem
1881.313Smartin.if ${MKX11} != "no"
1891.313Smartin_POSTINSTALL_X11=-x ${X11SRCDIR:Q}
1901.313Smartin.endif
1911.313Smartin
1921.228Slukempostinstall-check: .PHONY
1931.169Slukem	@echo "   === Post installation checks ==="
1941.313Smartin	${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR}/ check; if [ $$? -gt 1 ]; then exit 1; fi
1951.171Slukem	@echo "   ================================"
1961.171Slukem
1971.228Slukempostinstall-fix: .NOTMAIN .PHONY
1981.171Slukem	@echo "   === Post installation fixes ==="
1991.313Smartin	${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR}/ fix
2001.212Slukem	@echo "   ==============================="
2011.212Slukem
2021.228Slukempostinstall-fix-obsolete: .NOTMAIN .PHONY
2031.212Slukem	@echo "   === Removing obsolete files ==="
2041.313Smartin	${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR}/ fix obsolete
2051.212Slukem	@echo "   ==============================="
2061.169Slukem
2071.309Sapbpostinstall-fix-obsolete_stand: .NOTMAIN .PHONY
2081.309Sapb	@echo "   === Removing obsolete files ==="
2091.313Smartin	${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR}/ fix obsolete_stand
2101.332Schristos	${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR}/ fix obsolete_stand_debug
2111.309Sapb	@echo "   ==============================="
2121.309Sapb
2131.108Serh
2141.193Slukem#
2151.137Stv# Targets (in order!) called by "make build".
2161.193Slukem#
2171.156StvBUILDTARGETS+=	check-tools
2181.214Slukem.if ${MKUPDATE} == "no" && !defined(NOCLEANDIR)
2191.155StvBUILDTARGETS+=	cleandir
2201.155Stv.endif
2211.261Sapb.if ${MKOBJDIRS} != "no"
2221.261SapbBUILDTARGETS+=	do-top-obj
2231.261Sapb.endif
2241.261Sapb.if ${USETOOLS} == "yes"	# {
2251.149Stv.if ${MKOBJDIRS} != "no"
2261.260SapbBUILDTARGETS+=	do-tools-obj
2271.123Smrg.endif
2281.152StvBUILDTARGETS+=	do-tools
2291.261Sapb.endif # USETOOLS		# }
2301.300SapbBUILDTARGETS+=	params
2311.260Sapb.if ${MKOBJDIRS} != "no"
2321.260SapbBUILDTARGETS+=	obj
2331.260Sapb.endif
2341.270SapbBUILDTARGETS+=	clean_METALOG
2351.137Stv.if !defined(NODISTRIBDIRS)
2361.137StvBUILDTARGETS+=	do-distrib-dirs
2371.131Stv.endif
2381.137Stv.if !defined(NOINCLUDES)
2391.137StvBUILDTARGETS+=	includes
2401.131Stv.endif
2411.281SplunkyBUILDTARGETS+=	do-lib
2421.299SjoergBUILDTARGETS+=	do-compat-lib
2431.328Skamil.if ${MKLLVM} != "no"
2441.329SkamilBUILDTARGETS+=	do-sanitizer
2451.328Skamil.if ${MKSANITIZER:Uno} == "yes"
2461.328SkamilBUILDTARGETS+=	do-sanitizer-tools
2471.328Skamil.endif
2481.328Skamil.endif
2491.263Smrg.if ${MKX11} != "no"
2501.227SlukemBUILDTARGETS+=	do-x11
2511.227Slukem.endif
2521.321Suwe.if !defined(NOBINARIES)
2531.312SjoergBUILDTARGETS+=	do-build
2541.275Suebayasi.if ${MKEXTSRC} != "no"
2551.275SuebayasiBUILDTARGETS+=	do-extsrc
2561.275Suebayasi.endif
2571.200SlukemBUILDTARGETS+=	do-obsolete
2581.319Schristos.endif
2591.131Stv
2601.193Slukem#
2611.137Stv# Enforce proper ordering of some rules.
2621.193Slukem#
2631.123Smrg
2641.137Stv.ORDER:		${BUILDTARGETS}
2651.228Slukemincludes-lib:	.PHONY includes-include includes-sys
2661.123Smrg
2671.193Slukem#
2681.300Sapb# Record the values of variables that might affect the build.
2691.300Sapb# If no values have changed, avoid updating the timestamp
2701.300Sapb# of the params file.
2711.300Sapb#
2721.300Sapb# This is referenced by _NETBSD_VERSION_DEPENDS in <bsd.own.mk>.
2731.300Sapb#
2741.302Sapb.include "${NETBSDSRCDIR}/etc/Makefile.params"
2751.300SapbCLEANDIRFILES+= params
2761.300Sapbparams: .EXEC
2771.300Sapb	${_MKMSG_CREATE} params
2781.302Sapb	@${PRINT_PARAMS} >${.TARGET}.new
2791.300Sapb	@if cmp -s ${.TARGET}.new ${.TARGET} > /dev/null 2>&1; then \
2801.300Sapb		: "params is unchanged" ; \
2811.300Sapb		rm ${.TARGET}.new ; \
2821.300Sapb	else \
2831.300Sapb		: "params has changed or is new" ; \
2841.300Sapb		mv ${.TARGET}.new ${.TARGET} ; \
2851.300Sapb	fi
2861.300Sapb
2871.300Sapb#
2881.302Sapb# Display current make(1) parameters
2891.302Sapb#
2901.302Sapbshow-params: .PHONY .MAKE
2911.302Sapb	@${PRINT_PARAMS}
2921.302Sapb
2931.302Sapb#
2941.137Stv# Build the system and install into DESTDIR.
2951.193Slukem#
2961.123Smrg
2971.191SlukemSTART_TIME!=	date
2981.191Slukem
2991.242Sdslbuild: .PHONY .MAKE
3001.137Stv.if defined(BUILD_DONE)
3011.137Stv	@echo "Build already installed into ${DESTDIR}"
3021.137Stv.else
3031.191Slukem	@echo "Build started at: ${START_TIME}"
3041.145Stv.for tgt in ${BUILDTARGETS}
3051.232Slukem	${MAKEDIRTARGET} . ${tgt}
3061.145Stv.endfor
3071.232Slukem	${MAKEDIRTARGET} etc install-etc-release
3081.191Slukem	@echo   "Build started at:  ${START_TIME}"
3091.172Sbjh21	@printf "Build finished at: " && date
3101.71Smycroft.endif
3111.160Sthorpej
3121.193Slukem#
3131.160Sthorpej# Build a full distribution, but not a release (i.e. no sets into
3141.193Slukem# ${RELEASEDIR}).  "buildworld" enforces a build to ${DESTDIR} != /
3151.193Slukem#
3161.160Sthorpej
3171.242Sdsldistribution buildworld: .PHONY .MAKE
3181.194Slukem.if make(buildworld) && \
3191.194Slukem    (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/")
3201.193Slukem	@echo "Won't make ${.TARGET} with DESTDIR=/"
3211.193Slukem	@false
3221.193Slukem.endif
3231.232Slukem	${MAKEDIRTARGET} . build NOPOSTINSTALL=1
3241.232Slukem	${MAKEDIRTARGET} etc distribution INSTALL_DONE=1
3251.181Sthorpej.if defined(DESTDIR) && ${DESTDIR} != "" && ${DESTDIR} != "/"
3261.232Slukem	${MAKEDIRTARGET} . postinstall-fix-obsolete
3271.309Sapb	${MAKEDIRTARGET} . postinstall-fix-obsolete_stand
3281.232Slukem	${MAKEDIRTARGET} distrib/sets checkflist
3291.181Sthorpej.endif
3301.192Slukem	@echo   "make ${.TARGET} started at:  ${START_TIME}"
3311.185Slukem	@printf "make ${.TARGET} finished at: " && date
3321.123Smrg
3331.193Slukem#
3341.193Slukem# Install the distribution from $DESTDIR to $INSTALLWORLDDIR (defaults to `/')
3351.193Slukem# If installing to /, ensures that the host's operating system is NetBSD and
3361.193Slukem# the host's `uname -m` == ${MACHINE}.
3371.193Slukem#
3381.193Slukem
3391.193SlukemHOST_UNAME_S!=	uname -s
3401.193SlukemHOST_UNAME_M!=	uname -m
3411.193Slukem
3421.242Sdslinstallworld: .PHONY .MAKE
3431.194Slukem.if (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/")
3441.193Slukem	@echo "Can't make ${.TARGET} to DESTDIR=/"
3451.193Slukem	@false
3461.193Slukem.endif
3471.193Slukem.if !defined(INSTALLWORLDDIR) || \
3481.193Slukem    ${INSTALLWORLDDIR} == "" || ${INSTALLWORLDDIR} == "/"
3491.193Slukem.if (${HOST_UNAME_S} != "NetBSD")
3501.193Slukem	@echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_S} to NetBSD with INSTALLWORLDDIR=/"
3511.193Slukem	@false
3521.193Slukem.endif
3531.193Slukem.if (${HOST_UNAME_M} != ${MACHINE})
3541.193Slukem	@echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_M} to ${MACHINE} with INSTALLWORLDDIR=/"
3551.193Slukem	@false
3561.193Slukem.endif
3571.193Slukem.endif
3581.232Slukem	${MAKEDIRTARGET} distrib/sets installsets \
3591.282Sjym		INSTALLDIR=${INSTALLWORLDDIR:U/} INSTALLSETS=${INSTALLSETS:Q}
3601.232Slukem	${MAKEDIRTARGET} . postinstall-check DESTDIR=${INSTALLWORLDDIR}
3611.193Slukem	@echo   "make ${.TARGET} started at:  ${START_TIME}"
3621.193Slukem	@printf "make ${.TARGET} finished at: " && date
3631.199Slukem
3641.199Slukem#
3651.287Sjmcneill# Install modules from $DESTDIR to $INSTALLMODULESDIR
3661.287Sjmcneill#
3671.287Sjmcneillinstallmodules: .PHONY .MAKE
3681.287Sjmcneill.if (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/")
3691.287Sjmcneill	@echo "Can't make ${.TARGET} to DESTDIR=/"
3701.287Sjmcneill	@false
3711.287Sjmcneill.endif
3721.287Sjmcneill.if !defined(INSTALLMODULESDIR) || \
3731.287Sjmcneill    ${INSTALLMODULESDIR} == "" || ${INSTALLMODULESDIR} == "/"
3741.287Sjmcneill.if (${HOST_UNAME_S} != "NetBSD")
3751.287Sjmcneill	@echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_S} to NetBSD with INSTALLMODULESDIR=/"
3761.287Sjmcneill	@false
3771.287Sjmcneill.endif
3781.287Sjmcneill.if (${HOST_UNAME_M} != ${MACHINE})
3791.287Sjmcneill	@echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_M} to ${MACHINE} with INSTALLMODULESDIR=/"
3801.287Sjmcneill	@false
3811.287Sjmcneill.endif
3821.287Sjmcneill.endif
3831.288Sjmcneill	${MAKEDIRTARGET} sys/modules install DESTDIR=${INSTALLMODULESDIR:U/}
3841.287Sjmcneill	@echo   "make ${.TARGET} started at:  ${START_TIME}"
3851.287Sjmcneill	@printf "make ${.TARGET} finished at: " && date
3861.287Sjmcneill
3871.287Sjmcneill#
3881.206Slukem# Create sets from $DESTDIR or $NETBSDSRCDIR into $RELEASEDIR
3891.199Slukem#
3901.199Slukem
3911.241Sapb.for tgt in sets sourcesets syspkgs
3921.242Sdsl${tgt}: .PHONY .MAKE
3931.232Slukem	${MAKEDIRTARGET} distrib/sets ${tgt}
3941.206Slukem.endfor
3951.193Slukem
3961.193Slukem#
3971.240Slukem# Build a release or snapshot (implies "make distribution").  Note that
3981.181Sthorpej# in this case, the set lists will be checked before the tar files
3991.181Sthorpej# are made.
4001.193Slukem#
4011.123Smrg
4021.242Sdslrelease snapshot: .PHONY .MAKE
4031.240Slukem	${MAKEDIRTARGET} . distribution
4041.240Slukem	${MAKEDIRTARGET} etc release DISTRIBUTION_DONE=1
4051.192Slukem	@echo   "make ${.TARGET} started at:  ${START_TIME}"
4061.185Slukem	@printf "make ${.TARGET} finished at: " && date
4071.123Smrg
4081.193Slukem#
4091.243Sapb# Create a CD-ROM image.
4101.243Sapb#
4111.243Sapb
4121.243Sapbiso-image: .PHONY
4131.247Sbouyer	${MAKEDIRTARGET} distrib iso_image
4141.243Sapb	${MAKEDIRTARGET} etc iso-image
4151.243Sapb	@echo   "make ${.TARGET} started at:  ${START_TIME}"
4161.243Sapb	@printf "make ${.TARGET} finished at: " && date
4171.243Sapb
4181.248Sjnemethiso-image-source: .PHONY
4191.248Sjnemeth	${MAKEDIRTARGET} distrib iso_image CDSOURCE=true
4201.248Sjnemeth	${MAKEDIRTARGET} etc iso-image
4211.248Sjnemeth	@echo   "make ${.TARGET} started at:  ${START_TIME}"
4221.248Sjnemeth	@printf "make ${.TARGET} finished at: " && date
4231.248Sjnemeth
4241.243Sapb#
4251.290Stsutsui# Create bootable live images.
4261.290Stsutsui#
4271.290Stsutsui
4281.290Stsutsuilive-image: .PHONY
4291.290Stsutsui	${MAKEDIRTARGET} etc live-image
4301.290Stsutsui	@echo   "make ${.TARGET} started at:  ${START_TIME}"
4311.290Stsutsui	@printf "make ${.TARGET} finished at: " && date
4321.290Stsutsui
4331.290Stsutsui#
4341.290Stsutsui# Create bootable installation images.
4351.290Stsutsui#
4361.290Stsutsui
4371.290Stsutsuiinstall-image: .PHONY
4381.290Stsutsui	${MAKEDIRTARGET} etc install-image
4391.290Stsutsui	@echo   "make ${.TARGET} started at:  ${START_TIME}"
4401.290Stsutsui	@printf "make ${.TARGET} finished at: " && date
4411.290Stsutsui
4421.290Stsutsui#
4431.137Stv# Special components of the "make build" process.
4441.193Slukem#
4451.156Stv
4461.228Slukemcheck-tools: .PHONY
4471.223Slukem.if ${TOOLCHAIN_MISSING} != "no" && !defined(EXTERNAL_TOOLCHAIN)
4481.187Sthorpej	@echo '*** WARNING:  Building on MACHINE=${MACHINE} with missing toolchain.'
4491.187Sthorpej	@echo '*** May result in a failed build or corrupt binaries!'
4501.187Sthorpej.elif defined(EXTERNAL_TOOLCHAIN)
4511.187Sthorpej	@echo '*** Using external toolchain rooted at ${EXTERNAL_TOOLCHAIN}.'
4521.156Stv.endif
4531.173Ssommerfe.if defined(NBUILDJOBS)
4541.173Ssommerfe	@echo '*** WARNING: NBUILDJOBS is obsolete; use -j directly instead!'
4551.173Ssommerfe.endif
4561.123Smrg
4571.270Sapb# Delete or sanitise a leftover METALOG from a previous build.
4581.270Sapbclean_METALOG: .PHONY .MAKE
4591.270Sapb.if ${MKUPDATE} != "no"
4601.270Sapb	${MAKEDIRTARGET} distrib/sets clean_METALOG
4611.270Sapb.endif
4621.270Sapb
4631.242Sdsldo-distrib-dirs: .PHONY .MAKE
4641.147Sjmc.if !defined(DESTDIR) || ${DESTDIR} == ""
4651.232Slukem	${MAKEDIRTARGET} etc distrib-dirs DESTDIR=/
4661.147Sjmc.else
4671.232Slukem	${MAKEDIRTARGET} etc distrib-dirs DESTDIR=${DESTDIR}
4681.147Sjmc.endif
4691.190Slukem
4701.190Slukem.for targ in cleandir obj includes
4711.228Slukemdo-${targ}: .PHONY ${targ}
4721.190Slukem	@true
4731.190Slukem.endfor
4741.123Smrg
4751.301Sjoergdo-tools: .PHONY .MAKE
4761.301Sjoerg	${MAKEDIRTARGET} tools build_install
4771.184Slukem
4781.299Sjoergdo-lib: .PHONY .MAKE
4791.299Sjoerg	${MAKEDIRTARGET} lib build_install
4801.299Sjoerg
4811.299Sjoergdo-compat-lib: .PHONY .MAKE
4821.299Sjoerg	${MAKEDIRTARGET} compat build_install BOOTSTRAP_SUBDIRS="../../../lib"
4831.276Smrg
4841.329Skamildo-sanitizer: .PHONY .MAKE
4851.331Skamil	${MAKEDIRTARGET} external/bsd/compiler_rt build_install
4861.328Skamil
4871.328Skamildo-sanitizer-tools: .PHONY .MAKE
4881.329Skamil.if !exists(${TOOLDIR}/lib/clang) && ${HAVE_LLVM:Uno} == "yes"
4891.328Skamil	mkdir -p ${TOOLDIR}/lib/clang
4901.328Skamil	cd ${DESTDIR}/usr/lib/clang && \
4911.328Skamil		${TOOL_PAX} -rw . ${TOOLDIR}/lib/clang
4921.328Skamil.endif
4931.328Skamil
4941.261Sapbdo-top-obj: .PHONY .MAKE
4951.261Sapb	${MAKEDIRTARGET} . obj NOSUBDIR=
4961.261Sapb
4971.260Sapbdo-tools-obj: .PHONY .MAKE
4981.260Sapb	${MAKEDIRTARGET} tools obj
4991.260Sapb
5001.242Sdsldo-build: .PHONY .MAKE
5011.154Stv.for targ in dependall install
5021.232Slukem	${MAKEDIRTARGET} . ${targ} BUILD_tools=no BUILD_lib=no
5031.154Stv.endfor
5041.200Slukem
5051.242Sdsldo-x11: .PHONY .MAKE
5061.263Smrg.if ${MKX11} != "no"
5071.312Sjoerg	${MAKEDIRTARGET} external/mit/xorg/tools all
5081.312Sjoerg	${MAKEDIRTARGET} external/mit/xorg/lib build_install
5091.315Smatt.if ${MKCOMPATX11} != "no"
5101.314Smatt	${MAKEDIRTARGET} compat build_install BOOTSTRAP_SUBDIRS="../../../external/mit/xorg/lib"
5111.314Smatt.endif
5121.263Smrg.else
5131.263Smrg	@echo "MKX11 is not enabled"
5141.257Slukem	@false
5151.254Smrg.endif
5161.227Slukem
5171.275Suebayasido-extsrc: .PHONY .MAKE
5181.275Suebayasi.if ${MKEXTSRC} != "no"
5191.275Suebayasi	${MAKEDIRTARGET} extsrc build
5201.275Suebayasi.else
5211.275Suebayasi	@echo "MKEXTSRC is not enabled"
5221.275Suebayasi	@false
5231.275Suebayasi.endif
5241.275Suebayasi
5251.242Sdsldo-obsolete: .PHONY .MAKE
5261.232Slukem	${MAKEDIRTARGET} etc install-obsolete-lists
5271.87Scjs
5281.193Slukem#
5291.137Stv# Speedup stubs for some subtrees that don't need to run these rules.
5301.137Stv# (Tells <bsd.subdir.mk> not to recurse for them.)
5311.193Slukem#
5321.129Stv
5331.292Sveego.for dir in bin etc distrib games libexec regress sbin usr.bin usr.sbin tools
5341.228Slukemincludes-${dir}: .PHONY
5351.152Stv	@true
5361.152Stv.endfor
5371.152Stv.for dir in etc distrib regress
5381.228Slukeminstall-${dir}: .PHONY
5391.152Stv	@true
5401.152Stv.endfor
5411.152Stv
5421.193Slukem#
5431.152Stv# XXX this needs to change when distrib Makefiles are recursion compliant
5441.193Slukem# XXX many distrib subdirs need "cd etc && make snap_pre snap_kern" first...
5451.193Slukem#
5461.228Slukemdependall-distrib depend-distrib all-distrib: .PHONY
5471.136Snathanw	@true
5481.130Stv
5491.151Stv.include <bsd.obj.mk>
5501.209Slukem.include <bsd.kernobj.mk>
5511.146Stv.include <bsd.subdir.mk>
5521.322Smrg.include <bsd.clean.mk>
553