Makefile revision 1.298
11.298Sapb#	$NetBSD: Makefile,v 1.298 2012/08/15 12:50:12 apb 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.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.248Sjnemeth#	Create CD-ROM image in RELEASEDIR/iso.
681.243Sapb#	RELEASEDIR must already have been populated by `make release'
691.243Sapb#	or equivalent.
701.248Sjnemeth#   iso-image-source:
711.248Sjnemeth#	Create CD-ROM image with source in RELEASEDIR/iso.
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.137Stv#   obj:             creates object directories.
911.208Slukem#   do-distrib-dirs: creates the distribution directories.
921.208Slukem#   includes:        installs include files.
931.202Sthorpej#   do-tools-compat: builds the "libnbcompat" library; needed for some
941.202Sthorpej#                    random host tool programs in the source tree.
951.238Slukem#   do-lib-csu:      builds and installs prerequisites from lib/csu.
961.249Slukem#   do-libgcc:       builds and installs prerequisites from
971.249Slukem#                    gnu/lib/crtstuff${LIBGCC_EXT} (if necessary) and
981.249Slukem#                    gnu/lib/libgcc${LIBGCC_EXT}.
991.256Sgmcgarry#   do-libpcc:       builds and install prerequisites from
1001.280Sskrll#                    external/bsd/pcc/crtstuff (if necessary) and
1011.280Sskrll#                    external/bsd/pcc/libpcc.
1021.186Sthorpej#   do-lib-libc:     builds and installs prerequisites from lib/libc.
1031.143Stv#   do-lib:          builds and installs prerequisites from lib.
1041.274Spooka#   do-sys-rump-dev-lib: builds and installs prerequisites from sys/rump/dev/lib
1051.259Spooka#   do-sys-rump-fs-lib:  builds and installs prerequisites from sys/rump/fs/lib
1061.277Spooka#   do-sys-rump-kern-lib:  builds and installs prereq. from sys/rump/kern/lib
1071.259Spooka#   do-sys-rump-net-lib: builds and installs prerequisites from sys/rump/net/lib
1081.265Spooka#   do-sys-modules:  builds and installs kernel modules (used by rump binaries)
1091.189Sitohy#   do-ld.so:        builds and installs prerequisites from libexec/ld.*_so.
1101.262Smrg#   do-compat-lib-csu: builds and installs prerequisites from compat/lib/csu
1111.262Smrg#                    if ${MKCOMPAT} != "no".
1121.262Smrg#   do-compat-libgcc: builds and installs prerequisites from
1131.262Smrg#                    compat/gnu/lib/crtstuff${LIBGCC_EXT} (if necessary) and
1141.262Smrg#                    compat/gnu/lib/libgcc${LIBGCC_EXT} if ${MKCOMPAT} != "no".
1151.262Smrg#   do-compat-lib-libc: builds and installs prerequisites from compat/lib/libc
1161.262Smrg#                    if ${MKCOMPAT} != "no".
1171.137Stv#   do-build:        builds and installs the entire system.
1181.263Smrg#   do-x11:          builds and installs X11 if ${MKX11} != "no"; either
1191.263Smrg#                    X11R7 from src/external/mit/xorg if ${X11FLAVOUR} == "Xorg"
1201.263Smrg#                    or X11R6 from src/x11
1211.275Suebayasi#   do-extsrc:       builds and installs extsrc if ${MKEXTSRC} != "no".
1221.222Slukem#   do-obsolete:     installs the obsolete sets (for the postinstall-* targets).
1231.193Slukem#
1241.32Scgd
1251.146Stv.if ${.MAKEFLAGS:M${.CURDIR}/share/mk} == ""
1261.146Stv.MAKEFLAGS: -m ${.CURDIR}/share/mk
1271.146Stv.endif
1281.163Stv
1291.193Slukem#
1301.163Stv# If _SRC_TOP_OBJ_ gets set here, we will end up with a directory that may
1311.163Stv# not be the top level objdir, because "make obj" can happen in the *middle*
1321.163Stv# of "make build" (long after <bsd.own.mk> is calculated it).  So, pre-set
1331.163Stv# _SRC_TOP_OBJ_ here so it will not be added to ${.MAKEOVERRIDES}.
1341.193Slukem#
1351.163Stv_SRC_TOP_OBJ_=
1361.148Sjmc
1371.146Stv.include <bsd.own.mk>
1381.4Scgd
1391.193Slukem#
1401.137Stv# Sanity check: make sure that "make build" is not invoked simultaneously
1411.137Stv# with a standard recursive target.
1421.193Slukem#
1431.137Stv
1441.137Stv.if make(build) || make(release) || make(snapshot)
1451.137Stv.for targ in ${TARGETS:Nobj:Ncleandir}
1461.137Stv.if make(${targ}) && !target(.BEGIN)
1471.137Stv.BEGIN:
1481.137Stv	@echo 'BUILD ABORTED: "make build" and "make ${targ}" are mutually exclusive.'
1491.137Stv	@false
1501.137Stv.endif
1511.137Stv.endfor
1521.137Stv.endif
1531.58Stv
1541.261Sapb#
1551.261Sapb# _SUBDIR is used to set SUBDIR, after removing directories that have
1561.261Sapb# BUILD_${dir}=no, or that have no ${dir}/Makefile.
1571.261Sapb#
1581.271Schristos_SUBDIR=	tools lib include gnu external crypto/external bin games
1591.271Schristos_SUBDIR+=	libexec sbin usr.bin
1601.262Smrg_SUBDIR+=	usr.sbin share rescue sys etc tests compat .WAIT distrib regress
1611.105Sassar
1621.137Stv.for dir in ${_SUBDIR}
1631.261Sapb.if "${dir}" == ".WAIT" \
1641.261Sapb	|| (${BUILD_${dir}:Uyes} != "no" && exists(${dir}/Makefile))
1651.137StvSUBDIR+=	${dir}
1661.36Sexplorer.endif
1671.137Stv.endfor
1681.21Scgd
1691.13Sbrezak.if exists(regress)
1701.242Sdslregression-tests: .PHONY .MAKE
1711.10Scgd	@echo Running regression tests...
1721.232Slukem	${MAKEDIRTARGET} regress regress
1731.13Sbrezak.endif
1741.20Scgd
1751.214Slukem.if ${MKUNPRIVED} != "no"
1761.179SthorpejNOPOSTINSTALL=	# defined
1771.179Sthorpej.endif
1781.179Sthorpej
1791.242Sdslafterinstall: .PHONY .MAKE
1801.137Stv.if ${MKMAN} != "no"
1811.232Slukem	${MAKEDIRTARGET} share/man makedb
1821.137Stv.endif
1831.214Slukem.if (${MKUNPRIVED} != "no" && ${MKINFO} != "no")
1841.232Slukem	${MAKEDIRTARGET} gnu/usr.bin/texinfo/install-info infodir-meta
1851.176Slukem.endif
1861.179Sthorpej.if !defined(NOPOSTINSTALL)
1871.232Slukem	${MAKEDIRTARGET} . postinstall-check
1881.159Sperry.endif
1891.170Slukem
1901.239Slukem_POSTINSTALL=	${.CURDIR}/usr.sbin/postinstall/postinstall
1911.295Sapb_POSTINSTALL_ENV= \
1921.295Sapb	AWK=${TOOL_AWK:Q}		\
1931.295Sapb	DB=${TOOL_DB:Q}			\
1941.298Sapb	HOST_SH=${HOST_SH:Q}		\
1951.295Sapb	MAKE=${MAKE:Q}			\
1961.297Sapb	PWD_MKDB=${TOOL_PWD_MKDB:Q}	\
1971.297Sapb	STAT=${TOOL_STAT:Q}
1981.239Slukem
1991.228Slukempostinstall-check: .PHONY
2001.169Slukem	@echo "   === Post installation checks ==="
2011.295Sapb	${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} -d ${DESTDIR}/ check; if [ $$? -gt 1 ]; then exit 1; fi
2021.171Slukem	@echo "   ================================"
2031.171Slukem
2041.228Slukempostinstall-fix: .NOTMAIN .PHONY
2051.171Slukem	@echo "   === Post installation fixes ==="
2061.295Sapb	${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} -d ${DESTDIR}/ fix
2071.212Slukem	@echo "   ==============================="
2081.212Slukem
2091.228Slukempostinstall-fix-obsolete: .NOTMAIN .PHONY
2101.212Slukem	@echo "   === Removing obsolete files ==="
2111.295Sapb	${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} -d ${DESTDIR}/ fix obsolete
2121.212Slukem	@echo "   ==============================="
2131.169Slukem
2141.108Serh
2151.193Slukem#
2161.137Stv# Targets (in order!) called by "make build".
2171.193Slukem#
2181.256Sgmcgarry.if defined(HAVE_GCC)
2191.284Smrg.if ${HAVE_GCC} == "4"
2201.284SmrgLIBGCC_EXT=4
2211.285SmrgBUILD_CC_LIB_BASEDIR= gnu/lib
2221.285SmrgBUILD_CC_LIB_BASETARGET= gnu-lib
2231.245Smrg.else
2241.285SmrgLIBGCC_EXT=
2251.285SmrgBUILD_CC_LIB_BASEDIR= external/gpl3/gcc/lib
2261.285SmrgBUILD_CC_LIB_BASETARGET= external-gpl3-gcc-lib
2271.220Smrg.endif
2281.256Sgmcgarry.endif
2291.123Smrg
2301.156StvBUILDTARGETS+=	check-tools
2311.214Slukem.if ${MKUPDATE} == "no" && !defined(NOCLEANDIR)
2321.155StvBUILDTARGETS+=	cleandir
2331.155Stv.endif
2341.261Sapb.if ${MKOBJDIRS} != "no"
2351.261SapbBUILDTARGETS+=	do-top-obj
2361.261Sapb.endif
2371.261Sapb.if ${USETOOLS} == "yes"	# {
2381.149Stv.if ${MKOBJDIRS} != "no"
2391.260SapbBUILDTARGETS+=	do-tools-obj
2401.123Smrg.endif
2411.152StvBUILDTARGETS+=	do-tools
2421.261Sapb.endif # USETOOLS		# }
2431.260Sapb.if ${MKOBJDIRS} != "no"
2441.260SapbBUILDTARGETS+=	obj
2451.260Sapb.endif
2461.270SapbBUILDTARGETS+=	clean_METALOG
2471.137Stv.if !defined(NODISTRIBDIRS)
2481.137StvBUILDTARGETS+=	do-distrib-dirs
2491.131Stv.endif
2501.137Stv.if !defined(NOINCLUDES)
2511.137StvBUILDTARGETS+=	includes
2521.131Stv.endif
2531.202SthorpejBUILDTARGETS+=	do-tools-compat
2541.231SskrllBUILDTARGETS+=	do-lib-csu
2551.207Sdrochner.if ${MKGCC} != "no"
2561.249SlukemBUILDTARGETS+=	do-libgcc
2571.207Sdrochner.endif
2581.256Sgmcgarry.if ${MKPCC} != "no"
2591.256SgmcgarryBUILDTARGET+=	do-libpcc
2601.256Sgmcgarry.endif
2611.231SskrllBUILDTARGETS+=	do-lib-libc
2621.281SplunkyBUILDTARGETS+=	do-lib
2631.283Smrg.if ${MKKMOD} != "no"
2641.265SpookaBUILDTARGETS+=	do-sys-modules
2651.265Spooka.endif
2661.294Sapb.if ${MKRUMP} != "no"
2671.277SpookaBUILDTARGETS+=	do-sys-rump-dev-lib do-sys-rump-fs-lib
2681.277SpookaBUILDTARGETS+=	do-sys-rump-kern-lib do-sys-rump-net-lib
2691.293Schristos.endif
2701.262Smrg.if ${MKCOMPAT} != "no"
2711.262SmrgBUILDTARGETS+=	do-compat-lib-csu
2721.262SmrgBUILDTARGETS+=	do-compat-libgcc
2731.262SmrgBUILDTARGETS+=	do-compat-lib-libc
2741.262Smrg.endif
2751.224SlukemBUILDTARGETS+=	do-ld.so
2761.224SlukemBUILDTARGETS+=	do-build
2771.263Smrg.if ${MKX11} != "no"
2781.227SlukemBUILDTARGETS+=	do-x11
2791.227Slukem.endif
2801.275Suebayasi.if ${MKEXTSRC} != "no"
2811.275SuebayasiBUILDTARGETS+=	do-extsrc
2821.275Suebayasi.endif
2831.200SlukemBUILDTARGETS+=	do-obsolete
2841.131Stv
2851.193Slukem#
2861.137Stv# Enforce proper ordering of some rules.
2871.193Slukem#
2881.123Smrg
2891.137Stv.ORDER:		${BUILDTARGETS}
2901.228Slukemincludes-lib:	.PHONY includes-include includes-sys
2911.228Slukemincludes-gnu:	.PHONY includes-lib
2921.123Smrg
2931.193Slukem#
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.232Slukem	${MAKEDIRTARGET} distrib/sets checkflist
3281.181Sthorpej.endif
3291.192Slukem	@echo   "make ${.TARGET} started at:  ${START_TIME}"
3301.185Slukem	@printf "make ${.TARGET} finished at: " && date
3311.123Smrg
3321.193Slukem#
3331.193Slukem# Install the distribution from $DESTDIR to $INSTALLWORLDDIR (defaults to `/')
3341.193Slukem# If installing to /, ensures that the host's operating system is NetBSD and
3351.193Slukem# the host's `uname -m` == ${MACHINE}.
3361.193Slukem#
3371.193Slukem
3381.193SlukemHOST_UNAME_S!=	uname -s
3391.193SlukemHOST_UNAME_M!=	uname -m
3401.193Slukem
3411.242Sdslinstallworld: .PHONY .MAKE
3421.194Slukem.if (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/")
3431.193Slukem	@echo "Can't make ${.TARGET} to DESTDIR=/"
3441.193Slukem	@false
3451.193Slukem.endif
3461.193Slukem.if !defined(INSTALLWORLDDIR) || \
3471.193Slukem    ${INSTALLWORLDDIR} == "" || ${INSTALLWORLDDIR} == "/"
3481.193Slukem.if (${HOST_UNAME_S} != "NetBSD")
3491.193Slukem	@echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_S} to NetBSD with INSTALLWORLDDIR=/"
3501.193Slukem	@false
3511.193Slukem.endif
3521.193Slukem.if (${HOST_UNAME_M} != ${MACHINE})
3531.193Slukem	@echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_M} to ${MACHINE} with INSTALLWORLDDIR=/"
3541.193Slukem	@false
3551.193Slukem.endif
3561.193Slukem.endif
3571.232Slukem	${MAKEDIRTARGET} distrib/sets installsets \
3581.282Sjym		INSTALLDIR=${INSTALLWORLDDIR:U/} INSTALLSETS=${INSTALLSETS:Q}
3591.232Slukem	${MAKEDIRTARGET} . postinstall-check DESTDIR=${INSTALLWORLDDIR}
3601.193Slukem	@echo   "make ${.TARGET} started at:  ${START_TIME}"
3611.193Slukem	@printf "make ${.TARGET} finished at: " && date
3621.199Slukem
3631.199Slukem#
3641.287Sjmcneill# Install modules from $DESTDIR to $INSTALLMODULESDIR
3651.287Sjmcneill#
3661.287Sjmcneillinstallmodules: .PHONY .MAKE
3671.287Sjmcneill.if (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/")
3681.287Sjmcneill	@echo "Can't make ${.TARGET} to DESTDIR=/"
3691.287Sjmcneill	@false
3701.287Sjmcneill.endif
3711.287Sjmcneill.if !defined(INSTALLMODULESDIR) || \
3721.287Sjmcneill    ${INSTALLMODULESDIR} == "" || ${INSTALLMODULESDIR} == "/"
3731.287Sjmcneill.if (${HOST_UNAME_S} != "NetBSD")
3741.287Sjmcneill	@echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_S} to NetBSD with INSTALLMODULESDIR=/"
3751.287Sjmcneill	@false
3761.287Sjmcneill.endif
3771.287Sjmcneill.if (${HOST_UNAME_M} != ${MACHINE})
3781.287Sjmcneill	@echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_M} to ${MACHINE} with INSTALLMODULESDIR=/"
3791.287Sjmcneill	@false
3801.287Sjmcneill.endif
3811.287Sjmcneill.endif
3821.288Sjmcneill	${MAKEDIRTARGET} sys/modules install DESTDIR=${INSTALLMODULESDIR:U/}
3831.287Sjmcneill	@echo   "make ${.TARGET} started at:  ${START_TIME}"
3841.287Sjmcneill	@printf "make ${.TARGET} finished at: " && date
3851.287Sjmcneill
3861.287Sjmcneill#
3871.206Slukem# Create sets from $DESTDIR or $NETBSDSRCDIR into $RELEASEDIR
3881.199Slukem#
3891.199Slukem
3901.241Sapb.for tgt in sets sourcesets syspkgs
3911.242Sdsl${tgt}: .PHONY .MAKE
3921.232Slukem	${MAKEDIRTARGET} distrib/sets ${tgt}
3931.206Slukem.endfor
3941.193Slukem
3951.193Slukem#
3961.240Slukem# Build a release or snapshot (implies "make distribution").  Note that
3971.181Sthorpej# in this case, the set lists will be checked before the tar files
3981.181Sthorpej# are made.
3991.193Slukem#
4001.123Smrg
4011.242Sdslrelease snapshot: .PHONY .MAKE
4021.240Slukem	${MAKEDIRTARGET} . distribution
4031.240Slukem	${MAKEDIRTARGET} etc release DISTRIBUTION_DONE=1
4041.192Slukem	@echo   "make ${.TARGET} started at:  ${START_TIME}"
4051.185Slukem	@printf "make ${.TARGET} finished at: " && date
4061.123Smrg
4071.193Slukem#
4081.243Sapb# Create a CD-ROM image.
4091.243Sapb#
4101.243Sapb
4111.243Sapbiso-image: .PHONY
4121.247Sbouyer	${MAKEDIRTARGET} distrib iso_image
4131.243Sapb	${MAKEDIRTARGET} etc iso-image
4141.243Sapb	@echo   "make ${.TARGET} started at:  ${START_TIME}"
4151.243Sapb	@printf "make ${.TARGET} finished at: " && date
4161.243Sapb
4171.248Sjnemethiso-image-source: .PHONY
4181.248Sjnemeth	${MAKEDIRTARGET} distrib iso_image CDSOURCE=true
4191.248Sjnemeth	${MAKEDIRTARGET} etc iso-image
4201.248Sjnemeth	@echo   "make ${.TARGET} started at:  ${START_TIME}"
4211.248Sjnemeth	@printf "make ${.TARGET} finished at: " && date
4221.248Sjnemeth
4231.243Sapb#
4241.290Stsutsui# Create bootable live images.
4251.290Stsutsui#
4261.290Stsutsui
4271.290Stsutsuilive-image: .PHONY
4281.290Stsutsui	${MAKEDIRTARGET} etc live-image
4291.290Stsutsui	@echo   "make ${.TARGET} started at:  ${START_TIME}"
4301.290Stsutsui	@printf "make ${.TARGET} finished at: " && date
4311.290Stsutsui
4321.290Stsutsui#
4331.290Stsutsui# Create bootable installation images.
4341.290Stsutsui#
4351.290Stsutsui
4361.290Stsutsuiinstall-image: .PHONY
4371.290Stsutsui	${MAKEDIRTARGET} etc install-image
4381.290Stsutsui	@echo   "make ${.TARGET} started at:  ${START_TIME}"
4391.290Stsutsui	@printf "make ${.TARGET} finished at: " && date
4401.290Stsutsui
4411.290Stsutsui#
4421.137Stv# Special components of the "make build" process.
4431.193Slukem#
4441.156Stv
4451.228Slukemcheck-tools: .PHONY
4461.223Slukem.if ${TOOLCHAIN_MISSING} != "no" && !defined(EXTERNAL_TOOLCHAIN)
4471.187Sthorpej	@echo '*** WARNING:  Building on MACHINE=${MACHINE} with missing toolchain.'
4481.187Sthorpej	@echo '*** May result in a failed build or corrupt binaries!'
4491.187Sthorpej.elif defined(EXTERNAL_TOOLCHAIN)
4501.187Sthorpej	@echo '*** Using external toolchain rooted at ${EXTERNAL_TOOLCHAIN}.'
4511.156Stv.endif
4521.173Ssommerfe.if defined(NBUILDJOBS)
4531.173Ssommerfe	@echo '*** WARNING: NBUILDJOBS is obsolete; use -j directly instead!'
4541.173Ssommerfe.endif
4551.123Smrg
4561.270Sapb# Delete or sanitise a leftover METALOG from a previous build.
4571.270Sapbclean_METALOG: .PHONY .MAKE
4581.270Sapb.if ${MKUPDATE} != "no"
4591.270Sapb	${MAKEDIRTARGET} distrib/sets clean_METALOG
4601.270Sapb.endif
4611.270Sapb
4621.242Sdsldo-distrib-dirs: .PHONY .MAKE
4631.147Sjmc.if !defined(DESTDIR) || ${DESTDIR} == ""
4641.232Slukem	${MAKEDIRTARGET} etc distrib-dirs DESTDIR=/
4651.147Sjmc.else
4661.232Slukem	${MAKEDIRTARGET} etc distrib-dirs DESTDIR=${DESTDIR}
4671.147Sjmc.endif
4681.190Slukem
4691.190Slukem.for targ in cleandir obj includes
4701.228Slukemdo-${targ}: .PHONY ${targ}
4711.190Slukem	@true
4721.190Slukem.endfor
4731.123Smrg
4741.256Sgmcgarry.if defined(HAVE_GCC)
4751.280Sskrll.if ${USE_COMPILERCRTSTUFF} == "yes"
4761.285SmrgBUILD_CC_LIB= ${BUILD_CC_LIB_BASEDIR}/crtstuff${LIBGCC_EXT}
4771.280Sskrll.endif
4781.285SmrgBUILD_CC_LIB+= ${BUILD_CC_LIB_BASEDIR}/libgcc${LIBGCC_EXT}
4791.256Sgmcgarry.elif defined(HAVE_PCC)
4801.256SgmcgarryBUILD_CC_LIB+= external/bsd/pcc/crtstuff
4811.256SgmcgarryBUILD_CC_LIB+= external/bsd/pcc/libpcc
4821.256Sgmcgarry.endif
4831.256Sgmcgarry
4841.281Splunky.for dir in tools tools/compat lib/csu ${BUILD_CC_LIB} lib/libc lib sys/rump/dev/lib sys/rump/fs/lib sys/rump/kern/lib sys/rump/net/lib sys/modules
4851.242Sdsldo-${dir:S/\//-/g}: .PHONY .MAKE
4861.137Stv.for targ in dependall install
4871.232Slukem	${MAKEDIRTARGET} ${dir} ${targ}
4881.137Stv.endfor
4891.184Slukem.endfor
4901.184Slukem
4911.276Smrg.if ${MKCOMPAT} != "no"
4921.276SmrgCOMPAT_SUBDIR_LIST=lib/csu ${BUILD_CC_LIB} lib/libc
4931.276Smrg.for dir in ${COMPAT_SUBDIR_LIST}
4941.276Smrgdo-compat-${dir:S/\//-/g}: .PHONY .MAKE
4951.281Splunky.for targ in dependall install
4961.276Smrg	${MAKEDIRTARGET} compat ${targ} BOOTSTRAP_SUBDIRS="../../../${dir}"
4971.276Smrg.endfor
4981.276Smrg.endfor
4991.276Smrg.endif
5001.276Smrg
5011.261Sapbdo-top-obj: .PHONY .MAKE
5021.261Sapb	${MAKEDIRTARGET} . obj NOSUBDIR=
5031.261Sapb
5041.260Sapbdo-tools-obj: .PHONY .MAKE
5051.260Sapb	${MAKEDIRTARGET} tools obj
5061.260Sapb
5071.249Slukemdo-libgcc: .PHONY .MAKE
5081.256Sgmcgarry.if defined(HAVE_GCC)
5091.249Slukem.if ${MKGCC} != "no"
5101.280Sskrll.if ${USE_COMPILERCRTSTUFF} == "yes"
5111.285Smrg	${MAKEDIRTARGET} . do-${BUILD_CC_LIB_BASETARGET}-crtstuff${LIBGCC_EXT}
5121.249Slukem.endif
5131.285Smrg	${MAKEDIRTARGET} . do-${BUILD_CC_LIB_BASETARGET}-libgcc${LIBGCC_EXT}
5141.249Slukem.endif
5151.256Sgmcgarry.endif
5161.256Sgmcgarry
5171.262Smrgdo-compat-libgcc: .PHONY .MAKE
5181.262Smrg.if defined(HAVE_GCC)
5191.262Smrg.if ${MKGCC} != "no"
5201.280Sskrll.if ${USE_COMPILERCRTSTUFF} == "yes"
5211.285Smrg	${MAKEDIRTARGET} . do-compat-${BUILD_CC_LIB_BASETARGET}-crtstuff${LIBGCC_EXT}
5221.280Sskrll.endif
5231.285Smrg	${MAKEDIRTARGET} . do-compat-${BUILD_CC_LIB_BASETARGET}-libgcc${LIBGCC_EXT}
5241.262Smrg.endif
5251.262Smrg.endif
5261.262Smrg
5271.256Sgmcgarrydo-libpcc: .PHONY .MAKE
5281.256Sgmcgarry.if defined(HAVE_PCC)
5291.256Sgmcgarry.if ${MKPCC} != "no"
5301.280Sskrll.if ${USE_COMPILERCRTSTUFF} == "yes"
5311.256Sgmcgarry	${MAKEDIRTARGET} . do-pcc-lib-crtstuff
5321.280Sskrll.endif
5331.256Sgmcgarry	${MAKEDIRTARGET} . do-pcc-lib-libpcc
5341.256Sgmcgarry.endif
5351.256Sgmcgarry.endif
5361.249Slukem
5371.242Sdsldo-ld.so: .PHONY .MAKE
5381.184Slukem.for targ in dependall install
5391.232Slukem	${MAKEDIRTARGET} libexec/ld.elf_so ${targ}
5401.137Stv.endfor
5411.143Stv
5421.242Sdsldo-build: .PHONY .MAKE
5431.154Stv.for targ in dependall install
5441.232Slukem	${MAKEDIRTARGET} . ${targ} BUILD_tools=no BUILD_lib=no
5451.154Stv.endfor
5461.200Slukem
5471.242Sdsldo-x11: .PHONY .MAKE
5481.263Smrg.if ${MKX11} != "no"
5491.263Smrg.if ${X11FLAVOUR} == "Xorg"
5501.254Smrg	${MAKEDIRTARGET} external/mit/xorg build
5511.263Smrg.else
5521.257Slukem	${MAKEDIRTARGET} x11 build
5531.263Smrg.endif
5541.254Smrg.else
5551.263Smrg	@echo "MKX11 is not enabled"
5561.257Slukem	@false
5571.254Smrg.endif
5581.227Slukem
5591.275Suebayasido-extsrc: .PHONY .MAKE
5601.275Suebayasi.if ${MKEXTSRC} != "no"
5611.275Suebayasi	${MAKEDIRTARGET} extsrc build
5621.275Suebayasi.else
5631.275Suebayasi	@echo "MKEXTSRC is not enabled"
5641.275Suebayasi	@false
5651.275Suebayasi.endif
5661.275Suebayasi
5671.242Sdsldo-obsolete: .PHONY .MAKE
5681.232Slukem	${MAKEDIRTARGET} etc install-obsolete-lists
5691.87Scjs
5701.193Slukem#
5711.137Stv# Speedup stubs for some subtrees that don't need to run these rules.
5721.137Stv# (Tells <bsd.subdir.mk> not to recurse for them.)
5731.193Slukem#
5741.129Stv
5751.292Sveego.for dir in bin etc distrib games libexec regress sbin usr.bin usr.sbin tools
5761.228Slukemincludes-${dir}: .PHONY
5771.152Stv	@true
5781.152Stv.endfor
5791.152Stv.for dir in etc distrib regress
5801.228Slukeminstall-${dir}: .PHONY
5811.152Stv	@true
5821.152Stv.endfor
5831.152Stv
5841.193Slukem#
5851.152Stv# XXX this needs to change when distrib Makefiles are recursion compliant
5861.193Slukem# XXX many distrib subdirs need "cd etc && make snap_pre snap_kern" first...
5871.193Slukem#
5881.228Slukemdependall-distrib depend-distrib all-distrib: .PHONY
5891.136Snathanw	@true
5901.130Stv
5911.211Slukem.include <bsd.sys.mk>
5921.151Stv.include <bsd.obj.mk>
5931.209Slukem.include <bsd.kernobj.mk>
5941.146Stv.include <bsd.subdir.mk>
5951.144Stv
5961.209Slukem#
5971.209Slukem# Display current make(1) parameters
5981.209Slukem#
5991.242Sdslparams: .PHONY .MAKE
6001.232Slukem	${MAKEDIRTARGET} etc params
601