4 # The user-driven targets are:
6 # universe - *Really* build *everything* (buildworld and
7 # all kernels on all architectures). Define
8 # MAKE_JUST_KERNELS to only build kernels,
9 # MAKE_JUST_WORLDS to only build userland, and/or
10 # MAKE_OBSOLETE_GCC to also build architectures
11 # unsupported by clang using in-tree gcc.
12 # tinderbox - Same as universe, but presents a list of failed build
13 # targets and exits with an error if there were any.
14 # buildworld - Rebuild *everything*, including glue to help do
16 # installworld - Install everything built by "buildworld".
17 # world - buildworld + installworld, no kernel.
18 # buildkernel - Rebuild the kernel and the kernel-modules.
19 # installkernel - Install the kernel and the kernel-modules.
21 # reinstallkernel - Reinstall the kernel and the kernel-modules.
22 # reinstallkernel.debug
23 # kernel - buildkernel + installkernel.
24 # kernel-toolchain - Builds the subset of world necessary to build a kernel
25 # kernel-toolchains - Build kernel-toolchain for all universe targets.
26 # doxygen - Build API documentation of the kernel, needs doxygen.
27 # update - Convenient way to update your source tree(s).
28 # checkworld - Run test suite on installed world.
29 # check-old - List obsolete directories/files/libraries.
30 # check-old-dirs - List obsolete directories.
31 # check-old-files - List obsolete files.
32 # check-old-libs - List obsolete libraries.
33 # delete-old - Delete obsolete directories/files.
34 # delete-old-dirs - Delete obsolete directories.
35 # delete-old-files - Delete obsolete files.
36 # delete-old-libs - Delete obsolete libraries.
37 # targets - Print a list of supported TARGET/TARGET_ARCH pairs
38 # for world and kernel targets.
39 # toolchains - Build a toolchain for all world and kernel targets.
40 # makeman - Regenerate src.conf(5)
41 # sysent - (Re)build syscall entries from syscalls.master.
42 # xdev - xdev-build + xdev-install for the architecture
43 # specified with TARGET and TARGET_ARCH.
44 # xdev-build - Build cross-development tools.
45 # xdev-install - Install cross-development tools.
46 # xdev-links - Create traditional links in /usr/bin for cc, etc
47 # native-xtools - Create host binaries that produce target objects
48 # for use in qemu user-mode jails. TARGET and
49 # TARGET_ARCH should be defined.
50 # native-xtools-install
51 # - Install the files to the given DESTDIR/NXTP where
52 # NXTP defaults to /nxb-bin.
54 # This makefile is simple by design. The FreeBSD make automatically reads
55 # the /usr/share/mk/sys.mk unless the -m argument is specified on the
56 # command line. By keeping this makefile simple, it doesn't matter too
57 # much how different the installed mk files are from those in the source
58 # tree. This makefile executes a child make process, forcing it to use
59 # the mk files from the source tree which are supposed to DTRT.
61 # Most of the user-driven targets (as listed above) are implemented in
62 # Makefile.inc1. The exceptions are universe, tinderbox and targets.
64 # If you want to build your system from source, be sure that /usr/obj has
65 # at least 6 GB of disk space available. A complete 'universe' build of
66 # r340283 (2018-11) required 167 GB of space. ZFS lz4 compression
67 # achieved a 2.18x ratio, reducing actual space to 81 GB.
69 # For individuals wanting to build from the sources currently on their
70 # system, the simple instructions are:
72 # 1. `cd /usr/src' (or to the directory containing your source tree).
73 # 2. Define `HISTORICAL_MAKE_WORLD' variable (see README).
76 # For individuals wanting to upgrade their sources (even if only a
77 # delta of a few days):
79 # 1. `cd /usr/src' (or to the directory containing your source tree).
80 # 2. `make buildworld'
81 # 3. `make buildkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC).
82 # 4. `make installkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC).
83 # [steps 3. & 4. can be combined by using the "kernel" target]
84 # 5. `reboot' (in single user mode: boot -s from the loader prompt).
86 # 7. `make installworld'
87 # 8. `mergemaster' (you may wish to use -i, along with -U or -F).
88 # 9. `make delete-old'
90 # 11. `make delete-old-libs' (in case no 3rd party program uses them anymore)
92 # See src/UPDATING `COMMON ITEMS' for more complete information.
94 # If TARGET=machine (e.g. powerpc, sparc64, ...) is specified you can
95 # cross build world for other machine types using the buildworld target,
96 # and once the world is built you can cross build a kernel using the
99 # Define the user-driven targets. These are listed here in alphabetical
100 # order, but that's not important.
102 # Targets that begin with underscore are internal targets intended for
103 # developer convenience only. They are intentionally not documented and
104 # completely subject to change without notice.
106 # For more information, see the build(7) manual page.
109 # This is included so CC is set to ccache for -V, and COMPILER_TYPE/VERSION
110 # can be cached for sub-makes. We can't do this while still running on the
111 # old fmake from FreeBSD 9.x or older, so avoid including it then to avoid
112 # heartburn upgrading from older systems. The need for CC is done with new
113 # make later in the build, and caching COMPILER_TYPE/VERSION is only an
114 # optimization. Also sinclude it to be friendlier to foreign OS hosted builds.
115 .if ${MAKE_VERSION} >= 20140620 && defined(.PARSEDIR)
116 .sinclude <bsd.compiler.mk>
119 # Note: we use this awkward construct to be compatible with FreeBSD's
120 # old make used in 10.0 and 9.2 and earlier.
121 .if defined(MK_DIRDEPS_BUILD) && ${MK_DIRDEPS_BUILD} == "yes" && \
122 !make(showconfig) && !make(print-dir)
123 # targets/Makefile plays the role of top-level
124 .include "targets/Makefile"
127 TGTS= all all-man buildenv buildenvvars buildkernel buildworld \
128 check check-old check-old-dirs check-old-files check-old-libs \
129 checkdpadd checkworld clean cleandepend cleandir cleanworld \
131 delete-old delete-old-dirs delete-old-files delete-old-libs \
132 depend distribute distributekernel distributekernel.debug \
133 distributeworld distrib-dirs distribution doxygen \
134 everything hier hierarchy install installcheck installkernel \
135 installkernel.debug packagekernel packageworld \
136 reinstallkernel reinstallkernel.debug \
137 installworld kernel-toolchain libraries maninstall \
138 obj objlink showconfig tags toolchain update \
140 _worldtmp _legacy _bootstrap-tools _cleanobj _obj \
141 _build-tools _build-metadata _cross-tools _includes _libraries \
142 build32 distribute32 install32 buildsoft distributesoft installsoft \
143 builddtb xdev xdev-build xdev-install \
144 xdev-links native-xtools native-xtools-install stageworld stagekernel \
145 stage-packages stage-packages-kernel stage-packages-world \
146 create-packages-world create-packages-kernel create-packages \
147 packages installconfig real-packages sign-packages package-pkg \
148 print-dir test-system-compiler test-system-linker
150 # These targets require a TARGET and TARGET_ARCH be defined.
151 XTGTS= native-xtools native-xtools-install xdev xdev-build xdev-install \
154 # XXX: r156740: This can't work since bsd.subdir.mk is not included ever.
155 # It will only work for SUBDIR_TARGETS in make.conf.
156 TGTS+= ${SUBDIR_TARGETS}
158 BITGTS= files includes
159 BITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/}
162 # Only some targets are allowed to use meta mode. Others get it
163 # disabled. In some cases, such as 'install', meta mode can be dangerous
164 # as a cookie may be used to prevent redundant installations (such as
165 # for WORLDTMP staging). For DESTDIR=/ we always want to install though.
166 # For other cases, such as delete-old-libs, meta mode may break
167 # the interactive tty prompt. The safest route is to just whitelist
168 # the ones that benefit from it.
169 META_TGT_WHITELIST+= \
170 _* build32 buildfiles buildincludes buildkernel buildsoft \
171 buildworld everything kernel-toolchain kernel-toolchains kernel \
172 kernels libraries native-xtools showconfig test-system-compiler \
173 test-system-linker tinderbox toolchain \
174 toolchains universe universe-toolchain world worlds xdev xdev-build
176 .ORDER: buildworld installworld
177 .ORDER: buildworld distrib-dirs
178 .ORDER: buildworld distribution
179 .ORDER: buildworld distribute
180 .ORDER: buildworld distributeworld
181 .ORDER: buildworld buildkernel
182 .ORDER: distrib-dirs distribute
183 .ORDER: distrib-dirs distributeworld
184 .ORDER: distrib-dirs installworld
185 .ORDER: distribution distribute
186 .ORDER: distributeworld distribute
187 .ORDER: distributeworld distribution
188 .ORDER: installworld distribute
189 .ORDER: installworld distribution
190 .ORDER: installworld installkernel
191 .ORDER: buildkernel installkernel
192 .ORDER: buildkernel installkernel.debug
193 .ORDER: buildkernel reinstallkernel
194 .ORDER: buildkernel reinstallkernel.debug
196 PATH= /sbin:/bin:/usr/sbin:/usr/bin
197 MAKEOBJDIRPREFIX?= /usr/obj
198 _MAKEOBJDIRPREFIX!= /usr/bin/env -i PATH=${PATH} ${MAKE} MK_AUTO_OBJ=no \
199 ${.MAKEFLAGS:MMAKEOBJDIRPREFIX=*} __MAKE_CONF=${__MAKE_CONF} \
200 SRCCONF=${SRCCONF} SRC_ENV_CONF= \
201 -f /dev/null -V MAKEOBJDIRPREFIX dummy
202 .if !empty(_MAKEOBJDIRPREFIX)
203 .error MAKEOBJDIRPREFIX can only be set in environment or src-env.conf(5),\
204 not as a global (in make.conf(5) or src.conf(5)) or command-line variable.
207 # We often need to use the tree's version of make to build it.
208 # Choices add to complexity though.
209 # We cannot blindly use a make which may not be the one we want
210 # so be explicit - until all choice is removed.
212 .if !empty(.MAKE.MODE:Mmeta)
213 # 20160604 - support missing-meta,missing-filemon and performance improvements
214 WANT_MAKE_VERSION= 20160604
216 # 20160220 - support .dinclude for FAST_DEPEND.
217 WANT_MAKE_VERSION= 20160220
219 MYMAKE= ${OBJROOT}make.${MACHINE}/${WANT_MAKE}
220 .if defined(.PARSEDIR)
225 .if defined(ALWAYS_BOOTSTRAP_MAKE) || \
226 ${HAVE_MAKE} != ${WANT_MAKE} || \
227 (defined(WANT_MAKE_VERSION) && ${MAKE_VERSION} < ${WANT_MAKE_VERSION})
230 .if exists(${MYMAKE})
231 SUB_MAKE:= ${MYMAKE} -m ${.CURDIR}/share/mk
232 .elif defined(NEED_MAKE_UPGRADE)
233 # It may not exist yet but we may cause it to.
234 # In the case of fmake, upgrade_checks may cause a newer version to be built.
235 SUB_MAKE= `test -x ${MYMAKE} && echo ${MYMAKE} || echo ${MAKE}` \
236 -m ${.CURDIR}/share/mk
238 SUB_MAKE= ${MAKE} -m ${.CURDIR}/share/mk
241 _MAKE= PATH=${PATH} MAKE_CMD="${MAKE}" ${SUB_MAKE} -f Makefile.inc1 \
242 TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH} ${_MAKEARGS}
244 .if defined(MK_META_MODE) && ${MK_META_MODE} == "yes"
245 # Only allow meta mode for the whitelisted targets. See META_TGT_WHITELIST
246 # above. If overridden as a make argument then don't bother trying to
248 .if empty(.MAKEOVERRIDES:MMK_META_MODE)
249 .for _tgt in ${META_TGT_WHITELIST}
251 _CAN_USE_META_MODE?= yes
254 .if !defined(_CAN_USE_META_MODE)
255 _MAKE+= MK_META_MODE=no
257 .if defined(.PARSEDIR)
260 .endif # !defined(_CAN_USE_META_MODE)
261 .endif # empty(.MAKEOVERRIDES:MMK_META_MODE)
263 .if ${MK_META_MODE} == "yes"
264 .if !exists(/dev/filemon) && !defined(NO_FILEMON) && !make(showconfig)
265 # Require filemon be loaded to provide a working incremental build
266 .error ${.newline}ERROR: The filemon module (/dev/filemon) is not loaded. \
267 ${.newline}ERROR: WITH_META_MODE is enabled but requires filemon for an incremental build. \
268 ${.newline}ERROR: 'kldload filemon' or pass -DNO_FILEMON to suppress this error.
269 .endif # !exists(/dev/filemon) && !defined(NO_FILEMON)
270 .endif # ${MK_META_MODE} == yes
271 .endif # defined(MK_META_MODE) && ${MK_META_MODE} == yes
273 # Guess target architecture from target type, and vice versa, based on
274 # historic FreeBSD practice of tending to have TARGET == TARGET_ARCH
275 # expanding to TARGET == TARGET_CPUARCH in recent times, with known
277 .if !defined(TARGET_ARCH) && defined(TARGET)
278 # T->TA mapping is usually TARGET with arm64 the odd man out
279 _TARGET_ARCH= ${TARGET:S/arm64/aarch64/:S/riscv/riscv64/}
280 .elif !defined(TARGET) && defined(TARGET_ARCH) && \
281 ${TARGET_ARCH} != ${MACHINE_ARCH}
282 # TA->T mapping is accidentally CPUARCH with aarch64 the odd man out
283 _TARGET= ${TARGET_ARCH:${__TO_CPUARCH}:C/aarch64/arm64/}
285 .if defined(TARGET) && !defined(_TARGET)
288 .if defined(TARGET_ARCH) && !defined(_TARGET_ARCH)
289 _TARGET_ARCH=${TARGET_ARCH}
291 # for historical compatibility for xdev targets
295 .if defined(XDEV_ARCH)
296 _TARGET_ARCH= ${XDEV_ARCH}
298 # Some targets require a set TARGET/TARGET_ARCH, check before the default
299 # MACHINE and after the compatibility handling.
300 .if !defined(_TARGET) || !defined(_TARGET_ARCH)
301 ${XTGTS}: _assert_target
303 # Otherwise, default to current machine type and architecture.
305 _TARGET_ARCH?= ${MACHINE_ARCH}
307 .if make(native-xtools*)
308 NXB_TARGET:= ${_TARGET}
309 NXB_TARGET_ARCH:= ${_TARGET_ARCH}
311 _TARGET_ARCH= ${MACHINE_ARCH}
312 _MAKE+= NXB_TARGET=${NXB_TARGET} \
313 NXB_TARGET_ARCH=${NXB_TARGET_ARCH}
320 _assert_target: .PHONY .MAKE
321 .for _tgt in ${XTGTS}
323 @echo "*** Error: Both TARGET and TARGET_ARCH must be defined for \"${_tgt}\" target"
329 # Make sure we have an up-to-date make(1). Only world and buildworld
330 # should do this as those are the initial targets used for upgrades.
331 # The user can define ALWAYS_CHECK_MAKE to have this check performed
334 .if defined(ALWAYS_CHECK_MAKE) || !defined(.PARSEDIR)
335 ${TGTS}: upgrade_checks
337 buildworld: upgrade_checks
341 # Handle the user-driven targets, using the source relative mk files.
344 tinderbox toolchains kernel-toolchains: .MAKE
345 ${TGTS}: .PHONY .MAKE
346 ${_+_}@cd ${.CURDIR}; ${_MAKE} ${.TARGET}
348 # The historic default "all" target creates files which may cause stale
349 # or (in the cross build case) unlinkable results. Fail with an error
350 # when no target is given. The users can explicitly specify "all"
351 # if they want the historic behavior.
356 @echo "Explicit target required. Likely \"${SUBDIR_OVERRIDE:Dall:Ubuildworld}\" is wanted. See build(7)."
360 STARTTIME!= LC_ALL=C date
361 CHECK_TIME!= cmp=`mktemp`; find ${.CURDIR}/sys/sys/param.h -newer "$$cmp" && rm "$$cmp"; echo
362 .if !empty(CHECK_TIME)
363 .error check your date/time: ${STARTTIME}
366 .if defined(HISTORICAL_MAKE_WORLD) || defined(DESTDIR)
370 # Attempt to rebuild and reinstall everything. This target is not to be
371 # used for upgrading an existing FreeBSD system, because the kernel is
372 # not included. One can argue that this target doesn't build everything
375 world: upgrade_checks .PHONY
376 @echo "--------------------------------------------------------------"
377 @echo ">>> make world started on ${STARTTIME}"
378 @echo "--------------------------------------------------------------"
379 .if target(pre-world)
381 @echo "--------------------------------------------------------------"
382 @echo ">>> Making 'pre-world' target"
383 @echo "--------------------------------------------------------------"
384 ${_+_}@cd ${.CURDIR}; ${_MAKE} pre-world
386 ${_+_}@cd ${.CURDIR}; ${_MAKE} buildworld
387 ${_+_}@cd ${.CURDIR}; ${_MAKE} installworld MK_META_MODE=no
388 .if target(post-world)
390 @echo "--------------------------------------------------------------"
391 @echo ">>> Making 'post-world' target"
392 @echo "--------------------------------------------------------------"
393 ${_+_}@cd ${.CURDIR}; ${_MAKE} post-world
396 @echo "--------------------------------------------------------------"
397 @echo ">>> make world completed on `LC_ALL=C date`"
398 @echo " (started ${STARTTIME})"
399 @echo "--------------------------------------------------------------"
402 @echo "WARNING: make world will overwrite your existing FreeBSD"
403 @echo "installation without also building and installing a new"
404 @echo "kernel. This can be dangerous. Please read the handbook,"
405 @echo "'Rebuilding world', for how to upgrade your system."
406 @echo "Define DESTDIR to where you want to install FreeBSD,"
407 @echo "including /, to override this warning and proceed as usual."
409 @echo "Bailing out now..."
416 # Short hand for `make buildkernel installkernel'
418 kernel: buildkernel installkernel .PHONY
421 # Perform a few tests to determine if the installed tools are adequate
422 # for building the world.
424 upgrade_checks: .PHONY
425 .if defined(NEED_MAKE_UPGRADE)
426 @${_+_}(cd ${.CURDIR} && ${MAKE} ${WANT_MAKE:S,^f,,})
430 # Upgrade make(1) to the current version using the installed
431 # headers, libraries and tools. Also, allow the location of
432 # the system bsdmake-like utility to be overridden.
436 INSTALL="sh ${.CURDIR}/tools/install.sh"
437 MMAKE= ${MMAKEENV} ${MAKE} \
438 OBJTOP=${MYMAKE:H}/obj \
439 OBJROOT='$${OBJTOP}/' \
442 -DNO_CPU_CFLAGS -DNO_WERROR \
444 DESTDIR= PROGNAME=${MYMAKE:T}
448 @echo "--------------------------------------------------------------"
449 @echo ">>> Building an up-to-date ${.TARGET}(1)"
450 @echo "--------------------------------------------------------------"
451 ${_+_}@cd ${.CURDIR}/usr.bin/${.TARGET}; \
455 ${MMAKE} install DESTDIR=${MYMAKE:H} BINDIR=
458 @echo "'make regress' has been renamed 'make check'" | /usr/bin/fmt
461 tinderbox toolchains kernel-toolchains kernels worlds: upgrade_checks
464 @cd ${.CURDIR}; ${SUB_MAKE} DOING_TINDERBOX=YES universe
467 @cd ${.CURDIR}; ${SUB_MAKE} UNIVERSE_TARGET=toolchain universe
469 kernel-toolchains: .PHONY
470 @cd ${.CURDIR}; ${SUB_MAKE} UNIVERSE_TARGET=kernel-toolchain universe
473 @cd ${.CURDIR}; ${SUB_MAKE} UNIVERSE_TARGET=buildkernel universe
476 @cd ${.CURDIR}; ${SUB_MAKE} UNIVERSE_TARGET=buildworld universe
481 # Attempt to rebuild *everything* for all supported architectures,
482 # with a reasonable chance of success, regardless of how old your
483 # existing system is.
485 .if make(universe) || make(universe_kernels) || make(tinderbox) || \
486 make(targets) || make(universe-toolchain)
488 # By default, build only the known-good clang-supporting platforms.
489 # If MAKE_OBSOLETE_GCC is defined, built all the old GCC architectures.
490 # In all cases, if the user specifies TARGETS on the command line,
491 # honor that most of all.
493 _OBSOLETE_GCC_TARGETS=mips powerpc sparc64
494 TARGETS?=amd64 arm arm64 i386 riscv ${_OBSOLETE_GCC_TARGETS}
495 _UNIVERSE_TARGETS= ${TARGETS}
496 TARGET_ARCHES_arm?= arm armv6 armv7
497 TARGET_ARCHES_arm64?= aarch64
498 TARGET_ARCHES_mips?= mipsel mips mips64el mips64 mipsn32 mipselhf mipshf mips64elhf mips64hf
499 TARGET_ARCHES_powerpc?= powerpc powerpc64 powerpcspe
500 # riscv64sf excluded due to PR 232085
501 TARGET_ARCHES_riscv?= riscv64
502 .for target in ${TARGETS}
503 TARGET_ARCHES_${target}?= ${target}
506 MAKE_PARAMS_riscv?= CROSS_TOOLCHAIN=riscv64-gcc
507 .if !defined(MAKE_OBSOLETE_GCC)
508 OBSOLETE_GCC_TARGETS=${_OBSOLETE_GCC_TARGETS}
509 MAKE_PARAMS_mips?= CROSS_TOOLCHAIN=mips-gcc
510 MAKE_PARAMS_powerpc?= CROSS_TOOLCHAIN=powerpc-gcc
511 MAKE_PARAMS_sparc64?= CROSS_TOOLCHAIN=sparc64-gcc
514 TOOLCHAINS_mips= mips
515 TOOLCHAINS_powerpc= powerpc64
516 TOOLCHAINS_riscv= riscv64
517 TOOLCHAINS_sparc64= sparc64
519 # Remove architectures only supported by external toolchain from
520 # universe if required toolchain packages are missing. riscv requires
521 # an out-of-tree toolchain. When MAKE_OBSOLETE_GCC is not defined,
522 # the same logic appleis to the obsolete gcc targets.
523 .for target in riscv ${OBSOLETE_GCC_TARGETS}
524 .if ${_UNIVERSE_TARGETS:M${target}}
525 .for toolchain in ${TOOLCHAINS_${target}}
526 .if !exists(/usr/local/share/toolchains/${toolchain}-gcc.mk)
527 _UNIVERSE_TARGETS:= ${_UNIVERSE_TARGETS:N${target}}
528 universe: universe_${toolchain}_skip .PHONY
529 universe_epilogue: universe_${toolchain}_skip .PHONY
530 universe_${toolchain}_skip: universe_prologue .PHONY
531 @echo ">> ${target} skipped - install ${toolchain}-xtoolchain-gcc port or package to build"
537 .if defined(UNIVERSE_TARGET)
538 MAKE_JUST_WORLDS= YES
540 UNIVERSE_TARGET?= buildworld
542 KERNSRCDIR?= ${.CURDIR}/sys
545 @echo "Supported TARGET/TARGET_ARCH pairs for world and kernel targets"
546 .for target in ${TARGETS}
547 .for target_arch in ${TARGET_ARCHES_${target}}
548 @echo " ${target}/${target_arch}"
552 .if defined(DOING_TINDERBOX)
553 FAILFILE=${.CURDIR}/_.tinderbox.failed
554 MAKEFAIL=tee -a ${FAILFILE}
559 universe_prologue: upgrade_checks
560 universe: universe_prologue
561 universe_prologue: .PHONY
562 @echo "--------------------------------------------------------------"
563 @echo ">>> make universe started on ${STARTTIME}"
564 @echo "--------------------------------------------------------------"
565 .if defined(DOING_TINDERBOX)
569 universe-toolchain: .PHONY universe_prologue
570 @echo "--------------------------------------------------------------"
571 @echo "> Toolchain bootstrap started on `LC_ALL=C date`"
572 @echo "--------------------------------------------------------------"
573 ${_+_}@cd ${.CURDIR}; \
574 env PATH=${PATH} ${SUB_MAKE} ${JFLAG} kernel-toolchain \
575 TARGET=${MACHINE} TARGET_ARCH=${MACHINE_ARCH} \
576 OBJTOP="${HOST_OBJTOP}" \
577 WITHOUT_SYSTEM_COMPILER=yes \
578 WITHOUT_SYSTEM_LINKER=yes \
579 TOOLS_PREFIX_UNDEF= \
581 MK_LLVM_TARGET_ALL=yes \
582 > _.${.TARGET} 2>&1 || \
583 (echo "${.TARGET} failed," \
584 "check _.${.TARGET} for details" | \
586 @if [ ! -e "${HOST_OBJTOP}/tmp/usr/bin/cc" ]; then \
587 echo "Missing host compiler at ${HOST_OBJTOP}/tmp/usr/bin/cc?" >&2; \
590 @if [ ! -e "${HOST_OBJTOP}/tmp/usr/bin/ld" ]; then \
591 echo "Missing host linker at ${HOST_OBJTOP}/tmp/usr/bin/ld?" >&2; \
594 @echo "--------------------------------------------------------------"
595 @echo "> Toolchain bootstrap completed on `LC_ALL=C date`"
596 @echo "--------------------------------------------------------------"
598 .for target in ${_UNIVERSE_TARGETS}
599 universe: universe_${target}
600 universe_epilogue: universe_${target}
601 universe_${target}: universe_${target}_prologue .PHONY
602 universe_${target}_prologue: universe_prologue .PHONY
603 @echo ">> ${target} started on `LC_ALL=C date`"
604 universe_${target}_worlds: .PHONY
606 .if !make(targets) && !make(universe-toolchain)
607 .for target_arch in ${TARGET_ARCHES_${target}}
608 .if !defined(_need_clang_${target}_${target_arch})
609 _need_clang_${target}_${target_arch} != \
610 env TARGET=${target} TARGET_ARCH=${target_arch} \
611 ${SUB_MAKE} -C ${.CURDIR} -f Makefile.inc1 test-system-compiler \
612 ${MAKE_PARAMS_${target}} -V MK_CLANG_BOOTSTRAP 2>/dev/null || \
614 .export _need_clang_${target}_${target_arch}
616 .if !defined(_need_lld_${target}_${target_arch})
617 _need_lld_${target}_${target_arch} != \
618 env TARGET=${target} TARGET_ARCH=${target_arch} \
619 ${SUB_MAKE} -C ${.CURDIR} -f Makefile.inc1 test-system-linker \
620 ${MAKE_PARAMS_${target}} -V MK_LLD_BOOTSTRAP 2>/dev/null || \
622 .export _need_lld_${target}_${target_arch}
624 # Setup env for each arch to use the one clang.
625 .if defined(_need_clang_${target}_${target_arch}) && \
626 ${_need_clang_${target}_${target_arch}} == "yes"
627 # No check on existing XCC or CROSS_BINUTILS_PREFIX, etc, is needed since
628 # we use the test-system-compiler logic to determine if clang needs to be
629 # built. It will be no from that logic if already using an external
630 # toolchain or /usr/bin/cc.
631 # XXX: Passing HOST_OBJTOP into the PATH would allow skipping legacy,
632 # bootstrap-tools, and cross-tools. Need to ensure each tool actually
633 # supports all TARGETS though.
634 # For now we only pass UNIVERSE_TOOLCHAIN_PATH which will be added at the end
635 # of STRICTTMPPATH to ensure that the target-specific binaries come first.
636 MAKE_PARAMS_${target}+= \
637 XCC="${HOST_OBJTOP}/tmp/usr/bin/cc" \
638 XCXX="${HOST_OBJTOP}/tmp/usr/bin/c++" \
639 XCPP="${HOST_OBJTOP}/tmp/usr/bin/cpp" \
640 UNIVERSE_TOOLCHAIN_PATH=${HOST_OBJTOP}/tmp/usr/bin
642 .if defined(_need_lld_${target}_${target_arch}) && \
643 ${_need_lld_${target}_${target_arch}} == "yes"
644 MAKE_PARAMS_${target}+= \
645 XLD="${HOST_OBJTOP}/tmp/usr/bin/ld"
648 .endif # !make(targets)
650 .if !defined(MAKE_JUST_KERNELS)
651 universe_${target}_done: universe_${target}_worlds .PHONY
652 .for target_arch in ${TARGET_ARCHES_${target}}
653 universe_${target}_worlds: universe_${target}_${target_arch} .PHONY
654 .if (defined(_need_clang_${target}_${target_arch}) && \
655 ${_need_clang_${target}_${target_arch}} == "yes") || \
656 (defined(_need_lld_${target}_${target_arch}) && \
657 ${_need_lld_${target}_${target_arch}} == "yes")
658 universe_${target}_${target_arch}: universe-toolchain
659 universe_${target}_prologue: universe-toolchain
661 universe_${target}_${target_arch}: universe_${target}_prologue .MAKE .PHONY
662 @echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} started on `LC_ALL=C date`"
663 @(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
664 ${SUB_MAKE} ${JFLAG} ${UNIVERSE_TARGET} \
666 TARGET_ARCH=${target_arch} \
667 ${MAKE_PARAMS_${target}} \
668 > _.${target}.${target_arch}.${UNIVERSE_TARGET} 2>&1 || \
669 (echo "${target}.${target_arch} ${UNIVERSE_TARGET} failed," \
670 "check _.${target}.${target_arch}.${UNIVERSE_TARGET} for details" | \
672 @echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} completed on `LC_ALL=C date`"
674 .endif # !MAKE_JUST_KERNELS
676 .if !defined(MAKE_JUST_WORLDS)
677 universe_${target}_done: universe_${target}_kernels .PHONY
678 universe_${target}_kernels: universe_${target}_worlds .PHONY
679 universe_${target}_kernels: universe_${target}_prologue .MAKE .PHONY
680 @if [ -e "${KERNSRCDIR}/${target}/conf/NOTES" ]; then \
681 (cd ${KERNSRCDIR}/${target}/conf && env __MAKE_CONF=/dev/null \
683 > ${.CURDIR}/_.${target}.makeLINT 2>&1 || \
684 (echo "${target} 'make LINT' failed," \
685 "check _.${target}.makeLINT for details"| ${MAKEFAIL})); \
687 @cd ${.CURDIR}; ${SUB_MAKE} ${.MAKEFLAGS} TARGET=${target} \
689 .endif # !MAKE_JUST_WORLDS
691 # Tell the user the worlds and kernels have completed
692 universe_${target}: universe_${target}_done
693 universe_${target}_done:
694 @echo ">> ${target} completed on `LC_ALL=C date`"
696 .if make(universe_kernconfs) || make(universe_kernels)
700 universe_kernels_prologue: .PHONY
701 @echo ">> ${TARGET} kernels started on `LC_ALL=C date`"
702 universe_kernels: universe_kernconfs .PHONY
703 @echo ">> ${TARGET} kernels completed on `LC_ALL=C date`"
704 .if defined(MAKE_ALL_KERNELS)
706 .elif defined(MAKE_LINT_KERNELS)
707 _THINNER=grep 'LINT' || true
709 _THINNER=xargs grep -L "^.NO_UNIVERSE" || true
711 KERNCONFS!= cd ${KERNSRCDIR}/${TARGET}/conf && \
712 find [[:upper:][:digit:]]*[[:upper:][:digit:]] \
713 -type f -maxdepth 0 \
714 ! -name DEFAULTS ! -name NOTES | \
716 universe_kernconfs: universe_kernels_prologue .PHONY
717 .for kernel in ${KERNCONFS}
718 TARGET_ARCH_${kernel}!= cd ${KERNSRCDIR}/${TARGET}/conf && \
719 config -m ${KERNSRCDIR}/${TARGET}/conf/${kernel} 2> /dev/null | \
720 grep -v WARNING: | cut -f 2
721 .if empty(TARGET_ARCH_${kernel})
722 .error "Target architecture for ${TARGET}/conf/${kernel} unknown. config(8) likely too old."
724 universe_kernconfs: universe_kernconf_${TARGET}_${kernel}
725 universe_kernconf_${TARGET}_${kernel}: .MAKE
726 @echo ">> ${TARGET}.${TARGET_ARCH_${kernel}} ${kernel} kernel started on `LC_ALL=C date`"
727 @(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
728 ${SUB_MAKE} ${JFLAG} buildkernel \
730 TARGET_ARCH=${TARGET_ARCH_${kernel}} \
731 ${MAKE_PARAMS_${TARGET}} \
733 > _.${TARGET}.${kernel} 2>&1 || \
734 (echo "${TARGET} ${kernel} kernel failed," \
735 "check _.${TARGET}.${kernel} for details"| ${MAKEFAIL}))
736 @echo ">> ${TARGET}.${TARGET_ARCH_${kernel}} ${kernel} kernel completed on `LC_ALL=C date`"
738 .endif # make(universe_kernels)
739 universe: universe_epilogue
740 universe_epilogue: .PHONY
741 @echo "--------------------------------------------------------------"
742 @echo ">>> make universe completed on `LC_ALL=C date`"
743 @echo " (started ${STARTTIME})"
744 @echo "--------------------------------------------------------------"
745 .if defined(DOING_TINDERBOX)
746 @if [ -e ${FAILFILE} ] ; then \
747 echo "Tinderbox failed:" ;\
755 ${MAKE} -C ${.CURDIR}/sys/${_TARGET}/conf LINT
757 .if defined(.PARSEDIR)
758 # This makefile does not run in meta mode
760 # Normally the things we run from here don't either.
761 # Using -DWITH_META_MODE
762 # we can buildworld with meta files created which are useful
763 # for debugging, but without any of the rest of a meta mode build.
766 # tell meta.autodep.mk to not even think about updating anything.
767 UPDATE_DEPENDFILE= NO
768 .if !make(showconfig)
769 .export MK_DIRDEPS_BUILD MK_STAGING UPDATE_DEPENDFILE
773 # we do not want a failure of one branch abort all.
774 MAKE_JOB_ERROR_TOKEN= no
775 .export MAKE_JOB_ERROR_TOKEN
779 .endif # DIRDEPS_BUILD