Home | History | Annotate | Line # | Download | only in src
Makefile revision 1.297
      1 #	$NetBSD: Makefile,v 1.297 2012/08/14 13:12:15 apb Exp $
      2 
      3 #
      4 # This is the top-level makefile for building NetBSD. For an outline of
      5 # how to build a snapshot or release, as well as other release engineering
      6 # information, see http://www.NetBSD.org/developers/releng/index.html
      7 #
      8 # Not everything you can set or do is documented in this makefile. In
      9 # particular, you should review the files in /usr/share/mk (especially
     10 # bsd.README) for general information on building programs and writing
     11 # Makefiles within this structure, and see the comments in src/etc/Makefile
     12 # for further information on installation and release set options.
     13 #
     14 # Variables listed below can be set on the make command line (highest
     15 # priority), in /etc/mk.conf (middle priority), or in the environment
     16 # (lowest priority).
     17 #
     18 # Variables:
     19 #   DESTDIR is the target directory for installation of the compiled
     20 #	software. It defaults to /. Note that programs are built against
     21 #	libraries installed in DESTDIR.
     22 #   MKMAN, if `no', will prevent building of manual pages.
     23 #   MKOBJDIRS, if not `no', will build object directories at
     24 #	an appropriate point in a build.
     25 #   MKSHARE, if `no', will prevent building and installing
     26 #	anything in /usr/share.
     27 #   MKUPDATE, if not `no', will avoid a `make cleandir' at the start of
     28 #	`make build', as well as having the effects listed in
     29 #	/usr/share/mk/bsd.README.
     30 #   NOCLEANDIR, if defined, will avoid a `make cleandir' at the start
     31 #	of the `make build'.
     32 #   NOINCLUDES will avoid the `make includes' usually done by `make build'.
     33 #
     34 #   See mk.conf(5) for more details.
     35 #
     36 #
     37 # Targets:
     38 #   build:
     39 #	Builds a full release of NetBSD in DESTDIR, except for the
     40 #	/etc configuration files.
     41 #	If BUILD_DONE is set, this is an empty target.
     42 #   distribution:
     43 #	Builds a full release of NetBSD in DESTDIR, including the /etc
     44 #	configuration files.
     45 #   buildworld:
     46 #	As per `make distribution', except that it ensures that DESTDIR
     47 #	is not the root directory.
     48 #   installworld:
     49 #	Install the distribution from DESTDIR to INSTALLWORLDDIR (which
     50 #	defaults to the root directory).  Ensures that INSTALLWORLDDIR
     51 #	is not the root directory if cross compiling.
     52 #   release:
     53 #	Does a `make distribution', and then tars up the DESTDIR files
     54 #	into ${RELEASEDIR}/${RELEASEMACHINEDIR}, in release(7) format.
     55 #	(See etc/Makefile for more information on this.)
     56 #   regression-tests:
     57 #	Runs the regression tests in "regress" on this host.
     58 #   sets:
     59 #	Populate ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets
     60 #	from ${DESTDIR}
     61 #   sourcesets:
     62 #	Populate ${RELEASEDIR}/source/sets from ${NETBSDSRCDIR}
     63 #   syspkgs:
     64 #	Populate ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/syspkgs
     65 #	from ${DESTDIR}
     66 #   iso-image:
     67 #	Create CD-ROM image in RELEASEDIR/iso.
     68 #	RELEASEDIR must already have been populated by `make release'
     69 #	or equivalent.
     70 #   iso-image-source:
     71 #	Create CD-ROM image with source in RELEASEDIR/iso.
     72 #	RELEASEDIR must already have been populated by
     73 #	`make release sourcesets' or equivalent.
     74 #   live-image:
     75 #	Create bootable live image for emulators or USB stick etc.
     76 #	in RELEASEDIR/liveimage.
     77 #	RELEASEDIR must already have been populated by `make release'
     78 #	or equivalent.
     79 #   install-image:
     80 #	Create bootable installation image for USB stick etc.
     81 #	in RELEASEDIR/installimage.
     82 #	RELEASEDIR must already have been populated by `make release'
     83 #	or equivalent.
     84 #
     85 # Targets invoked by `make build,' in order:
     86 #   cleandir:        cleans the tree.
     87 #   do-top-obj:      creates the top level object directory.
     88 #   do-tools-obj:    creates object directories for the host toolchain.
     89 #   do-tools:        builds host toolchain.
     90 #   obj:             creates object directories.
     91 #   do-distrib-dirs: creates the distribution directories.
     92 #   includes:        installs include files.
     93 #   do-tools-compat: builds the "libnbcompat" library; needed for some
     94 #                    random host tool programs in the source tree.
     95 #   do-lib-csu:      builds and installs prerequisites from lib/csu.
     96 #   do-libgcc:       builds and installs prerequisites from
     97 #                    gnu/lib/crtstuff${LIBGCC_EXT} (if necessary) and
     98 #                    gnu/lib/libgcc${LIBGCC_EXT}.
     99 #   do-libpcc:       builds and install prerequisites from
    100 #                    external/bsd/pcc/crtstuff (if necessary) and
    101 #                    external/bsd/pcc/libpcc.
    102 #   do-lib-libc:     builds and installs prerequisites from lib/libc.
    103 #   do-lib:          builds and installs prerequisites from lib.
    104 #   do-sys-rump-dev-lib: builds and installs prerequisites from sys/rump/dev/lib
    105 #   do-sys-rump-fs-lib:  builds and installs prerequisites from sys/rump/fs/lib
    106 #   do-sys-rump-kern-lib:  builds and installs prereq. from sys/rump/kern/lib
    107 #   do-sys-rump-net-lib: builds and installs prerequisites from sys/rump/net/lib
    108 #   do-sys-modules:  builds and installs kernel modules (used by rump binaries)
    109 #   do-ld.so:        builds and installs prerequisites from libexec/ld.*_so.
    110 #   do-compat-lib-csu: builds and installs prerequisites from compat/lib/csu
    111 #                    if ${MKCOMPAT} != "no".
    112 #   do-compat-libgcc: builds and installs prerequisites from
    113 #                    compat/gnu/lib/crtstuff${LIBGCC_EXT} (if necessary) and
    114 #                    compat/gnu/lib/libgcc${LIBGCC_EXT} if ${MKCOMPAT} != "no".
    115 #   do-compat-lib-libc: builds and installs prerequisites from compat/lib/libc
    116 #                    if ${MKCOMPAT} != "no".
    117 #   do-build:        builds and installs the entire system.
    118 #   do-x11:          builds and installs X11 if ${MKX11} != "no"; either
    119 #                    X11R7 from src/external/mit/xorg if ${X11FLAVOUR} == "Xorg"
    120 #                    or X11R6 from src/x11
    121 #   do-extsrc:       builds and installs extsrc if ${MKEXTSRC} != "no".
    122 #   do-obsolete:     installs the obsolete sets (for the postinstall-* targets).
    123 #
    124 
    125 .if ${.MAKEFLAGS:M${.CURDIR}/share/mk} == ""
    126 .MAKEFLAGS: -m ${.CURDIR}/share/mk
    127 .endif
    128 
    129 #
    130 # If _SRC_TOP_OBJ_ gets set here, we will end up with a directory that may
    131 # not be the top level objdir, because "make obj" can happen in the *middle*
    132 # of "make build" (long after <bsd.own.mk> is calculated it).  So, pre-set
    133 # _SRC_TOP_OBJ_ here so it will not be added to ${.MAKEOVERRIDES}.
    134 #
    135 _SRC_TOP_OBJ_=
    136 
    137 .include <bsd.own.mk>
    138 
    139 #
    140 # Sanity check: make sure that "make build" is not invoked simultaneously
    141 # with a standard recursive target.
    142 #
    143 
    144 .if make(build) || make(release) || make(snapshot)
    145 .for targ in ${TARGETS:Nobj:Ncleandir}
    146 .if make(${targ}) && !target(.BEGIN)
    147 .BEGIN:
    148 	@echo 'BUILD ABORTED: "make build" and "make ${targ}" are mutually exclusive.'
    149 	@false
    150 .endif
    151 .endfor
    152 .endif
    153 
    154 #
    155 # _SUBDIR is used to set SUBDIR, after removing directories that have
    156 # BUILD_${dir}=no, or that have no ${dir}/Makefile.
    157 #
    158 _SUBDIR=	tools lib include gnu external crypto/external bin games
    159 _SUBDIR+=	libexec sbin usr.bin
    160 _SUBDIR+=	usr.sbin share rescue sys etc tests compat .WAIT distrib regress
    161 
    162 .for dir in ${_SUBDIR}
    163 .if "${dir}" == ".WAIT" \
    164 	|| (${BUILD_${dir}:Uyes} != "no" && exists(${dir}/Makefile))
    165 SUBDIR+=	${dir}
    166 .endif
    167 .endfor
    168 
    169 .if exists(regress)
    170 regression-tests: .PHONY .MAKE
    171 	@echo Running regression tests...
    172 	${MAKEDIRTARGET} regress regress
    173 .endif
    174 
    175 .if ${MKUNPRIVED} != "no"
    176 NOPOSTINSTALL=	# defined
    177 .endif
    178 
    179 afterinstall: .PHONY .MAKE
    180 .if ${MKMAN} != "no"
    181 	${MAKEDIRTARGET} share/man makedb
    182 .endif
    183 .if (${MKUNPRIVED} != "no" && ${MKINFO} != "no")
    184 	${MAKEDIRTARGET} gnu/usr.bin/texinfo/install-info infodir-meta
    185 .endif
    186 .if !defined(NOPOSTINSTALL)
    187 	${MAKEDIRTARGET} . postinstall-check
    188 .endif
    189 
    190 _POSTINSTALL=	${.CURDIR}/usr.sbin/postinstall/postinstall
    191 _POSTINSTALL_ENV= \
    192 	AWK=${TOOL_AWK:Q}		\
    193 	DB=${TOOL_DB:Q}			\
    194 	MAKE=${MAKE:Q}			\
    195 	PWD_MKDB=${TOOL_PWD_MKDB:Q}	\
    196 	STAT=${TOOL_STAT:Q}
    197 
    198 postinstall-check: .PHONY
    199 	@echo "   === Post installation checks ==="
    200 	${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} -d ${DESTDIR}/ check; if [ $$? -gt 1 ]; then exit 1; fi
    201 	@echo "   ================================"
    202 
    203 postinstall-fix: .NOTMAIN .PHONY
    204 	@echo "   === Post installation fixes ==="
    205 	${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} -d ${DESTDIR}/ fix
    206 	@echo "   ==============================="
    207 
    208 postinstall-fix-obsolete: .NOTMAIN .PHONY
    209 	@echo "   === Removing obsolete files ==="
    210 	${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} -d ${DESTDIR}/ fix obsolete
    211 	@echo "   ==============================="
    212 
    213 
    214 #
    215 # Targets (in order!) called by "make build".
    216 #
    217 .if defined(HAVE_GCC)
    218 .if ${HAVE_GCC} == "4"
    219 LIBGCC_EXT=4
    220 BUILD_CC_LIB_BASEDIR= gnu/lib
    221 BUILD_CC_LIB_BASETARGET= gnu-lib
    222 .else
    223 LIBGCC_EXT=
    224 BUILD_CC_LIB_BASEDIR= external/gpl3/gcc/lib
    225 BUILD_CC_LIB_BASETARGET= external-gpl3-gcc-lib
    226 .endif
    227 .endif
    228 
    229 BUILDTARGETS+=	check-tools
    230 .if ${MKUPDATE} == "no" && !defined(NOCLEANDIR)
    231 BUILDTARGETS+=	cleandir
    232 .endif
    233 .if ${MKOBJDIRS} != "no"
    234 BUILDTARGETS+=	do-top-obj
    235 .endif
    236 .if ${USETOOLS} == "yes"	# {
    237 .if ${MKOBJDIRS} != "no"
    238 BUILDTARGETS+=	do-tools-obj
    239 .endif
    240 BUILDTARGETS+=	do-tools
    241 .endif # USETOOLS		# }
    242 .if ${MKOBJDIRS} != "no"
    243 BUILDTARGETS+=	obj
    244 .endif
    245 BUILDTARGETS+=	clean_METALOG
    246 .if !defined(NODISTRIBDIRS)
    247 BUILDTARGETS+=	do-distrib-dirs
    248 .endif
    249 .if !defined(NOINCLUDES)
    250 BUILDTARGETS+=	includes
    251 .endif
    252 BUILDTARGETS+=	do-tools-compat
    253 BUILDTARGETS+=	do-lib-csu
    254 .if ${MKGCC} != "no"
    255 BUILDTARGETS+=	do-libgcc
    256 .endif
    257 .if ${MKPCC} != "no"
    258 BUILDTARGET+=	do-libpcc
    259 .endif
    260 BUILDTARGETS+=	do-lib-libc
    261 BUILDTARGETS+=	do-lib
    262 .if ${MKKMOD} != "no"
    263 BUILDTARGETS+=	do-sys-modules
    264 .endif
    265 .if ${MKRUMP} != "no"
    266 BUILDTARGETS+=	do-sys-rump-dev-lib do-sys-rump-fs-lib
    267 BUILDTARGETS+=	do-sys-rump-kern-lib do-sys-rump-net-lib
    268 .endif
    269 .if ${MKCOMPAT} != "no"
    270 BUILDTARGETS+=	do-compat-lib-csu
    271 BUILDTARGETS+=	do-compat-libgcc
    272 BUILDTARGETS+=	do-compat-lib-libc
    273 .endif
    274 BUILDTARGETS+=	do-ld.so
    275 BUILDTARGETS+=	do-build
    276 .if ${MKX11} != "no"
    277 BUILDTARGETS+=	do-x11
    278 .endif
    279 .if ${MKEXTSRC} != "no"
    280 BUILDTARGETS+=	do-extsrc
    281 .endif
    282 BUILDTARGETS+=	do-obsolete
    283 
    284 #
    285 # Enforce proper ordering of some rules.
    286 #
    287 
    288 .ORDER:		${BUILDTARGETS}
    289 includes-lib:	.PHONY includes-include includes-sys
    290 includes-gnu:	.PHONY includes-lib
    291 
    292 #
    293 # Build the system and install into DESTDIR.
    294 #
    295 
    296 START_TIME!=	date
    297 
    298 build: .PHONY .MAKE
    299 .if defined(BUILD_DONE)
    300 	@echo "Build already installed into ${DESTDIR}"
    301 .else
    302 	@echo "Build started at: ${START_TIME}"
    303 .for tgt in ${BUILDTARGETS}
    304 	${MAKEDIRTARGET} . ${tgt}
    305 .endfor
    306 	${MAKEDIRTARGET} etc install-etc-release
    307 	@echo   "Build started at:  ${START_TIME}"
    308 	@printf "Build finished at: " && date
    309 .endif
    310 
    311 #
    312 # Build a full distribution, but not a release (i.e. no sets into
    313 # ${RELEASEDIR}).  "buildworld" enforces a build to ${DESTDIR} != /
    314 #
    315 
    316 distribution buildworld: .PHONY .MAKE
    317 .if make(buildworld) && \
    318     (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/")
    319 	@echo "Won't make ${.TARGET} with DESTDIR=/"
    320 	@false
    321 .endif
    322 	${MAKEDIRTARGET} . build NOPOSTINSTALL=1
    323 	${MAKEDIRTARGET} etc distribution INSTALL_DONE=1
    324 .if defined(DESTDIR) && ${DESTDIR} != "" && ${DESTDIR} != "/"
    325 	${MAKEDIRTARGET} . postinstall-fix-obsolete
    326 	${MAKEDIRTARGET} distrib/sets checkflist
    327 .endif
    328 	@echo   "make ${.TARGET} started at:  ${START_TIME}"
    329 	@printf "make ${.TARGET} finished at: " && date
    330 
    331 #
    332 # Install the distribution from $DESTDIR to $INSTALLWORLDDIR (defaults to `/')
    333 # If installing to /, ensures that the host's operating system is NetBSD and
    334 # the host's `uname -m` == ${MACHINE}.
    335 #
    336 
    337 HOST_UNAME_S!=	uname -s
    338 HOST_UNAME_M!=	uname -m
    339 
    340 installworld: .PHONY .MAKE
    341 .if (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/")
    342 	@echo "Can't make ${.TARGET} to DESTDIR=/"
    343 	@false
    344 .endif
    345 .if !defined(INSTALLWORLDDIR) || \
    346     ${INSTALLWORLDDIR} == "" || ${INSTALLWORLDDIR} == "/"
    347 .if (${HOST_UNAME_S} != "NetBSD")
    348 	@echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_S} to NetBSD with INSTALLWORLDDIR=/"
    349 	@false
    350 .endif
    351 .if (${HOST_UNAME_M} != ${MACHINE})
    352 	@echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_M} to ${MACHINE} with INSTALLWORLDDIR=/"
    353 	@false
    354 .endif
    355 .endif
    356 	${MAKEDIRTARGET} distrib/sets installsets \
    357 		INSTALLDIR=${INSTALLWORLDDIR:U/} INSTALLSETS=${INSTALLSETS:Q}
    358 	${MAKEDIRTARGET} . postinstall-check DESTDIR=${INSTALLWORLDDIR}
    359 	@echo   "make ${.TARGET} started at:  ${START_TIME}"
    360 	@printf "make ${.TARGET} finished at: " && date
    361 
    362 #
    363 # Install modules from $DESTDIR to $INSTALLMODULESDIR
    364 #
    365 installmodules: .PHONY .MAKE
    366 .if (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/")
    367 	@echo "Can't make ${.TARGET} to DESTDIR=/"
    368 	@false
    369 .endif
    370 .if !defined(INSTALLMODULESDIR) || \
    371     ${INSTALLMODULESDIR} == "" || ${INSTALLMODULESDIR} == "/"
    372 .if (${HOST_UNAME_S} != "NetBSD")
    373 	@echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_S} to NetBSD with INSTALLMODULESDIR=/"
    374 	@false
    375 .endif
    376 .if (${HOST_UNAME_M} != ${MACHINE})
    377 	@echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_M} to ${MACHINE} with INSTALLMODULESDIR=/"
    378 	@false
    379 .endif
    380 .endif
    381 	${MAKEDIRTARGET} sys/modules install DESTDIR=${INSTALLMODULESDIR:U/}
    382 	@echo   "make ${.TARGET} started at:  ${START_TIME}"
    383 	@printf "make ${.TARGET} finished at: " && date
    384 
    385 #
    386 # Create sets from $DESTDIR or $NETBSDSRCDIR into $RELEASEDIR
    387 #
    388 
    389 .for tgt in sets sourcesets syspkgs
    390 ${tgt}: .PHONY .MAKE
    391 	${MAKEDIRTARGET} distrib/sets ${tgt}
    392 .endfor
    393 
    394 #
    395 # Build a release or snapshot (implies "make distribution").  Note that
    396 # in this case, the set lists will be checked before the tar files
    397 # are made.
    398 #
    399 
    400 release snapshot: .PHONY .MAKE
    401 	${MAKEDIRTARGET} . distribution
    402 	${MAKEDIRTARGET} etc release DISTRIBUTION_DONE=1
    403 	@echo   "make ${.TARGET} started at:  ${START_TIME}"
    404 	@printf "make ${.TARGET} finished at: " && date
    405 
    406 #
    407 # Create a CD-ROM image.
    408 #
    409 
    410 iso-image: .PHONY
    411 	${MAKEDIRTARGET} distrib iso_image
    412 	${MAKEDIRTARGET} etc iso-image
    413 	@echo   "make ${.TARGET} started at:  ${START_TIME}"
    414 	@printf "make ${.TARGET} finished at: " && date
    415 
    416 iso-image-source: .PHONY
    417 	${MAKEDIRTARGET} distrib iso_image CDSOURCE=true
    418 	${MAKEDIRTARGET} etc iso-image
    419 	@echo   "make ${.TARGET} started at:  ${START_TIME}"
    420 	@printf "make ${.TARGET} finished at: " && date
    421 
    422 #
    423 # Create bootable live images.
    424 #
    425 
    426 live-image: .PHONY
    427 	${MAKEDIRTARGET} etc live-image
    428 	@echo   "make ${.TARGET} started at:  ${START_TIME}"
    429 	@printf "make ${.TARGET} finished at: " && date
    430 
    431 #
    432 # Create bootable installation images.
    433 #
    434 
    435 install-image: .PHONY
    436 	${MAKEDIRTARGET} etc install-image
    437 	@echo   "make ${.TARGET} started at:  ${START_TIME}"
    438 	@printf "make ${.TARGET} finished at: " && date
    439 
    440 #
    441 # Special components of the "make build" process.
    442 #
    443 
    444 check-tools: .PHONY
    445 .if ${TOOLCHAIN_MISSING} != "no" && !defined(EXTERNAL_TOOLCHAIN)
    446 	@echo '*** WARNING:  Building on MACHINE=${MACHINE} with missing toolchain.'
    447 	@echo '*** May result in a failed build or corrupt binaries!'
    448 .elif defined(EXTERNAL_TOOLCHAIN)
    449 	@echo '*** Using external toolchain rooted at ${EXTERNAL_TOOLCHAIN}.'
    450 .endif
    451 .if defined(NBUILDJOBS)
    452 	@echo '*** WARNING: NBUILDJOBS is obsolete; use -j directly instead!'
    453 .endif
    454 
    455 # Delete or sanitise a leftover METALOG from a previous build.
    456 clean_METALOG: .PHONY .MAKE
    457 .if ${MKUPDATE} != "no"
    458 	${MAKEDIRTARGET} distrib/sets clean_METALOG
    459 .endif
    460 
    461 do-distrib-dirs: .PHONY .MAKE
    462 .if !defined(DESTDIR) || ${DESTDIR} == ""
    463 	${MAKEDIRTARGET} etc distrib-dirs DESTDIR=/
    464 .else
    465 	${MAKEDIRTARGET} etc distrib-dirs DESTDIR=${DESTDIR}
    466 .endif
    467 
    468 .for targ in cleandir obj includes
    469 do-${targ}: .PHONY ${targ}
    470 	@true
    471 .endfor
    472 
    473 .if defined(HAVE_GCC)
    474 .if ${USE_COMPILERCRTSTUFF} == "yes"
    475 BUILD_CC_LIB= ${BUILD_CC_LIB_BASEDIR}/crtstuff${LIBGCC_EXT}
    476 .endif
    477 BUILD_CC_LIB+= ${BUILD_CC_LIB_BASEDIR}/libgcc${LIBGCC_EXT}
    478 .elif defined(HAVE_PCC)
    479 BUILD_CC_LIB+= external/bsd/pcc/crtstuff
    480 BUILD_CC_LIB+= external/bsd/pcc/libpcc
    481 .endif
    482 
    483 .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
    484 do-${dir:S/\//-/g}: .PHONY .MAKE
    485 .for targ in dependall install
    486 	${MAKEDIRTARGET} ${dir} ${targ}
    487 .endfor
    488 .endfor
    489 
    490 .if ${MKCOMPAT} != "no"
    491 COMPAT_SUBDIR_LIST=lib/csu ${BUILD_CC_LIB} lib/libc
    492 .for dir in ${COMPAT_SUBDIR_LIST}
    493 do-compat-${dir:S/\//-/g}: .PHONY .MAKE
    494 .for targ in dependall install
    495 	${MAKEDIRTARGET} compat ${targ} BOOTSTRAP_SUBDIRS="../../../${dir}"
    496 .endfor
    497 .endfor
    498 .endif
    499 
    500 do-top-obj: .PHONY .MAKE
    501 	${MAKEDIRTARGET} . obj NOSUBDIR=
    502 
    503 do-tools-obj: .PHONY .MAKE
    504 	${MAKEDIRTARGET} tools obj
    505 
    506 do-libgcc: .PHONY .MAKE
    507 .if defined(HAVE_GCC)
    508 .if ${MKGCC} != "no"
    509 .if ${USE_COMPILERCRTSTUFF} == "yes"
    510 	${MAKEDIRTARGET} . do-${BUILD_CC_LIB_BASETARGET}-crtstuff${LIBGCC_EXT}
    511 .endif
    512 	${MAKEDIRTARGET} . do-${BUILD_CC_LIB_BASETARGET}-libgcc${LIBGCC_EXT}
    513 .endif
    514 .endif
    515 
    516 do-compat-libgcc: .PHONY .MAKE
    517 .if defined(HAVE_GCC)
    518 .if ${MKGCC} != "no"
    519 .if ${USE_COMPILERCRTSTUFF} == "yes"
    520 	${MAKEDIRTARGET} . do-compat-${BUILD_CC_LIB_BASETARGET}-crtstuff${LIBGCC_EXT}
    521 .endif
    522 	${MAKEDIRTARGET} . do-compat-${BUILD_CC_LIB_BASETARGET}-libgcc${LIBGCC_EXT}
    523 .endif
    524 .endif
    525 
    526 do-libpcc: .PHONY .MAKE
    527 .if defined(HAVE_PCC)
    528 .if ${MKPCC} != "no"
    529 .if ${USE_COMPILERCRTSTUFF} == "yes"
    530 	${MAKEDIRTARGET} . do-pcc-lib-crtstuff
    531 .endif
    532 	${MAKEDIRTARGET} . do-pcc-lib-libpcc
    533 .endif
    534 .endif
    535 
    536 do-ld.so: .PHONY .MAKE
    537 .for targ in dependall install
    538 	${MAKEDIRTARGET} libexec/ld.elf_so ${targ}
    539 .endfor
    540 
    541 do-build: .PHONY .MAKE
    542 .for targ in dependall install
    543 	${MAKEDIRTARGET} . ${targ} BUILD_tools=no BUILD_lib=no
    544 .endfor
    545 
    546 do-x11: .PHONY .MAKE
    547 .if ${MKX11} != "no"
    548 .if ${X11FLAVOUR} == "Xorg"
    549 	${MAKEDIRTARGET} external/mit/xorg build
    550 .else
    551 	${MAKEDIRTARGET} x11 build
    552 .endif
    553 .else
    554 	@echo "MKX11 is not enabled"
    555 	@false
    556 .endif
    557 
    558 do-extsrc: .PHONY .MAKE
    559 .if ${MKEXTSRC} != "no"
    560 	${MAKEDIRTARGET} extsrc build
    561 .else
    562 	@echo "MKEXTSRC is not enabled"
    563 	@false
    564 .endif
    565 
    566 do-obsolete: .PHONY .MAKE
    567 	${MAKEDIRTARGET} etc install-obsolete-lists
    568 
    569 #
    570 # Speedup stubs for some subtrees that don't need to run these rules.
    571 # (Tells <bsd.subdir.mk> not to recurse for them.)
    572 #
    573 
    574 .for dir in bin etc distrib games libexec regress sbin usr.bin usr.sbin tools
    575 includes-${dir}: .PHONY
    576 	@true
    577 .endfor
    578 .for dir in etc distrib regress
    579 install-${dir}: .PHONY
    580 	@true
    581 .endfor
    582 
    583 #
    584 # XXX this needs to change when distrib Makefiles are recursion compliant
    585 # XXX many distrib subdirs need "cd etc && make snap_pre snap_kern" first...
    586 #
    587 dependall-distrib depend-distrib all-distrib: .PHONY
    588 	@true
    589 
    590 .include <bsd.sys.mk>
    591 .include <bsd.obj.mk>
    592 .include <bsd.kernobj.mk>
    593 .include <bsd.subdir.mk>
    594 
    595 #
    596 # Display current make(1) parameters
    597 #
    598 params: .PHONY .MAKE
    599 	${MAKEDIRTARGET} etc params
    600