Makefile revision 1.262
11.262Smrg#	$NetBSD: Makefile,v 1.262 2008/10/27 22:32:51 mrg 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.189Sitohy#   do-ld.so:        builds and installs prerequisites from libexec/ld.*_so.
981.262Smrg#   do-compat-lib-csu: builds and installs prerequisites from compat/lib/csu
991.262Smrg#                    if ${MKCOMPAT} != "no".
1001.262Smrg#   do-compat-libgcc: builds and installs prerequisites from
1011.262Smrg#                    compat/gnu/lib/crtstuff${LIBGCC_EXT} (if necessary) and
1021.262Smrg#                    compat/gnu/lib/libgcc${LIBGCC_EXT} if ${MKCOMPAT} != "no".
1031.262Smrg#   do-compat-lib-libc: builds and installs prerequisites from compat/lib/libc
1041.262Smrg#                    if ${MKCOMPAT} != "no".
1051.137Stv#   do-build:        builds and installs the entire system.
1061.257Slukem#   do-x11:          builds and installs X11; either
1071.258Sjnemeth#                    X11R7 from src/external/mit/xorg if ${MKXORG} != "no"
1081.257Slukem#                    or X11R6 from src/x11 if ${MKX11} != "no"
1091.222Slukem#   do-obsolete:     installs the obsolete sets (for the postinstall-* targets).
1101.193Slukem#
1111.32Scgd
1121.146Stv.if ${.MAKEFLAGS:M${.CURDIR}/share/mk} == ""
1131.146Stv.MAKEFLAGS: -m ${.CURDIR}/share/mk
1141.146Stv.endif
1151.163Stv
1161.193Slukem#
1171.163Stv# If _SRC_TOP_OBJ_ gets set here, we will end up with a directory that may
1181.163Stv# not be the top level objdir, because "make obj" can happen in the *middle*
1191.163Stv# of "make build" (long after <bsd.own.mk> is calculated it).  So, pre-set
1201.163Stv# _SRC_TOP_OBJ_ here so it will not be added to ${.MAKEOVERRIDES}.
1211.193Slukem#
1221.163Stv_SRC_TOP_OBJ_=
1231.148Sjmc
1241.146Stv.include <bsd.own.mk>
1251.4Scgd
1261.193Slukem#
1271.137Stv# Sanity check: make sure that "make build" is not invoked simultaneously
1281.137Stv# with a standard recursive target.
1291.193Slukem#
1301.137Stv
1311.137Stv.if make(build) || make(release) || make(snapshot)
1321.137Stv.for targ in ${TARGETS:Nobj:Ncleandir}
1331.137Stv.if make(${targ}) && !target(.BEGIN)
1341.137Stv.BEGIN:
1351.137Stv	@echo 'BUILD ABORTED: "make build" and "make ${targ}" are mutually exclusive.'
1361.137Stv	@false
1371.137Stv.endif
1381.137Stv.endfor
1391.137Stv.endif
1401.58Stv
1411.261Sapb#
1421.261Sapb# _SUBDIR is used to set SUBDIR, after removing directories that have
1431.261Sapb# BUILD_${dir}=no, or that have no ${dir}/Makefile.
1441.261Sapb#
1451.253Slukem_SUBDIR=	tools lib include gnu external bin games libexec sbin usr.bin
1461.262Smrg_SUBDIR+=	usr.sbin share rescue sys etc tests compat .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.232Slukem	${MAKEDIRTARGET} gnu/usr.bin/texinfo/install-info infodir-meta
1711.176Slukem.endif
1721.179Sthorpej.if !defined(NOPOSTINSTALL)
1731.232Slukem	${MAKEDIRTARGET} . postinstall-check
1741.159Sperry.endif
1751.170Slukem
1761.239Slukem_POSTINSTALL=	${.CURDIR}/usr.sbin/postinstall/postinstall
1771.239Slukem
1781.228Slukempostinstall-check: .PHONY
1791.169Slukem	@echo "   === Post installation checks ==="
1801.250Spavel	${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} -d ${DESTDIR}/ check; if [ $$? -gt 1 ]; then exit 1; fi
1811.171Slukem	@echo "   ================================"
1821.171Slukem
1831.228Slukempostinstall-fix: .NOTMAIN .PHONY
1841.171Slukem	@echo "   === Post installation fixes ==="
1851.239Slukem	${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} -d ${DESTDIR}/ fix
1861.212Slukem	@echo "   ==============================="
1871.212Slukem
1881.228Slukempostinstall-fix-obsolete: .NOTMAIN .PHONY
1891.212Slukem	@echo "   === Removing obsolete files ==="
1901.239Slukem	${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} -d ${DESTDIR}/ fix obsolete
1911.212Slukem	@echo "   ==============================="
1921.169Slukem
1931.108Serh
1941.193Slukem#
1951.137Stv# Targets (in order!) called by "make build".
1961.193Slukem#
1971.256Sgmcgarry.if defined(HAVE_GCC)
1981.245Smrg.if ${HAVE_GCC} == "3"
1991.220SmrgLIBGCC_EXT=3
2001.245Smrg.else
2011.244SmrgLIBGCC_EXT=4
2021.220Smrg.endif
2031.256Sgmcgarry.endif
2041.123Smrg
2051.156StvBUILDTARGETS+=	check-tools
2061.214Slukem.if ${MKUPDATE} == "no" && !defined(NOCLEANDIR)
2071.155StvBUILDTARGETS+=	cleandir
2081.155Stv.endif
2091.261Sapb.if ${MKOBJDIRS} != "no"
2101.261SapbBUILDTARGETS+=	do-top-obj
2111.261Sapb.endif
2121.261Sapb.if ${USETOOLS} == "yes"	# {
2131.149Stv.if ${MKOBJDIRS} != "no"
2141.260SapbBUILDTARGETS+=	do-tools-obj
2151.123Smrg.endif
2161.152StvBUILDTARGETS+=	do-tools
2171.261Sapb.endif # USETOOLS		# }
2181.260Sapb.if ${MKOBJDIRS} != "no"
2191.260SapbBUILDTARGETS+=	obj
2201.260Sapb.endif
2211.137Stv.if !defined(NODISTRIBDIRS)
2221.137StvBUILDTARGETS+=	do-distrib-dirs
2231.131Stv.endif
2241.137Stv.if !defined(NOINCLUDES)
2251.137StvBUILDTARGETS+=	includes
2261.131Stv.endif
2271.202SthorpejBUILDTARGETS+=	do-tools-compat
2281.231SskrllBUILDTARGETS+=	do-lib-csu
2291.207Sdrochner.if ${MKGCC} != "no"
2301.249SlukemBUILDTARGETS+=	do-libgcc
2311.207Sdrochner.endif
2321.256Sgmcgarry.if ${MKPCC} != "no"
2331.256SgmcgarryBUILDTARGET+=	do-libpcc
2341.256Sgmcgarry.endif
2351.231SskrllBUILDTARGETS+=	do-lib-libc
2361.253SlukemBUILDTARGETS+=	do-lib do-gnu-lib do-external-lib
2371.259SpookaBUILDTARGETS+=	do-sys-rump-fs-lib do-sys-rump-net-lib
2381.262Smrg.if ${MKCOMPAT} != "no"
2391.262SmrgBUILDTARGETS+=	do-compat-lib-csu
2401.262SmrgBUILDTARGETS+=	do-compat-libgcc
2411.262SmrgBUILDTARGETS+=	do-compat-lib-libc
2421.262Smrg.endif
2431.224SlukemBUILDTARGETS+=	do-ld.so
2441.224SlukemBUILDTARGETS+=	do-build
2451.257Slukem.if ${MKX11} != "no" || ${MKXORG} != "no"
2461.227SlukemBUILDTARGETS+=	do-x11
2471.227Slukem.endif
2481.200SlukemBUILDTARGETS+=	do-obsolete
2491.131Stv
2501.193Slukem#
2511.137Stv# Enforce proper ordering of some rules.
2521.193Slukem#
2531.123Smrg
2541.137Stv.ORDER:		${BUILDTARGETS}
2551.228Slukemincludes-lib:	.PHONY includes-include includes-sys
2561.228Slukemincludes-gnu:	.PHONY includes-lib
2571.123Smrg
2581.193Slukem#
2591.137Stv# Build the system and install into DESTDIR.
2601.193Slukem#
2611.123Smrg
2621.191SlukemSTART_TIME!=	date
2631.191Slukem
2641.242Sdslbuild: .PHONY .MAKE
2651.137Stv.if defined(BUILD_DONE)
2661.137Stv	@echo "Build already installed into ${DESTDIR}"
2671.137Stv.else
2681.191Slukem	@echo "Build started at: ${START_TIME}"
2691.145Stv.for tgt in ${BUILDTARGETS}
2701.232Slukem	${MAKEDIRTARGET} . ${tgt}
2711.145Stv.endfor
2721.232Slukem	${MAKEDIRTARGET} etc install-etc-release
2731.191Slukem	@echo   "Build started at:  ${START_TIME}"
2741.172Sbjh21	@printf "Build finished at: " && date
2751.71Smycroft.endif
2761.160Sthorpej
2771.193Slukem#
2781.160Sthorpej# Build a full distribution, but not a release (i.e. no sets into
2791.193Slukem# ${RELEASEDIR}).  "buildworld" enforces a build to ${DESTDIR} != /
2801.193Slukem#
2811.160Sthorpej
2821.242Sdsldistribution buildworld: .PHONY .MAKE
2831.194Slukem.if make(buildworld) && \
2841.194Slukem    (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/")
2851.193Slukem	@echo "Won't make ${.TARGET} with DESTDIR=/"
2861.193Slukem	@false
2871.193Slukem.endif
2881.232Slukem	${MAKEDIRTARGET} . build NOPOSTINSTALL=1
2891.232Slukem	${MAKEDIRTARGET} etc distribution INSTALL_DONE=1
2901.181Sthorpej.if defined(DESTDIR) && ${DESTDIR} != "" && ${DESTDIR} != "/"
2911.232Slukem	${MAKEDIRTARGET} . postinstall-fix-obsolete
2921.232Slukem	${MAKEDIRTARGET} distrib/sets checkflist
2931.181Sthorpej.endif
2941.192Slukem	@echo   "make ${.TARGET} started at:  ${START_TIME}"
2951.185Slukem	@printf "make ${.TARGET} finished at: " && date
2961.123Smrg
2971.193Slukem#
2981.193Slukem# Install the distribution from $DESTDIR to $INSTALLWORLDDIR (defaults to `/')
2991.193Slukem# If installing to /, ensures that the host's operating system is NetBSD and
3001.193Slukem# the host's `uname -m` == ${MACHINE}.
3011.193Slukem#
3021.193Slukem
3031.193SlukemHOST_UNAME_S!=	uname -s
3041.193SlukemHOST_UNAME_M!=	uname -m
3051.193Slukem
3061.242Sdslinstallworld: .PHONY .MAKE
3071.194Slukem.if (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/")
3081.193Slukem	@echo "Can't make ${.TARGET} to DESTDIR=/"
3091.193Slukem	@false
3101.193Slukem.endif
3111.193Slukem.if !defined(INSTALLWORLDDIR) || \
3121.193Slukem    ${INSTALLWORLDDIR} == "" || ${INSTALLWORLDDIR} == "/"
3131.193Slukem.if (${HOST_UNAME_S} != "NetBSD")
3141.193Slukem	@echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_S} to NetBSD with INSTALLWORLDDIR=/"
3151.193Slukem	@false
3161.193Slukem.endif
3171.193Slukem.if (${HOST_UNAME_M} != ${MACHINE})
3181.193Slukem	@echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_M} to ${MACHINE} with INSTALLWORLDDIR=/"
3191.193Slukem	@false
3201.193Slukem.endif
3211.193Slukem.endif
3221.232Slukem	${MAKEDIRTARGET} distrib/sets installsets \
3231.232Slukem	    INSTALLDIR=${INSTALLWORLDDIR:U/} INSTALLSETS=
3241.232Slukem	${MAKEDIRTARGET} . postinstall-check DESTDIR=${INSTALLWORLDDIR}
3251.193Slukem	@echo   "make ${.TARGET} started at:  ${START_TIME}"
3261.193Slukem	@printf "make ${.TARGET} finished at: " && date
3271.199Slukem
3281.199Slukem#
3291.206Slukem# Create sets from $DESTDIR or $NETBSDSRCDIR into $RELEASEDIR
3301.199Slukem#
3311.199Slukem
3321.241Sapb.for tgt in sets sourcesets syspkgs
3331.242Sdsl${tgt}: .PHONY .MAKE
3341.232Slukem	${MAKEDIRTARGET} distrib/sets ${tgt}
3351.206Slukem.endfor
3361.193Slukem
3371.193Slukem#
3381.240Slukem# Build a release or snapshot (implies "make distribution").  Note that
3391.181Sthorpej# in this case, the set lists will be checked before the tar files
3401.181Sthorpej# are made.
3411.193Slukem#
3421.123Smrg
3431.242Sdslrelease snapshot: .PHONY .MAKE
3441.240Slukem	${MAKEDIRTARGET} . distribution
3451.240Slukem	${MAKEDIRTARGET} etc release DISTRIBUTION_DONE=1
3461.192Slukem	@echo   "make ${.TARGET} started at:  ${START_TIME}"
3471.185Slukem	@printf "make ${.TARGET} finished at: " && date
3481.123Smrg
3491.193Slukem#
3501.243Sapb# Create a CD-ROM image.
3511.243Sapb#
3521.243Sapb
3531.243Sapbiso-image: .PHONY
3541.247Sbouyer	${MAKEDIRTARGET} distrib iso_image
3551.243Sapb	${MAKEDIRTARGET} etc iso-image
3561.243Sapb	@echo   "make ${.TARGET} started at:  ${START_TIME}"
3571.243Sapb	@printf "make ${.TARGET} finished at: " && date
3581.243Sapb
3591.248Sjnemethiso-image-source: .PHONY
3601.248Sjnemeth	${MAKEDIRTARGET} distrib iso_image CDSOURCE=true
3611.248Sjnemeth	${MAKEDIRTARGET} etc iso-image
3621.248Sjnemeth	@echo   "make ${.TARGET} started at:  ${START_TIME}"
3631.248Sjnemeth	@printf "make ${.TARGET} finished at: " && date
3641.248Sjnemeth
3651.243Sapb#
3661.137Stv# Special components of the "make build" process.
3671.193Slukem#
3681.156Stv
3691.228Slukemcheck-tools: .PHONY
3701.223Slukem.if ${TOOLCHAIN_MISSING} != "no" && !defined(EXTERNAL_TOOLCHAIN)
3711.187Sthorpej	@echo '*** WARNING:  Building on MACHINE=${MACHINE} with missing toolchain.'
3721.187Sthorpej	@echo '*** May result in a failed build or corrupt binaries!'
3731.187Sthorpej.elif defined(EXTERNAL_TOOLCHAIN)
3741.187Sthorpej	@echo '*** Using external toolchain rooted at ${EXTERNAL_TOOLCHAIN}.'
3751.156Stv.endif
3761.173Ssommerfe.if defined(NBUILDJOBS)
3771.173Ssommerfe	@echo '*** WARNING: NBUILDJOBS is obsolete; use -j directly instead!'
3781.173Ssommerfe.endif
3791.123Smrg
3801.242Sdsldo-distrib-dirs: .PHONY .MAKE
3811.147Sjmc.if !defined(DESTDIR) || ${DESTDIR} == ""
3821.232Slukem	${MAKEDIRTARGET} etc distrib-dirs DESTDIR=/
3831.147Sjmc.else
3841.232Slukem	${MAKEDIRTARGET} etc distrib-dirs DESTDIR=${DESTDIR}
3851.147Sjmc.endif
3861.190Slukem
3871.190Slukem.for targ in cleandir obj includes
3881.228Slukemdo-${targ}: .PHONY ${targ}
3891.190Slukem	@true
3901.190Slukem.endfor
3911.123Smrg
3921.256Sgmcgarry.if defined(HAVE_GCC)
3931.256SgmcgarryBUILD_CC_LIB= gnu/lib/crtstuff${LIBGCC_EXT}
3941.256SgmcgarryBUILD_CC_LIB+= gnu/lib/libgcc${LIBGCC_EXT}
3951.256Sgmcgarry.elif defined(HAVE_PCC)
3961.256SgmcgarryBUILD_CC_LIB+= external/bsd/pcc/crtstuff
3971.256SgmcgarryBUILD_CC_LIB+= external/bsd/pcc/libpcc
3981.256Sgmcgarry.endif
3991.256Sgmcgarry
4001.262Smrg.if ${MKCOMPAT} != "no"
4011.262SmrgBUILD_COMPAT_LIBS=	compat/lib/csu ${BUILD_CC_LIB:S/^/compat\//} compat/lib/libc
4021.262Smrg.else
4031.262SmrgBUILD_COMPAT_LIBS=
4041.262Smrg.endif
4051.262Smrg
4061.262Smrg.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 ${BUILD_COMPAT_LIBS}
4071.242Sdsldo-${dir:S/\//-/g}: .PHONY .MAKE
4081.137Stv.for targ in dependall install
4091.232Slukem	${MAKEDIRTARGET} ${dir} ${targ}
4101.137Stv.endfor
4111.184Slukem.endfor
4121.184Slukem
4131.261Sapbdo-top-obj: .PHONY .MAKE
4141.261Sapb	${MAKEDIRTARGET} . obj NOSUBDIR=
4151.261Sapb
4161.260Sapbdo-tools-obj: .PHONY .MAKE
4171.260Sapb	${MAKEDIRTARGET} tools obj
4181.260Sapb
4191.249Slukemdo-libgcc: .PHONY .MAKE
4201.256Sgmcgarry.if defined(HAVE_GCC)
4211.249Slukem.if ${MKGCC} != "no"
4221.249Slukem.if (${HAVE_GCC} == "3" || ${HAVE_GCC} == "4")
4231.249Slukem	${MAKEDIRTARGET} . do-gnu-lib-crtstuff${LIBGCC_EXT}
4241.249Slukem.endif
4251.249Slukem	${MAKEDIRTARGET} . do-gnu-lib-libgcc${LIBGCC_EXT}
4261.249Slukem.endif
4271.256Sgmcgarry.endif
4281.256Sgmcgarry
4291.262Smrgdo-compat-libgcc: .PHONY .MAKE
4301.262Smrg.if defined(HAVE_GCC)
4311.262Smrg.if ${MKGCC} != "no"
4321.262Smrg	${MAKEDIRTARGET} . do-compat-gnu-lib-crtstuff${LIBGCC_EXT}
4331.262Smrg	${MAKEDIRTARGET} . do-compat-gnu-lib-libgcc${LIBGCC_EXT}
4341.262Smrg.endif
4351.262Smrg.endif
4361.262Smrg
4371.256Sgmcgarrydo-libpcc: .PHONY .MAKE
4381.256Sgmcgarry.if defined(HAVE_PCC)
4391.256Sgmcgarry.if ${MKPCC} != "no"
4401.256Sgmcgarry	${MAKEDIRTARGET} . do-pcc-lib-crtstuff
4411.256Sgmcgarry	${MAKEDIRTARGET} . do-pcc-lib-libpcc
4421.256Sgmcgarry.endif
4431.256Sgmcgarry.endif
4441.249Slukem
4451.242Sdsldo-ld.so: .PHONY .MAKE
4461.184Slukem.for targ in dependall install
4471.189Sitohy.if (${OBJECT_FMT} == "a.out")
4481.232Slukem	${MAKEDIRTARGET} libexec/ld.aout_so ${targ}
4491.189Sitohy.endif
4501.189Sitohy.if (${OBJECT_FMT} == "ELF")
4511.232Slukem	${MAKEDIRTARGET} libexec/ld.elf_so ${targ}
4521.189Sitohy.endif
4531.137Stv.endfor
4541.143Stv
4551.242Sdsldo-build: .PHONY .MAKE
4561.154Stv.for targ in dependall install
4571.232Slukem	${MAKEDIRTARGET} . ${targ} BUILD_tools=no BUILD_lib=no
4581.154Stv.endfor
4591.200Slukem
4601.242Sdsldo-x11: .PHONY .MAKE
4611.254Smrg.if ${MKXORG} != "no"
4621.254Smrg	${MAKEDIRTARGET} external/mit/xorg build
4631.257Slukem.elif ${MKX11} != "no"
4641.257Slukem	${MAKEDIRTARGET} x11 build
4651.254Smrg.else
4661.257Slukem	@echo "Neither MKX11 or MKXORG is enabled"
4671.257Slukem	@false
4681.254Smrg.endif
4691.227Slukem
4701.242Sdsldo-obsolete: .PHONY .MAKE
4711.232Slukem	${MAKEDIRTARGET} etc install-obsolete-lists
4721.87Scjs
4731.193Slukem#
4741.137Stv# Speedup stubs for some subtrees that don't need to run these rules.
4751.137Stv# (Tells <bsd.subdir.mk> not to recurse for them.)
4761.193Slukem#
4771.129Stv
4781.152Stv.for dir in bin etc distrib games libexec regress sbin usr.sbin tools
4791.228Slukemincludes-${dir}: .PHONY
4801.152Stv	@true
4811.152Stv.endfor
4821.152Stv.for dir in etc distrib regress
4831.228Slukeminstall-${dir}: .PHONY
4841.152Stv	@true
4851.152Stv.endfor
4861.152Stv
4871.193Slukem#
4881.152Stv# XXX this needs to change when distrib Makefiles are recursion compliant
4891.193Slukem# XXX many distrib subdirs need "cd etc && make snap_pre snap_kern" first...
4901.193Slukem#
4911.228Slukemdependall-distrib depend-distrib all-distrib: .PHONY
4921.136Snathanw	@true
4931.130Stv
4941.211Slukem.include <bsd.sys.mk>
4951.151Stv.include <bsd.obj.mk>
4961.209Slukem.include <bsd.kernobj.mk>
4971.146Stv.include <bsd.subdir.mk>
4981.144Stv
4991.228Slukembuild-docs: .PHONY ${.CURDIR}/BUILDING
5001.188Slukem${.CURDIR}/BUILDING: doc/BUILDING.mdoc
5011.230Slukem	${_MKMSG_CREATE} ${.TARGET}
5021.216Slukem	${TOOL_GROFF} -mdoc -Tascii -P-bou $> >$@
5031.209Slukem
5041.209Slukem
5051.209Slukem#
5061.209Slukem# Display current make(1) parameters
5071.209Slukem#
5081.242Sdslparams: .PHONY .MAKE
5091.232Slukem	${MAKEDIRTARGET} etc params
510