]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - Makefile
build(7): Document native-xtools.
[FreeBSD/FreeBSD.git] / Makefile
1 #
2 # $FreeBSD$
3 #
4 # The user-driven targets are:
5 #
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
11 #                       upgrades.
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.
16 # installkernel.debug
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 # xdev                - xdev-build + xdev-install for the architecture
37 #                       specified with XDEV and XDEV_ARCH.
38 # xdev-build          - Build cross-development tools.
39 # xdev-install        - Install cross-development tools.
40 # xdev-links          - Create traditional links in /usr/bin for cc, etc
41 # native-xtools       - Create host binaries that produce target objects
42 #                       for use in qemu user-mode jails.  Override
43 #                       target location with NXBDESTDIR.  TARGET and
44 #                       TARGET_ARCH should be defined.
45
46 # "quick" way to test all kernel builds:
47 #       _jflag=`sysctl -n hw.ncpu`
48 #       _jflag=$(($_jflag * 2))
49 #       [ $_jflag -gt 12 ] && _jflag=12
50 #       make universe -DMAKE_JUST_KERNELS JFLAG=-j${_jflag}
51 #
52 # This makefile is simple by design. The FreeBSD make automatically reads
53 # the /usr/share/mk/sys.mk unless the -m argument is specified on the
54 # command line. By keeping this makefile simple, it doesn't matter too
55 # much how different the installed mk files are from those in the source
56 # tree. This makefile executes a child make process, forcing it to use
57 # the mk files from the source tree which are supposed to DTRT.
58 #
59 # Most of the user-driven targets (as listed above) are implemented in
60 # Makefile.inc1.  The exceptions are universe, tinderbox and targets.
61 #
62 # If you want to build your system from source be sure that /usr/obj has
63 # at least 6GB of diskspace available.  A complete 'universe' build requires
64 # about 100GB of space.
65 #
66 # For individuals wanting to build from the sources currently on their
67 # system, the simple instructions are:
68 #
69 # 1.  `cd /usr/src'  (or to the directory containing your source tree).
70 # 2.  Define `HISTORICAL_MAKE_WORLD' variable (see README).
71 # 3.  `make world'
72 #
73 # For individuals wanting to upgrade their sources (even if only a
74 # delta of a few days):
75 #
76 #  1.  `cd /usr/src'       (or to the directory containing your source tree).
77 #  2.  `make buildworld'
78 #  3.  `make buildkernel KERNCONF=YOUR_KERNEL_HERE'     (default is GENERIC).
79 #  4.  `make installkernel KERNCONF=YOUR_KERNEL_HERE'   (default is GENERIC).
80 #       [steps 3. & 4. can be combined by using the "kernel" target]
81 #  5.  `reboot'        (in single user mode: boot -s from the loader prompt).
82 #  6.  `mergemaster -p'
83 #  7.  `make installworld'
84 #  8.  `mergemaster'            (you may wish to use -i, along with -U or -F).
85 #  9.  `make delete-old'
86 # 10.  `reboot'
87 # 11.  `make delete-old-libs' (in case no 3rd party program uses them anymore)
88 #
89 # See src/UPDATING `COMMON ITEMS' for more complete information.
90 #
91 # If TARGET=machine (e.g. powerpc, sparc64, ...) is specified you can
92 # cross build world for other machine types using the buildworld target,
93 # and once the world is built you can cross build a kernel using the
94 # buildkernel target.
95 #
96 # Define the user-driven targets. These are listed here in alphabetical
97 # order, but that's not important.
98 #
99 # Targets that begin with underscore are internal targets intended for
100 # developer convenience only.  They are intentionally not documented and
101 # completely subject to change without notice.
102 #
103 # For more information, see the build(7) manual page.
104 #
105
106 # This is included so CC is set to ccache for -V, and COMPILER_TYPE/VERSION
107 # can be cached for sub-makes.
108 .if ${MAKE_VERSION} >= 20140620 && defined(.PARSEDIR)
109 .include <bsd.compiler.mk>
110 .endif
111
112 # Note: we use this awkward construct to be compatible with FreeBSD's
113 # old make used in 10.0 and 9.2 and earlier.
114 .if defined(MK_DIRDEPS_BUILD) && ${MK_DIRDEPS_BUILD} == "yes" && \
115     !make(showconfig) && !make(print-dir)
116 # targets/Makefile plays the role of top-level
117 .include "targets/Makefile"
118 .else
119
120 TGTS=   all all-man buildenv buildenvvars buildkernel buildworld \
121         check check-old check-old-dirs check-old-files check-old-libs \
122         checkdpadd checkworld clean cleandepend cleandir cleanworld \
123         delete-old delete-old-dirs delete-old-files delete-old-libs \
124         depend distribute distributekernel distributekernel.debug \
125         distributeworld distrib-dirs distribution doxygen \
126         everything hier hierarchy install installcheck installkernel \
127         installkernel.debug packagekernel packageworld \
128         reinstallkernel reinstallkernel.debug \
129         installworld kernel-toolchain libraries lint maninstall \
130         obj objlink rerelease showconfig tags toolchain update \
131         _worldtmp _legacy _bootstrap-tools _cleanobj _obj \
132         _build-tools _build-metadata _cross-tools _includes _libraries \
133         build32 distribute32 install32 buildsoft distributesoft installsoft \
134         builddtb xdev xdev-build xdev-install \
135         xdev-links native-xtools stageworld stagekernel stage-packages \
136         create-packages-world create-packages-kernel create-packages \
137         packages installconfig real-packages sign-packages package-pkg \
138         print-dir test-system-compiler
139
140 # These targets require a TARGET and TARGET_ARCH be defined.
141 XTGTS=  native-xtools xdev xdev-build xdev-install xdev-links
142
143 # XXX: r156740: This can't work since bsd.subdir.mk is not included ever.
144 # It will only work for SUBDIR_TARGETS in make.conf.
145 TGTS+=  ${SUBDIR_TARGETS}
146
147 BITGTS= files includes
148 BITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/}
149 TGTS+=  ${BITGTS}
150
151 # Only some targets are allowed to use meta mode.  Others get it
152 # disabled.  In some cases, such as 'install', meta mode can be dangerous
153 # as a cookie may be used to prevent redundant installations (such as
154 # for WORLDTMP staging).  For DESTDIR=/ we always want to install though.
155 # For other cases, such as delete-old-libs, meta mode may break
156 # the interactive tty prompt.  The safest route is to just whitelist
157 # the ones that benefit from it.
158 META_TGT_WHITELIST+= \
159         _* build32 buildfiles buildincludes buildkernel buildsoft \
160         buildworld everything kernel-toolchain kernel-toolchains kernel \
161         kernels libraries native-xtools showconfig test-system-compiler \
162         tinderbox toolchain \
163         toolchains universe world worlds xdev xdev-build
164
165 .ORDER: buildworld installworld
166 .ORDER: buildworld distrib-dirs
167 .ORDER: buildworld distribution
168 .ORDER: buildworld distribute
169 .ORDER: buildworld distributeworld
170 .ORDER: buildworld buildkernel
171 .ORDER: distrib-dirs distribute
172 .ORDER: distrib-dirs distributeworld
173 .ORDER: distrib-dirs installworld
174 .ORDER: distribution distribute
175 .ORDER: distributeworld distribute
176 .ORDER: distributeworld distribution
177 .ORDER: installworld distribute
178 .ORDER: installworld distribution
179 .ORDER: installworld installkernel
180 .ORDER: buildkernel installkernel
181 .ORDER: buildkernel installkernel.debug
182 .ORDER: buildkernel reinstallkernel
183 .ORDER: buildkernel reinstallkernel.debug
184
185 PATH=   /sbin:/bin:/usr/sbin:/usr/bin
186 MAKEOBJDIRPREFIX?=      /usr/obj
187 _MAKEOBJDIRPREFIX!= /usr/bin/env -i PATH=${PATH} ${MAKE} MK_AUTO_OBJ=no \
188     ${.MAKEFLAGS:MMAKEOBJDIRPREFIX=*} __MAKE_CONF=${__MAKE_CONF} \
189     -f /dev/null -V MAKEOBJDIRPREFIX dummy
190 .if !empty(_MAKEOBJDIRPREFIX)
191 .error MAKEOBJDIRPREFIX can only be set in environment, not as a global\
192         (in make.conf(5)) or command-line variable.
193 .endif
194
195 # We often need to use the tree's version of make to build it.
196 # Choices add to complexity though.
197 # We cannot blindly use a make which may not be the one we want
198 # so be exlicit - until all choice is removed.
199 WANT_MAKE=      bmake
200 .if !empty(.MAKE.MODE:Mmeta)
201 # 20160604 - support missing-meta,missing-filemon and performance improvements
202 WANT_MAKE_VERSION= 20160604
203 .else
204 # 20160220 - support .dinclude for FAST_DEPEND.
205 WANT_MAKE_VERSION= 20160220
206 .endif
207 MYMAKE=         ${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE}/${WANT_MAKE}
208 .if defined(.PARSEDIR)
209 HAVE_MAKE=      bmake
210 .else
211 HAVE_MAKE=      fmake
212 .endif
213 .if defined(ALWAYS_BOOTSTRAP_MAKE) || \
214     ${HAVE_MAKE} != ${WANT_MAKE} || \
215     (defined(WANT_MAKE_VERSION) && ${MAKE_VERSION} < ${WANT_MAKE_VERSION})
216 NEED_MAKE_UPGRADE= t
217 .endif
218 .if exists(${MYMAKE})
219 SUB_MAKE:= ${MYMAKE} -m ${.CURDIR}/share/mk
220 .elif defined(NEED_MAKE_UPGRADE)
221 # It may not exist yet but we may cause it to.
222 # In the case of fmake, upgrade_checks may cause a newer version to be built.
223 SUB_MAKE= `test -x ${MYMAKE} && echo ${MYMAKE} || echo ${MAKE}` \
224         -m ${.CURDIR}/share/mk
225 .else
226 SUB_MAKE= ${MAKE} -m ${.CURDIR}/share/mk
227 .endif
228
229 _MAKE=  PATH=${PATH} MAKE_CMD="${MAKE}" ${SUB_MAKE} -f Makefile.inc1 \
230         TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH}
231
232 # Only allow meta mode for the whitelisted targets.  See META_TGT_WHITELIST
233 # above.
234 .for _tgt in ${META_TGT_WHITELIST}
235 .if make(${_tgt})
236 _CAN_USE_META_MODE?= yes
237 .endif
238 .endfor
239 .if !defined(_CAN_USE_META_MODE)
240 _MAKE+= MK_META_MODE=no
241 .if defined(.PARSEDIR)
242 .unexport META_MODE
243 .endif
244 .elif defined(MK_META_MODE) && ${MK_META_MODE} == "yes"
245 .if !exists(/dev/filemon) && !defined(NO_FILEMON) && !make(showconfig)
246 # Require filemon be loaded to provide a working incremental build
247 .error ${.newline}ERROR: The filemon module (/dev/filemon) is not loaded. \
248     ${.newline}ERROR: WITH_META_MODE is enabled but requires filemon for an incremental build. \
249     ${.newline}ERROR: 'kldload filemon' or pass -DNO_FILEMON to suppress this error.
250 .endif  # !exists(/dev/filemon) && !defined(NO_FILEMON)
251 .endif  # !defined(_CAN_USE_META_MODE)
252
253 # Guess target architecture from target type, and vice versa, based on
254 # historic FreeBSD practice of tending to have TARGET == TARGET_ARCH
255 # expanding to TARGET == TARGET_CPUARCH in recent times, with known
256 # exceptions.
257 .if !defined(TARGET_ARCH) && defined(TARGET)
258 # T->TA mapping is usually TARGET with arm64 the odd man out
259 _TARGET_ARCH=   ${TARGET:S/arm64/aarch64/}
260 .elif !defined(TARGET) && defined(TARGET_ARCH) && \
261     ${TARGET_ARCH} != ${MACHINE_ARCH}
262 # TA->T mapping is accidentally CPUARCH with aarch64 the odd man out
263 _TARGET=        ${TARGET_ARCH:${__TO_CPUARCH}:C/aarch64/arm64/}
264 .endif
265 .if defined(TARGET) && !defined(_TARGET)
266 _TARGET=${TARGET}
267 .endif
268 .if defined(TARGET_ARCH) && !defined(_TARGET_ARCH)
269 _TARGET_ARCH=${TARGET_ARCH}
270 .endif
271 # for historical compatibility for xdev targets
272 .if defined(XDEV)
273 _TARGET=        ${XDEV}
274 .endif
275 .if defined(XDEV_ARCH)
276 _TARGET_ARCH=   ${XDEV_ARCH}
277 .endif
278 # Some targets require a set TARGET/TARGET_ARCH, check before the default
279 # MACHINE and after the compatibility handling.
280 .if !defined(_TARGET) || !defined(_TARGET_ARCH)
281 ${XTGTS}: _assert_target
282 .endif
283 # Otherwise, default to current machine type and architecture.
284 _TARGET?=       ${MACHINE}
285 _TARGET_ARCH?=  ${MACHINE_ARCH}
286
287 .if make(print-dir)
288 .SILENT:
289 .endif
290
291 _assert_target: .PHONY .MAKE
292 .for _tgt in ${XTGTS}
293 .if make(${_tgt})
294         @echo "*** Error: Both TARGET and TARGET_ARCH must be defined for \"${_tgt}\" target"
295         @false
296 .endif
297 .endfor
298
299 #
300 # Make sure we have an up-to-date make(1). Only world and buildworld
301 # should do this as those are the initial targets used for upgrades.
302 # The user can define ALWAYS_CHECK_MAKE to have this check performed
303 # for all targets.
304 #
305 .if defined(ALWAYS_CHECK_MAKE) || !defined(.PARSEDIR)
306 ${TGTS}: upgrade_checks
307 .else
308 buildworld: upgrade_checks
309 .endif
310
311 #
312 # Handle the user-driven targets, using the source relative mk files.
313 #
314
315 tinderbox toolchains kernel-toolchains: .MAKE
316 ${TGTS}: .PHONY .MAKE
317         ${_+_}@cd ${.CURDIR}; ${_MAKE} ${.TARGET}
318
319 # The historic default "all" target creates files which may cause stale
320 # or (in the cross build case) unlinkable results. Fail with an error
321 # when no target is given. The users can explicitly specify "all"
322 # if they want the historic behavior.
323 .MAIN:  _guard
324
325 _guard: .PHONY
326         @echo
327         @echo "Explicit target required.  Likely \"${SUBDIR_OVERRIDE:Dall:Ubuildworld}\" is wanted.  See build(7)."
328         @echo
329         @false
330
331 STARTTIME!= LC_ALL=C date
332 CHECK_TIME!= find ${.CURDIR}/sys/sys/param.h -mtime -0s ; echo
333 .if !empty(CHECK_TIME)
334 .error check your date/time: ${STARTTIME}
335 .endif
336
337 .if defined(HISTORICAL_MAKE_WORLD) || defined(DESTDIR)
338 #
339 # world
340 #
341 # Attempt to rebuild and reinstall everything. This target is not to be
342 # used for upgrading an existing FreeBSD system, because the kernel is
343 # not included. One can argue that this target doesn't build everything
344 # then.
345 #
346 world: upgrade_checks .PHONY
347         @echo "--------------------------------------------------------------"
348         @echo ">>> make world started on ${STARTTIME}"
349         @echo "--------------------------------------------------------------"
350 .if target(pre-world)
351         @echo
352         @echo "--------------------------------------------------------------"
353         @echo ">>> Making 'pre-world' target"
354         @echo "--------------------------------------------------------------"
355         ${_+_}@cd ${.CURDIR}; ${_MAKE} pre-world
356 .endif
357         ${_+_}@cd ${.CURDIR}; ${_MAKE} buildworld
358         ${_+_}@cd ${.CURDIR}; ${_MAKE} installworld MK_META_MODE=no
359 .if target(post-world)
360         @echo
361         @echo "--------------------------------------------------------------"
362         @echo ">>> Making 'post-world' target"
363         @echo "--------------------------------------------------------------"
364         ${_+_}@cd ${.CURDIR}; ${_MAKE} post-world
365 .endif
366         @echo
367         @echo "--------------------------------------------------------------"
368         @echo ">>> make world completed on `LC_ALL=C date`"
369         @echo "                   (started ${STARTTIME})"
370         @echo "--------------------------------------------------------------"
371 .else
372 world: .PHONY
373         @echo "WARNING: make world will overwrite your existing FreeBSD"
374         @echo "installation without also building and installing a new"
375         @echo "kernel.  This can be dangerous.  Please read the handbook,"
376         @echo "'Rebuilding world', for how to upgrade your system."
377         @echo "Define DESTDIR to where you want to install FreeBSD,"
378         @echo "including /, to override this warning and proceed as usual."
379         @echo ""
380         @echo "Bailing out now..."
381         @false
382 .endif
383
384 #
385 # kernel
386 #
387 # Short hand for `make buildkernel installkernel'
388 #
389 kernel: buildkernel installkernel .PHONY
390
391 #
392 # Perform a few tests to determine if the installed tools are adequate
393 # for building the world.
394 #
395 upgrade_checks: .PHONY
396 .if defined(NEED_MAKE_UPGRADE)
397         @${_+_}(cd ${.CURDIR} && ${MAKE} ${WANT_MAKE:S,^f,,})
398 .endif
399
400 #
401 # Upgrade make(1) to the current version using the installed
402 # headers, libraries and tools.  Also, allow the location of
403 # the system bsdmake-like utility to be overridden.
404 #
405 MMAKEENV=       MAKEOBJDIRPREFIX=${MYMAKE:H} \
406                 DESTDIR= \
407                 INSTALL="sh ${.CURDIR}/tools/install.sh"
408 MMAKE=          ${MMAKEENV} ${MAKE} \
409                 MAN= -DNO_SHARED \
410                 -DNO_CPU_CFLAGS -DNO_WERROR \
411                 -DNO_SUBDIR \
412                 DESTDIR= PROGNAME=${MYMAKE:T}
413
414 bmake: .PHONY
415         @echo
416         @echo "--------------------------------------------------------------"
417         @echo ">>> Building an up-to-date ${.TARGET}(1)"
418         @echo "--------------------------------------------------------------"
419         ${_+_}@cd ${.CURDIR}/usr.bin/${.TARGET}; \
420                 ${MMAKE} obj; \
421                 ${MMAKE} depend; \
422                 ${MMAKE} all; \
423                 ${MMAKE} install DESTDIR=${MYMAKE:H} BINDIR=
424
425 regress: .PHONY
426         @echo "'make regress' has been renamed 'make check'" | /usr/bin/fmt
427         @false
428
429 tinderbox toolchains kernel-toolchains kernels worlds: upgrade_checks
430
431 tinderbox: .PHONY
432         @cd ${.CURDIR}; ${SUB_MAKE} DOING_TINDERBOX=YES universe
433
434 toolchains: .PHONY
435         @cd ${.CURDIR}; ${SUB_MAKE} UNIVERSE_TARGET=toolchain universe
436
437 kernel-toolchains: .PHONY
438         @cd ${.CURDIR}; ${SUB_MAKE} UNIVERSE_TARGET=kernel-toolchain universe
439
440 kernels: .PHONY
441         @cd ${.CURDIR}; ${SUB_MAKE} UNIVERSE_TARGET=buildkernel universe
442
443 worlds: .PHONY
444         @cd ${.CURDIR}; ${SUB_MAKE} UNIVERSE_TARGET=buildworld universe
445
446 #
447 # universe
448 #
449 # Attempt to rebuild *everything* for all supported architectures,
450 # with a reasonable chance of success, regardless of how old your
451 # existing system is.
452 #
453 .if make(universe) || make(universe_kernels) || make(tinderbox) || make(targets)
454 TARGETS?=amd64 arm arm64 i386 mips powerpc riscv sparc64
455 _UNIVERSE_TARGETS=      ${TARGETS}
456 TARGET_ARCHES_arm?=     arm armeb armv6 armv7
457 TARGET_ARCHES_arm64?=   aarch64
458 TARGET_ARCHES_mips?=    mipsel mips mips64el mips64 mipsn32 mipselhf mipshf mips64elhf mips64hf
459 TARGET_ARCHES_powerpc?= powerpc powerpc64 powerpcspe
460 TARGET_ARCHES_riscv?=   riscv64 riscv64sf
461 .for target in ${TARGETS}
462 TARGET_ARCHES_${target}?= ${target}
463 .endfor
464
465 MAKE_PARAMS_riscv?=     CROSS_TOOLCHAIN=riscv64-gcc
466
467 # XXX Remove architectures only supported by external toolchain from universe
468 # if required toolchain packages are missing.
469 TOOLCHAINS_riscv=       riscv64
470 .for target in riscv
471 .if ${_UNIVERSE_TARGETS:M${target}}
472 .for toolchain in ${TOOLCHAINS_${target}}
473 .if !exists(/usr/local/share/toolchains/${toolchain}-gcc.mk)
474 _UNIVERSE_TARGETS:= ${_UNIVERSE_TARGETS:N${target}}
475 universe: universe_${toolchain}_skip .PHONY
476 universe_epilogue: universe_${toolchain}_skip .PHONY
477 universe_${toolchain}_skip: universe_prologue .PHONY
478         @echo ">> ${target} skipped - install ${toolchain}-xtoolchain-gcc port or package to build"
479 .endif
480 .endfor
481 .endif
482 .endfor
483
484 .if defined(UNIVERSE_TARGET)
485 MAKE_JUST_WORLDS=       YES
486 .else
487 UNIVERSE_TARGET?=       buildworld
488 .endif
489 KERNSRCDIR?=            ${.CURDIR}/sys
490
491 targets:        .PHONY
492         @echo "Supported TARGET/TARGET_ARCH pairs for world and kernel targets"
493 .for target in ${TARGETS}
494 .for target_arch in ${TARGET_ARCHES_${target}}
495         @echo "    ${target}/${target_arch}"
496 .endfor
497 .endfor
498
499 .if defined(DOING_TINDERBOX)
500 FAILFILE=${.CURDIR}/_.tinderbox.failed
501 MAKEFAIL=tee -a ${FAILFILE}
502 .else
503 MAKEFAIL=cat
504 .endif
505
506 universe_prologue:  upgrade_checks
507 universe: universe_prologue
508 universe_prologue: .PHONY
509         @echo "--------------------------------------------------------------"
510         @echo ">>> make universe started on ${STARTTIME}"
511         @echo "--------------------------------------------------------------"
512 .if defined(DOING_TINDERBOX)
513         @rm -f ${FAILFILE}
514 .endif
515 .for target in ${_UNIVERSE_TARGETS}
516 universe: universe_${target}
517 universe_epilogue: universe_${target}
518 universe_${target}: universe_${target}_prologue .PHONY
519 universe_${target}_prologue: universe_prologue .PHONY
520         @echo ">> ${target} started on `LC_ALL=C date`"
521 universe_${target}_worlds: .PHONY
522
523 .if !defined(MAKE_JUST_KERNELS)
524 universe_${target}_done: universe_${target}_worlds .PHONY
525 .for target_arch in ${TARGET_ARCHES_${target}}
526 universe_${target}_worlds: universe_${target}_${target_arch} .PHONY
527 universe_${target}_${target_arch}: universe_${target}_prologue .MAKE .PHONY
528         @echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} started on `LC_ALL=C date`"
529         @(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
530             ${SUB_MAKE} ${JFLAG} ${UNIVERSE_TARGET} \
531             TARGET=${target} \
532             TARGET_ARCH=${target_arch} \
533             ${MAKE_PARAMS_${target}} \
534             > _.${target}.${target_arch}.${UNIVERSE_TARGET} 2>&1 || \
535             (echo "${target}.${target_arch} ${UNIVERSE_TARGET} failed," \
536             "check _.${target}.${target_arch}.${UNIVERSE_TARGET} for details" | \
537             ${MAKEFAIL}))
538         @echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} completed on `LC_ALL=C date`"
539 .endfor
540 .endif # !MAKE_JUST_KERNELS
541
542 .if !defined(MAKE_JUST_WORLDS)
543 universe_${target}_done: universe_${target}_kernels .PHONY
544 universe_${target}_kernels: universe_${target}_worlds .PHONY
545 universe_${target}_kernels: universe_${target}_prologue .MAKE .PHONY
546 .if exists(${KERNSRCDIR}/${target}/conf/NOTES)
547         @(cd ${KERNSRCDIR}/${target}/conf && env __MAKE_CONF=/dev/null \
548             ${SUB_MAKE} LINT > ${.CURDIR}/_.${target}.makeLINT 2>&1 || \
549             (echo "${target} 'make LINT' failed," \
550             "check _.${target}.makeLINT for details"| ${MAKEFAIL}))
551 .endif
552         @cd ${.CURDIR}; ${SUB_MAKE} ${.MAKEFLAGS} TARGET=${target} \
553             universe_kernels
554 .endif # !MAKE_JUST_WORLDS
555
556 # Tell the user the worlds and kernels have completed
557 universe_${target}: universe_${target}_done
558 universe_${target}_done:
559         @echo ">> ${target} completed on `LC_ALL=C date`"
560 .endfor
561 universe_kernels: universe_kernconfs .PHONY
562 .if !defined(TARGET)
563 TARGET!=        uname -m
564 .endif
565 .if defined(MAKE_ALL_KERNELS)
566 _THINNER=cat
567 .elif defined(MAKE_LINT_KERNELS)
568 _THINNER=grep 'LINT' || true
569 .else
570 _THINNER=xargs grep -L "^.NO_UNIVERSE" || true
571 .endif
572 KERNCONFS!=     cd ${KERNSRCDIR}/${TARGET}/conf && \
573                 find [[:upper:][:digit:]]*[[:upper:][:digit:]] \
574                 -type f -maxdepth 0 \
575                 ! -name DEFAULTS ! -name NOTES | \
576                 ${_THINNER}
577 universe_kernconfs: .PHONY
578 .for kernel in ${KERNCONFS}
579 TARGET_ARCH_${kernel}!= cd ${KERNSRCDIR}/${TARGET}/conf && \
580         config -m ${KERNSRCDIR}/${TARGET}/conf/${kernel} 2> /dev/null | \
581         grep -v WARNING: | cut -f 2
582 .if empty(TARGET_ARCH_${kernel})
583 .error "Target architecture for ${TARGET}/conf/${kernel} unknown.  config(8) likely too old."
584 .endif
585 universe_kernconfs: universe_kernconf_${TARGET}_${kernel}
586 universe_kernconf_${TARGET}_${kernel}: .MAKE
587         @(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
588             ${SUB_MAKE} ${JFLAG} buildkernel \
589             TARGET=${TARGET} \
590             TARGET_ARCH=${TARGET_ARCH_${kernel}} \
591             ${MAKE_PARAMS_${TARGET}} \
592             KERNCONF=${kernel} \
593             > _.${TARGET}.${kernel} 2>&1 || \
594             (echo "${TARGET} ${kernel} kernel failed," \
595             "check _.${TARGET}.${kernel} for details"| ${MAKEFAIL}))
596 .endfor
597 universe: universe_epilogue
598 universe_epilogue: .PHONY
599         @echo "--------------------------------------------------------------"
600         @echo ">>> make universe completed on `LC_ALL=C date`"
601         @echo "                      (started ${STARTTIME})"
602         @echo "--------------------------------------------------------------"
603 .if defined(DOING_TINDERBOX)
604         @if [ -e ${FAILFILE} ] ; then \
605                 echo "Tinderbox failed:" ;\
606                 cat ${FAILFILE} ;\
607                 exit 1 ;\
608         fi
609 .endif
610 .endif
611
612 buildLINT: .PHONY
613         ${MAKE} -C ${.CURDIR}/sys/${_TARGET}/conf LINT
614
615 .if defined(.PARSEDIR)
616 # This makefile does not run in meta mode
617 .MAKE.MODE= normal
618 # Normally the things we run from here don't either.
619 # Using -DWITH_META_MODE
620 # we can buildworld with meta files created which are useful 
621 # for debugging, but without any of the rest of a meta mode build.
622 MK_DIRDEPS_BUILD= no
623 MK_STAGING= no
624 # tell meta.autodep.mk to not even think about updating anything.
625 UPDATE_DEPENDFILE= NO
626 .if !make(showconfig)
627 .export MK_DIRDEPS_BUILD MK_STAGING UPDATE_DEPENDFILE
628 .endif
629
630 .if make(universe)
631 # we do not want a failure of one branch abort all.
632 MAKE_JOB_ERROR_TOKEN= no
633 .export MAKE_JOB_ERROR_TOKEN
634 .endif
635 .endif # bmake
636
637 .endif                          # DIRDEPS_BUILD