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