Makefile revision 1.299
11.299Sjoerg#	$NetBSD: Makefile,v 1.299 2012/08/17 16:22:27 joerg 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.299Sjoerg#   do-lib:          builds and installs prerequisites from lib
961.262Smrg#                    if ${MKCOMPAT} != "no".
971.299Sjoerg#   do-compat-lib:   builds and installs prerequisites from compat/lib
981.262Smrg#                    if ${MKCOMPAT} != "no".
991.137Stv#   do-build:        builds and installs the entire system.
1001.263Smrg#   do-x11:          builds and installs X11 if ${MKX11} != "no"; either
1011.263Smrg#                    X11R7 from src/external/mit/xorg if ${X11FLAVOUR} == "Xorg"
1021.263Smrg#                    or X11R6 from src/x11
1031.275Suebayasi#   do-extsrc:       builds and installs extsrc if ${MKEXTSRC} != "no".
1041.222Slukem#   do-obsolete:     installs the obsolete sets (for the postinstall-* targets).
1051.193Slukem#
1061.32Scgd
1071.146Stv.if ${.MAKEFLAGS:M${.CURDIR}/share/mk} == ""
1081.146Stv.MAKEFLAGS: -m ${.CURDIR}/share/mk
1091.146Stv.endif
1101.163Stv
1111.193Slukem#
1121.163Stv# If _SRC_TOP_OBJ_ gets set here, we will end up with a directory that may
1131.163Stv# not be the top level objdir, because "make obj" can happen in the *middle*
1141.163Stv# of "make build" (long after <bsd.own.mk> is calculated it).  So, pre-set
1151.163Stv# _SRC_TOP_OBJ_ here so it will not be added to ${.MAKEOVERRIDES}.
1161.193Slukem#
1171.163Stv_SRC_TOP_OBJ_=
1181.148Sjmc
1191.146Stv.include <bsd.own.mk>
1201.4Scgd
1211.193Slukem#
1221.137Stv# Sanity check: make sure that "make build" is not invoked simultaneously
1231.137Stv# with a standard recursive target.
1241.193Slukem#
1251.137Stv
1261.137Stv.if make(build) || make(release) || make(snapshot)
1271.137Stv.for targ in ${TARGETS:Nobj:Ncleandir}
1281.137Stv.if make(${targ}) && !target(.BEGIN)
1291.137Stv.BEGIN:
1301.137Stv	@echo 'BUILD ABORTED: "make build" and "make ${targ}" are mutually exclusive.'
1311.137Stv	@false
1321.137Stv.endif
1331.137Stv.endfor
1341.137Stv.endif
1351.58Stv
1361.261Sapb#
1371.261Sapb# _SUBDIR is used to set SUBDIR, after removing directories that have
1381.261Sapb# BUILD_${dir}=no, or that have no ${dir}/Makefile.
1391.261Sapb#
1401.271Schristos_SUBDIR=	tools lib include gnu external crypto/external bin games
1411.271Schristos_SUBDIR+=	libexec sbin usr.bin
1421.262Smrg_SUBDIR+=	usr.sbin share rescue sys etc tests compat .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.232Slukem	${MAKEDIRTARGET} gnu/usr.bin/texinfo/install-info infodir-meta
1671.176Slukem.endif
1681.179Sthorpej.if !defined(NOPOSTINSTALL)
1691.232Slukem	${MAKEDIRTARGET} . postinstall-check
1701.159Sperry.endif
1711.170Slukem
1721.239Slukem_POSTINSTALL=	${.CURDIR}/usr.sbin/postinstall/postinstall
1731.295Sapb_POSTINSTALL_ENV= \
1741.295Sapb	AWK=${TOOL_AWK:Q}		\
1751.295Sapb	DB=${TOOL_DB:Q}			\
1761.298Sapb	HOST_SH=${HOST_SH:Q}		\
1771.295Sapb	MAKE=${MAKE:Q}			\
1781.297Sapb	PWD_MKDB=${TOOL_PWD_MKDB:Q}	\
1791.297Sapb	STAT=${TOOL_STAT:Q}
1801.239Slukem
1811.228Slukempostinstall-check: .PHONY
1821.169Slukem	@echo "   === Post installation checks ==="
1831.295Sapb	${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} -d ${DESTDIR}/ check; if [ $$? -gt 1 ]; then exit 1; fi
1841.171Slukem	@echo "   ================================"
1851.171Slukem
1861.228Slukempostinstall-fix: .NOTMAIN .PHONY
1871.171Slukem	@echo "   === Post installation fixes ==="
1881.295Sapb	${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} -d ${DESTDIR}/ fix
1891.212Slukem	@echo "   ==============================="
1901.212Slukem
1911.228Slukempostinstall-fix-obsolete: .NOTMAIN .PHONY
1921.212Slukem	@echo "   === Removing obsolete files ==="
1931.295Sapb	${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} -d ${DESTDIR}/ fix obsolete
1941.212Slukem	@echo "   ==============================="
1951.169Slukem
1961.108Serh
1971.193Slukem#
1981.137Stv# Targets (in order!) called by "make build".
1991.193Slukem#
2001.256Sgmcgarry.if defined(HAVE_GCC)
2011.284Smrg.if ${HAVE_GCC} == "4"
2021.284SmrgLIBGCC_EXT=4
2031.285SmrgBUILD_CC_LIB_BASEDIR= gnu/lib
2041.285SmrgBUILD_CC_LIB_BASETARGET= gnu-lib
2051.245Smrg.else
2061.285SmrgLIBGCC_EXT=
2071.285SmrgBUILD_CC_LIB_BASEDIR= external/gpl3/gcc/lib
2081.285SmrgBUILD_CC_LIB_BASETARGET= external-gpl3-gcc-lib
2091.220Smrg.endif
2101.256Sgmcgarry.endif
2111.123Smrg
2121.156StvBUILDTARGETS+=	check-tools
2131.214Slukem.if ${MKUPDATE} == "no" && !defined(NOCLEANDIR)
2141.155StvBUILDTARGETS+=	cleandir
2151.155Stv.endif
2161.261Sapb.if ${MKOBJDIRS} != "no"
2171.261SapbBUILDTARGETS+=	do-top-obj
2181.261Sapb.endif
2191.261Sapb.if ${USETOOLS} == "yes"	# {
2201.149Stv.if ${MKOBJDIRS} != "no"
2211.260SapbBUILDTARGETS+=	do-tools-obj
2221.123Smrg.endif
2231.152StvBUILDTARGETS+=	do-tools
2241.261Sapb.endif # USETOOLS		# }
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.224SlukemBUILDTARGETS+=	do-build
2381.263Smrg.if ${MKX11} != "no"
2391.227SlukemBUILDTARGETS+=	do-x11
2401.227Slukem.endif
2411.275Suebayasi.if ${MKEXTSRC} != "no"
2421.275SuebayasiBUILDTARGETS+=	do-extsrc
2431.275Suebayasi.endif
2441.200SlukemBUILDTARGETS+=	do-obsolete
2451.131Stv
2461.193Slukem#
2471.137Stv# Enforce proper ordering of some rules.
2481.193Slukem#
2491.123Smrg
2501.137Stv.ORDER:		${BUILDTARGETS}
2511.228Slukemincludes-lib:	.PHONY includes-include includes-sys
2521.228Slukemincludes-gnu:	.PHONY includes-lib
2531.123Smrg
2541.193Slukem#
2551.137Stv# Build the system and install into DESTDIR.
2561.193Slukem#
2571.123Smrg
2581.191SlukemSTART_TIME!=	date
2591.191Slukem
2601.242Sdslbuild: .PHONY .MAKE
2611.137Stv.if defined(BUILD_DONE)
2621.137Stv	@echo "Build already installed into ${DESTDIR}"
2631.137Stv.else
2641.191Slukem	@echo "Build started at: ${START_TIME}"
2651.145Stv.for tgt in ${BUILDTARGETS}
2661.232Slukem	${MAKEDIRTARGET} . ${tgt}
2671.145Stv.endfor
2681.232Slukem	${MAKEDIRTARGET} etc install-etc-release
2691.191Slukem	@echo   "Build started at:  ${START_TIME}"
2701.172Sbjh21	@printf "Build finished at: " && date
2711.71Smycroft.endif
2721.160Sthorpej
2731.193Slukem#
2741.160Sthorpej# Build a full distribution, but not a release (i.e. no sets into
2751.193Slukem# ${RELEASEDIR}).  "buildworld" enforces a build to ${DESTDIR} != /
2761.193Slukem#
2771.160Sthorpej
2781.242Sdsldistribution buildworld: .PHONY .MAKE
2791.194Slukem.if make(buildworld) && \
2801.194Slukem    (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/")
2811.193Slukem	@echo "Won't make ${.TARGET} with DESTDIR=/"
2821.193Slukem	@false
2831.193Slukem.endif
2841.232Slukem	${MAKEDIRTARGET} . build NOPOSTINSTALL=1
2851.232Slukem	${MAKEDIRTARGET} etc distribution INSTALL_DONE=1
2861.181Sthorpej.if defined(DESTDIR) && ${DESTDIR} != "" && ${DESTDIR} != "/"
2871.232Slukem	${MAKEDIRTARGET} . postinstall-fix-obsolete
2881.232Slukem	${MAKEDIRTARGET} distrib/sets checkflist
2891.181Sthorpej.endif
2901.192Slukem	@echo   "make ${.TARGET} started at:  ${START_TIME}"
2911.185Slukem	@printf "make ${.TARGET} finished at: " && date
2921.123Smrg
2931.193Slukem#
2941.193Slukem# Install the distribution from $DESTDIR to $INSTALLWORLDDIR (defaults to `/')
2951.193Slukem# If installing to /, ensures that the host's operating system is NetBSD and
2961.193Slukem# the host's `uname -m` == ${MACHINE}.
2971.193Slukem#
2981.193Slukem
2991.193SlukemHOST_UNAME_S!=	uname -s
3001.193SlukemHOST_UNAME_M!=	uname -m
3011.193Slukem
3021.242Sdslinstallworld: .PHONY .MAKE
3031.194Slukem.if (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/")
3041.193Slukem	@echo "Can't make ${.TARGET} to DESTDIR=/"
3051.193Slukem	@false
3061.193Slukem.endif
3071.193Slukem.if !defined(INSTALLWORLDDIR) || \
3081.193Slukem    ${INSTALLWORLDDIR} == "" || ${INSTALLWORLDDIR} == "/"
3091.193Slukem.if (${HOST_UNAME_S} != "NetBSD")
3101.193Slukem	@echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_S} to NetBSD with INSTALLWORLDDIR=/"
3111.193Slukem	@false
3121.193Slukem.endif
3131.193Slukem.if (${HOST_UNAME_M} != ${MACHINE})
3141.193Slukem	@echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_M} to ${MACHINE} with INSTALLWORLDDIR=/"
3151.193Slukem	@false
3161.193Slukem.endif
3171.193Slukem.endif
3181.232Slukem	${MAKEDIRTARGET} distrib/sets installsets \
3191.282Sjym		INSTALLDIR=${INSTALLWORLDDIR:U/} INSTALLSETS=${INSTALLSETS:Q}
3201.232Slukem	${MAKEDIRTARGET} . postinstall-check DESTDIR=${INSTALLWORLDDIR}
3211.193Slukem	@echo   "make ${.TARGET} started at:  ${START_TIME}"
3221.193Slukem	@printf "make ${.TARGET} finished at: " && date
3231.199Slukem
3241.199Slukem#
3251.287Sjmcneill# Install modules from $DESTDIR to $INSTALLMODULESDIR
3261.287Sjmcneill#
3271.287Sjmcneillinstallmodules: .PHONY .MAKE
3281.287Sjmcneill.if (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/")
3291.287Sjmcneill	@echo "Can't make ${.TARGET} to DESTDIR=/"
3301.287Sjmcneill	@false
3311.287Sjmcneill.endif
3321.287Sjmcneill.if !defined(INSTALLMODULESDIR) || \
3331.287Sjmcneill    ${INSTALLMODULESDIR} == "" || ${INSTALLMODULESDIR} == "/"
3341.287Sjmcneill.if (${HOST_UNAME_S} != "NetBSD")
3351.287Sjmcneill	@echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_S} to NetBSD with INSTALLMODULESDIR=/"
3361.287Sjmcneill	@false
3371.287Sjmcneill.endif
3381.287Sjmcneill.if (${HOST_UNAME_M} != ${MACHINE})
3391.287Sjmcneill	@echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_M} to ${MACHINE} with INSTALLMODULESDIR=/"
3401.287Sjmcneill	@false
3411.287Sjmcneill.endif
3421.287Sjmcneill.endif
3431.288Sjmcneill	${MAKEDIRTARGET} sys/modules install DESTDIR=${INSTALLMODULESDIR:U/}
3441.287Sjmcneill	@echo   "make ${.TARGET} started at:  ${START_TIME}"
3451.287Sjmcneill	@printf "make ${.TARGET} finished at: " && date
3461.287Sjmcneill
3471.287Sjmcneill#
3481.206Slukem# Create sets from $DESTDIR or $NETBSDSRCDIR into $RELEASEDIR
3491.199Slukem#
3501.199Slukem
3511.241Sapb.for tgt in sets sourcesets syspkgs
3521.242Sdsl${tgt}: .PHONY .MAKE
3531.232Slukem	${MAKEDIRTARGET} distrib/sets ${tgt}
3541.206Slukem.endfor
3551.193Slukem
3561.193Slukem#
3571.240Slukem# Build a release or snapshot (implies "make distribution").  Note that
3581.181Sthorpej# in this case, the set lists will be checked before the tar files
3591.181Sthorpej# are made.
3601.193Slukem#
3611.123Smrg
3621.242Sdslrelease snapshot: .PHONY .MAKE
3631.240Slukem	${MAKEDIRTARGET} . distribution
3641.240Slukem	${MAKEDIRTARGET} etc release DISTRIBUTION_DONE=1
3651.192Slukem	@echo   "make ${.TARGET} started at:  ${START_TIME}"
3661.185Slukem	@printf "make ${.TARGET} finished at: " && date
3671.123Smrg
3681.193Slukem#
3691.243Sapb# Create a CD-ROM image.
3701.243Sapb#
3711.243Sapb
3721.243Sapbiso-image: .PHONY
3731.247Sbouyer	${MAKEDIRTARGET} distrib iso_image
3741.243Sapb	${MAKEDIRTARGET} etc iso-image
3751.243Sapb	@echo   "make ${.TARGET} started at:  ${START_TIME}"
3761.243Sapb	@printf "make ${.TARGET} finished at: " && date
3771.243Sapb
3781.248Sjnemethiso-image-source: .PHONY
3791.248Sjnemeth	${MAKEDIRTARGET} distrib iso_image CDSOURCE=true
3801.248Sjnemeth	${MAKEDIRTARGET} etc iso-image
3811.248Sjnemeth	@echo   "make ${.TARGET} started at:  ${START_TIME}"
3821.248Sjnemeth	@printf "make ${.TARGET} finished at: " && date
3831.248Sjnemeth
3841.243Sapb#
3851.290Stsutsui# Create bootable live images.
3861.290Stsutsui#
3871.290Stsutsui
3881.290Stsutsuilive-image: .PHONY
3891.290Stsutsui	${MAKEDIRTARGET} etc live-image
3901.290Stsutsui	@echo   "make ${.TARGET} started at:  ${START_TIME}"
3911.290Stsutsui	@printf "make ${.TARGET} finished at: " && date
3921.290Stsutsui
3931.290Stsutsui#
3941.290Stsutsui# Create bootable installation images.
3951.290Stsutsui#
3961.290Stsutsui
3971.290Stsutsuiinstall-image: .PHONY
3981.290Stsutsui	${MAKEDIRTARGET} etc install-image
3991.290Stsutsui	@echo   "make ${.TARGET} started at:  ${START_TIME}"
4001.290Stsutsui	@printf "make ${.TARGET} finished at: " && date
4011.290Stsutsui
4021.290Stsutsui#
4031.137Stv# Special components of the "make build" process.
4041.193Slukem#
4051.156Stv
4061.228Slukemcheck-tools: .PHONY
4071.223Slukem.if ${TOOLCHAIN_MISSING} != "no" && !defined(EXTERNAL_TOOLCHAIN)
4081.187Sthorpej	@echo '*** WARNING:  Building on MACHINE=${MACHINE} with missing toolchain.'
4091.187Sthorpej	@echo '*** May result in a failed build or corrupt binaries!'
4101.187Sthorpej.elif defined(EXTERNAL_TOOLCHAIN)
4111.187Sthorpej	@echo '*** Using external toolchain rooted at ${EXTERNAL_TOOLCHAIN}.'
4121.156Stv.endif
4131.173Ssommerfe.if defined(NBUILDJOBS)
4141.173Ssommerfe	@echo '*** WARNING: NBUILDJOBS is obsolete; use -j directly instead!'
4151.173Ssommerfe.endif
4161.123Smrg
4171.270Sapb# Delete or sanitise a leftover METALOG from a previous build.
4181.270Sapbclean_METALOG: .PHONY .MAKE
4191.270Sapb.if ${MKUPDATE} != "no"
4201.270Sapb	${MAKEDIRTARGET} distrib/sets clean_METALOG
4211.270Sapb.endif
4221.270Sapb
4231.242Sdsldo-distrib-dirs: .PHONY .MAKE
4241.147Sjmc.if !defined(DESTDIR) || ${DESTDIR} == ""
4251.232Slukem	${MAKEDIRTARGET} etc distrib-dirs DESTDIR=/
4261.147Sjmc.else
4271.232Slukem	${MAKEDIRTARGET} etc distrib-dirs DESTDIR=${DESTDIR}
4281.147Sjmc.endif
4291.190Slukem
4301.190Slukem.for targ in cleandir obj includes
4311.228Slukemdo-${targ}: .PHONY ${targ}
4321.190Slukem	@true
4331.190Slukem.endfor
4341.123Smrg
4351.299Sjoerg.for dir in tools tools/compat
4361.242Sdsldo-${dir:S/\//-/g}: .PHONY .MAKE
4371.137Stv.for targ in dependall install
4381.232Slukem	${MAKEDIRTARGET} ${dir} ${targ}
4391.137Stv.endfor
4401.184Slukem.endfor
4411.184Slukem
4421.299Sjoergdo-lib: .PHONY .MAKE
4431.299Sjoerg	${MAKEDIRTARGET} lib build_install
4441.299Sjoerg
4451.299Sjoergdo-compat-lib: .PHONY .MAKE
4461.299Sjoerg	${MAKEDIRTARGET} compat build_install BOOTSTRAP_SUBDIRS="../../../lib"
4471.276Smrg
4481.261Sapbdo-top-obj: .PHONY .MAKE
4491.261Sapb	${MAKEDIRTARGET} . obj NOSUBDIR=
4501.261Sapb
4511.260Sapbdo-tools-obj: .PHONY .MAKE
4521.260Sapb	${MAKEDIRTARGET} tools obj
4531.260Sapb
4541.242Sdsldo-build: .PHONY .MAKE
4551.154Stv.for targ in dependall install
4561.232Slukem	${MAKEDIRTARGET} . ${targ} BUILD_tools=no BUILD_lib=no
4571.154Stv.endfor
4581.200Slukem
4591.242Sdsldo-x11: .PHONY .MAKE
4601.263Smrg.if ${MKX11} != "no"
4611.263Smrg.if ${X11FLAVOUR} == "Xorg"
4621.254Smrg	${MAKEDIRTARGET} external/mit/xorg build
4631.263Smrg.else
4641.257Slukem	${MAKEDIRTARGET} x11 build
4651.263Smrg.endif
4661.254Smrg.else
4671.263Smrg	@echo "MKX11 is not enabled"
4681.257Slukem	@false
4691.254Smrg.endif
4701.227Slukem
4711.275Suebayasido-extsrc: .PHONY .MAKE
4721.275Suebayasi.if ${MKEXTSRC} != "no"
4731.275Suebayasi	${MAKEDIRTARGET} extsrc build
4741.275Suebayasi.else
4751.275Suebayasi	@echo "MKEXTSRC is not enabled"
4761.275Suebayasi	@false
4771.275Suebayasi.endif
4781.275Suebayasi
4791.242Sdsldo-obsolete: .PHONY .MAKE
4801.232Slukem	${MAKEDIRTARGET} etc install-obsolete-lists
4811.87Scjs
4821.193Slukem#
4831.137Stv# Speedup stubs for some subtrees that don't need to run these rules.
4841.137Stv# (Tells <bsd.subdir.mk> not to recurse for them.)
4851.193Slukem#
4861.129Stv
4871.292Sveego.for dir in bin etc distrib games libexec regress sbin usr.bin usr.sbin tools
4881.228Slukemincludes-${dir}: .PHONY
4891.152Stv	@true
4901.152Stv.endfor
4911.152Stv.for dir in etc distrib regress
4921.228Slukeminstall-${dir}: .PHONY
4931.152Stv	@true
4941.152Stv.endfor
4951.152Stv
4961.193Slukem#
4971.152Stv# XXX this needs to change when distrib Makefiles are recursion compliant
4981.193Slukem# XXX many distrib subdirs need "cd etc && make snap_pre snap_kern" first...
4991.193Slukem#
5001.228Slukemdependall-distrib depend-distrib all-distrib: .PHONY
5011.136Snathanw	@true
5021.130Stv
5031.211Slukem.include <bsd.sys.mk>
5041.151Stv.include <bsd.obj.mk>
5051.209Slukem.include <bsd.kernobj.mk>
5061.146Stv.include <bsd.subdir.mk>
5071.144Stv
5081.209Slukem#
5091.209Slukem# Display current make(1) parameters
5101.209Slukem#
5111.242Sdslparams: .PHONY .MAKE
5121.232Slukem	${MAKEDIRTARGET} etc params
513