1#
2# $FreeBSD: stable/11/Makefile 353790 2019-10-21 01:27:01Z kevans $
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# makeman             - Regenerate src.conf(5)
37# sysent              - (Re)build syscall entries from syscalls.master.
38# xdev                - xdev-build + xdev-install for the architecture
39#                       specified with XDEV and XDEV_ARCH.
40# xdev-build          - Build cross-development tools.
41# xdev-install        - Install cross-development tools.
42# xdev-links          - Create traditional links in /usr/bin for cc, etc
43# native-xtools       - Create host binaries that produce target objects
44#                       for use in qemu user-mode jails.
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
120TGTS=	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	makeman sysent \
132	_worldtmp _legacy _bootstrap-tools _cleanobj _obj \
133	_build-tools _compiler-metadata _cross-tools _includes _libraries \
134	build32 distribute32 install32 buildsoft distributesoft installsoft \
135	builddtb xdev xdev-build xdev-install \
136	xdev-links native-xtools stageworld stagekernel stage-packages \
137	create-packages-world create-packages-kernel create-packages \
138	packages installconfig real-packages sign-packages package-pkg \
139	print-dir test-system-compiler
140
141# XXX: r156740: This can't work since bsd.subdir.mk is not included ever.
142# It will only work for SUBDIR_TARGETS in make.conf.
143TGTS+=	${SUBDIR_TARGETS}
144
145BITGTS=	files includes
146BITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/}
147TGTS+=	${BITGTS}
148
149# Only some targets are allowed to use meta mode.  Others get it
150# disabled.  In some cases, such as 'install', meta mode can be dangerous
151# as a cookie may be used to prevent redundant installations (such as
152# for WORLDTMP staging).  For DESTDIR=/ we always want to install though.
153# For other cases, such as delete-old-libs, meta mode may break
154# the interactive tty prompt.  The safest route is to just whitelist
155# the ones that benefit from it.
156META_TGT_WHITELIST+= \
157	_* build32 buildfiles buildincludes buildkernel buildsoft \
158	buildworld everything kernel-toolchain kernel-toolchains kernel \
159	kernels libraries native-xtools showconfig test-system-compiler \
160	tinderbox toolchain \
161	toolchains universe world worlds xdev xdev-build
162
163.ORDER: buildworld installworld
164.ORDER: buildworld distributeworld
165.ORDER: buildworld buildkernel
166.ORDER: installworld distribution
167.ORDER: installworld installkernel
168.ORDER: buildkernel installkernel
169.ORDER: buildkernel installkernel.debug
170.ORDER: buildkernel reinstallkernel
171.ORDER: buildkernel reinstallkernel.debug
172
173PATH=	/sbin:/bin:/usr/sbin:/usr/bin
174MAKEOBJDIRPREFIX?=	/usr/obj
175_MAKEOBJDIRPREFIX!= /usr/bin/env -i PATH=${PATH} MK_AUTO_OBJ=no ${MAKE} \
176    ${.MAKEFLAGS:MMAKEOBJDIRPREFIX=*} __MAKE_CONF=${__MAKE_CONF} \
177    SRCCONF=${SRCCONF} SRC_ENV_CONF= \
178    -f /dev/null -V MAKEOBJDIRPREFIX dummy
179.if !empty(_MAKEOBJDIRPREFIX)
180.error MAKEOBJDIRPREFIX can only be set in environment or src-env.conf(5),\
181    not as a global (in make.conf(5) or src.conf(5)) or command-line variable.
182.endif
183
184# We often need to use the tree's version of make to build it.
185# Choices add to complexity though.
186# We cannot blindly use a make which may not be the one we want
187# so be explicit - until all choice is removed.
188WANT_MAKE=	bmake
189.if !empty(.MAKE.MODE:Mmeta)
190# 20160604 - support missing-meta,missing-filemon and performance improvements
191WANT_MAKE_VERSION= 20160604
192.else
193# 20160220 - support .dinclude for FAST_DEPEND.
194WANT_MAKE_VERSION= 20160220
195.endif
196MYMAKE=		${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE}/${WANT_MAKE}
197.if defined(.PARSEDIR)
198HAVE_MAKE=	bmake
199.else
200HAVE_MAKE=	fmake
201.endif
202.if defined(ALWAYS_BOOTSTRAP_MAKE) || \
203    ${HAVE_MAKE} != ${WANT_MAKE} || \
204    (defined(WANT_MAKE_VERSION) && ${MAKE_VERSION} < ${WANT_MAKE_VERSION})
205NEED_MAKE_UPGRADE= t
206.endif
207.if exists(${MYMAKE})
208SUB_MAKE:= ${MYMAKE} -m ${.CURDIR}/share/mk
209.elif defined(NEED_MAKE_UPGRADE)
210# It may not exist yet but we may cause it to.
211# In the case of fmake, upgrade_checks may cause a newer version to be built.
212SUB_MAKE= `test -x ${MYMAKE} && echo ${MYMAKE} || echo ${MAKE}` \
213	-m ${.CURDIR}/share/mk
214.else
215SUB_MAKE= ${MAKE} -m ${.CURDIR}/share/mk
216.endif
217
218_MAKE=	PATH=${PATH} MAKE_CMD=${MAKE} ${SUB_MAKE} -f Makefile.inc1 \
219	TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH}
220
221# Only allow meta mode for the whitelisted targets.  See META_TGT_WHITELIST
222# above.
223.for _tgt in ${META_TGT_WHITELIST}
224.if make(${_tgt})
225_CAN_USE_META_MODE?= yes
226.endif
227.endfor
228.if !defined(_CAN_USE_META_MODE)
229_MAKE+=	MK_META_MODE=no
230.if defined(.PARSEDIR)
231.unexport META_MODE
232.endif
233.elif defined(MK_META_MODE) && ${MK_META_MODE} == "yes"
234.if !exists(/dev/filemon) && !defined(NO_FILEMON) && !make(showconfig)
235# Require filemon be loaded to provide a working incremental build
236.error ${.newline}ERROR: The filemon module (/dev/filemon) is not loaded. \
237    ${.newline}ERROR: WITH_META_MODE is enabled but requires filemon for an incremental build. \
238    ${.newline}ERROR: 'kldload filemon' or pass -DNO_FILEMON to suppress this error.
239.endif	# !exists(/dev/filemon) && !defined(NO_FILEMON)
240.endif	# !defined(_CAN_USE_META_MODE)
241
242# Guess machine architecture from machine type, and vice versa.
243.if !defined(TARGET_ARCH) && defined(TARGET)
244_TARGET_ARCH=	${TARGET:S/pc98/i386/:S/arm64/aarch64/}
245.elif !defined(TARGET) && defined(TARGET_ARCH) && \
246    ${TARGET_ARCH} != ${MACHINE_ARCH}
247_TARGET=		${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/aarch64/arm64/:C/powerpc64/powerpc/:C/riscv64/riscv/}
248.endif
249.if defined(TARGET) && !defined(_TARGET)
250_TARGET=${TARGET}
251.endif
252.if defined(TARGET_ARCH) && !defined(_TARGET_ARCH)
253_TARGET_ARCH=${TARGET_ARCH}
254.endif
255# for historical compatibility for xdev targets
256.if defined(XDEV)
257_TARGET=	${XDEV}
258.endif
259.if defined(XDEV_ARCH)
260_TARGET_ARCH=	${XDEV_ARCH}
261.endif
262# Otherwise, default to current machine type and architecture.
263_TARGET?=	${MACHINE}
264_TARGET_ARCH?=	${MACHINE_ARCH}
265
266.if make(print-dir)
267.SILENT:
268.endif
269
270#
271# Make sure we have an up-to-date make(1). Only world and buildworld
272# should do this as those are the initial targets used for upgrades.
273# The user can define ALWAYS_CHECK_MAKE to have this check performed
274# for all targets.
275#
276.if defined(ALWAYS_CHECK_MAKE) || !defined(.PARSEDIR)
277${TGTS}: upgrade_checks
278.else
279buildworld: upgrade_checks
280.endif
281
282#
283# Handle the user-driven targets, using the source relative mk files.
284#
285
286tinderbox toolchains kernel-toolchains: .MAKE
287${TGTS}: .PHONY .MAKE
288	${_+_}@cd ${.CURDIR}; ${_MAKE} ${.TARGET}
289
290# The historic default "all" target creates files which may cause stale
291# or (in the cross build case) unlinkable results. Fail with an error
292# when no target is given. The users can explicitly specify "all"
293# if they want the historic behavior.
294.MAIN:	_guard
295
296_guard: .PHONY
297	@echo
298	@echo "Explicit target required.  Likely \"${SUBDIR_OVERRIDE:Dall:Ubuildworld}\" is wanted.  See build(7)."
299	@echo
300	@false
301
302STARTTIME!= LC_ALL=C date
303CHECK_TIME!= find ${.CURDIR}/sys/sys/param.h -mtime -0s ; echo
304.if !empty(CHECK_TIME)
305.error check your date/time: ${STARTTIME}
306.endif
307
308.if defined(HISTORICAL_MAKE_WORLD) || defined(DESTDIR)
309#
310# world
311#
312# Attempt to rebuild and reinstall everything. This target is not to be
313# used for upgrading an existing FreeBSD system, because the kernel is
314# not included. One can argue that this target doesn't build everything
315# then.
316#
317world: upgrade_checks .PHONY
318	@echo "--------------------------------------------------------------"
319	@echo ">>> make world started on ${STARTTIME}"
320	@echo "--------------------------------------------------------------"
321.if target(pre-world)
322	@echo
323	@echo "--------------------------------------------------------------"
324	@echo ">>> Making 'pre-world' target"
325	@echo "--------------------------------------------------------------"
326	${_+_}@cd ${.CURDIR}; ${_MAKE} pre-world
327.endif
328	${_+_}@cd ${.CURDIR}; ${_MAKE} buildworld
329	${_+_}@cd ${.CURDIR}; ${_MAKE} -B installworld
330.if target(post-world)
331	@echo
332	@echo "--------------------------------------------------------------"
333	@echo ">>> Making 'post-world' target"
334	@echo "--------------------------------------------------------------"
335	${_+_}@cd ${.CURDIR}; ${_MAKE} post-world
336.endif
337	@echo
338	@echo "--------------------------------------------------------------"
339	@echo ">>> make world completed on `LC_ALL=C date`"
340	@echo "                   (started ${STARTTIME})"
341	@echo "--------------------------------------------------------------"
342.else
343world: .PHONY
344	@echo "WARNING: make world will overwrite your existing FreeBSD"
345	@echo "installation without also building and installing a new"
346	@echo "kernel.  This can be dangerous.  Please read the handbook,"
347	@echo "'Rebuilding world', for how to upgrade your system."
348	@echo "Define DESTDIR to where you want to install FreeBSD,"
349	@echo "including /, to override this warning and proceed as usual."
350	@echo ""
351	@echo "Bailing out now..."
352	@false
353.endif
354
355#
356# kernel
357#
358# Short hand for `make buildkernel installkernel'
359#
360kernel: buildkernel installkernel .PHONY
361
362#
363# Perform a few tests to determine if the installed tools are adequate
364# for building the world.
365#
366upgrade_checks: .PHONY
367.if defined(NEED_MAKE_UPGRADE)
368	@${_+_}(cd ${.CURDIR} && ${MAKE} ${WANT_MAKE:S,^f,,})
369.endif
370
371#
372# Upgrade make(1) to the current version using the installed
373# headers, libraries and tools.  Also, allow the location of
374# the system bsdmake-like utility to be overridden.
375#
376MMAKEENV=	MAKEOBJDIRPREFIX=${MYMAKE:H} \
377		DESTDIR= \
378		INSTALL="sh ${.CURDIR}/tools/install.sh"
379MMAKE=		${MMAKEENV} ${MAKE} \
380		MAN= -DNO_SHARED \
381		-DNO_CPU_CFLAGS -DNO_WERROR \
382		-DNO_SUBDIR \
383		DESTDIR= PROGNAME=${MYMAKE:T}
384
385bmake: .PHONY
386	@echo
387	@echo "--------------------------------------------------------------"
388	@echo ">>> Building an up-to-date ${.TARGET}(1)"
389	@echo "--------------------------------------------------------------"
390	${_+_}@cd ${.CURDIR}/usr.bin/${.TARGET}; \
391		${MMAKE} obj; \
392		${MMAKE} depend; \
393		${MMAKE} all; \
394		${MMAKE} install DESTDIR=${MYMAKE:H} BINDIR=
395
396regress: .PHONY
397	@echo "'make regress' has been renamed 'make check'" | /usr/bin/fmt
398	@false
399
400tinderbox toolchains kernel-toolchains kernels worlds: upgrade_checks
401
402tinderbox: .PHONY
403	@cd ${.CURDIR}; ${SUB_MAKE} DOING_TINDERBOX=YES universe
404
405toolchains: .PHONY
406	@cd ${.CURDIR}; ${SUB_MAKE} UNIVERSE_TARGET=toolchain universe
407
408kernel-toolchains: .PHONY
409	@cd ${.CURDIR}; ${SUB_MAKE} UNIVERSE_TARGET=kernel-toolchain universe
410
411kernels: .PHONY
412	@cd ${.CURDIR}; ${SUB_MAKE} UNIVERSE_TARGET=buildkernel universe
413
414worlds: .PHONY
415	@cd ${.CURDIR}; ${SUB_MAKE} UNIVERSE_TARGET=buildworld universe
416
417#
418# universe
419#
420# Attempt to rebuild *everything* for all supported architectures,
421# with a reasonable chance of success, regardless of how old your
422# existing system is.
423#
424.if make(universe) || make(universe_kernels) || make(tinderbox) || make(targets)
425TARGETS?=amd64 arm arm64 i386 mips pc98 powerpc sparc64
426_UNIVERSE_TARGETS=	${TARGETS}
427TARGET_ARCHES_arm?=	arm armeb armv6
428TARGET_ARCHES_arm64?=	aarch64
429TARGET_ARCHES_mips?=	mipsel mips mips64el mips64 mipsn32
430TARGET_ARCHES_powerpc?=	powerpc powerpc64
431TARGET_ARCHES_pc98?=	i386
432.for target in ${TARGETS}
433TARGET_ARCHES_${target}?= ${target}
434.endfor
435
436# XXX Remove arm64 from universe if the required binutils package is missing.
437# It does not build with the in-tree linker.
438.if !exists(/usr/local/aarch64-freebsd/bin/ld) && ${TARGETS:Marm64}
439_UNIVERSE_TARGETS:= ${_UNIVERSE_TARGETS:Narm64}
440universe: universe_arm64_skip .PHONY
441universe_epilogue: universe_arm64_skip .PHONY
442universe_arm64_skip: universe_prologue .PHONY
443	@echo ">> arm64 skipped - install aarch64-binutils port or package to build"
444.endif
445
446.if defined(UNIVERSE_TARGET)
447MAKE_JUST_WORLDS=	YES
448.else
449UNIVERSE_TARGET?=	buildworld
450.endif
451KERNSRCDIR?=		${.CURDIR}/sys
452
453targets:	.PHONY
454	@echo "Supported TARGET/TARGET_ARCH pairs for world and kernel targets"
455.for target in ${TARGETS}
456.for target_arch in ${TARGET_ARCHES_${target}}
457	@echo "    ${target}/${target_arch}"
458.endfor
459.endfor
460
461.if defined(DOING_TINDERBOX)
462FAILFILE=${.CURDIR}/_.tinderbox.failed
463MAKEFAIL=tee -a ${FAILFILE}
464.else
465MAKEFAIL=cat
466.endif
467
468universe_prologue:  upgrade_checks
469universe: universe_prologue
470universe_prologue: .PHONY
471	@echo "--------------------------------------------------------------"
472	@echo ">>> make universe started on ${STARTTIME}"
473	@echo "--------------------------------------------------------------"
474.if defined(DOING_TINDERBOX)
475	@rm -f ${FAILFILE}
476.endif
477.for target in ${_UNIVERSE_TARGETS}
478universe: universe_${target}
479universe_epilogue: universe_${target}
480universe_${target}: universe_${target}_prologue .PHONY
481universe_${target}_prologue: universe_prologue .PHONY
482	@echo ">> ${target} started on `LC_ALL=C date`"
483universe_${target}_worlds: .PHONY
484
485.if !defined(MAKE_JUST_KERNELS)
486universe_${target}_done: universe_${target}_worlds .PHONY
487.for target_arch in ${TARGET_ARCHES_${target}}
488universe_${target}_worlds: universe_${target}_${target_arch} .PHONY
489universe_${target}_${target_arch}: universe_${target}_prologue .MAKE .PHONY
490	@echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} started on `LC_ALL=C date`"
491	@(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
492	    ${SUB_MAKE} ${JFLAG} ${UNIVERSE_TARGET} \
493	    TARGET=${target} \
494	    TARGET_ARCH=${target_arch} \
495	    > _.${target}.${target_arch}.${UNIVERSE_TARGET} 2>&1 || \
496	    (echo "${target}.${target_arch} ${UNIVERSE_TARGET} failed," \
497	    "check _.${target}.${target_arch}.${UNIVERSE_TARGET} for details" | \
498	    ${MAKEFAIL}))
499	@echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} completed on `LC_ALL=C date`"
500.endfor
501.endif # !MAKE_JUST_KERNELS
502
503.if !defined(MAKE_JUST_WORLDS)
504universe_${target}_done: universe_${target}_kernels .PHONY
505universe_${target}_kernels: universe_${target}_worlds .PHONY
506universe_${target}_kernels: universe_${target}_prologue .MAKE .PHONY
507.if exists(${KERNSRCDIR}/${target}/conf/NOTES)
508	@(cd ${KERNSRCDIR}/${target}/conf && env __MAKE_CONF=/dev/null \
509	    ${SUB_MAKE} LINT > ${.CURDIR}/_.${target}.makeLINT 2>&1 || \
510	    (echo "${target} 'make LINT' failed," \
511	    "check _.${target}.makeLINT for details"| ${MAKEFAIL}))
512.endif
513	@cd ${.CURDIR}; ${SUB_MAKE} ${.MAKEFLAGS} TARGET=${target} \
514	    universe_kernels
515.endif # !MAKE_JUST_WORLDS
516
517# Tell the user the worlds and kernels have completed
518universe_${target}: universe_${target}_done
519universe_${target}_done:
520	@echo ">> ${target} completed on `LC_ALL=C date`"
521.endfor
522.if !defined(TARGET)
523TARGET!=	uname -m
524.endif
525universe_kernels_prologue: .PHONY
526	@echo ">> ${TARGET} kernels started on `LC_ALL=C date`"
527universe_kernels: universe_kernconfs .PHONY
528	@echo ">> ${TARGET} kernels completed on `LC_ALL=C date`"
529.if defined(MAKE_ALL_KERNELS)
530_THINNER=cat
531.elif defined(MAKE_LINT_KERNELS)
532_THINNER=grep 'LINT' || true
533.else
534_THINNER=xargs grep -L "^.NO_UNIVERSE" || true
535.endif
536KERNCONFS!=	cd ${KERNSRCDIR}/${TARGET}/conf && \
537		find [[:upper:][:digit:]]*[[:upper:][:digit:]] \
538		-type f -maxdepth 0 \
539		! -name DEFAULTS ! -name NOTES | \
540		${_THINNER}
541universe_kernconfs: universe_kernels_prologue .PHONY
542.for kernel in ${KERNCONFS}
543TARGET_ARCH_${kernel}!=	cd ${KERNSRCDIR}/${TARGET}/conf && \
544	config -m ${KERNSRCDIR}/${TARGET}/conf/${kernel} 2> /dev/null | \
545	grep -v WARNING: | cut -f 2
546.if empty(TARGET_ARCH_${kernel})
547.error "Target architecture for ${TARGET}/conf/${kernel} unknown.  config(8) likely too old."
548.endif
549universe_kernconfs: universe_kernconf_${TARGET}_${kernel}
550universe_kernconf_${TARGET}_${kernel}: .MAKE
551	@echo ">> ${TARGET}.${TARGET_ARCH_${kernel}} ${kernel} kernel started on `LC_ALL=C date`"
552	@(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
553	    ${SUB_MAKE} ${JFLAG} buildkernel \
554	    TARGET=${TARGET} \
555	    TARGET_ARCH=${TARGET_ARCH_${kernel}} \
556	    KERNCONF=${kernel} \
557	    > _.${TARGET}.${kernel} 2>&1 || \
558	    (echo "${TARGET} ${kernel} kernel failed," \
559	    "check _.${TARGET}.${kernel} for details"| ${MAKEFAIL}))
560	@echo ">> ${TARGET}.${TARGET_ARCH_${kernel}} ${kernel} kernel completed on `LC_ALL=C date`"
561.endfor
562universe: universe_epilogue
563universe_epilogue: .PHONY
564	@echo "--------------------------------------------------------------"
565	@echo ">>> make universe completed on `LC_ALL=C date`"
566	@echo "                      (started ${STARTTIME})"
567	@echo "--------------------------------------------------------------"
568.if defined(DOING_TINDERBOX)
569	@if [ -e ${FAILFILE} ] ; then \
570		echo "Tinderbox failed:" ;\
571		cat ${FAILFILE} ;\
572		exit 1 ;\
573	fi
574.endif
575.endif
576
577buildLINT: .PHONY
578	${MAKE} -C ${.CURDIR}/sys/${_TARGET}/conf LINT
579
580.if defined(.PARSEDIR)
581# This makefile does not run in meta mode
582.MAKE.MODE= normal
583# Normally the things we run from here don't either.
584# Using -DWITH_META_MODE
585# we can buildworld with meta files created which are useful 
586# for debugging, but without any of the rest of a meta mode build.
587MK_DIRDEPS_BUILD= no
588MK_STAGING= no
589# tell meta.autodep.mk to not even think about updating anything.
590UPDATE_DEPENDFILE= NO
591.if !make(showconfig)
592.export MK_DIRDEPS_BUILD MK_STAGING UPDATE_DEPENDFILE
593.endif
594
595.if make(universe)
596# we do not want a failure of one branch abort all.
597MAKE_JOB_ERROR_TOKEN= no
598.export MAKE_JOB_ERROR_TOKEN
599.endif
600.endif # bmake
601
602.endif				# DIRDEPS_BUILD
603