Makefile revision 1.326
11.326Smartin#	$NetBSD: Makefile,v 1.326 2019/06/06 14:51:43 martin 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.325Smaya_SUBDIR=	tools .WAIT lib include external crypto/external bin
1401.325Smaya_SUBDIR+=	games libexec sbin usr.bin
1411.303Sjoerg_SUBDIR+=	usr.sbin share sys etc tests compat
1421.303Sjoerg_SUBDIR+=	.WAIT rescue .WAIT distrib regress
1431.105Sassar
1441.137Stv.for dir in ${_SUBDIR}
1451.261Sapb.if "${dir}" == ".WAIT" \
1461.261Sapb	|| (${BUILD_${dir}:Uyes} != "no" && exists(${dir}/Makefile))
1471.137StvSUBDIR+=	${dir}
1481.36Sexplorer.endif
1491.137Stv.endfor
1501.21Scgd
1511.13Sbrezak.if exists(regress)
1521.242Sdslregression-tests: .PHONY .MAKE
1531.10Scgd	@echo Running regression tests...
1541.232Slukem	${MAKEDIRTARGET} regress regress
1551.13Sbrezak.endif
1561.20Scgd
1571.214Slukem.if ${MKUNPRIVED} != "no"
1581.179SthorpejNOPOSTINSTALL=	# defined
1591.179Sthorpej.endif
1601.179Sthorpej
1611.242Sdslafterinstall: .PHONY .MAKE
1621.137Stv.if ${MKMAN} != "no"
1631.232Slukem	${MAKEDIRTARGET} share/man makedb
1641.137Stv.endif
1651.214Slukem.if (${MKUNPRIVED} != "no" && ${MKINFO} != "no")
1661.317Schristos	${MAKEDIRTARGET} external/gpl2/texinfo/bin/install-info infodir-meta
1671.176Slukem.endif
1681.179Sthorpej.if !defined(NOPOSTINSTALL)
1691.232Slukem	${MAKEDIRTARGET} . postinstall-check
1701.159Sperry.endif
1711.170Slukem
1721.308Sapb_POSTINSTALL=	${.CURDIR}/usr.sbin/postinstall/postinstall \
1731.308Sapb		-m ${MACHINE} -a ${MACHINE_ARCH}
1741.295Sapb_POSTINSTALL_ENV= \
1751.295Sapb	AWK=${TOOL_AWK:Q}		\
1761.295Sapb	DB=${TOOL_DB:Q}			\
1771.298Sapb	HOST_SH=${HOST_SH:Q}		\
1781.295Sapb	MAKE=${MAKE:Q}			\
1791.297Sapb	PWD_MKDB=${TOOL_PWD_MKDB:Q}	\
1801.307Sapb	SED=${TOOL_SED:Q}		\
1811.297Sapb	STAT=${TOOL_STAT:Q}
1821.239Slukem
1831.313Smartin.if ${MKX11} != "no"
1841.313Smartin_POSTINSTALL_X11=-x ${X11SRCDIR:Q}
1851.313Smartin.endif
1861.313Smartin
1871.228Slukempostinstall-check: .PHONY
1881.169Slukem	@echo "   === Post installation checks ==="
1891.313Smartin	${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR}/ check; if [ $$? -gt 1 ]; then exit 1; fi
1901.171Slukem	@echo "   ================================"
1911.171Slukem
1921.228Slukempostinstall-fix: .NOTMAIN .PHONY
1931.171Slukem	@echo "   === Post installation fixes ==="
1941.313Smartin	${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR}/ fix
1951.212Slukem	@echo "   ==============================="
1961.212Slukem
1971.228Slukempostinstall-fix-obsolete: .NOTMAIN .PHONY
1981.212Slukem	@echo "   === Removing obsolete files ==="
1991.313Smartin	${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR}/ fix obsolete
2001.212Slukem	@echo "   ==============================="
2011.169Slukem
2021.309Sapbpostinstall-fix-obsolete_stand: .NOTMAIN .PHONY
2031.309Sapb	@echo "   === Removing obsolete files ==="
2041.313Smartin	${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR}/ fix obsolete_stand
2051.309Sapb	@echo "   ==============================="
2061.309Sapb
2071.108Serh
2081.193Slukem#
2091.137Stv# Targets (in order!) called by "make build".
2101.193Slukem#
2111.156StvBUILDTARGETS+=	check-tools
2121.214Slukem.if ${MKUPDATE} == "no" && !defined(NOCLEANDIR)
2131.155StvBUILDTARGETS+=	cleandir
2141.155Stv.endif
2151.261Sapb.if ${MKOBJDIRS} != "no"
2161.261SapbBUILDTARGETS+=	do-top-obj
2171.261Sapb.endif
2181.261Sapb.if ${USETOOLS} == "yes"	# {
2191.149Stv.if ${MKOBJDIRS} != "no"
2201.260SapbBUILDTARGETS+=	do-tools-obj
2211.123Smrg.endif
2221.152StvBUILDTARGETS+=	do-tools
2231.261Sapb.endif # USETOOLS		# }
2241.300SapbBUILDTARGETS+=	params
2251.260Sapb.if ${MKOBJDIRS} != "no"
2261.260SapbBUILDTARGETS+=	obj
2271.260Sapb.endif
2281.270SapbBUILDTARGETS+=	clean_METALOG
2291.137Stv.if !defined(NODISTRIBDIRS)
2301.137StvBUILDTARGETS+=	do-distrib-dirs
2311.131Stv.endif
2321.137Stv.if !defined(NOINCLUDES)
2331.137StvBUILDTARGETS+=	includes
2341.131Stv.endif
2351.281SplunkyBUILDTARGETS+=	do-lib
2361.299SjoergBUILDTARGETS+=	do-compat-lib
2371.263Smrg.if ${MKX11} != "no"
2381.227SlukemBUILDTARGETS+=	do-x11
2391.227Slukem.endif
2401.321Suwe.if !defined(NOBINARIES)
2411.312SjoergBUILDTARGETS+=	do-build
2421.275Suebayasi.if ${MKEXTSRC} != "no"
2431.275SuebayasiBUILDTARGETS+=	do-extsrc
2441.275Suebayasi.endif
2451.200SlukemBUILDTARGETS+=	do-obsolete
2461.319Schristos.endif
2471.131Stv
2481.193Slukem#
2491.137Stv# Enforce proper ordering of some rules.
2501.193Slukem#
2511.123Smrg
2521.137Stv.ORDER:		${BUILDTARGETS}
2531.228Slukemincludes-lib:	.PHONY includes-include includes-sys
2541.123Smrg
2551.193Slukem#
2561.300Sapb# Record the values of variables that might affect the build.
2571.300Sapb# If no values have changed, avoid updating the timestamp
2581.300Sapb# of the params file.
2591.300Sapb#
2601.300Sapb# This is referenced by _NETBSD_VERSION_DEPENDS in <bsd.own.mk>.
2611.300Sapb#
2621.302Sapb.include "${NETBSDSRCDIR}/etc/Makefile.params"
2631.300SapbCLEANDIRFILES+= params
2641.300Sapbparams: .EXEC
2651.300Sapb	${_MKMSG_CREATE} params
2661.302Sapb	@${PRINT_PARAMS} >${.TARGET}.new
2671.300Sapb	@if cmp -s ${.TARGET}.new ${.TARGET} > /dev/null 2>&1; then \
2681.300Sapb		: "params is unchanged" ; \
2691.300Sapb		rm ${.TARGET}.new ; \
2701.300Sapb	else \
2711.300Sapb		: "params has changed or is new" ; \
2721.300Sapb		mv ${.TARGET}.new ${.TARGET} ; \
2731.300Sapb	fi
2741.300Sapb
2751.300Sapb#
2761.302Sapb# Display current make(1) parameters
2771.302Sapb#
2781.302Sapbshow-params: .PHONY .MAKE
2791.302Sapb	@${PRINT_PARAMS}
2801.302Sapb
2811.302Sapb#
2821.137Stv# Build the system and install into DESTDIR.
2831.193Slukem#
2841.123Smrg
2851.191SlukemSTART_TIME!=	date
2861.191Slukem
2871.242Sdslbuild: .PHONY .MAKE
2881.137Stv.if defined(BUILD_DONE)
2891.137Stv	@echo "Build already installed into ${DESTDIR}"
2901.137Stv.else
2911.191Slukem	@echo "Build started at: ${START_TIME}"
2921.145Stv.for tgt in ${BUILDTARGETS}
2931.232Slukem	${MAKEDIRTARGET} . ${tgt}
2941.145Stv.endfor
2951.232Slukem	${MAKEDIRTARGET} etc install-etc-release
2961.191Slukem	@echo   "Build started at:  ${START_TIME}"
2971.172Sbjh21	@printf "Build finished at: " && date
2981.71Smycroft.endif
2991.160Sthorpej
3001.193Slukem#
3011.160Sthorpej# Build a full distribution, but not a release (i.e. no sets into
3021.193Slukem# ${RELEASEDIR}).  "buildworld" enforces a build to ${DESTDIR} != /
3031.193Slukem#
3041.160Sthorpej
3051.242Sdsldistribution buildworld: .PHONY .MAKE
3061.194Slukem.if make(buildworld) && \
3071.194Slukem    (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/")
3081.193Slukem	@echo "Won't make ${.TARGET} with DESTDIR=/"
3091.193Slukem	@false
3101.193Slukem.endif
3111.232Slukem	${MAKEDIRTARGET} . build NOPOSTINSTALL=1
3121.232Slukem	${MAKEDIRTARGET} etc distribution INSTALL_DONE=1
3131.181Sthorpej.if defined(DESTDIR) && ${DESTDIR} != "" && ${DESTDIR} != "/"
3141.232Slukem	${MAKEDIRTARGET} . postinstall-fix-obsolete
3151.309Sapb	${MAKEDIRTARGET} . postinstall-fix-obsolete_stand
3161.232Slukem	${MAKEDIRTARGET} distrib/sets checkflist
3171.181Sthorpej.endif
3181.192Slukem	@echo   "make ${.TARGET} started at:  ${START_TIME}"
3191.185Slukem	@printf "make ${.TARGET} finished at: " && date
3201.123Smrg
3211.193Slukem#
3221.193Slukem# Install the distribution from $DESTDIR to $INSTALLWORLDDIR (defaults to `/')
3231.193Slukem# If installing to /, ensures that the host's operating system is NetBSD and
3241.193Slukem# the host's `uname -m` == ${MACHINE}.
3251.193Slukem#
3261.193Slukem
3271.193SlukemHOST_UNAME_S!=	uname -s
3281.193SlukemHOST_UNAME_M!=	uname -m
3291.193Slukem
3301.242Sdslinstallworld: .PHONY .MAKE
3311.194Slukem.if (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/")
3321.193Slukem	@echo "Can't make ${.TARGET} to DESTDIR=/"
3331.193Slukem	@false
3341.193Slukem.endif
3351.193Slukem.if !defined(INSTALLWORLDDIR) || \
3361.193Slukem    ${INSTALLWORLDDIR} == "" || ${INSTALLWORLDDIR} == "/"
3371.193Slukem.if (${HOST_UNAME_S} != "NetBSD")
3381.193Slukem	@echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_S} to NetBSD with INSTALLWORLDDIR=/"
3391.193Slukem	@false
3401.193Slukem.endif
3411.193Slukem.if (${HOST_UNAME_M} != ${MACHINE})
3421.193Slukem	@echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_M} to ${MACHINE} with INSTALLWORLDDIR=/"
3431.193Slukem	@false
3441.193Slukem.endif
3451.193Slukem.endif
3461.232Slukem	${MAKEDIRTARGET} distrib/sets installsets \
3471.282Sjym		INSTALLDIR=${INSTALLWORLDDIR:U/} INSTALLSETS=${INSTALLSETS:Q}
3481.232Slukem	${MAKEDIRTARGET} . postinstall-check DESTDIR=${INSTALLWORLDDIR}
3491.193Slukem	@echo   "make ${.TARGET} started at:  ${START_TIME}"
3501.193Slukem	@printf "make ${.TARGET} finished at: " && date
3511.199Slukem
3521.199Slukem#
3531.287Sjmcneill# Install modules from $DESTDIR to $INSTALLMODULESDIR
3541.287Sjmcneill#
3551.287Sjmcneillinstallmodules: .PHONY .MAKE
3561.287Sjmcneill.if (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/")
3571.287Sjmcneill	@echo "Can't make ${.TARGET} to DESTDIR=/"
3581.287Sjmcneill	@false
3591.287Sjmcneill.endif
3601.287Sjmcneill.if !defined(INSTALLMODULESDIR) || \
3611.287Sjmcneill    ${INSTALLMODULESDIR} == "" || ${INSTALLMODULESDIR} == "/"
3621.287Sjmcneill.if (${HOST_UNAME_S} != "NetBSD")
3631.287Sjmcneill	@echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_S} to NetBSD with INSTALLMODULESDIR=/"
3641.287Sjmcneill	@false
3651.287Sjmcneill.endif
3661.287Sjmcneill.if (${HOST_UNAME_M} != ${MACHINE})
3671.287Sjmcneill	@echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_M} to ${MACHINE} with INSTALLMODULESDIR=/"
3681.287Sjmcneill	@false
3691.287Sjmcneill.endif
3701.287Sjmcneill.endif
3711.288Sjmcneill	${MAKEDIRTARGET} sys/modules install DESTDIR=${INSTALLMODULESDIR:U/}
3721.287Sjmcneill	@echo   "make ${.TARGET} started at:  ${START_TIME}"
3731.287Sjmcneill	@printf "make ${.TARGET} finished at: " && date
3741.287Sjmcneill
3751.287Sjmcneill#
3761.206Slukem# Create sets from $DESTDIR or $NETBSDSRCDIR into $RELEASEDIR
3771.199Slukem#
3781.199Slukem
3791.241Sapb.for tgt in sets sourcesets syspkgs
3801.242Sdsl${tgt}: .PHONY .MAKE
3811.232Slukem	${MAKEDIRTARGET} distrib/sets ${tgt}
3821.206Slukem.endfor
3831.193Slukem
3841.193Slukem#
3851.240Slukem# Build a release or snapshot (implies "make distribution").  Note that
3861.181Sthorpej# in this case, the set lists will be checked before the tar files
3871.181Sthorpej# are made.
3881.193Slukem#
3891.123Smrg
3901.242Sdslrelease snapshot: .PHONY .MAKE
3911.240Slukem	${MAKEDIRTARGET} . distribution
3921.240Slukem	${MAKEDIRTARGET} etc release DISTRIBUTION_DONE=1
3931.192Slukem	@echo   "make ${.TARGET} started at:  ${START_TIME}"
3941.185Slukem	@printf "make ${.TARGET} finished at: " && date
3951.123Smrg
3961.193Slukem#
3971.243Sapb# Create a CD-ROM image.
3981.243Sapb#
3991.243Sapb
4001.243Sapbiso-image: .PHONY
4011.247Sbouyer	${MAKEDIRTARGET} distrib iso_image
4021.243Sapb	${MAKEDIRTARGET} etc iso-image
4031.243Sapb	@echo   "make ${.TARGET} started at:  ${START_TIME}"
4041.243Sapb	@printf "make ${.TARGET} finished at: " && date
4051.243Sapb
4061.248Sjnemethiso-image-source: .PHONY
4071.248Sjnemeth	${MAKEDIRTARGET} distrib iso_image CDSOURCE=true
4081.248Sjnemeth	${MAKEDIRTARGET} etc iso-image
4091.248Sjnemeth	@echo   "make ${.TARGET} started at:  ${START_TIME}"
4101.248Sjnemeth	@printf "make ${.TARGET} finished at: " && date
4111.248Sjnemeth
4121.243Sapb#
4131.290Stsutsui# Create bootable live images.
4141.290Stsutsui#
4151.290Stsutsui
4161.290Stsutsuilive-image: .PHONY
4171.290Stsutsui	${MAKEDIRTARGET} etc live-image
4181.290Stsutsui	@echo   "make ${.TARGET} started at:  ${START_TIME}"
4191.290Stsutsui	@printf "make ${.TARGET} finished at: " && date
4201.290Stsutsui
4211.290Stsutsui#
4221.290Stsutsui# Create bootable installation images.
4231.290Stsutsui#
4241.290Stsutsui
4251.290Stsutsuiinstall-image: .PHONY
4261.290Stsutsui	${MAKEDIRTARGET} etc install-image
4271.290Stsutsui	@echo   "make ${.TARGET} started at:  ${START_TIME}"
4281.290Stsutsui	@printf "make ${.TARGET} finished at: " && date
4291.290Stsutsui
4301.290Stsutsui#
4311.137Stv# Special components of the "make build" process.
4321.193Slukem#
4331.156Stv
4341.228Slukemcheck-tools: .PHONY
4351.223Slukem.if ${TOOLCHAIN_MISSING} != "no" && !defined(EXTERNAL_TOOLCHAIN)
4361.187Sthorpej	@echo '*** WARNING:  Building on MACHINE=${MACHINE} with missing toolchain.'
4371.187Sthorpej	@echo '*** May result in a failed build or corrupt binaries!'
4381.187Sthorpej.elif defined(EXTERNAL_TOOLCHAIN)
4391.187Sthorpej	@echo '*** Using external toolchain rooted at ${EXTERNAL_TOOLCHAIN}.'
4401.156Stv.endif
4411.173Ssommerfe.if defined(NBUILDJOBS)
4421.173Ssommerfe	@echo '*** WARNING: NBUILDJOBS is obsolete; use -j directly instead!'
4431.173Ssommerfe.endif
4441.123Smrg
4451.270Sapb# Delete or sanitise a leftover METALOG from a previous build.
4461.270Sapbclean_METALOG: .PHONY .MAKE
4471.270Sapb.if ${MKUPDATE} != "no"
4481.270Sapb	${MAKEDIRTARGET} distrib/sets clean_METALOG
4491.270Sapb.endif
4501.270Sapb
4511.242Sdsldo-distrib-dirs: .PHONY .MAKE
4521.147Sjmc.if !defined(DESTDIR) || ${DESTDIR} == ""
4531.232Slukem	${MAKEDIRTARGET} etc distrib-dirs DESTDIR=/
4541.147Sjmc.else
4551.232Slukem	${MAKEDIRTARGET} etc distrib-dirs DESTDIR=${DESTDIR}
4561.147Sjmc.endif
4571.190Slukem
4581.190Slukem.for targ in cleandir obj includes
4591.228Slukemdo-${targ}: .PHONY ${targ}
4601.190Slukem	@true
4611.190Slukem.endfor
4621.123Smrg
4631.301Sjoergdo-tools: .PHONY .MAKE
4641.301Sjoerg	${MAKEDIRTARGET} tools build_install
4651.184Slukem
4661.299Sjoergdo-lib: .PHONY .MAKE
4671.299Sjoerg	${MAKEDIRTARGET} lib build_install
4681.299Sjoerg
4691.299Sjoergdo-compat-lib: .PHONY .MAKE
4701.299Sjoerg	${MAKEDIRTARGET} compat build_install BOOTSTRAP_SUBDIRS="../../../lib"
4711.276Smrg
4721.261Sapbdo-top-obj: .PHONY .MAKE
4731.261Sapb	${MAKEDIRTARGET} . obj NOSUBDIR=
4741.261Sapb
4751.260Sapbdo-tools-obj: .PHONY .MAKE
4761.260Sapb	${MAKEDIRTARGET} tools obj
4771.260Sapb
4781.242Sdsldo-build: .PHONY .MAKE
4791.154Stv.for targ in dependall install
4801.232Slukem	${MAKEDIRTARGET} . ${targ} BUILD_tools=no BUILD_lib=no
4811.154Stv.endfor
4821.200Slukem
4831.242Sdsldo-x11: .PHONY .MAKE
4841.263Smrg.if ${MKX11} != "no"
4851.312Sjoerg	${MAKEDIRTARGET} external/mit/xorg/tools all
4861.312Sjoerg	${MAKEDIRTARGET} external/mit/xorg/lib build_install
4871.315Smatt.if ${MKCOMPATX11} != "no"
4881.314Smatt	${MAKEDIRTARGET} compat build_install BOOTSTRAP_SUBDIRS="../../../external/mit/xorg/lib"
4891.314Smatt.endif
4901.263Smrg.else
4911.263Smrg	@echo "MKX11 is not enabled"
4921.257Slukem	@false
4931.254Smrg.endif
4941.227Slukem
4951.275Suebayasido-extsrc: .PHONY .MAKE
4961.275Suebayasi.if ${MKEXTSRC} != "no"
4971.275Suebayasi	${MAKEDIRTARGET} extsrc build
4981.275Suebayasi.else
4991.275Suebayasi	@echo "MKEXTSRC is not enabled"
5001.275Suebayasi	@false
5011.275Suebayasi.endif
5021.275Suebayasi
5031.242Sdsldo-obsolete: .PHONY .MAKE
5041.232Slukem	${MAKEDIRTARGET} etc install-obsolete-lists
5051.87Scjs
5061.193Slukem#
5071.137Stv# Speedup stubs for some subtrees that don't need to run these rules.
5081.137Stv# (Tells <bsd.subdir.mk> not to recurse for them.)
5091.193Slukem#
5101.129Stv
5111.292Sveego.for dir in bin etc distrib games libexec regress sbin usr.bin usr.sbin tools
5121.228Slukemincludes-${dir}: .PHONY
5131.152Stv	@true
5141.152Stv.endfor
5151.152Stv.for dir in etc distrib regress
5161.228Slukeminstall-${dir}: .PHONY
5171.152Stv	@true
5181.152Stv.endfor
5191.152Stv
5201.193Slukem#
5211.152Stv# XXX this needs to change when distrib Makefiles are recursion compliant
5221.193Slukem# XXX many distrib subdirs need "cd etc && make snap_pre snap_kern" first...
5231.193Slukem#
5241.228Slukemdependall-distrib depend-distrib all-distrib: .PHONY
5251.136Snathanw	@true
5261.130Stv
5271.151Stv.include <bsd.obj.mk>
5281.209Slukem.include <bsd.kernobj.mk>
5291.146Stv.include <bsd.subdir.mk>
5301.322Smrg.include <bsd.clean.mk>
531