4 # The user-driven targets are:
6 # universe - *Really* build *everything* (buildworld and
7 # all kernels on all architectures).
8 # tinderbox - Same as universe, but presents a list of failed build
9 # targets and exits with an error if there were any.
10 # buildworld - Rebuild *everything*, including glue to help do
12 # installworld - Install everything built by "buildworld".
13 # world - buildworld + installworld, no kernel.
14 # buildkernel - Rebuild the kernel and the kernel-modules.
15 # installkernel - Install the kernel and the kernel-modules.
17 # reinstallkernel - Reinstall the kernel and the kernel-modules.
18 # reinstallkernel.debug
19 # kernel - buildkernel + installkernel.
20 # kernel-toolchain - Builds the subset of world necessary to build a kernel
21 # kernel-toolchains - Build kernel-toolchain for all universe targets.
22 # doxygen - Build API documentation of the kernel, needs doxygen.
23 # update - Convenient way to update your source tree(s).
24 # checkworld - Run test suite on installed world.
25 # check-old - List obsolete directories/files/libraries.
26 # check-old-dirs - List obsolete directories.
27 # check-old-files - List obsolete files.
28 # check-old-libs - List obsolete libraries.
29 # delete-old - Delete obsolete directories/files.
30 # delete-old-dirs - Delete obsolete directories.
31 # delete-old-files - Delete obsolete files.
32 # delete-old-libs - Delete obsolete libraries.
33 # targets - Print a list of supported TARGET/TARGET_ARCH pairs
34 # for world and kernel targets.
35 # toolchains - Build a toolchain for all world and kernel targets.
36 # sysent - (Re)build syscall entries from syscalls.master.
37 # xdev - xdev-build + xdev-install for the architecture
38 # specified with TARGET and TARGET_ARCH.
39 # xdev-build - Build cross-development tools.
40 # xdev-install - Install cross-development tools.
41 # xdev-links - Create traditional links in /usr/bin for cc, etc
42 # native-xtools - Create host binaries that produce target objects
43 # for use in qemu user-mode jails. TARGET and
44 # TARGET_ARCH should be defined.
45 # native-xtools-install
46 # - Install the files to the given DESTDIR/NXTP where
47 # NXTP defaults to /nxb-bin.
49 # "quick" way to test all kernel builds:
50 # _jflag=`sysctl -n hw.ncpu`
51 # _jflag=$(($_jflag * 2))
52 # [ $_jflag -gt 12 ] && _jflag=12
53 # make universe -DMAKE_JUST_KERNELS JFLAG=-j${_jflag}
55 # This makefile is simple by design. The FreeBSD make automatically reads
56 # the /usr/share/mk/sys.mk unless the -m argument is specified on the
57 # command line. By keeping this makefile simple, it doesn't matter too
58 # much how different the installed mk files are from those in the source
59 # tree. This makefile executes a child make process, forcing it to use
60 # the mk files from the source tree which are supposed to DTRT.
62 # Most of the user-driven targets (as listed above) are implemented in
63 # Makefile.inc1. The exceptions are universe, tinderbox and targets.
65 # If you want to build your system from source, be sure that /usr/obj has
66 # at least 6 GB of disk space available. A complete 'universe' build of
67 # r340283 (2018-11) required 167 GB of space. ZFS lz4 compression
68 # achieved a 2.18x ratio, reducing actual space to 81 GB.
70 # For individuals wanting to build from the sources currently on their
71 # system, the simple instructions are:
73 # 1. `cd /usr/src' (or to the directory containing your source tree).
74 # 2. Define `HISTORICAL_MAKE_WORLD' variable (see README).
77 # For individuals wanting to upgrade their sources (even if only a
78 # delta of a few days):
80 # 1. `cd /usr/src' (or to the directory containing your source tree).
81 # 2. `make buildworld'
82 # 3. `make buildkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC).
83 # 4. `make installkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC).
84 # [steps 3. & 4. can be combined by using the "kernel" target]
85 # 5. `reboot' (in single user mode: boot -s from the loader prompt).
87 # 7. `make installworld'
88 # 8. `mergemaster' (you may wish to use -i, along with -U or -F).
89 # 9. `make delete-old'
91 # 11. `make delete-old-libs' (in case no 3rd party program uses them anymore)
93 # See src/UPDATING `COMMON ITEMS' for more complete information.
95 # If TARGET=machine (e.g. powerpc, sparc64, ...) is specified you can
96 # cross build world for other machine types using the buildworld target,
97 # and once the world is built you can cross build a kernel using the
100 # Define the user-driven targets. These are listed here in alphabetical
101 # order, but that's not important.
103 # Targets that begin with underscore are internal targets intended for
104 # developer convenience only. They are intentionally not documented and
105 # completely subject to change without notice.
107 # For more information, see the build(7) manual page.
110 # This is included so CC is set to ccache for -V, and COMPILER_TYPE/VERSION
111 # can be cached for sub-makes. We can't do this while still running on the
112 # old fmake from FreeBSD 9.x or older, so avoid including it then to avoid
113 # heartburn upgrading from older systems. The need for CC is done with new
114 # make later in the build, and caching COMPILER_TYPE/VERSION is only an
115 # optimization. Also sinclude it to be friendlier to foreign OS hosted builds.
116 .if ${MAKE_VERSION} >= 20140620 && defined(.PARSEDIR)
117 .sinclude <bsd.compiler.mk>
120 # Note: we use this awkward construct to be compatible with FreeBSD's
121 # old make used in 10.0 and 9.2 and earlier.
122 .if defined(MK_DIRDEPS_BUILD) && ${MK_DIRDEPS_BUILD} == "yes" && \
123 !make(showconfig) && !make(print-dir)
124 # targets/Makefile plays the role of top-level
125 .include "targets/Makefile"
128 TGTS= all all-man buildenv buildenvvars buildkernel buildworld \
129 check check-old check-old-dirs check-old-files check-old-libs \
130 checkdpadd checkworld clean cleandepend cleandir cleanworld \
132 delete-old delete-old-dirs delete-old-files delete-old-libs \
133 depend distribute distributekernel distributekernel.debug \
134 distributeworld distrib-dirs distribution doxygen \
135 everything hier hierarchy install installcheck installkernel \
136 installkernel.debug packagekernel packageworld \
137 reinstallkernel reinstallkernel.debug \
138 installworld kernel-toolchain libraries maninstall \
139 obj objlink showconfig tags toolchain update \
141 _worldtmp _legacy _bootstrap-tools _cleanobj _obj \
142 _build-tools _build-metadata _cross-tools _includes _libraries \
143 build32 distribute32 install32 buildsoft distributesoft installsoft \
144 builddtb xdev xdev-build xdev-install \
145 xdev-links native-xtools native-xtools-install stageworld stagekernel \
147 create-packages-world create-packages-kernel create-packages \
148 packages installconfig real-packages sign-packages package-pkg \
149 print-dir test-system-compiler test-system-linker
151 # These targets require a TARGET and TARGET_ARCH be defined.
152 XTGTS= native-xtools native-xtools-install xdev xdev-build xdev-install \
155 # XXX: r156740: This can't work since bsd.subdir.mk is not included ever.
156 # It will only work for SUBDIR_TARGETS in make.conf.
157 TGTS+= ${SUBDIR_TARGETS}
159 BITGTS= files includes
160 BITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/}
163 # Only some targets are allowed to use meta mode. Others get it
164 # disabled. In some cases, such as 'install', meta mode can be dangerous
165 # as a cookie may be used to prevent redundant installations (such as
166 # for WORLDTMP staging). For DESTDIR=/ we always want to install though.
167 # For other cases, such as delete-old-libs, meta mode may break
168 # the interactive tty prompt. The safest route is to just whitelist
169 # the ones that benefit from it.
170 META_TGT_WHITELIST+= \
171 _* build32 buildfiles buildincludes buildkernel buildsoft \
172 buildworld everything kernel-toolchain kernel-toolchains kernel \
173 kernels libraries native-xtools showconfig test-system-compiler \
174 test-system-linker tinderbox toolchain \
175 toolchains universe universe-toolchain world worlds xdev xdev-build
177 .ORDER: buildworld installworld
178 .ORDER: buildworld distrib-dirs
179 .ORDER: buildworld distribution
180 .ORDER: buildworld distribute
181 .ORDER: buildworld distributeworld
182 .ORDER: buildworld buildkernel
183 .ORDER: distrib-dirs distribute
184 .ORDER: distrib-dirs distributeworld
185 .ORDER: distrib-dirs installworld
186 .ORDER: distribution distribute
187 .ORDER: distributeworld distribute
188 .ORDER: distributeworld distribution
189 .ORDER: installworld distribute
190 .ORDER: installworld distribution
191 .ORDER: installworld installkernel
192 .ORDER: buildkernel installkernel
193 .ORDER: buildkernel installkernel.debug
194 .ORDER: buildkernel reinstallkernel
195 .ORDER: buildkernel reinstallkernel.debug
197 PATH= /sbin:/bin:/usr/sbin:/usr/bin
198 MAKEOBJDIRPREFIX?= /usr/obj
199 _MAKEOBJDIRPREFIX!= /usr/bin/env -i PATH=${PATH} ${MAKE} MK_AUTO_OBJ=no \
200 ${.MAKEFLAGS:MMAKEOBJDIRPREFIX=*} __MAKE_CONF=${__MAKE_CONF} \
201 SRCCONF=${SRCCONF} SRC_ENV_CONF= \
202 -f /dev/null -V MAKEOBJDIRPREFIX dummy
203 .if !empty(_MAKEOBJDIRPREFIX)
204 .error MAKEOBJDIRPREFIX can only be set in environment or src-env.conf(5),\
205 not as a global (in make.conf(5) or src.conf(5)) or command-line variable.
208 # We often need to use the tree's version of make to build it.
209 # Choices add to complexity though.
210 # We cannot blindly use a make which may not be the one we want
211 # so be explicit - until all choice is removed.
213 .if !empty(.MAKE.MODE:Mmeta)
214 # 20160604 - support missing-meta,missing-filemon and performance improvements
215 WANT_MAKE_VERSION= 20160604
217 # 20160220 - support .dinclude for FAST_DEPEND.
218 WANT_MAKE_VERSION= 20160220
220 MYMAKE= ${OBJROOT}make.${MACHINE}/${WANT_MAKE}
221 .if defined(.PARSEDIR)
226 .if defined(ALWAYS_BOOTSTRAP_MAKE) || \
227 ${HAVE_MAKE} != ${WANT_MAKE} || \
228 (defined(WANT_MAKE_VERSION) && ${MAKE_VERSION} < ${WANT_MAKE_VERSION})
231 .if exists(${MYMAKE})
232 SUB_MAKE:= ${MYMAKE} -m ${.CURDIR}/share/mk
233 .elif defined(NEED_MAKE_UPGRADE)
234 # It may not exist yet but we may cause it to.
235 # In the case of fmake, upgrade_checks may cause a newer version to be built.
236 SUB_MAKE= `test -x ${MYMAKE} && echo ${MYMAKE} || echo ${MAKE}` \
237 -m ${.CURDIR}/share/mk
239 SUB_MAKE= ${MAKE} -m ${.CURDIR}/share/mk
242 _MAKE= PATH=${PATH} MAKE_CMD="${MAKE}" ${SUB_MAKE} -f Makefile.inc1 \
243 TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH} ${_MAKEARGS}
245 .if defined(MK_META_MODE) && ${MK_META_MODE} == "yes"
246 # Only allow meta mode for the whitelisted targets. See META_TGT_WHITELIST
247 # above. If overridden as a make argument then don't bother trying to
249 .if empty(.MAKEOVERRIDES:MMK_META_MODE)
250 .for _tgt in ${META_TGT_WHITELIST}
252 _CAN_USE_META_MODE?= yes
255 .if !defined(_CAN_USE_META_MODE)
256 _MAKE+= MK_META_MODE=no
258 .if defined(.PARSEDIR)
261 .endif # !defined(_CAN_USE_META_MODE)
262 .endif # empty(.MAKEOVERRIDES:MMK_META_MODE)
264 .if ${MK_META_MODE} == "yes"
265 .if !exists(/dev/filemon) && !defined(NO_FILEMON) && !make(showconfig)
266 # Require filemon be loaded to provide a working incremental build
267 .error ${.newline}ERROR: The filemon module (/dev/filemon) is not loaded. \
268 ${.newline}ERROR: WITH_META_MODE is enabled but requires filemon for an incremental build. \
269 ${.newline}ERROR: 'kldload filemon' or pass -DNO_FILEMON to suppress this error.
270 .endif # !exists(/dev/filemon) && !defined(NO_FILEMON)
271 .endif # ${MK_META_MODE} == yes
272 .endif # defined(MK_META_MODE) && ${MK_META_MODE} == yes
274 # Guess target architecture from target type, and vice versa, based on
275 # historic FreeBSD practice of tending to have TARGET == TARGET_ARCH
276 # expanding to TARGET == TARGET_CPUARCH in recent times, with known
278 .if !defined(TARGET_ARCH) && defined(TARGET)
279 # T->TA mapping is usually TARGET with arm64 the odd man out
280 _TARGET_ARCH= ${TARGET:S/arm64/aarch64/:S/riscv/riscv64/}
281 .elif !defined(TARGET) && defined(TARGET_ARCH) && \
282 ${TARGET_ARCH} != ${MACHINE_ARCH}
283 # TA->T mapping is accidentally CPUARCH with aarch64 the odd man out
284 _TARGET= ${TARGET_ARCH:${__TO_CPUARCH}:C/aarch64/arm64/}
286 .if defined(TARGET) && !defined(_TARGET)
289 .if defined(TARGET_ARCH) && !defined(_TARGET_ARCH)
290 _TARGET_ARCH=${TARGET_ARCH}
292 # for historical compatibility for xdev targets
296 .if defined(XDEV_ARCH)
297 _TARGET_ARCH= ${XDEV_ARCH}
299 # Some targets require a set TARGET/TARGET_ARCH, check before the default
300 # MACHINE and after the compatibility handling.
301 .if !defined(_TARGET) || !defined(_TARGET_ARCH)
302 ${XTGTS}: _assert_target
304 # Otherwise, default to current machine type and architecture.
306 _TARGET_ARCH?= ${MACHINE_ARCH}
308 .if make(native-xtools*)
309 NXB_TARGET:= ${_TARGET}
310 NXB_TARGET_ARCH:= ${_TARGET_ARCH}
312 _TARGET_ARCH= ${MACHINE_ARCH}
313 _MAKE+= NXB_TARGET=${NXB_TARGET} \
314 NXB_TARGET_ARCH=${NXB_TARGET_ARCH}
321 _assert_target: .PHONY .MAKE
322 .for _tgt in ${XTGTS}
324 @echo "*** Error: Both TARGET and TARGET_ARCH must be defined for \"${_tgt}\" target"
330 # Make sure we have an up-to-date make(1). Only world and buildworld
331 # should do this as those are the initial targets used for upgrades.
332 # The user can define ALWAYS_CHECK_MAKE to have this check performed
335 .if defined(ALWAYS_CHECK_MAKE) || !defined(.PARSEDIR)
336 ${TGTS}: upgrade_checks
338 buildworld: upgrade_checks
342 # Handle the user-driven targets, using the source relative mk files.
345 tinderbox toolchains kernel-toolchains: .MAKE
346 ${TGTS}: .PHONY .MAKE
347 ${_+_}@cd ${.CURDIR}; ${_MAKE} ${.TARGET}
349 # The historic default "all" target creates files which may cause stale
350 # or (in the cross build case) unlinkable results. Fail with an error
351 # when no target is given. The users can explicitly specify "all"
352 # if they want the historic behavior.
357 @echo "Explicit target required. Likely \"${SUBDIR_OVERRIDE:Dall:Ubuildworld}\" is wanted. See build(7)."
361 STARTTIME!= LC_ALL=C date
362 CHECK_TIME!= cmp=`mktemp`; find ${.CURDIR}/sys/sys/param.h -newer "$$cmp" && rm "$$cmp"; echo
363 .if !empty(CHECK_TIME)
364 .error check your date/time: ${STARTTIME}
367 .if defined(HISTORICAL_MAKE_WORLD) || defined(DESTDIR)
371 # Attempt to rebuild and reinstall everything. This target is not to be
372 # used for upgrading an existing FreeBSD system, because the kernel is
373 # not included. One can argue that this target doesn't build everything
376 world: upgrade_checks .PHONY
377 @echo "--------------------------------------------------------------"
378 @echo ">>> make world started on ${STARTTIME}"
379 @echo "--------------------------------------------------------------"
380 .if target(pre-world)
382 @echo "--------------------------------------------------------------"
383 @echo ">>> Making 'pre-world' target"
384 @echo "--------------------------------------------------------------"
385 ${_+_}@cd ${.CURDIR}; ${_MAKE} pre-world
387 ${_+_}@cd ${.CURDIR}; ${_MAKE} buildworld
388 ${_+_}@cd ${.CURDIR}; ${_MAKE} installworld MK_META_MODE=no
389 .if target(post-world)
391 @echo "--------------------------------------------------------------"
392 @echo ">>> Making 'post-world' target"
393 @echo "--------------------------------------------------------------"
394 ${_+_}@cd ${.CURDIR}; ${_MAKE} post-world
397 @echo "--------------------------------------------------------------"
398 @echo ">>> make world completed on `LC_ALL=C date`"
399 @echo " (started ${STARTTIME})"
400 @echo "--------------------------------------------------------------"
403 @echo "WARNING: make world will overwrite your existing FreeBSD"
404 @echo "installation without also building and installing a new"
405 @echo "kernel. This can be dangerous. Please read the handbook,"
406 @echo "'Rebuilding world', for how to upgrade your system."
407 @echo "Define DESTDIR to where you want to install FreeBSD,"
408 @echo "including /, to override this warning and proceed as usual."
410 @echo "Bailing out now..."
417 # Short hand for `make buildkernel installkernel'
419 kernel: buildkernel installkernel .PHONY
422 # Perform a few tests to determine if the installed tools are adequate
423 # for building the world.
425 upgrade_checks: .PHONY
426 .if defined(NEED_MAKE_UPGRADE)
427 @${_+_}(cd ${.CURDIR} && ${MAKE} ${WANT_MAKE:S,^f,,})
431 # Upgrade make(1) to the current version using the installed
432 # headers, libraries and tools. Also, allow the location of
433 # the system bsdmake-like utility to be overridden.
437 INSTALL="sh ${.CURDIR}/tools/install.sh"
438 MMAKE= ${MMAKEENV} ${MAKE} \
439 OBJTOP=${MYMAKE:H}/obj \
440 OBJROOT='$${OBJTOP}/' \
443 -DNO_CPU_CFLAGS -DNO_WERROR \
445 DESTDIR= PROGNAME=${MYMAKE:T}
449 @echo "--------------------------------------------------------------"
450 @echo ">>> Building an up-to-date ${.TARGET}(1)"
451 @echo "--------------------------------------------------------------"
452 ${_+_}@cd ${.CURDIR}/usr.bin/${.TARGET}; \
456 ${MMAKE} install DESTDIR=${MYMAKE:H} BINDIR=
459 @echo "'make regress' has been renamed 'make check'" | /usr/bin/fmt
462 tinderbox toolchains kernel-toolchains kernels worlds: upgrade_checks
465 @cd ${.CURDIR}; ${SUB_MAKE} DOING_TINDERBOX=YES universe
468 @cd ${.CURDIR}; ${SUB_MAKE} UNIVERSE_TARGET=toolchain universe
470 kernel-toolchains: .PHONY
471 @cd ${.CURDIR}; ${SUB_MAKE} UNIVERSE_TARGET=kernel-toolchain universe
474 @cd ${.CURDIR}; ${SUB_MAKE} UNIVERSE_TARGET=buildkernel universe
477 @cd ${.CURDIR}; ${SUB_MAKE} UNIVERSE_TARGET=buildworld universe
482 # Attempt to rebuild *everything* for all supported architectures,
483 # with a reasonable chance of success, regardless of how old your
484 # existing system is.
486 .if make(universe) || make(universe_kernels) || make(tinderbox) || \
487 make(targets) || make(universe-toolchain)
488 TARGETS?=amd64 arm arm64 i386 mips powerpc riscv sparc64
489 _UNIVERSE_TARGETS= ${TARGETS}
490 TARGET_ARCHES_arm?= arm armv6 armv7
491 TARGET_ARCHES_arm64?= aarch64
492 TARGET_ARCHES_mips?= mipsel mips mips64el mips64 mipsn32 mipselhf mipshf mips64elhf mips64hf
493 TARGET_ARCHES_powerpc?= powerpc powerpc64 powerpcspe
494 # riscv64sf excluded due to PR 232085
495 TARGET_ARCHES_riscv?= riscv64
496 .for target in ${TARGETS}
497 TARGET_ARCHES_${target}?= ${target}
500 MAKE_PARAMS_riscv?= CROSS_TOOLCHAIN=riscv64-gcc
502 # XXX Remove architectures only supported by external toolchain from universe
503 # if required toolchain packages are missing.
504 TOOLCHAINS_riscv= riscv64
506 .if ${_UNIVERSE_TARGETS:M${target}}
507 .for toolchain in ${TOOLCHAINS_${target}}
508 .if !exists(/usr/local/share/toolchains/${toolchain}-gcc.mk)
509 _UNIVERSE_TARGETS:= ${_UNIVERSE_TARGETS:N${target}}
510 universe: universe_${toolchain}_skip .PHONY
511 universe_epilogue: universe_${toolchain}_skip .PHONY
512 universe_${toolchain}_skip: universe_prologue .PHONY
513 @echo ">> ${target} skipped - install ${toolchain}-xtoolchain-gcc port or package to build"
519 .if defined(UNIVERSE_TARGET)
520 MAKE_JUST_WORLDS= YES
522 UNIVERSE_TARGET?= buildworld
524 KERNSRCDIR?= ${.CURDIR}/sys
527 @echo "Supported TARGET/TARGET_ARCH pairs for world and kernel targets"
528 .for target in ${TARGETS}
529 .for target_arch in ${TARGET_ARCHES_${target}}
530 @echo " ${target}/${target_arch}"
534 .if defined(DOING_TINDERBOX)
535 FAILFILE=${.CURDIR}/_.tinderbox.failed
536 MAKEFAIL=tee -a ${FAILFILE}
541 universe_prologue: upgrade_checks
542 universe: universe_prologue
543 universe_prologue: .PHONY
544 @echo "--------------------------------------------------------------"
545 @echo ">>> make universe started on ${STARTTIME}"
546 @echo "--------------------------------------------------------------"
547 .if defined(DOING_TINDERBOX)
551 universe-toolchain: .PHONY universe_prologue
552 @echo "--------------------------------------------------------------"
553 @echo "> Toolchain bootstrap started on `LC_ALL=C date`"
554 @echo "--------------------------------------------------------------"
555 ${_+_}@cd ${.CURDIR}; \
556 env PATH=${PATH} ${SUB_MAKE} ${JFLAG} kernel-toolchain \
557 TARGET=${MACHINE} TARGET_ARCH=${MACHINE_ARCH} \
558 OBJTOP="${HOST_OBJTOP}" \
559 WITHOUT_SYSTEM_COMPILER=yes \
560 WITHOUT_SYSTEM_LINKER=yes \
561 TOOLS_PREFIX_UNDEF= \
563 MK_LLVM_TARGET_ALL=yes \
564 > _.${.TARGET} 2>&1 || \
565 (echo "${.TARGET} failed," \
566 "check _.${.TARGET} for details" | \
568 @if [ ! -e "${HOST_OBJTOP}/tmp/usr/bin/cc" ]; then \
569 echo "Missing host compiler at ${HOST_OBJTOP}/tmp/usr/bin/cc?" >&2; \
572 @if [ ! -e "${HOST_OBJTOP}/tmp/usr/bin/ld" ]; then \
573 echo "Missing host linker at ${HOST_OBJTOP}/tmp/usr/bin/ld?" >&2; \
576 @echo "--------------------------------------------------------------"
577 @echo "> Toolchain bootstrap completed on `LC_ALL=C date`"
578 @echo "--------------------------------------------------------------"
580 .for target in ${_UNIVERSE_TARGETS}
581 universe: universe_${target}
582 universe_epilogue: universe_${target}
583 universe_${target}: universe_${target}_prologue .PHONY
584 universe_${target}_prologue: universe_prologue .PHONY
585 @echo ">> ${target} started on `LC_ALL=C date`"
586 universe_${target}_worlds: .PHONY
588 .if !make(targets) && !make(universe-toolchain)
589 .for target_arch in ${TARGET_ARCHES_${target}}
590 .if !defined(_need_clang_${target}_${target_arch})
591 _need_clang_${target}_${target_arch} != \
592 env TARGET=${target} TARGET_ARCH=${target_arch} \
593 ${SUB_MAKE} -C ${.CURDIR} -f Makefile.inc1 test-system-compiler \
594 ${MAKE_PARAMS_${target}} -V MK_CLANG_BOOTSTRAP 2>/dev/null || \
596 .export _need_clang_${target}_${target_arch}
598 .if !defined(_need_lld_${target}_${target_arch})
599 _need_lld_${target}_${target_arch} != \
600 env TARGET=${target} TARGET_ARCH=${target_arch} \
601 ${SUB_MAKE} -C ${.CURDIR} -f Makefile.inc1 test-system-linker \
602 ${MAKE_PARAMS_${target}} -V MK_LLD_BOOTSTRAP 2>/dev/null || \
604 .export _need_lld_${target}_${target_arch}
606 # Setup env for each arch to use the one clang.
607 .if defined(_need_clang_${target}_${target_arch}) && \
608 ${_need_clang_${target}_${target_arch}} == "yes"
609 # No check on existing XCC or CROSS_BINUTILS_PREFIX, etc, is needed since
610 # we use the test-system-compiler logic to determine if clang needs to be
611 # built. It will be no from that logic if already using an external
612 # toolchain or /usr/bin/cc.
613 # XXX: Passing HOST_OBJTOP into the PATH would allow skipping legacy,
614 # bootstrap-tools, and cross-tools. Need to ensure each tool actually
615 # supports all TARGETS though.
616 # For now we only pass UNIVERSE_TOOLCHAIN_PATH which will be added at the end
617 # of STRICTTMPPATH to ensure that the target-specific binaries come first.
618 MAKE_PARAMS_${target}+= \
619 XCC="${HOST_OBJTOP}/tmp/usr/bin/cc" \
620 XCXX="${HOST_OBJTOP}/tmp/usr/bin/c++" \
621 XCPP="${HOST_OBJTOP}/tmp/usr/bin/cpp" \
622 UNIVERSE_TOOLCHAIN_PATH=${HOST_OBJTOP}/tmp/usr/bin
624 .if defined(_need_lld_${target}_${target_arch}) && \
625 ${_need_lld_${target}_${target_arch}} == "yes"
626 MAKE_PARAMS_${target}+= \
627 XLD="${HOST_OBJTOP}/tmp/usr/bin/ld"
630 .endif # !make(targets)
632 .if !defined(MAKE_JUST_KERNELS)
633 universe_${target}_done: universe_${target}_worlds .PHONY
634 .for target_arch in ${TARGET_ARCHES_${target}}
635 universe_${target}_worlds: universe_${target}_${target_arch} .PHONY
636 .if (defined(_need_clang_${target}_${target_arch}) && \
637 ${_need_clang_${target}_${target_arch}} == "yes") || \
638 (defined(_need_lld_${target}_${target_arch}) && \
639 ${_need_lld_${target}_${target_arch}} == "yes")
640 universe_${target}_${target_arch}: universe-toolchain
641 universe_${target}_prologue: universe-toolchain
643 universe_${target}_${target_arch}: universe_${target}_prologue .MAKE .PHONY
644 @echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} started on `LC_ALL=C date`"
645 @(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
646 ${SUB_MAKE} ${JFLAG} ${UNIVERSE_TARGET} \
648 TARGET_ARCH=${target_arch} \
649 ${MAKE_PARAMS_${target}} \
650 > _.${target}.${target_arch}.${UNIVERSE_TARGET} 2>&1 || \
651 (echo "${target}.${target_arch} ${UNIVERSE_TARGET} failed," \
652 "check _.${target}.${target_arch}.${UNIVERSE_TARGET} for details" | \
654 @echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} completed on `LC_ALL=C date`"
656 .endif # !MAKE_JUST_KERNELS
658 .if !defined(MAKE_JUST_WORLDS)
659 universe_${target}_done: universe_${target}_kernels .PHONY
660 universe_${target}_kernels: universe_${target}_worlds .PHONY
661 universe_${target}_kernels: universe_${target}_prologue .MAKE .PHONY
662 @if [ -e "${KERNSRCDIR}/${target}/conf/NOTES" ]; then \
663 (cd ${KERNSRCDIR}/${target}/conf && env __MAKE_CONF=/dev/null \
665 > ${.CURDIR}/_.${target}.makeLINT 2>&1 || \
666 (echo "${target} 'make LINT' failed," \
667 "check _.${target}.makeLINT for details"| ${MAKEFAIL})); \
669 @cd ${.CURDIR}; ${SUB_MAKE} ${.MAKEFLAGS} TARGET=${target} \
671 .endif # !MAKE_JUST_WORLDS
673 # Tell the user the worlds and kernels have completed
674 universe_${target}: universe_${target}_done
675 universe_${target}_done:
676 @echo ">> ${target} completed on `LC_ALL=C date`"
678 .if make(universe_kernconfs) || make(universe_kernels)
682 universe_kernels_prologue: .PHONY
683 @echo ">> ${TARGET} kernels started on `LC_ALL=C date`"
684 universe_kernels: universe_kernconfs .PHONY
685 @echo ">> ${TARGET} kernels completed on `LC_ALL=C date`"
686 .if defined(MAKE_ALL_KERNELS)
688 .elif defined(MAKE_LINT_KERNELS)
689 _THINNER=grep 'LINT' || true
691 _THINNER=xargs grep -L "^.NO_UNIVERSE" || true
693 KERNCONFS!= cd ${KERNSRCDIR}/${TARGET}/conf && \
694 find [[:upper:][:digit:]]*[[:upper:][:digit:]] \
695 -type f -maxdepth 0 \
696 ! -name DEFAULTS ! -name NOTES | \
698 universe_kernconfs: universe_kernels_prologue .PHONY
699 .for kernel in ${KERNCONFS}
700 TARGET_ARCH_${kernel}!= cd ${KERNSRCDIR}/${TARGET}/conf && \
701 config -m ${KERNSRCDIR}/${TARGET}/conf/${kernel} 2> /dev/null | \
702 grep -v WARNING: | cut -f 2
703 .if empty(TARGET_ARCH_${kernel})
704 .error "Target architecture for ${TARGET}/conf/${kernel} unknown. config(8) likely too old."
706 universe_kernconfs: universe_kernconf_${TARGET}_${kernel}
707 universe_kernconf_${TARGET}_${kernel}: .MAKE
708 @echo ">> ${TARGET}.${TARGET_ARCH_${kernel}} ${kernel} kernel started on `LC_ALL=C date`"
709 @(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
710 ${SUB_MAKE} ${JFLAG} buildkernel \
712 TARGET_ARCH=${TARGET_ARCH_${kernel}} \
713 ${MAKE_PARAMS_${TARGET}} \
715 > _.${TARGET}.${kernel} 2>&1 || \
716 (echo "${TARGET} ${kernel} kernel failed," \
717 "check _.${TARGET}.${kernel} for details"| ${MAKEFAIL}))
718 @echo ">> ${TARGET}.${TARGET_ARCH_${kernel}} ${kernel} kernel completed on `LC_ALL=C date`"
720 .endif # make(universe_kernels)
721 universe: universe_epilogue
722 universe_epilogue: .PHONY
723 @echo "--------------------------------------------------------------"
724 @echo ">>> make universe completed on `LC_ALL=C date`"
725 @echo " (started ${STARTTIME})"
726 @echo "--------------------------------------------------------------"
727 .if defined(DOING_TINDERBOX)
728 @if [ -e ${FAILFILE} ] ; then \
729 echo "Tinderbox failed:" ;\
737 ${MAKE} -C ${.CURDIR}/sys/${_TARGET}/conf LINT
739 .if defined(.PARSEDIR)
740 # This makefile does not run in meta mode
742 # Normally the things we run from here don't either.
743 # Using -DWITH_META_MODE
744 # we can buildworld with meta files created which are useful
745 # for debugging, but without any of the rest of a meta mode build.
748 # tell meta.autodep.mk to not even think about updating anything.
749 UPDATE_DEPENDFILE= NO
750 .if !make(showconfig)
751 .export MK_DIRDEPS_BUILD MK_STAGING UPDATE_DEPENDFILE
755 # we do not want a failure of one branch abort all.
756 MAKE_JOB_ERROR_TOKEN= no
757 .export MAKE_JOB_ERROR_TOKEN
761 .endif # DIRDEPS_BUILD