12061Sjkh#
250479Speter# $FreeBSD$
32061Sjkh#
438666Sjb# The user-driven targets are:
532427Sjb#
6111131Sru# universe            - *Really* build *everything* (buildworld and
7111131Sru#                       all kernels on all architectures).
8217733Sbz# tinderbox           - Same as universe, but presents a list of failed build
9217733Sbz#                       targets and exits with an error if there were any.
1038666Sjb# buildworld          - Rebuild *everything*, including glue to help do
1138666Sjb#                       upgrades.
1238666Sjb# installworld        - Install everything built by "buildworld".
13159363Strhodes# world               - buildworld + installworld, no kernel.
1464049Salex# buildkernel         - Rebuild the kernel and the kernel-modules.
1564049Salex# installkernel       - Install the kernel and the kernel-modules.
16116679Ssimokawa# installkernel.debug
1766071Smarkm# reinstallkernel     - Reinstall the kernel and the kernel-modules.
18116679Ssimokawa# reinstallkernel.debug
1973504Sobrien# kernel              - buildkernel + installkernel.
20204661Simp# kernel-toolchain    - Builds the subset of world necessary to build a kernel
21158962Snetchild# doxygen             - Build API documentation of the kernel, needs doxygen.
22223148Sru# update              - Convenient way to update your source tree(s).
23169597Sdes# check-old           - List obsolete directories/files/libraries.
24169597Sdes# check-old-dirs      - List obsolete directories.
25169597Sdes# check-old-files     - List obsolete files.
26169597Sdes# check-old-libs      - List obsolete libraries.
27231941Spluknet# delete-old          - Delete obsolete directories/files.
28169597Sdes# delete-old-dirs     - Delete obsolete directories.
29169597Sdes# delete-old-files    - Delete obsolete files.
30169597Sdes# delete-old-libs     - Delete obsolete libraries.
31217815Sbz# targets             - Print a list of supported TARGET/TARGET_ARCH pairs
32217815Sbz#                       for world and kernel targets.
33218524Sjhb# toolchains          - Build a toolchain for all world and kernel targets.
34264812Sbrueffer# xdev                - xdev-build + xdev-install for the architecture
35264812Sbrueffer#                       specified with XDEV and XDEV_ARCH.
36264812Sbrueffer# xdev-build          - Build cross-development tools.
37264812Sbrueffer# xdev-install        - Install cross-development tools.
3832427Sjb#
3938666Sjb# This makefile is simple by design. The FreeBSD make automatically reads
40108451Sschweikh# the /usr/share/mk/sys.mk unless the -m argument is specified on the
4138666Sjb# command line. By keeping this makefile simple, it doesn't matter too
4238666Sjb# much how different the installed mk files are from those in the source
4338666Sjb# tree. This makefile executes a child make process, forcing it to use
4438666Sjb# the mk files from the source tree which are supposed to DTRT.
4517308Speter#
46217273Simp# Most of the user-driven targets (as listed above) are implemented in
47217294Simp# Makefile.inc1.  The exceptions are universe, tinderbox and targets.
4819175Sbde#
4996205Sjwd# If you want to build your system from source be sure that /usr/obj has
50217297Simp# at least 1GB of diskspace available.  A complete 'universe' build requires
51217297Simp# about 15GB of space.
5238042Sbde#
5396205Sjwd# For individuals wanting to build from the sources currently on their
5496205Sjwd# system, the simple instructions are:
5538042Sbde#
5696205Sjwd# 1.  `cd /usr/src'  (or to the directory containing your source tree).
57159363Strhodes# 2.  Define `HISTORICAL_MAKE_WORLD' variable (see README).
58159363Strhodes# 3.  `make world'
5917308Speter#
6096205Sjwd# For individuals wanting to upgrade their sources (even if only a
6196205Sjwd# delta of a few days):
6217308Speter#
63148330Snetchild#  1.  `cd /usr/src'       (or to the directory containing your source tree).
64148330Snetchild#  2.  `make buildworld'
65148330Snetchild#  3.  `make buildkernel KERNCONF=YOUR_KERNEL_HERE'     (default is GENERIC).
66148330Snetchild#  4.  `make installkernel KERNCONF=YOUR_KERNEL_HERE'   (default is GENERIC).
67159831Sobrien#       [steps 3. & 4. can be combined by using the "kernel" target]
68148330Snetchild#  5.  `reboot'        (in single user mode: boot -s from the loader prompt).
69148330Snetchild#  6.  `mergemaster -p'
70148330Snetchild#  7.  `make installworld'
71148330Snetchild#  8.  `make delete-old'
72220512Sdougb#  9.  `mergemaster'		(you may wish to use -i, along with -U or -F).
73148330Snetchild# 10.  `reboot'
74148330Snetchild# 11.  `make delete-old-libs' (in case no 3rd party program uses them anymore)
7596205Sjwd#
7696205Sjwd# See src/UPDATING `COMMON ITEMS' for more complete information.
7796205Sjwd#
78162147Sru# If TARGET=machine (e.g. ia64, sparc64, ...) is specified you can
79162147Sru# cross build world for other machine types using the buildworld target,
8098723Sdillon# and once the world is built you can cross build a kernel using the
8198723Sdillon# buildkernel target.
8298723Sdillon#
8338666Sjb# Define the user-driven targets. These are listed here in alphabetical
8438666Sjb# order, but that's not important.
8517308Speter#
86123311Speter# Targets that begin with underscore are internal targets intended for
87123311Speter# developer convenience only.  They are intentionally not documented and
88123311Speter# completely subject to change without notice.
89123311Speter#
90175833Sjhb# For more information, see the build(7) manual page.
91175833Sjhb#
92169597SdesTGTS=	all all-man buildenv buildenvvars buildkernel buildworld \
93169597Sdes	check-old check-old-dirs check-old-files check-old-libs \
94169597Sdes	checkdpadd clean cleandepend cleandir \
95169597Sdes	delete-old delete-old-dirs delete-old-files delete-old-libs \
96219177Snwhitehorn	depend distribute distributekernel distributekernel.debug \
97219177Snwhitehorn	distributeworld distrib-dirs distribution doxygen \
98252588Sobrien	everything hier hierarchy install installcheck installkernel \
99219177Snwhitehorn	installkernel.debug packagekernel packageworld \
100219177Snwhitehorn	reinstallkernel reinstallkernel.debug \
101158962Snetchild	installworld kernel-toolchain libraries lint maninstall \
102156840Sru	obj objlink regress rerelease showconfig tags toolchain update \
103123311Speter	_worldtmp _legacy _bootstrap-tools _cleanobj _obj \
104137288Speter	_build-tools _cross-tools _includes _libraries _depend \
105209128Sraj	build32 builddtb distribute32 install32 xdev xdev-build xdev-install \
106209128Sraj
107156740SruTGTS+=	${SUBDIR_TARGETS}
1082061Sjkh
10997769SruBITGTS=	files includes
11097252SruBITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/}
111119579SruTGTS+=	${BITGTS}
11297252Sru
11395730Sru.ORDER: buildworld installworld
11495793Sru.ORDER: buildworld distributeworld
115111617Sru.ORDER: buildworld buildkernel
11695730Sru.ORDER: buildkernel installkernel
117116679Ssimokawa.ORDER: buildkernel installkernel.debug
11895730Sru.ORDER: buildkernel reinstallkernel
119116679Ssimokawa.ORDER: buildkernel reinstallkernel.debug
12095730Sru
121110035SruPATH=	/sbin:/bin:/usr/sbin:/usr/bin
122107516SruMAKEOBJDIRPREFIX?=	/usr/obj
123138921Sru_MAKEOBJDIRPREFIX!= /usr/bin/env -i PATH=${PATH} ${MAKE} \
124156145Syar    ${.MAKEFLAGS:MMAKEOBJDIRPREFIX=*} __MAKE_CONF=${__MAKE_CONF} \
125138921Sru    -f /dev/null -V MAKEOBJDIRPREFIX dummy
126133942Sru.if !empty(_MAKEOBJDIRPREFIX)
127133942Sru.error MAKEOBJDIRPREFIX can only be set in environment, not as a global\
128156145Syar	(in make.conf(5)) or command-line variable.
129133942Sru.endif
130110035SruMAKEPATH=	${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE}
131117234SruBINMAKE= \
132110035Sru	`if [ -x ${MAKEPATH}/make ]; then echo ${MAKEPATH}/make; else echo ${MAKE}; fi` \
133117229Sru	-m ${.CURDIR}/share/mk
134252048Ssjg
135252048Ssjg.if defined(.PARSEDIR)
136252048Ssjg# don't pass -J to fmake
137252048Ssjg_MAKE=	PATH=${PATH} MAKEFLAGS="${MAKEFLAGS:N-J:N1*,1*}" ${BINMAKE} -f Makefile.inc1 TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH}
138252048Ssjg.else
139218206Simp_MAKE=	PATH=${PATH} ${BINMAKE} -f Makefile.inc1 TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH}
140252048Ssjg.endif
14154324Smarcel
142218130Simp# Guess machine architecture from machine type, and vice versa.
143218130Simp.if !defined(TARGET_ARCH) && defined(TARGET)
144221869Sattilio_TARGET_ARCH=	${TARGET:S/pc98/i386/:S/mips/mipsel/}
145218130Simp.elif !defined(TARGET) && defined(TARGET_ARCH) && \
146218130Simp    ${TARGET_ARCH} != ${MACHINE_ARCH}
147218130Simp_TARGET=		${TARGET_ARCH:C/mips.*e[lb]/mips/:C/armeb/arm/}
148218130Simp.endif
149218130Simp# Legacy names, for a transition period mips:mips -> mipsel:mips
150218130Simp.if defined(TARGET) && defined(TARGET_ARCH) && \
151218130Simp    ${TARGET_ARCH} == "mips" && ${TARGET} == "mips"
152218130Simp.warning "TARGET_ARCH of mips is deprecated in favor of mipsel or mipseb"
153218130Simp.if defined(TARGET_BIG_ENDIAN)
154218130Simp_TARGET_ARCH=mipseb
155218130Simp.else
156218130Simp_TARGET_ARCH=mipsel
157218130Simp.endif
158218130Simp.endif
159218130Simp# arm with TARGET_BIG_ENDIAN -> armeb
160218130Simp.if defined(TARGET_ARCH) && ${TARGET_ARCH} == "arm" && defined(TARGET_BIG_ENDIAN)
161218130Simp.warning "TARGET_ARCH of arm with TARGET_BIG_ENDIAN is deprecated.  use armeb"
162218130Simp_TARGET_ARCH=armeb
163218130Simp.endif
164218130Simp.if defined(TARGET) && !defined(_TARGET)
165218130Simp_TARGET=${TARGET}
166218130Simp.endif
167218130Simp.if defined(TARGET_ARCH) && !defined(_TARGET_ARCH)
168218130Simp_TARGET_ARCH=${TARGET_ARCH}
169218130Simp.endif
170218130Simp# Otherwise, default to current machine type and architecture.
171218130Simp_TARGET?=	${MACHINE}
172218130Simp_TARGET_ARCH?=	${MACHINE_ARCH}
173218130Simp
17417308Speter#
175119519Smarcel# Make sure we have an up-to-date make(1). Only world and buildworld
176119519Smarcel# should do this as those are the initial targets used for upgrades.
177119519Smarcel# The user can define ALWAYS_CHECK_MAKE to have this check performed
178119519Smarcel# for all targets.
179119519Smarcel#
180119519Smarcel.if defined(ALWAYS_CHECK_MAKE)
181119579Sru${TGTS}: upgrade_checks
182119519Smarcel.else
183119519Smarcelbuildworld: upgrade_checks
184119519Smarcel.endif
185119519Smarcel
186119519Smarcel#
187126031Sgad# This 'cleanworld' target is not included in TGTS, because it is not a
188126024Sgad# recursive target.  All of the work for it is done right here.   It is
189126024Sgad# expected that BW_CANONICALOBJDIR == the CANONICALOBJDIR as would be
190126024Sgad# created by bsd.obj.mk, except that we don't want to .include that file
191126024Sgad# in this makefile.  
192126024Sgad#
193126024Sgad# In the following, the first 'rm' in a series will usually remove all
194126024Sgad# files and directories.  If it does not, then there are probably some
195227879Sgjb# files with file flags set, so this unsets them and tries the 'rm' a
196126024Sgad# second time.  There are situations where this target will be cleaning
197126024Sgad# some directories via more than one method, but that duplication is
198227879Sgjb# needed to correctly handle all the possible situations.  Removing all
199227879Sgjb# files without file flags set in the first 'rm' instance saves time,
200227879Sgjb# because 'chflags' will need to operate on fewer files afterwards.
201126024Sgad#
202126024SgadBW_CANONICALOBJDIR:=${MAKEOBJDIRPREFIX}${.CURDIR}
203126031Sgadcleanworld:
204126024Sgad.if ${.CURDIR} == ${.OBJDIR} || ${.CURDIR}/obj == ${.OBJDIR}
205126024Sgad.if exists(${BW_CANONICALOBJDIR}/)
206126024Sgad	-rm -rf ${BW_CANONICALOBJDIR}/*
207172744Sdelphij	-chflags -R 0 ${BW_CANONICALOBJDIR}
208126024Sgad	rm -rf ${BW_CANONICALOBJDIR}/*
209126024Sgad.endif
210126024Sgad	#   To be safe in this case, fall back to a 'make cleandir'
211133376Sharti	${_+_}@cd ${.CURDIR}; ${_MAKE} cleandir
212126024Sgad.else
213126024Sgad	-rm -rf ${.OBJDIR}/*
214172744Sdelphij	-chflags -R 0 ${.OBJDIR}
215126024Sgad	rm -rf ${.OBJDIR}/*
216126024Sgad.endif
217125885Sgad
218125885Sgad#
21938666Sjb# Handle the user-driven targets, using the source relative mk files.
22017308Speter#
221119519Smarcel
222119579Sru${TGTS}:
223218206Simp	${_+_}@cd ${.CURDIR}; ${_MAKE} ${.TARGET}
2242302Spaul
225265450Sbrooks# The historic default "all" target creates files which may cause stale
226265450Sbrooks# or (in the cross build case) unlinkable results. Fail with an error
227265450Sbrooks# when no target is given. The users can explicitly specify "all"
228265450Sbrooks# if they want the historic behavior.
229265450Sbrooks.MAIN:	_guard
23039206Sjkh
231265450Sbrooks_guard:
232265450Sbrooks	@echo
233265450Sbrooks	@echo "Explicit target required (use \"all\" for historic behavior)"
234265450Sbrooks	@echo
235265450Sbrooks	@false
236265450Sbrooks
237133945SruSTARTTIME!= LC_ALL=C date
238251653SgjbCHECK_TIME!= find ${.CURDIR}/sys/sys/param.h -mtime -0s ; echo
239177609Sru.if !empty(CHECK_TIME)
240177609Sru.error check your date/time: ${STARTTIME}
241177609Sru.endif
242133945Sru
243132358Smarkm.if defined(HISTORICAL_MAKE_WORLD) || defined(DESTDIR)
24417308Speter#
24554324Smarcel# world
24654324Smarcel#
247132234Smarcel# Attempt to rebuild and reinstall everything. This target is not to be
248132234Smarcel# used for upgrading an existing FreeBSD system, because the kernel is
249132234Smarcel# not included. One can argue that this target doesn't build everything
250132234Smarcel# then.
25154324Smarcel#
25254324Smarcelworld: upgrade_checks
25354324Smarcel	@echo "--------------------------------------------------------------"
254118531Sru	@echo ">>> make world started on ${STARTTIME}"
25554324Smarcel	@echo "--------------------------------------------------------------"
25654324Smarcel.if target(pre-world)
25754324Smarcel	@echo
25854324Smarcel	@echo "--------------------------------------------------------------"
25954324Smarcel	@echo ">>> Making 'pre-world' target"
26054324Smarcel	@echo "--------------------------------------------------------------"
261133376Sharti	${_+_}@cd ${.CURDIR}; ${_MAKE} pre-world
26254324Smarcel.endif
263133376Sharti	${_+_}@cd ${.CURDIR}; ${_MAKE} buildworld
264133376Sharti	${_+_}@cd ${.CURDIR}; ${_MAKE} -B installworld
26554324Smarcel.if target(post-world)
26654324Smarcel	@echo
26754324Smarcel	@echo "--------------------------------------------------------------"
26854324Smarcel	@echo ">>> Making 'post-world' target"
26954324Smarcel	@echo "--------------------------------------------------------------"
270133376Sharti	${_+_}@cd ${.CURDIR}; ${_MAKE} post-world
27154324Smarcel.endif
27254324Smarcel	@echo
27354324Smarcel	@echo "--------------------------------------------------------------"
274118531Sru	@echo ">>> make world completed on `LC_ALL=C date`"
275118531Sru	@echo "                   (started ${STARTTIME})"
27654324Smarcel	@echo "--------------------------------------------------------------"
277132234Smarcel.else
278132234Smarcelworld:
279132234Smarcel	@echo "WARNING: make world will overwrite your existing FreeBSD"
280132234Smarcel	@echo "installation without also building and installing a new"
281132234Smarcel	@echo "kernel.  This can be dangerous.  Please read the handbook,"
282132588Skensmith	@echo "'Rebuilding world', for how to upgrade your system."
283132358Smarkm	@echo "Define DESTDIR to where you want to install FreeBSD,"
284132234Smarcel	@echo "including /, to override this warning and proceed as usual."
285132358Smarkm	@echo ""
286132234Smarcel	@echo "Bailing out now..."
287132234Smarcel	@false
288132234Smarcel.endif
28954324Smarcel
29054324Smarcel#
29195730Sru# kernel
29295730Sru#
29395730Sru# Short hand for `make buildkernel installkernel'
29495730Sru#
29595730Srukernel: buildkernel installkernel
29695730Sru
29795730Sru#
29838666Sjb# Perform a few tests to determine if the installed tools are adequate
299107374Sru# for building the world.
30017308Speter#
30155678Smarcelupgrade_checks:
302143032Sharti	@if ! (cd ${.CURDIR}/tools/build/make_check && \
303138515Sharti	    PATH=${PATH} ${BINMAKE} obj >/dev/null 2>&1 && \
304117793Sru	    PATH=${PATH} ${BINMAKE} >/dev/null 2>&1); \
305110035Sru	then \
306174564Simp	    (cd ${.CURDIR} && ${MAKE} make); \
307110035Sru	fi
3082061Sjkh
30917308Speter#
310107516Sru# Upgrade make(1) to the current version using the installed
311174539Simp# headers, libraries and tools.  Also, allow the location of
312174539Simp# the system bsdmake-like utility to be overridden.
31355678Smarcel#
314107516SruMMAKEENV=	MAKEOBJDIRPREFIX=${MAKEPATH} \
315107516Sru		DESTDIR= \
316107516Sru		INSTALL="sh ${.CURDIR}/tools/install.sh"
317174564SimpMMAKE=		${MMAKEENV} ${MAKE} \
318107516Sru		-D_UPGRADING \
319139112Sru		-DNOMAN -DNO_MAN -DNOSHARED -DNO_SHARED \
320164470Sjb		-DNO_CPU_CFLAGS -DNO_WERROR
321107516Sru
322122204Skrismake: .PHONY
32355678Smarcel	@echo
32455678Smarcel	@echo "--------------------------------------------------------------"
325116696Sru	@echo ">>> Building an up-to-date make(1)"
32655678Smarcel	@echo "--------------------------------------------------------------"
327133376Sharti	${_+_}@cd ${.CURDIR}/usr.bin/make; \
328107516Sru		${MMAKE} obj && \
329107516Sru		${MMAKE} depend && \
330107516Sru		${MMAKE} all && \
331107516Sru		${MMAKE} install DESTDIR=${MAKEPATH} BINDIR=
33255678Smarcel
333185499Salfredtinderbox:
334218524Sjhb	@cd ${.CURDIR} && ${MAKE} DOING_TINDERBOX=YES universe
335185499Salfred
336218524Sjhbtoolchains:
337218524Sjhb	@cd ${.CURDIR} && ${MAKE} UNIVERSE_TARGET=toolchain universe
338218524Sjhb
33955678Smarcel#
340111131Sru# universe
341111131Sru#
342111131Sru# Attempt to rebuild *everything* for all supported architectures,
343133945Sru# with a reasonable chance of success, regardless of how old your
344111131Sru# existing system is.
345111131Sru#
346217125Simp.if make(universe) || make(universe_kernels) || make(tinderbox) || make(targets)
347221869SattilioTARGETS?=amd64 arm i386 ia64 mips pc98 powerpc sparc64
348216520SnwhitehornTARGET_ARCHES_arm?=	arm armeb
349221216SjhbTARGET_ARCHES_mips?=	mipsel mipseb mips64el mips64eb mipsn32eb
350216520SnwhitehornTARGET_ARCHES_powerpc?=	powerpc powerpc64
351216520SnwhitehornTARGET_ARCHES_pc98?=	i386
352216520Snwhitehorn.for target in ${TARGETS}
353216520SnwhitehornTARGET_ARCHES_${target}?= ${target}
354216520Snwhitehorn.endfor
355168280Smarcel
356218524Sjhb.if defined(UNIVERSE_TARGET)
357218524SjhbMAKE_JUST_WORLDS=	YES
358218524Sjhb.else
359218524SjhbUNIVERSE_TARGET?=	buildworld
360218524Sjhb.endif
361219137SjhbKERNSRCDIR?=		${.CURDIR}/sys
362218524Sjhb
363217125Simptargets:
364217815Sbz	@echo "Supported TARGET/TARGET_ARCH pairs for world and kernel targets"
365217125Simp.for target in ${TARGETS}
366217125Simp.for target_arch in ${TARGET_ARCHES_${target}}
367217125Simp	@echo "    ${target}/${target_arch}"
368217125Simp.endfor
369217125Simp.endfor
370217125Simp
371185499Salfred.if defined(DOING_TINDERBOX)
372217735SbzFAILFILE=${.CURDIR}/_.tinderbox.failed
373185499SalfredMAKEFAIL=tee -a ${FAILFILE}
374185499Salfred.else
375185499SalfredMAKEFAIL=cat
376185499Salfred.endif
377185499Salfred
378249534Sdimuniverse: universe_prologue upgrade_checks
379133945Sruuniverse_prologue:
380103985Sphk	@echo "--------------------------------------------------------------"
381103985Sphk	@echo ">>> make universe started on ${STARTTIME}"
382103985Sphk	@echo "--------------------------------------------------------------"
383185499Salfred.if defined(DOING_TINDERBOX)
384217754Sbz	@rm -f ${FAILFILE}
385185499Salfred.endif
386168280Smarcel.for target in ${TARGETS}
387162147Sruuniverse: universe_${target}
388249534Sdim.ORDER: universe_prologue upgrade_checks universe_${target}_prologue universe_${target} universe_epilogue
389216520Snwhitehornuniverse_${target}: universe_${target}_prologue
390216520Snwhitehornuniverse_${target}_prologue:
391216520Snwhitehorn	@echo ">> ${target} started on `LC_ALL=C date`"
392179232Sjb.if !defined(MAKE_JUST_KERNELS)
393216520Snwhitehorn.for target_arch in ${TARGET_ARCHES_${target}}
394216520Snwhitehornuniverse_${target}: universe_${target}_${target_arch}
395216520Snwhitehornuniverse_${target}_${target_arch}: universe_${target}_prologue
396218524Sjhb	@echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} started on `LC_ALL=C date`"
397185250Sdes	@(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
398218524Sjhb	    ${MAKE} ${JFLAG} ${UNIVERSE_TARGET} \
399162147Sru	    TARGET=${target} \
400216520Snwhitehorn	    TARGET_ARCH=${target_arch} \
401218524Sjhb	    > _.${target}.${target_arch}.${UNIVERSE_TARGET} 2>&1 || \
402218524Sjhb	    (echo "${target}.${target_arch} ${UNIVERSE_TARGET} failed," \
403218524Sjhb	    "check _.${target}.${target_arch}.${UNIVERSE_TARGET} for details" | \
404216520Snwhitehorn	    ${MAKEFAIL}))
405218524Sjhb	@echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} completed on `LC_ALL=C date`"
406216520Snwhitehorn.endfor
407179232Sjb.endif
408205290Sdougb.if !defined(MAKE_JUST_WORLDS)
409219137Sjhb.if exists(${KERNSRCDIR}/${target}/conf/NOTES)
410219137Sjhb	@(cd ${KERNSRCDIR}/${target}/conf && env __MAKE_CONF=/dev/null \
411185250Sdes	    ${MAKE} LINT > ${.CURDIR}/_.${target}.makeLINT 2>&1 || \
412185499Salfred	    (echo "${target} 'make LINT' failed," \
413185499Salfred	    "check _.${target}.makeLINT for details"| ${MAKEFAIL}))
414103985Sphk.endif
415201815Sbz	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} TARGET=${target} \
416201815Sbz	    universe_kernels
417205290Sdougb.endif
418201815Sbz	@echo ">> ${target} completed on `LC_ALL=C date`"
419201815Sbz.endfor
420201815Sbzuniverse_kernels: universe_kernconfs
421202095Sbz.if !defined(TARGET)
422202095SbzTARGET!=	uname -m
423202095Sbz.endif
424219137SjhbKERNCONFS!=	cd ${KERNSRCDIR}/${TARGET}/conf && \
425201815Sbz		find [A-Z0-9]*[A-Z0-9] -type f -maxdepth 0 \
426201815Sbz		! -name DEFAULTS ! -name NOTES
427201815Sbzuniverse_kernconfs:
428148154Sru.for kernel in ${KERNCONFS}
429219137SjhbTARGET_ARCH_${kernel}!=	cd ${KERNSRCDIR}/${TARGET}/conf && \
430219137Sjhb	config -m ${KERNSRCDIR}/${TARGET}/conf/${kernel} 2> /dev/null | \
431216934Simp	grep -v WARNING: | cut -f 2
432216934Simp.if empty(TARGET_ARCH_${kernel})
433216934Simp.error "Target architecture for ${TARGET}/conf/${kernel} unknown.  config(8) likely too old."
434216934Simp.endif
435216520Snwhitehornuniverse_kernconfs: universe_kernconf_${TARGET}_${kernel}
436216520Snwhitehornuniverse_kernconf_${TARGET}_${kernel}:
437185250Sdes	@(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
438185250Sdes	    ${MAKE} ${JFLAG} buildkernel \
439201815Sbz	    TARGET=${TARGET} \
440216520Snwhitehorn	    TARGET_ARCH=${TARGET_ARCH_${kernel}} \
441148154Sru	    KERNCONF=${kernel} \
442201815Sbz	    > _.${TARGET}.${kernel} 2>&1 || \
443201815Sbz	    (echo "${TARGET} ${kernel} kernel failed," \
444201815Sbz	    "check _.${TARGET}.${kernel} for details"| ${MAKEFAIL}))
445148154Sru.endfor
446133945Sruuniverse: universe_epilogue
447133945Sruuniverse_epilogue:
448103985Sphk	@echo "--------------------------------------------------------------"
449118531Sru	@echo ">>> make universe completed on `LC_ALL=C date`"
450118531Sru	@echo "                      (started ${STARTTIME})"
451103985Sphk	@echo "--------------------------------------------------------------"
452185499Salfred.if defined(DOING_TINDERBOX)
453185499Salfred	@if [ -e ${FAILFILE} ] ; then \
454185499Salfred		echo "Tinderbox failed:" ;\
455185499Salfred		cat ${FAILFILE} ;\
456185499Salfred		exit 1 ;\
457185499Salfred	fi
458133945Sru.endif
459185499Salfred.endif
460