Makefile revision 1.285
11.285Smrg#	$NetBSD: Makefile,v 1.285 2011/06/22 05:13:20 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.280Sskrll#                    external/bsd/pcc/crtstuff (if necessary) and
911.280Sskrll#                    external/bsd/pcc/libpcc.
921.186Sthorpej#   do-lib-libc:     builds and installs prerequisites from lib/libc.
931.143Stv#   do-lib:          builds and installs prerequisites from lib.
941.274Spooka#   do-sys-rump-dev-lib: builds and installs prerequisites from sys/rump/dev/lib
951.259Spooka#   do-sys-rump-fs-lib:  builds and installs prerequisites from sys/rump/fs/lib
961.277Spooka#   do-sys-rump-kern-lib:  builds and installs prereq. from sys/rump/kern/lib
971.259Spooka#   do-sys-rump-net-lib: builds and installs prerequisites from sys/rump/net/lib
981.265Spooka#   do-sys-modules:  builds and installs kernel modules (used by rump binaries)
991.189Sitohy#   do-ld.so:        builds and installs prerequisites from libexec/ld.*_so.
1001.262Smrg#   do-compat-lib-csu: builds and installs prerequisites from compat/lib/csu
1011.262Smrg#                    if ${MKCOMPAT} != "no".
1021.262Smrg#   do-compat-libgcc: builds and installs prerequisites from
1031.262Smrg#                    compat/gnu/lib/crtstuff${LIBGCC_EXT} (if necessary) and
1041.262Smrg#                    compat/gnu/lib/libgcc${LIBGCC_EXT} if ${MKCOMPAT} != "no".
1051.262Smrg#   do-compat-lib-libc: builds and installs prerequisites from compat/lib/libc
1061.262Smrg#                    if ${MKCOMPAT} != "no".
1071.137Stv#   do-build:        builds and installs the entire system.
1081.263Smrg#   do-x11:          builds and installs X11 if ${MKX11} != "no"; either
1091.263Smrg#                    X11R7 from src/external/mit/xorg if ${X11FLAVOUR} == "Xorg"
1101.263Smrg#                    or X11R6 from src/x11
1111.275Suebayasi#   do-extsrc:       builds and installs extsrc if ${MKEXTSRC} != "no".
1121.222Slukem#   do-obsolete:     installs the obsolete sets (for the postinstall-* targets).
1131.193Slukem#
1141.32Scgd
1151.146Stv.if ${.MAKEFLAGS:M${.CURDIR}/share/mk} == ""
1161.146Stv.MAKEFLAGS: -m ${.CURDIR}/share/mk
1171.146Stv.endif
1181.163Stv
1191.193Slukem#
1201.163Stv# If _SRC_TOP_OBJ_ gets set here, we will end up with a directory that may
1211.163Stv# not be the top level objdir, because "make obj" can happen in the *middle*
1221.163Stv# of "make build" (long after <bsd.own.mk> is calculated it).  So, pre-set
1231.163Stv# _SRC_TOP_OBJ_ here so it will not be added to ${.MAKEOVERRIDES}.
1241.193Slukem#
1251.163Stv_SRC_TOP_OBJ_=
1261.148Sjmc
1271.146Stv.include <bsd.own.mk>
1281.4Scgd
1291.193Slukem#
1301.137Stv# Sanity check: make sure that "make build" is not invoked simultaneously
1311.137Stv# with a standard recursive target.
1321.193Slukem#
1331.137Stv
1341.137Stv.if make(build) || make(release) || make(snapshot)
1351.137Stv.for targ in ${TARGETS:Nobj:Ncleandir}
1361.137Stv.if make(${targ}) && !target(.BEGIN)
1371.137Stv.BEGIN:
1381.137Stv	@echo 'BUILD ABORTED: "make build" and "make ${targ}" are mutually exclusive.'
1391.137Stv	@false
1401.137Stv.endif
1411.137Stv.endfor
1421.137Stv.endif
1431.58Stv
1441.261Sapb#
1451.261Sapb# _SUBDIR is used to set SUBDIR, after removing directories that have
1461.261Sapb# BUILD_${dir}=no, or that have no ${dir}/Makefile.
1471.261Sapb#
1481.271Schristos_SUBDIR=	tools lib include gnu external crypto/external bin games
1491.271Schristos_SUBDIR+=	libexec sbin usr.bin
1501.262Smrg_SUBDIR+=	usr.sbin share rescue sys etc tests compat .WAIT distrib regress
1511.105Sassar
1521.137Stv.for dir in ${_SUBDIR}
1531.261Sapb.if "${dir}" == ".WAIT" \
1541.261Sapb	|| (${BUILD_${dir}:Uyes} != "no" && exists(${dir}/Makefile))
1551.137StvSUBDIR+=	${dir}
1561.36Sexplorer.endif
1571.137Stv.endfor
1581.21Scgd
1591.13Sbrezak.if exists(regress)
1601.242Sdslregression-tests: .PHONY .MAKE
1611.10Scgd	@echo Running regression tests...
1621.232Slukem	${MAKEDIRTARGET} regress regress
1631.13Sbrezak.endif
1641.20Scgd
1651.214Slukem.if ${MKUNPRIVED} != "no"
1661.179SthorpejNOPOSTINSTALL=	# defined
1671.179Sthorpej.endif
1681.179Sthorpej
1691.242Sdslafterinstall: .PHONY .MAKE
1701.137Stv.if ${MKMAN} != "no"
1711.232Slukem	${MAKEDIRTARGET} share/man makedb
1721.137Stv.endif
1731.214Slukem.if (${MKUNPRIVED} != "no" && ${MKINFO} != "no")
1741.232Slukem	${MAKEDIRTARGET} gnu/usr.bin/texinfo/install-info infodir-meta
1751.176Slukem.endif
1761.179Sthorpej.if !defined(NOPOSTINSTALL)
1771.232Slukem	${MAKEDIRTARGET} . postinstall-check
1781.159Sperry.endif
1791.170Slukem
1801.239Slukem_POSTINSTALL=	${.CURDIR}/usr.sbin/postinstall/postinstall
1811.239Slukem
1821.228Slukempostinstall-check: .PHONY
1831.169Slukem	@echo "   === Post installation checks ==="
1841.268Ssketch	AWK=${TOOL_AWK:Q} MAKE=${MAKE:Q} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} -d ${DESTDIR}/ check; if [ $$? -gt 1 ]; then exit 1; fi
1851.171Slukem	@echo "   ================================"
1861.171Slukem
1871.228Slukempostinstall-fix: .NOTMAIN .PHONY
1881.171Slukem	@echo "   === Post installation fixes ==="
1891.268Ssketch	AWK=${TOOL_AWK:Q} MAKE=${MAKE:Q} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} -d ${DESTDIR}/ fix
1901.212Slukem	@echo "   ==============================="
1911.212Slukem
1921.228Slukempostinstall-fix-obsolete: .NOTMAIN .PHONY
1931.212Slukem	@echo "   === Removing obsolete files ==="
1941.268Ssketch	AWK=${TOOL_AWK:Q} MAKE=${MAKE:Q} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} -d ${DESTDIR}/ fix obsolete
1951.212Slukem	@echo "   ==============================="
1961.169Slukem
1971.108Serh
1981.193Slukem#
1991.137Stv# Targets (in order!) called by "make build".
2001.193Slukem#
2011.256Sgmcgarry.if defined(HAVE_GCC)
2021.284Smrg.if ${HAVE_GCC} == "4"
2031.284SmrgLIBGCC_EXT=4
2041.285SmrgBUILD_CC_LIB_BASEDIR= gnu/lib
2051.285SmrgBUILD_CC_LIB_BASETARGET= gnu-lib
2061.245Smrg.else
2071.285SmrgLIBGCC_EXT=
2081.285SmrgBUILD_CC_LIB_BASEDIR= external/gpl3/gcc/lib
2091.285SmrgBUILD_CC_LIB_BASETARGET= external-gpl3-gcc-lib
2101.220Smrg.endif
2111.256Sgmcgarry.endif
2121.123Smrg
2131.156StvBUILDTARGETS+=	check-tools
2141.214Slukem.if ${MKUPDATE} == "no" && !defined(NOCLEANDIR)
2151.155StvBUILDTARGETS+=	cleandir
2161.155Stv.endif
2171.261Sapb.if ${MKOBJDIRS} != "no"
2181.261SapbBUILDTARGETS+=	do-top-obj
2191.261Sapb.endif
2201.261Sapb.if ${USETOOLS} == "yes"	# {
2211.149Stv.if ${MKOBJDIRS} != "no"
2221.260SapbBUILDTARGETS+=	do-tools-obj
2231.123Smrg.endif
2241.152StvBUILDTARGETS+=	do-tools
2251.261Sapb.endif # USETOOLS		# }
2261.260Sapb.if ${MKOBJDIRS} != "no"
2271.260SapbBUILDTARGETS+=	obj
2281.260Sapb.endif
2291.270SapbBUILDTARGETS+=	clean_METALOG
2301.137Stv.if !defined(NODISTRIBDIRS)
2311.137StvBUILDTARGETS+=	do-distrib-dirs
2321.131Stv.endif
2331.137Stv.if !defined(NOINCLUDES)
2341.137StvBUILDTARGETS+=	includes
2351.131Stv.endif
2361.202SthorpejBUILDTARGETS+=	do-tools-compat
2371.231SskrllBUILDTARGETS+=	do-lib-csu
2381.207Sdrochner.if ${MKGCC} != "no"
2391.249SlukemBUILDTARGETS+=	do-libgcc
2401.207Sdrochner.endif
2411.256Sgmcgarry.if ${MKPCC} != "no"
2421.256SgmcgarryBUILDTARGET+=	do-libpcc
2431.256Sgmcgarry.endif
2441.231SskrllBUILDTARGETS+=	do-lib-libc
2451.281SplunkyBUILDTARGETS+=	do-lib
2461.283Smrg.if ${MKKMOD} != "no"
2471.265SpookaBUILDTARGETS+=	do-sys-modules
2481.265Spooka.endif
2491.277SpookaBUILDTARGETS+=	do-sys-rump-dev-lib do-sys-rump-fs-lib
2501.277SpookaBUILDTARGETS+=	do-sys-rump-kern-lib do-sys-rump-net-lib
2511.262Smrg.if ${MKCOMPAT} != "no"
2521.262SmrgBUILDTARGETS+=	do-compat-lib-csu
2531.262SmrgBUILDTARGETS+=	do-compat-libgcc
2541.262SmrgBUILDTARGETS+=	do-compat-lib-libc
2551.262Smrg.endif
2561.224SlukemBUILDTARGETS+=	do-ld.so
2571.224SlukemBUILDTARGETS+=	do-build
2581.263Smrg.if ${MKX11} != "no"
2591.227SlukemBUILDTARGETS+=	do-x11
2601.227Slukem.endif
2611.275Suebayasi.if ${MKEXTSRC} != "no"
2621.275SuebayasiBUILDTARGETS+=	do-extsrc
2631.275Suebayasi.endif
2641.200SlukemBUILDTARGETS+=	do-obsolete
2651.131Stv
2661.193Slukem#
2671.137Stv# Enforce proper ordering of some rules.
2681.193Slukem#
2691.123Smrg
2701.137Stv.ORDER:		${BUILDTARGETS}
2711.228Slukemincludes-lib:	.PHONY includes-include includes-sys
2721.228Slukemincludes-gnu:	.PHONY includes-lib
2731.123Smrg
2741.193Slukem#
2751.137Stv# Build the system and install into DESTDIR.
2761.193Slukem#
2771.123Smrg
2781.191SlukemSTART_TIME!=	date
2791.191Slukem
2801.242Sdslbuild: .PHONY .MAKE
2811.137Stv.if defined(BUILD_DONE)
2821.137Stv	@echo "Build already installed into ${DESTDIR}"
2831.137Stv.else
2841.191Slukem	@echo "Build started at: ${START_TIME}"
2851.145Stv.for tgt in ${BUILDTARGETS}
2861.232Slukem	${MAKEDIRTARGET} . ${tgt}
2871.145Stv.endfor
2881.232Slukem	${MAKEDIRTARGET} etc install-etc-release
2891.191Slukem	@echo   "Build started at:  ${START_TIME}"
2901.172Sbjh21	@printf "Build finished at: " && date
2911.71Smycroft.endif
2921.160Sthorpej
2931.193Slukem#
2941.160Sthorpej# Build a full distribution, but not a release (i.e. no sets into
2951.193Slukem# ${RELEASEDIR}).  "buildworld" enforces a build to ${DESTDIR} != /
2961.193Slukem#
2971.160Sthorpej
2981.242Sdsldistribution buildworld: .PHONY .MAKE
2991.194Slukem.if make(buildworld) && \
3001.194Slukem    (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/")
3011.193Slukem	@echo "Won't make ${.TARGET} with DESTDIR=/"
3021.193Slukem	@false
3031.193Slukem.endif
3041.232Slukem	${MAKEDIRTARGET} . build NOPOSTINSTALL=1
3051.232Slukem	${MAKEDIRTARGET} etc distribution INSTALL_DONE=1
3061.181Sthorpej.if defined(DESTDIR) && ${DESTDIR} != "" && ${DESTDIR} != "/"
3071.232Slukem	${MAKEDIRTARGET} . postinstall-fix-obsolete
3081.232Slukem	${MAKEDIRTARGET} distrib/sets checkflist
3091.181Sthorpej.endif
3101.192Slukem	@echo   "make ${.TARGET} started at:  ${START_TIME}"
3111.185Slukem	@printf "make ${.TARGET} finished at: " && date
3121.123Smrg
3131.193Slukem#
3141.193Slukem# Install the distribution from $DESTDIR to $INSTALLWORLDDIR (defaults to `/')
3151.193Slukem# If installing to /, ensures that the host's operating system is NetBSD and
3161.193Slukem# the host's `uname -m` == ${MACHINE}.
3171.193Slukem#
3181.193Slukem
3191.193SlukemHOST_UNAME_S!=	uname -s
3201.193SlukemHOST_UNAME_M!=	uname -m
3211.193Slukem
3221.242Sdslinstallworld: .PHONY .MAKE
3231.194Slukem.if (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/")
3241.193Slukem	@echo "Can't make ${.TARGET} to DESTDIR=/"
3251.193Slukem	@false
3261.193Slukem.endif
3271.193Slukem.if !defined(INSTALLWORLDDIR) || \
3281.193Slukem    ${INSTALLWORLDDIR} == "" || ${INSTALLWORLDDIR} == "/"
3291.193Slukem.if (${HOST_UNAME_S} != "NetBSD")
3301.193Slukem	@echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_S} to NetBSD with INSTALLWORLDDIR=/"
3311.193Slukem	@false
3321.193Slukem.endif
3331.193Slukem.if (${HOST_UNAME_M} != ${MACHINE})
3341.193Slukem	@echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_M} to ${MACHINE} with INSTALLWORLDDIR=/"
3351.193Slukem	@false
3361.193Slukem.endif
3371.193Slukem.endif
3381.232Slukem	${MAKEDIRTARGET} distrib/sets installsets \
3391.282Sjym		INSTALLDIR=${INSTALLWORLDDIR:U/} INSTALLSETS=${INSTALLSETS:Q}
3401.232Slukem	${MAKEDIRTARGET} . postinstall-check DESTDIR=${INSTALLWORLDDIR}
3411.193Slukem	@echo   "make ${.TARGET} started at:  ${START_TIME}"
3421.193Slukem	@printf "make ${.TARGET} finished at: " && date
3431.199Slukem
3441.199Slukem#
3451.206Slukem# Create sets from $DESTDIR or $NETBSDSRCDIR into $RELEASEDIR
3461.199Slukem#
3471.199Slukem
3481.241Sapb.for tgt in sets sourcesets syspkgs
3491.242Sdsl${tgt}: .PHONY .MAKE
3501.232Slukem	${MAKEDIRTARGET} distrib/sets ${tgt}
3511.206Slukem.endfor
3521.193Slukem
3531.193Slukem#
3541.240Slukem# Build a release or snapshot (implies "make distribution").  Note that
3551.181Sthorpej# in this case, the set lists will be checked before the tar files
3561.181Sthorpej# are made.
3571.193Slukem#
3581.123Smrg
3591.242Sdslrelease snapshot: .PHONY .MAKE
3601.240Slukem	${MAKEDIRTARGET} . distribution
3611.240Slukem	${MAKEDIRTARGET} etc release DISTRIBUTION_DONE=1
3621.192Slukem	@echo   "make ${.TARGET} started at:  ${START_TIME}"
3631.185Slukem	@printf "make ${.TARGET} finished at: " && date
3641.123Smrg
3651.193Slukem#
3661.243Sapb# Create a CD-ROM image.
3671.243Sapb#
3681.243Sapb
3691.243Sapbiso-image: .PHONY
3701.247Sbouyer	${MAKEDIRTARGET} distrib iso_image
3711.243Sapb	${MAKEDIRTARGET} etc iso-image
3721.243Sapb	@echo   "make ${.TARGET} started at:  ${START_TIME}"
3731.243Sapb	@printf "make ${.TARGET} finished at: " && date
3741.243Sapb
3751.248Sjnemethiso-image-source: .PHONY
3761.248Sjnemeth	${MAKEDIRTARGET} distrib iso_image CDSOURCE=true
3771.248Sjnemeth	${MAKEDIRTARGET} etc iso-image
3781.248Sjnemeth	@echo   "make ${.TARGET} started at:  ${START_TIME}"
3791.248Sjnemeth	@printf "make ${.TARGET} finished at: " && date
3801.248Sjnemeth
3811.243Sapb#
3821.137Stv# Special components of the "make build" process.
3831.193Slukem#
3841.156Stv
3851.228Slukemcheck-tools: .PHONY
3861.223Slukem.if ${TOOLCHAIN_MISSING} != "no" && !defined(EXTERNAL_TOOLCHAIN)
3871.187Sthorpej	@echo '*** WARNING:  Building on MACHINE=${MACHINE} with missing toolchain.'
3881.187Sthorpej	@echo '*** May result in a failed build or corrupt binaries!'
3891.187Sthorpej.elif defined(EXTERNAL_TOOLCHAIN)
3901.187Sthorpej	@echo '*** Using external toolchain rooted at ${EXTERNAL_TOOLCHAIN}.'
3911.156Stv.endif
3921.173Ssommerfe.if defined(NBUILDJOBS)
3931.173Ssommerfe	@echo '*** WARNING: NBUILDJOBS is obsolete; use -j directly instead!'
3941.173Ssommerfe.endif
3951.123Smrg
3961.270Sapb# Delete or sanitise a leftover METALOG from a previous build.
3971.270Sapbclean_METALOG: .PHONY .MAKE
3981.270Sapb.if ${MKUPDATE} != "no"
3991.270Sapb	${MAKEDIRTARGET} distrib/sets clean_METALOG
4001.270Sapb.endif
4011.270Sapb
4021.242Sdsldo-distrib-dirs: .PHONY .MAKE
4031.147Sjmc.if !defined(DESTDIR) || ${DESTDIR} == ""
4041.232Slukem	${MAKEDIRTARGET} etc distrib-dirs DESTDIR=/
4051.147Sjmc.else
4061.232Slukem	${MAKEDIRTARGET} etc distrib-dirs DESTDIR=${DESTDIR}
4071.147Sjmc.endif
4081.190Slukem
4091.190Slukem.for targ in cleandir obj includes
4101.228Slukemdo-${targ}: .PHONY ${targ}
4111.190Slukem	@true
4121.190Slukem.endfor
4131.123Smrg
4141.256Sgmcgarry.if defined(HAVE_GCC)
4151.285Smrg.    if ${HAVE_GCC} != 45	# XXX for now
4161.280Sskrll.if ${USE_COMPILERCRTSTUFF} == "yes"
4171.285SmrgBUILD_CC_LIB= ${BUILD_CC_LIB_BASEDIR}/crtstuff${LIBGCC_EXT}
4181.280Sskrll.endif
4191.285SmrgBUILD_CC_LIB+= ${BUILD_CC_LIB_BASEDIR}/libgcc${LIBGCC_EXT}
4201.285Smrg.    endif
4211.256Sgmcgarry.elif defined(HAVE_PCC)
4221.256SgmcgarryBUILD_CC_LIB+= external/bsd/pcc/crtstuff
4231.256SgmcgarryBUILD_CC_LIB+= external/bsd/pcc/libpcc
4241.256Sgmcgarry.endif
4251.256Sgmcgarry
4261.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
4271.242Sdsldo-${dir:S/\//-/g}: .PHONY .MAKE
4281.137Stv.for targ in dependall install
4291.232Slukem	${MAKEDIRTARGET} ${dir} ${targ}
4301.137Stv.endfor
4311.184Slukem.endfor
4321.184Slukem
4331.276Smrg.if ${MKCOMPAT} != "no"
4341.276SmrgCOMPAT_SUBDIR_LIST=lib/csu ${BUILD_CC_LIB} lib/libc
4351.276Smrg.for dir in ${COMPAT_SUBDIR_LIST}
4361.276Smrgdo-compat-${dir:S/\//-/g}: .PHONY .MAKE
4371.281Splunky.for targ in dependall install
4381.276Smrg	${MAKEDIRTARGET} compat ${targ} BOOTSTRAP_SUBDIRS="../../../${dir}"
4391.276Smrg.endfor
4401.276Smrg.endfor
4411.276Smrg.endif
4421.276Smrg
4431.261Sapbdo-top-obj: .PHONY .MAKE
4441.261Sapb	${MAKEDIRTARGET} . obj NOSUBDIR=
4451.261Sapb
4461.260Sapbdo-tools-obj: .PHONY .MAKE
4471.260Sapb	${MAKEDIRTARGET} tools obj
4481.260Sapb
4491.249Slukemdo-libgcc: .PHONY .MAKE
4501.256Sgmcgarry.if defined(HAVE_GCC)
4511.285Smrg.    if ${HAVE_GCC} != 45	# XXX for now
4521.249Slukem.if ${MKGCC} != "no"
4531.280Sskrll.if ${USE_COMPILERCRTSTUFF} == "yes"
4541.285Smrg	${MAKEDIRTARGET} . do-${BUILD_CC_LIB_BASETARGET}-crtstuff${LIBGCC_EXT}
4551.249Slukem.endif
4561.285Smrg	${MAKEDIRTARGET} . do-${BUILD_CC_LIB_BASETARGET}-libgcc${LIBGCC_EXT}
4571.249Slukem.endif
4581.285Smrg.    endif
4591.256Sgmcgarry.endif
4601.256Sgmcgarry
4611.262Smrgdo-compat-libgcc: .PHONY .MAKE
4621.262Smrg.if defined(HAVE_GCC)
4631.285Smrg.    if ${HAVE_GCC} != 45	# XXX for now
4641.262Smrg.if ${MKGCC} != "no"
4651.280Sskrll.if ${USE_COMPILERCRTSTUFF} == "yes"
4661.285Smrg	${MAKEDIRTARGET} . do-compat-${BUILD_CC_LIB_BASETARGET}-crtstuff${LIBGCC_EXT}
4671.280Sskrll.endif
4681.285Smrg	${MAKEDIRTARGET} . do-compat-${BUILD_CC_LIB_BASETARGET}-libgcc${LIBGCC_EXT}
4691.262Smrg.endif
4701.285Smrg.    endif
4711.262Smrg.endif
4721.262Smrg
4731.256Sgmcgarrydo-libpcc: .PHONY .MAKE
4741.256Sgmcgarry.if defined(HAVE_PCC)
4751.256Sgmcgarry.if ${MKPCC} != "no"
4761.280Sskrll.if ${USE_COMPILERCRTSTUFF} == "yes"
4771.256Sgmcgarry	${MAKEDIRTARGET} . do-pcc-lib-crtstuff
4781.280Sskrll.endif
4791.256Sgmcgarry	${MAKEDIRTARGET} . do-pcc-lib-libpcc
4801.256Sgmcgarry.endif
4811.256Sgmcgarry.endif
4821.249Slukem
4831.242Sdsldo-ld.so: .PHONY .MAKE
4841.184Slukem.for targ in dependall install
4851.232Slukem	${MAKEDIRTARGET} libexec/ld.elf_so ${targ}
4861.137Stv.endfor
4871.143Stv
4881.242Sdsldo-build: .PHONY .MAKE
4891.154Stv.for targ in dependall install
4901.232Slukem	${MAKEDIRTARGET} . ${targ} BUILD_tools=no BUILD_lib=no
4911.154Stv.endfor
4921.200Slukem
4931.242Sdsldo-x11: .PHONY .MAKE
4941.263Smrg.if ${MKX11} != "no"
4951.263Smrg.if ${X11FLAVOUR} == "Xorg"
4961.254Smrg	${MAKEDIRTARGET} external/mit/xorg build
4971.263Smrg.else
4981.257Slukem	${MAKEDIRTARGET} x11 build
4991.263Smrg.endif
5001.254Smrg.else
5011.263Smrg	@echo "MKX11 is not enabled"
5021.257Slukem	@false
5031.254Smrg.endif
5041.227Slukem
5051.275Suebayasido-extsrc: .PHONY .MAKE
5061.275Suebayasi.if ${MKEXTSRC} != "no"
5071.275Suebayasi	${MAKEDIRTARGET} extsrc build
5081.275Suebayasi.else
5091.275Suebayasi	@echo "MKEXTSRC is not enabled"
5101.275Suebayasi	@false
5111.275Suebayasi.endif
5121.275Suebayasi
5131.242Sdsldo-obsolete: .PHONY .MAKE
5141.232Slukem	${MAKEDIRTARGET} etc install-obsolete-lists
5151.87Scjs
5161.193Slukem#
5171.137Stv# Speedup stubs for some subtrees that don't need to run these rules.
5181.137Stv# (Tells <bsd.subdir.mk> not to recurse for them.)
5191.193Slukem#
5201.129Stv
5211.152Stv.for dir in bin etc distrib games libexec regress sbin usr.sbin tools
5221.228Slukemincludes-${dir}: .PHONY
5231.152Stv	@true
5241.152Stv.endfor
5251.152Stv.for dir in etc distrib regress
5261.228Slukeminstall-${dir}: .PHONY
5271.152Stv	@true
5281.152Stv.endfor
5291.152Stv
5301.193Slukem#
5311.152Stv# XXX this needs to change when distrib Makefiles are recursion compliant
5321.193Slukem# XXX many distrib subdirs need "cd etc && make snap_pre snap_kern" first...
5331.193Slukem#
5341.228Slukemdependall-distrib depend-distrib all-distrib: .PHONY
5351.136Snathanw	@true
5361.130Stv
5371.211Slukem.include <bsd.sys.mk>
5381.151Stv.include <bsd.obj.mk>
5391.209Slukem.include <bsd.kernobj.mk>
5401.146Stv.include <bsd.subdir.mk>
5411.144Stv
5421.228Slukembuild-docs: .PHONY ${.CURDIR}/BUILDING
5431.188Slukem${.CURDIR}/BUILDING: doc/BUILDING.mdoc
5441.230Slukem	${_MKMSG_CREATE} ${.TARGET}
5451.216Slukem	${TOOL_GROFF} -mdoc -Tascii -P-bou $> >$@
5461.209Slukem
5471.209Slukem
5481.209Slukem#
5491.209Slukem# Display current make(1) parameters
5501.209Slukem#
5511.242Sdslparams: .PHONY .MAKE
5521.232Slukem	${MAKEDIRTARGET} etc params
553