Makefile revision 1.265
11.265Spooka#	$NetBSD: Makefile,v 1.265 2008/12/30 22:18:11 pooka 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.196Slukem#	is the not 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.123Smrg#
751.137Stv# Targets invoked by `make build,' in order:
761.155Stv#   cleandir:        cleans the tree.
771.261Sapb#   do-top-obj:      creates the top level object directory.
781.260Sapb#   do-tools-obj:    creates object directories for the host toolchain.
791.260Sapb#   do-tools:        builds host toolchain.
801.137Stv#   obj:             creates object directories.
811.208Slukem#   do-distrib-dirs: creates the distribution directories.
821.208Slukem#   includes:        installs include files.
831.202Sthorpej#   do-tools-compat: builds the "libnbcompat" library; needed for some
841.202Sthorpej#                    random host tool programs in the source tree.
851.238Slukem#   do-lib-csu:      builds and installs prerequisites from lib/csu.
861.249Slukem#   do-libgcc:       builds and installs prerequisites from
871.249Slukem#                    gnu/lib/crtstuff${LIBGCC_EXT} (if necessary) and
881.249Slukem#                    gnu/lib/libgcc${LIBGCC_EXT}.
891.256Sgmcgarry#   do-libpcc:       builds and install prerequisites from
901.256Sgmcgarry#                    external/bsd/pcc/crtstuff and external/bsd/pcc/libpcc.
911.186Sthorpej#   do-lib-libc:     builds and installs prerequisites from lib/libc.
921.143Stv#   do-lib:          builds and installs prerequisites from lib.
931.143Stv#   do-gnu-lib:      builds and installs prerequisites from gnu/lib.
941.253Slukem#   do-external-lib: builds and installs prerequisites from external/lib.
951.259Spooka#   do-sys-rump-fs-lib:  builds and installs prerequisites from sys/rump/fs/lib
961.259Spooka#   do-sys-rump-net-lib: builds and installs prerequisites from sys/rump/net/lib
971.265Spooka#   do-sys-modules:  builds and installs kernel modules (used by rump binaries)
981.189Sitohy#   do-ld.so:        builds and installs prerequisites from libexec/ld.*_so.
991.262Smrg#   do-compat-lib-csu: builds and installs prerequisites from compat/lib/csu
1001.262Smrg#                    if ${MKCOMPAT} != "no".
1011.262Smrg#   do-compat-libgcc: builds and installs prerequisites from
1021.262Smrg#                    compat/gnu/lib/crtstuff${LIBGCC_EXT} (if necessary) and
1031.262Smrg#                    compat/gnu/lib/libgcc${LIBGCC_EXT} if ${MKCOMPAT} != "no".
1041.262Smrg#   do-compat-lib-libc: builds and installs prerequisites from compat/lib/libc
1051.262Smrg#                    if ${MKCOMPAT} != "no".
1061.137Stv#   do-build:        builds and installs the entire system.
1071.263Smrg#   do-x11:          builds and installs X11 if ${MKX11} != "no"; either
1081.263Smrg#                    X11R7 from src/external/mit/xorg if ${X11FLAVOUR} == "Xorg"
1091.263Smrg#                    or X11R6 from src/x11
1101.222Slukem#   do-obsolete:     installs the obsolete sets (for the postinstall-* targets).
1111.193Slukem#
1121.32Scgd
1131.146Stv.if ${.MAKEFLAGS:M${.CURDIR}/share/mk} == ""
1141.146Stv.MAKEFLAGS: -m ${.CURDIR}/share/mk
1151.146Stv.endif
1161.163Stv
1171.193Slukem#
1181.163Stv# If _SRC_TOP_OBJ_ gets set here, we will end up with a directory that may
1191.163Stv# not be the top level objdir, because "make obj" can happen in the *middle*
1201.163Stv# of "make build" (long after <bsd.own.mk> is calculated it).  So, pre-set
1211.163Stv# _SRC_TOP_OBJ_ here so it will not be added to ${.MAKEOVERRIDES}.
1221.193Slukem#
1231.163Stv_SRC_TOP_OBJ_=
1241.148Sjmc
1251.146Stv.include <bsd.own.mk>
1261.4Scgd
1271.193Slukem#
1281.137Stv# Sanity check: make sure that "make build" is not invoked simultaneously
1291.137Stv# with a standard recursive target.
1301.193Slukem#
1311.137Stv
1321.137Stv.if make(build) || make(release) || make(snapshot)
1331.137Stv.for targ in ${TARGETS:Nobj:Ncleandir}
1341.137Stv.if make(${targ}) && !target(.BEGIN)
1351.137Stv.BEGIN:
1361.137Stv	@echo 'BUILD ABORTED: "make build" and "make ${targ}" are mutually exclusive.'
1371.137Stv	@false
1381.137Stv.endif
1391.137Stv.endfor
1401.137Stv.endif
1411.58Stv
1421.261Sapb#
1431.261Sapb# _SUBDIR is used to set SUBDIR, after removing directories that have
1441.261Sapb# BUILD_${dir}=no, or that have no ${dir}/Makefile.
1451.261Sapb#
1461.253Slukem_SUBDIR=	tools lib include gnu external bin games libexec sbin usr.bin
1471.262Smrg_SUBDIR+=	usr.sbin share rescue sys etc tests compat .WAIT distrib regress
1481.105Sassar
1491.137Stv.for dir in ${_SUBDIR}
1501.261Sapb.if "${dir}" == ".WAIT" \
1511.261Sapb	|| (${BUILD_${dir}:Uyes} != "no" && exists(${dir}/Makefile))
1521.137StvSUBDIR+=	${dir}
1531.36Sexplorer.endif
1541.137Stv.endfor
1551.21Scgd
1561.13Sbrezak.if exists(regress)
1571.242Sdslregression-tests: .PHONY .MAKE
1581.10Scgd	@echo Running regression tests...
1591.232Slukem	${MAKEDIRTARGET} regress regress
1601.13Sbrezak.endif
1611.20Scgd
1621.214Slukem.if ${MKUNPRIVED} != "no"
1631.179SthorpejNOPOSTINSTALL=	# defined
1641.179Sthorpej.endif
1651.179Sthorpej
1661.242Sdslafterinstall: .PHONY .MAKE
1671.137Stv.if ${MKMAN} != "no"
1681.232Slukem	${MAKEDIRTARGET} share/man makedb
1691.137Stv.endif
1701.214Slukem.if (${MKUNPRIVED} != "no" && ${MKINFO} != "no")
1711.232Slukem	${MAKEDIRTARGET} gnu/usr.bin/texinfo/install-info infodir-meta
1721.176Slukem.endif
1731.179Sthorpej.if !defined(NOPOSTINSTALL)
1741.232Slukem	${MAKEDIRTARGET} . postinstall-check
1751.159Sperry.endif
1761.170Slukem
1771.239Slukem_POSTINSTALL=	${.CURDIR}/usr.sbin/postinstall/postinstall
1781.239Slukem
1791.228Slukempostinstall-check: .PHONY
1801.169Slukem	@echo "   === Post installation checks ==="
1811.264Scube	MAKE=${MAKE:Q} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} -d ${DESTDIR}/ check; if [ $$? -gt 1 ]; then exit 1; fi
1821.171Slukem	@echo "   ================================"
1831.171Slukem
1841.228Slukempostinstall-fix: .NOTMAIN .PHONY
1851.171Slukem	@echo "   === Post installation fixes ==="
1861.264Scube	MAKE=${MAKE:Q} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} -d ${DESTDIR}/ fix
1871.212Slukem	@echo "   ==============================="
1881.212Slukem
1891.228Slukempostinstall-fix-obsolete: .NOTMAIN .PHONY
1901.212Slukem	@echo "   === Removing obsolete files ==="
1911.264Scube	MAKE=${MAKE:Q} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} -d ${DESTDIR}/ fix obsolete
1921.212Slukem	@echo "   ==============================="
1931.169Slukem
1941.108Serh
1951.193Slukem#
1961.137Stv# Targets (in order!) called by "make build".
1971.193Slukem#
1981.256Sgmcgarry.if defined(HAVE_GCC)
1991.245Smrg.if ${HAVE_GCC} == "3"
2001.220SmrgLIBGCC_EXT=3
2011.245Smrg.else
2021.244SmrgLIBGCC_EXT=4
2031.220Smrg.endif
2041.256Sgmcgarry.endif
2051.123Smrg
2061.156StvBUILDTARGETS+=	check-tools
2071.214Slukem.if ${MKUPDATE} == "no" && !defined(NOCLEANDIR)
2081.155StvBUILDTARGETS+=	cleandir
2091.155Stv.endif
2101.261Sapb.if ${MKOBJDIRS} != "no"
2111.261SapbBUILDTARGETS+=	do-top-obj
2121.261Sapb.endif
2131.261Sapb.if ${USETOOLS} == "yes"	# {
2141.149Stv.if ${MKOBJDIRS} != "no"
2151.260SapbBUILDTARGETS+=	do-tools-obj
2161.123Smrg.endif
2171.152StvBUILDTARGETS+=	do-tools
2181.261Sapb.endif # USETOOLS		# }
2191.260Sapb.if ${MKOBJDIRS} != "no"
2201.260SapbBUILDTARGETS+=	obj
2211.260Sapb.endif
2221.137Stv.if !defined(NODISTRIBDIRS)
2231.137StvBUILDTARGETS+=	do-distrib-dirs
2241.131Stv.endif
2251.137Stv.if !defined(NOINCLUDES)
2261.137StvBUILDTARGETS+=	includes
2271.131Stv.endif
2281.202SthorpejBUILDTARGETS+=	do-tools-compat
2291.231SskrllBUILDTARGETS+=	do-lib-csu
2301.207Sdrochner.if ${MKGCC} != "no"
2311.249SlukemBUILDTARGETS+=	do-libgcc
2321.207Sdrochner.endif
2331.256Sgmcgarry.if ${MKPCC} != "no"
2341.256SgmcgarryBUILDTARGET+=	do-libpcc
2351.256Sgmcgarry.endif
2361.231SskrllBUILDTARGETS+=	do-lib-libc
2371.253SlukemBUILDTARGETS+=	do-lib do-gnu-lib do-external-lib
2381.259SpookaBUILDTARGETS+=	do-sys-rump-fs-lib do-sys-rump-net-lib
2391.265Spooka.if (${MACHINE} != "evbppc")
2401.265SpookaBUILDTARGETS+=	do-sys-modules
2411.265Spooka.endif
2421.262Smrg.if ${MKCOMPAT} != "no"
2431.262SmrgBUILDTARGETS+=	do-compat-lib-csu
2441.262SmrgBUILDTARGETS+=	do-compat-libgcc
2451.262SmrgBUILDTARGETS+=	do-compat-lib-libc
2461.262Smrg.endif
2471.224SlukemBUILDTARGETS+=	do-ld.so
2481.224SlukemBUILDTARGETS+=	do-build
2491.263Smrg.if ${MKX11} != "no"
2501.227SlukemBUILDTARGETS+=	do-x11
2511.227Slukem.endif
2521.200SlukemBUILDTARGETS+=	do-obsolete
2531.131Stv
2541.193Slukem#
2551.137Stv# Enforce proper ordering of some rules.
2561.193Slukem#
2571.123Smrg
2581.137Stv.ORDER:		${BUILDTARGETS}
2591.228Slukemincludes-lib:	.PHONY includes-include includes-sys
2601.228Slukemincludes-gnu:	.PHONY includes-lib
2611.123Smrg
2621.193Slukem#
2631.137Stv# Build the system and install into DESTDIR.
2641.193Slukem#
2651.123Smrg
2661.191SlukemSTART_TIME!=	date
2671.191Slukem
2681.242Sdslbuild: .PHONY .MAKE
2691.137Stv.if defined(BUILD_DONE)
2701.137Stv	@echo "Build already installed into ${DESTDIR}"
2711.137Stv.else
2721.191Slukem	@echo "Build started at: ${START_TIME}"
2731.145Stv.for tgt in ${BUILDTARGETS}
2741.232Slukem	${MAKEDIRTARGET} . ${tgt}
2751.145Stv.endfor
2761.232Slukem	${MAKEDIRTARGET} etc install-etc-release
2771.191Slukem	@echo   "Build started at:  ${START_TIME}"
2781.172Sbjh21	@printf "Build finished at: " && date
2791.71Smycroft.endif
2801.160Sthorpej
2811.193Slukem#
2821.160Sthorpej# Build a full distribution, but not a release (i.e. no sets into
2831.193Slukem# ${RELEASEDIR}).  "buildworld" enforces a build to ${DESTDIR} != /
2841.193Slukem#
2851.160Sthorpej
2861.242Sdsldistribution buildworld: .PHONY .MAKE
2871.194Slukem.if make(buildworld) && \
2881.194Slukem    (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/")
2891.193Slukem	@echo "Won't make ${.TARGET} with DESTDIR=/"
2901.193Slukem	@false
2911.193Slukem.endif
2921.232Slukem	${MAKEDIRTARGET} . build NOPOSTINSTALL=1
2931.232Slukem	${MAKEDIRTARGET} etc distribution INSTALL_DONE=1
2941.181Sthorpej.if defined(DESTDIR) && ${DESTDIR} != "" && ${DESTDIR} != "/"
2951.232Slukem	${MAKEDIRTARGET} . postinstall-fix-obsolete
2961.232Slukem	${MAKEDIRTARGET} distrib/sets checkflist
2971.181Sthorpej.endif
2981.192Slukem	@echo   "make ${.TARGET} started at:  ${START_TIME}"
2991.185Slukem	@printf "make ${.TARGET} finished at: " && date
3001.123Smrg
3011.193Slukem#
3021.193Slukem# Install the distribution from $DESTDIR to $INSTALLWORLDDIR (defaults to `/')
3031.193Slukem# If installing to /, ensures that the host's operating system is NetBSD and
3041.193Slukem# the host's `uname -m` == ${MACHINE}.
3051.193Slukem#
3061.193Slukem
3071.193SlukemHOST_UNAME_S!=	uname -s
3081.193SlukemHOST_UNAME_M!=	uname -m
3091.193Slukem
3101.242Sdslinstallworld: .PHONY .MAKE
3111.194Slukem.if (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/")
3121.193Slukem	@echo "Can't make ${.TARGET} to DESTDIR=/"
3131.193Slukem	@false
3141.193Slukem.endif
3151.193Slukem.if !defined(INSTALLWORLDDIR) || \
3161.193Slukem    ${INSTALLWORLDDIR} == "" || ${INSTALLWORLDDIR} == "/"
3171.193Slukem.if (${HOST_UNAME_S} != "NetBSD")
3181.193Slukem	@echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_S} to NetBSD with INSTALLWORLDDIR=/"
3191.193Slukem	@false
3201.193Slukem.endif
3211.193Slukem.if (${HOST_UNAME_M} != ${MACHINE})
3221.193Slukem	@echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_M} to ${MACHINE} with INSTALLWORLDDIR=/"
3231.193Slukem	@false
3241.193Slukem.endif
3251.193Slukem.endif
3261.232Slukem	${MAKEDIRTARGET} distrib/sets installsets \
3271.232Slukem	    INSTALLDIR=${INSTALLWORLDDIR:U/} INSTALLSETS=
3281.232Slukem	${MAKEDIRTARGET} . postinstall-check DESTDIR=${INSTALLWORLDDIR}
3291.193Slukem	@echo   "make ${.TARGET} started at:  ${START_TIME}"
3301.193Slukem	@printf "make ${.TARGET} finished at: " && date
3311.199Slukem
3321.199Slukem#
3331.206Slukem# Create sets from $DESTDIR or $NETBSDSRCDIR into $RELEASEDIR
3341.199Slukem#
3351.199Slukem
3361.241Sapb.for tgt in sets sourcesets syspkgs
3371.242Sdsl${tgt}: .PHONY .MAKE
3381.232Slukem	${MAKEDIRTARGET} distrib/sets ${tgt}
3391.206Slukem.endfor
3401.193Slukem
3411.193Slukem#
3421.240Slukem# Build a release or snapshot (implies "make distribution").  Note that
3431.181Sthorpej# in this case, the set lists will be checked before the tar files
3441.181Sthorpej# are made.
3451.193Slukem#
3461.123Smrg
3471.242Sdslrelease snapshot: .PHONY .MAKE
3481.240Slukem	${MAKEDIRTARGET} . distribution
3491.240Slukem	${MAKEDIRTARGET} etc release DISTRIBUTION_DONE=1
3501.192Slukem	@echo   "make ${.TARGET} started at:  ${START_TIME}"
3511.185Slukem	@printf "make ${.TARGET} finished at: " && date
3521.123Smrg
3531.193Slukem#
3541.243Sapb# Create a CD-ROM image.
3551.243Sapb#
3561.243Sapb
3571.243Sapbiso-image: .PHONY
3581.247Sbouyer	${MAKEDIRTARGET} distrib iso_image
3591.243Sapb	${MAKEDIRTARGET} etc iso-image
3601.243Sapb	@echo   "make ${.TARGET} started at:  ${START_TIME}"
3611.243Sapb	@printf "make ${.TARGET} finished at: " && date
3621.243Sapb
3631.248Sjnemethiso-image-source: .PHONY
3641.248Sjnemeth	${MAKEDIRTARGET} distrib iso_image CDSOURCE=true
3651.248Sjnemeth	${MAKEDIRTARGET} etc iso-image
3661.248Sjnemeth	@echo   "make ${.TARGET} started at:  ${START_TIME}"
3671.248Sjnemeth	@printf "make ${.TARGET} finished at: " && date
3681.248Sjnemeth
3691.243Sapb#
3701.137Stv# Special components of the "make build" process.
3711.193Slukem#
3721.156Stv
3731.228Slukemcheck-tools: .PHONY
3741.223Slukem.if ${TOOLCHAIN_MISSING} != "no" && !defined(EXTERNAL_TOOLCHAIN)
3751.187Sthorpej	@echo '*** WARNING:  Building on MACHINE=${MACHINE} with missing toolchain.'
3761.187Sthorpej	@echo '*** May result in a failed build or corrupt binaries!'
3771.187Sthorpej.elif defined(EXTERNAL_TOOLCHAIN)
3781.187Sthorpej	@echo '*** Using external toolchain rooted at ${EXTERNAL_TOOLCHAIN}.'
3791.156Stv.endif
3801.173Ssommerfe.if defined(NBUILDJOBS)
3811.173Ssommerfe	@echo '*** WARNING: NBUILDJOBS is obsolete; use -j directly instead!'
3821.173Ssommerfe.endif
3831.123Smrg
3841.242Sdsldo-distrib-dirs: .PHONY .MAKE
3851.147Sjmc.if !defined(DESTDIR) || ${DESTDIR} == ""
3861.232Slukem	${MAKEDIRTARGET} etc distrib-dirs DESTDIR=/
3871.147Sjmc.else
3881.232Slukem	${MAKEDIRTARGET} etc distrib-dirs DESTDIR=${DESTDIR}
3891.147Sjmc.endif
3901.190Slukem
3911.190Slukem.for targ in cleandir obj includes
3921.228Slukemdo-${targ}: .PHONY ${targ}
3931.190Slukem	@true
3941.190Slukem.endfor
3951.123Smrg
3961.256Sgmcgarry.if defined(HAVE_GCC)
3971.256SgmcgarryBUILD_CC_LIB= gnu/lib/crtstuff${LIBGCC_EXT}
3981.256SgmcgarryBUILD_CC_LIB+= gnu/lib/libgcc${LIBGCC_EXT}
3991.256Sgmcgarry.elif defined(HAVE_PCC)
4001.256SgmcgarryBUILD_CC_LIB+= external/bsd/pcc/crtstuff
4011.256SgmcgarryBUILD_CC_LIB+= external/bsd/pcc/libpcc
4021.256Sgmcgarry.endif
4031.256Sgmcgarry
4041.262Smrg.if ${MKCOMPAT} != "no"
4051.262SmrgBUILD_COMPAT_LIBS=	compat/lib/csu ${BUILD_CC_LIB:S/^/compat\//} compat/lib/libc
4061.262Smrg.else
4071.262SmrgBUILD_COMPAT_LIBS=
4081.262Smrg.endif
4091.262Smrg
4101.265Spooka.for dir in tools tools/compat lib/csu ${BUILD_CC_LIB} lib/libc lib/libdes lib gnu/lib external/lib sys/rump/fs/lib sys/rump/net/lib sys/modules ${BUILD_COMPAT_LIBS}
4111.242Sdsldo-${dir:S/\//-/g}: .PHONY .MAKE
4121.137Stv.for targ in dependall install
4131.232Slukem	${MAKEDIRTARGET} ${dir} ${targ}
4141.137Stv.endfor
4151.184Slukem.endfor
4161.184Slukem
4171.261Sapbdo-top-obj: .PHONY .MAKE
4181.261Sapb	${MAKEDIRTARGET} . obj NOSUBDIR=
4191.261Sapb
4201.260Sapbdo-tools-obj: .PHONY .MAKE
4211.260Sapb	${MAKEDIRTARGET} tools obj
4221.260Sapb
4231.249Slukemdo-libgcc: .PHONY .MAKE
4241.256Sgmcgarry.if defined(HAVE_GCC)
4251.249Slukem.if ${MKGCC} != "no"
4261.249Slukem.if (${HAVE_GCC} == "3" || ${HAVE_GCC} == "4")
4271.249Slukem	${MAKEDIRTARGET} . do-gnu-lib-crtstuff${LIBGCC_EXT}
4281.249Slukem.endif
4291.249Slukem	${MAKEDIRTARGET} . do-gnu-lib-libgcc${LIBGCC_EXT}
4301.249Slukem.endif
4311.256Sgmcgarry.endif
4321.256Sgmcgarry
4331.262Smrgdo-compat-libgcc: .PHONY .MAKE
4341.262Smrg.if defined(HAVE_GCC)
4351.262Smrg.if ${MKGCC} != "no"
4361.262Smrg	${MAKEDIRTARGET} . do-compat-gnu-lib-crtstuff${LIBGCC_EXT}
4371.262Smrg	${MAKEDIRTARGET} . do-compat-gnu-lib-libgcc${LIBGCC_EXT}
4381.262Smrg.endif
4391.262Smrg.endif
4401.262Smrg
4411.256Sgmcgarrydo-libpcc: .PHONY .MAKE
4421.256Sgmcgarry.if defined(HAVE_PCC)
4431.256Sgmcgarry.if ${MKPCC} != "no"
4441.256Sgmcgarry	${MAKEDIRTARGET} . do-pcc-lib-crtstuff
4451.256Sgmcgarry	${MAKEDIRTARGET} . do-pcc-lib-libpcc
4461.256Sgmcgarry.endif
4471.256Sgmcgarry.endif
4481.249Slukem
4491.242Sdsldo-ld.so: .PHONY .MAKE
4501.184Slukem.for targ in dependall install
4511.189Sitohy.if (${OBJECT_FMT} == "a.out")
4521.232Slukem	${MAKEDIRTARGET} libexec/ld.aout_so ${targ}
4531.189Sitohy.endif
4541.189Sitohy.if (${OBJECT_FMT} == "ELF")
4551.232Slukem	${MAKEDIRTARGET} libexec/ld.elf_so ${targ}
4561.189Sitohy.endif
4571.137Stv.endfor
4581.143Stv
4591.242Sdsldo-build: .PHONY .MAKE
4601.154Stv.for targ in dependall install
4611.232Slukem	${MAKEDIRTARGET} . ${targ} BUILD_tools=no BUILD_lib=no
4621.154Stv.endfor
4631.200Slukem
4641.242Sdsldo-x11: .PHONY .MAKE
4651.263Smrg.if ${MKX11} != "no"
4661.263Smrg.if ${X11FLAVOUR} == "Xorg"
4671.254Smrg	${MAKEDIRTARGET} external/mit/xorg build
4681.263Smrg.else
4691.257Slukem	${MAKEDIRTARGET} x11 build
4701.263Smrg.endif
4711.254Smrg.else
4721.263Smrg	@echo "MKX11 is not enabled"
4731.257Slukem	@false
4741.254Smrg.endif
4751.227Slukem
4761.242Sdsldo-obsolete: .PHONY .MAKE
4771.232Slukem	${MAKEDIRTARGET} etc install-obsolete-lists
4781.87Scjs
4791.193Slukem#
4801.137Stv# Speedup stubs for some subtrees that don't need to run these rules.
4811.137Stv# (Tells <bsd.subdir.mk> not to recurse for them.)
4821.193Slukem#
4831.129Stv
4841.152Stv.for dir in bin etc distrib games libexec regress sbin usr.sbin tools
4851.228Slukemincludes-${dir}: .PHONY
4861.152Stv	@true
4871.152Stv.endfor
4881.152Stv.for dir in etc distrib regress
4891.228Slukeminstall-${dir}: .PHONY
4901.152Stv	@true
4911.152Stv.endfor
4921.152Stv
4931.193Slukem#
4941.152Stv# XXX this needs to change when distrib Makefiles are recursion compliant
4951.193Slukem# XXX many distrib subdirs need "cd etc && make snap_pre snap_kern" first...
4961.193Slukem#
4971.228Slukemdependall-distrib depend-distrib all-distrib: .PHONY
4981.136Snathanw	@true
4991.130Stv
5001.211Slukem.include <bsd.sys.mk>
5011.151Stv.include <bsd.obj.mk>
5021.209Slukem.include <bsd.kernobj.mk>
5031.146Stv.include <bsd.subdir.mk>
5041.144Stv
5051.228Slukembuild-docs: .PHONY ${.CURDIR}/BUILDING
5061.188Slukem${.CURDIR}/BUILDING: doc/BUILDING.mdoc
5071.230Slukem	${_MKMSG_CREATE} ${.TARGET}
5081.216Slukem	${TOOL_GROFF} -mdoc -Tascii -P-bou $> >$@
5091.209Slukem
5101.209Slukem
5111.209Slukem#
5121.209Slukem# Display current make(1) parameters
5131.209Slukem#
5141.242Sdslparams: .PHONY .MAKE
5151.232Slukem	${MAKEDIRTARGET} etc params
516