Makefile revision 252048
12061Sjkh#
250479Speter# $FreeBSD: stable/9/Makefile 252048 2013-06-20 22:50:08Z sjg $
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.
3432427Sjb#
3538666Sjb# This makefile is simple by design. The FreeBSD make automatically reads
36108451Sschweikh# the /usr/share/mk/sys.mk unless the -m argument is specified on the
3738666Sjb# command line. By keeping this makefile simple, it doesn't matter too
3838666Sjb# much how different the installed mk files are from those in the source
3938666Sjb# tree. This makefile executes a child make process, forcing it to use
4038666Sjb# the mk files from the source tree which are supposed to DTRT.
4117308Speter#
42217273Simp# Most of the user-driven targets (as listed above) are implemented in
43217294Simp# Makefile.inc1.  The exceptions are universe, tinderbox and targets.
4419175Sbde#
4596205Sjwd# If you want to build your system from source be sure that /usr/obj has
46217297Simp# at least 1GB of diskspace available.  A complete 'universe' build requires
47217297Simp# about 15GB of space.
4838042Sbde#
4996205Sjwd# For individuals wanting to build from the sources currently on their
5096205Sjwd# system, the simple instructions are:
5138042Sbde#
5296205Sjwd# 1.  `cd /usr/src'  (or to the directory containing your source tree).
53159363Strhodes# 2.  Define `HISTORICAL_MAKE_WORLD' variable (see README).
54159363Strhodes# 3.  `make world'
5517308Speter#
5696205Sjwd# For individuals wanting to upgrade their sources (even if only a
5796205Sjwd# delta of a few days):
5817308Speter#
59148330Snetchild#  1.  `cd /usr/src'       (or to the directory containing your source tree).
60148330Snetchild#  2.  `make buildworld'
61148330Snetchild#  3.  `make buildkernel KERNCONF=YOUR_KERNEL_HERE'     (default is GENERIC).
62148330Snetchild#  4.  `make installkernel KERNCONF=YOUR_KERNEL_HERE'   (default is GENERIC).
63159831Sobrien#       [steps 3. & 4. can be combined by using the "kernel" target]
64148330Snetchild#  5.  `reboot'        (in single user mode: boot -s from the loader prompt).
65148330Snetchild#  6.  `mergemaster -p'
66148330Snetchild#  7.  `make installworld'
67148330Snetchild#  8.  `make delete-old'
68220512Sdougb#  9.  `mergemaster'		(you may wish to use -i, along with -U or -F).
69148330Snetchild# 10.  `reboot'
70148330Snetchild# 11.  `make delete-old-libs' (in case no 3rd party program uses them anymore)
7196205Sjwd#
7296205Sjwd# See src/UPDATING `COMMON ITEMS' for more complete information.
7396205Sjwd#
74162147Sru# If TARGET=machine (e.g. ia64, sparc64, ...) is specified you can
75162147Sru# cross build world for other machine types using the buildworld target,
7698723Sdillon# and once the world is built you can cross build a kernel using the
7798723Sdillon# buildkernel target.
7898723Sdillon#
7938666Sjb# Define the user-driven targets. These are listed here in alphabetical
8038666Sjb# order, but that's not important.
8117308Speter#
82123311Speter# Targets that begin with underscore are internal targets intended for
83123311Speter# developer convenience only.  They are intentionally not documented and
84123311Speter# completely subject to change without notice.
85123311Speter#
86175833Sjhb# For more information, see the build(7) manual page.
87175833Sjhb#
88169597SdesTGTS=	all all-man buildenv buildenvvars buildkernel buildworld \
89169597Sdes	check-old check-old-dirs check-old-files check-old-libs \
90169597Sdes	checkdpadd clean cleandepend cleandir \
91169597Sdes	delete-old delete-old-dirs delete-old-files delete-old-libs \
92219177Snwhitehorn	depend distribute distributekernel distributekernel.debug \
93219177Snwhitehorn	distributeworld distrib-dirs distribution doxygen \
94158962Snetchild	everything hierarchy install installcheck installkernel \
95219177Snwhitehorn	installkernel.debug packagekernel packageworld \
96219177Snwhitehorn	reinstallkernel reinstallkernel.debug \
97158962Snetchild	installworld kernel-toolchain libraries lint maninstall \
98156840Sru	obj objlink regress rerelease showconfig tags toolchain update \
99123311Speter	_worldtmp _legacy _bootstrap-tools _cleanobj _obj \
100137288Speter	_build-tools _cross-tools _includes _libraries _depend \
101209128Sraj	build32 builddtb distribute32 install32 xdev xdev-build xdev-install \
102209128Sraj
103156740SruTGTS+=	${SUBDIR_TARGETS}
1042061Sjkh
10597769SruBITGTS=	files includes
10697252SruBITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/}
107119579SruTGTS+=	${BITGTS}
10897252Sru
10995730Sru.ORDER: buildworld installworld
11095793Sru.ORDER: buildworld distributeworld
111111617Sru.ORDER: buildworld buildkernel
11295730Sru.ORDER: buildkernel installkernel
113116679Ssimokawa.ORDER: buildkernel installkernel.debug
11495730Sru.ORDER: buildkernel reinstallkernel
115116679Ssimokawa.ORDER: buildkernel reinstallkernel.debug
11695730Sru
117110035SruPATH=	/sbin:/bin:/usr/sbin:/usr/bin
118107516SruMAKEOBJDIRPREFIX?=	/usr/obj
119138921Sru_MAKEOBJDIRPREFIX!= /usr/bin/env -i PATH=${PATH} ${MAKE} \
120156145Syar    ${.MAKEFLAGS:MMAKEOBJDIRPREFIX=*} __MAKE_CONF=${__MAKE_CONF} \
121138921Sru    -f /dev/null -V MAKEOBJDIRPREFIX dummy
122133942Sru.if !empty(_MAKEOBJDIRPREFIX)
123133942Sru.error MAKEOBJDIRPREFIX can only be set in environment, not as a global\
124156145Syar	(in make.conf(5)) or command-line variable.
125133942Sru.endif
126110035SruMAKEPATH=	${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE}
127117234SruBINMAKE= \
128110035Sru	`if [ -x ${MAKEPATH}/make ]; then echo ${MAKEPATH}/make; else echo ${MAKE}; fi` \
129117229Sru	-m ${.CURDIR}/share/mk
130252048Ssjg
131252048Ssjg.if defined(.PARSEDIR)
132252048Ssjg# don't pass -J to fmake
133252048Ssjg_MAKE=	PATH=${PATH} MAKEFLAGS="${MAKEFLAGS:N-J:N1*,1*}" ${BINMAKE} -f Makefile.inc1 TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH}
134252048Ssjg.else
135218206Simp_MAKE=	PATH=${PATH} ${BINMAKE} -f Makefile.inc1 TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH}
136252048Ssjg.endif
13754324Smarcel
138218130Simp# Guess machine architecture from machine type, and vice versa.
139218130Simp.if !defined(TARGET_ARCH) && defined(TARGET)
140221869Sattilio_TARGET_ARCH=	${TARGET:S/pc98/i386/:S/mips/mipsel/}
141218130Simp.elif !defined(TARGET) && defined(TARGET_ARCH) && \
142218130Simp    ${TARGET_ARCH} != ${MACHINE_ARCH}
143218130Simp_TARGET=		${TARGET_ARCH:C/mips.*e[lb]/mips/:C/armeb/arm/}
144218130Simp.endif
145218130Simp# Legacy names, for a transition period mips:mips -> mipsel:mips
146218130Simp.if defined(TARGET) && defined(TARGET_ARCH) && \
147218130Simp    ${TARGET_ARCH} == "mips" && ${TARGET} == "mips"
148218130Simp.warning "TARGET_ARCH of mips is deprecated in favor of mipsel or mipseb"
149218130Simp.if defined(TARGET_BIG_ENDIAN)
150218130Simp_TARGET_ARCH=mipseb
151218130Simp.else
152218130Simp_TARGET_ARCH=mipsel
153218130Simp.endif
154218130Simp.endif
155218130Simp# arm with TARGET_BIG_ENDIAN -> armeb
156218130Simp.if defined(TARGET_ARCH) && ${TARGET_ARCH} == "arm" && defined(TARGET_BIG_ENDIAN)
157218130Simp.warning "TARGET_ARCH of arm with TARGET_BIG_ENDIAN is deprecated.  use armeb"
158218130Simp_TARGET_ARCH=armeb
159218130Simp.endif
160218130Simp.if defined(TARGET) && !defined(_TARGET)
161218130Simp_TARGET=${TARGET}
162218130Simp.endif
163218130Simp.if defined(TARGET_ARCH) && !defined(_TARGET_ARCH)
164218130Simp_TARGET_ARCH=${TARGET_ARCH}
165218130Simp.endif
166218130Simp# Otherwise, default to current machine type and architecture.
167218130Simp_TARGET?=	${MACHINE}
168218130Simp_TARGET_ARCH?=	${MACHINE_ARCH}
169218130Simp
17017308Speter#
171119519Smarcel# Make sure we have an up-to-date make(1). Only world and buildworld
172119519Smarcel# should do this as those are the initial targets used for upgrades.
173119519Smarcel# The user can define ALWAYS_CHECK_MAKE to have this check performed
174119519Smarcel# for all targets.
175119519Smarcel#
176119519Smarcel.if defined(ALWAYS_CHECK_MAKE)
177119579Sru${TGTS}: upgrade_checks
178119519Smarcel.else
179119519Smarcelbuildworld: upgrade_checks
180119519Smarcel.endif
181119519Smarcel
182119519Smarcel#
183126031Sgad# This 'cleanworld' target is not included in TGTS, because it is not a
184126024Sgad# recursive target.  All of the work for it is done right here.   It is
185126024Sgad# expected that BW_CANONICALOBJDIR == the CANONICALOBJDIR as would be
186126024Sgad# created by bsd.obj.mk, except that we don't want to .include that file
187126024Sgad# in this makefile.  
188126024Sgad#
189126024Sgad# In the following, the first 'rm' in a series will usually remove all
190126024Sgad# files and directories.  If it does not, then there are probably some
191227879Sgjb# files with file flags set, so this unsets them and tries the 'rm' a
192126024Sgad# second time.  There are situations where this target will be cleaning
193126024Sgad# some directories via more than one method, but that duplication is
194227879Sgjb# needed to correctly handle all the possible situations.  Removing all
195227879Sgjb# files without file flags set in the first 'rm' instance saves time,
196227879Sgjb# because 'chflags' will need to operate on fewer files afterwards.
197126024Sgad#
198126024SgadBW_CANONICALOBJDIR:=${MAKEOBJDIRPREFIX}${.CURDIR}
199126031Sgadcleanworld:
200126024Sgad.if ${.CURDIR} == ${.OBJDIR} || ${.CURDIR}/obj == ${.OBJDIR}
201126024Sgad.if exists(${BW_CANONICALOBJDIR}/)
202126024Sgad	-rm -rf ${BW_CANONICALOBJDIR}/*
203172744Sdelphij	-chflags -R 0 ${BW_CANONICALOBJDIR}
204126024Sgad	rm -rf ${BW_CANONICALOBJDIR}/*
205126024Sgad.endif
206126024Sgad	#   To be safe in this case, fall back to a 'make cleandir'
207133376Sharti	${_+_}@cd ${.CURDIR}; ${_MAKE} cleandir
208126024Sgad.else
209126024Sgad	-rm -rf ${.OBJDIR}/*
210172744Sdelphij	-chflags -R 0 ${.OBJDIR}
211126024Sgad	rm -rf ${.OBJDIR}/*
212126024Sgad.endif
213125885Sgad
214125885Sgad#
21538666Sjb# Handle the user-driven targets, using the source relative mk files.
21617308Speter#
217119519Smarcel
218119579Sru${TGTS}:
219218206Simp	${_+_}@cd ${.CURDIR}; ${_MAKE} ${.TARGET}
2202302Spaul
22139206Sjkh# Set a reasonable default
22239206Sjkh.MAIN:	all
22339206Sjkh
224133945SruSTARTTIME!= LC_ALL=C date
225251653SgjbCHECK_TIME!= find ${.CURDIR}/sys/sys/param.h -mtime -0s ; echo
226177609Sru.if !empty(CHECK_TIME)
227177609Sru.error check your date/time: ${STARTTIME}
228177609Sru.endif
229133945Sru
230132358Smarkm.if defined(HISTORICAL_MAKE_WORLD) || defined(DESTDIR)
23117308Speter#
23254324Smarcel# world
23354324Smarcel#
234132234Smarcel# Attempt to rebuild and reinstall everything. This target is not to be
235132234Smarcel# used for upgrading an existing FreeBSD system, because the kernel is
236132234Smarcel# not included. One can argue that this target doesn't build everything
237132234Smarcel# then.
23854324Smarcel#
23954324Smarcelworld: upgrade_checks
24054324Smarcel	@echo "--------------------------------------------------------------"
241118531Sru	@echo ">>> make world started on ${STARTTIME}"
24254324Smarcel	@echo "--------------------------------------------------------------"
24354324Smarcel.if target(pre-world)
24454324Smarcel	@echo
24554324Smarcel	@echo "--------------------------------------------------------------"
24654324Smarcel	@echo ">>> Making 'pre-world' target"
24754324Smarcel	@echo "--------------------------------------------------------------"
248133376Sharti	${_+_}@cd ${.CURDIR}; ${_MAKE} pre-world
24954324Smarcel.endif
250133376Sharti	${_+_}@cd ${.CURDIR}; ${_MAKE} buildworld
251133376Sharti	${_+_}@cd ${.CURDIR}; ${_MAKE} -B installworld
25254324Smarcel.if target(post-world)
25354324Smarcel	@echo
25454324Smarcel	@echo "--------------------------------------------------------------"
25554324Smarcel	@echo ">>> Making 'post-world' target"
25654324Smarcel	@echo "--------------------------------------------------------------"
257133376Sharti	${_+_}@cd ${.CURDIR}; ${_MAKE} post-world
25854324Smarcel.endif
25954324Smarcel	@echo
26054324Smarcel	@echo "--------------------------------------------------------------"
261118531Sru	@echo ">>> make world completed on `LC_ALL=C date`"
262118531Sru	@echo "                   (started ${STARTTIME})"
26354324Smarcel	@echo "--------------------------------------------------------------"
264132234Smarcel.else
265132234Smarcelworld:
266132234Smarcel	@echo "WARNING: make world will overwrite your existing FreeBSD"
267132234Smarcel	@echo "installation without also building and installing a new"
268132234Smarcel	@echo "kernel.  This can be dangerous.  Please read the handbook,"
269132588Skensmith	@echo "'Rebuilding world', for how to upgrade your system."
270132358Smarkm	@echo "Define DESTDIR to where you want to install FreeBSD,"
271132234Smarcel	@echo "including /, to override this warning and proceed as usual."
272132358Smarkm	@echo ""
273132234Smarcel	@echo "Bailing out now..."
274132234Smarcel	@false
275132234Smarcel.endif
27654324Smarcel
27754324Smarcel#
27895730Sru# kernel
27995730Sru#
28095730Sru# Short hand for `make buildkernel installkernel'
28195730Sru#
28295730Srukernel: buildkernel installkernel
28395730Sru
28495730Sru#
28538666Sjb# Perform a few tests to determine if the installed tools are adequate
286107374Sru# for building the world.
28717308Speter#
28855678Smarcelupgrade_checks:
289143032Sharti	@if ! (cd ${.CURDIR}/tools/build/make_check && \
290138515Sharti	    PATH=${PATH} ${BINMAKE} obj >/dev/null 2>&1 && \
291117793Sru	    PATH=${PATH} ${BINMAKE} >/dev/null 2>&1); \
292110035Sru	then \
293174564Simp	    (cd ${.CURDIR} && ${MAKE} make); \
294110035Sru	fi
2952061Sjkh
29617308Speter#
297107516Sru# Upgrade make(1) to the current version using the installed
298174539Simp# headers, libraries and tools.  Also, allow the location of
299174539Simp# the system bsdmake-like utility to be overridden.
30055678Smarcel#
301107516SruMMAKEENV=	MAKEOBJDIRPREFIX=${MAKEPATH} \
302107516Sru		DESTDIR= \
303107516Sru		INSTALL="sh ${.CURDIR}/tools/install.sh"
304174564SimpMMAKE=		${MMAKEENV} ${MAKE} \
305107516Sru		-D_UPGRADING \
306139112Sru		-DNOMAN -DNO_MAN -DNOSHARED -DNO_SHARED \
307164470Sjb		-DNO_CPU_CFLAGS -DNO_WERROR
308107516Sru
309122204Skrismake: .PHONY
31055678Smarcel	@echo
31155678Smarcel	@echo "--------------------------------------------------------------"
312116696Sru	@echo ">>> Building an up-to-date make(1)"
31355678Smarcel	@echo "--------------------------------------------------------------"
314133376Sharti	${_+_}@cd ${.CURDIR}/usr.bin/make; \
315107516Sru		${MMAKE} obj && \
316107516Sru		${MMAKE} depend && \
317107516Sru		${MMAKE} all && \
318107516Sru		${MMAKE} install DESTDIR=${MAKEPATH} BINDIR=
31955678Smarcel
320185499Salfredtinderbox:
321218524Sjhb	@cd ${.CURDIR} && ${MAKE} DOING_TINDERBOX=YES universe
322185499Salfred
323218524Sjhbtoolchains:
324218524Sjhb	@cd ${.CURDIR} && ${MAKE} UNIVERSE_TARGET=toolchain universe
325218524Sjhb
32655678Smarcel#
327111131Sru# universe
328111131Sru#
329111131Sru# Attempt to rebuild *everything* for all supported architectures,
330133945Sru# with a reasonable chance of success, regardless of how old your
331111131Sru# existing system is.
332111131Sru#
333217125Simp.if make(universe) || make(universe_kernels) || make(tinderbox) || make(targets)
334221869SattilioTARGETS?=amd64 arm i386 ia64 mips pc98 powerpc sparc64
335216520SnwhitehornTARGET_ARCHES_arm?=	arm armeb
336221216SjhbTARGET_ARCHES_mips?=	mipsel mipseb mips64el mips64eb mipsn32eb
337216520SnwhitehornTARGET_ARCHES_powerpc?=	powerpc powerpc64
338216520SnwhitehornTARGET_ARCHES_pc98?=	i386
339216520Snwhitehorn.for target in ${TARGETS}
340216520SnwhitehornTARGET_ARCHES_${target}?= ${target}
341216520Snwhitehorn.endfor
342168280Smarcel
343218524Sjhb.if defined(UNIVERSE_TARGET)
344218524SjhbMAKE_JUST_WORLDS=	YES
345218524Sjhb.else
346218524SjhbUNIVERSE_TARGET?=	buildworld
347218524Sjhb.endif
348219137SjhbKERNSRCDIR?=		${.CURDIR}/sys
349218524Sjhb
350217125Simptargets:
351217815Sbz	@echo "Supported TARGET/TARGET_ARCH pairs for world and kernel targets"
352217125Simp.for target in ${TARGETS}
353217125Simp.for target_arch in ${TARGET_ARCHES_${target}}
354217125Simp	@echo "    ${target}/${target_arch}"
355217125Simp.endfor
356217125Simp.endfor
357217125Simp
358185499Salfred.if defined(DOING_TINDERBOX)
359217735SbzFAILFILE=${.CURDIR}/_.tinderbox.failed
360185499SalfredMAKEFAIL=tee -a ${FAILFILE}
361185499Salfred.else
362185499SalfredMAKEFAIL=cat
363185499Salfred.endif
364185499Salfred
365249534Sdimuniverse: universe_prologue upgrade_checks
366133945Sruuniverse_prologue:
367103985Sphk	@echo "--------------------------------------------------------------"
368103985Sphk	@echo ">>> make universe started on ${STARTTIME}"
369103985Sphk	@echo "--------------------------------------------------------------"
370185499Salfred.if defined(DOING_TINDERBOX)
371217754Sbz	@rm -f ${FAILFILE}
372185499Salfred.endif
373168280Smarcel.for target in ${TARGETS}
374162147Sruuniverse: universe_${target}
375249534Sdim.ORDER: universe_prologue upgrade_checks universe_${target}_prologue universe_${target} universe_epilogue
376216520Snwhitehornuniverse_${target}: universe_${target}_prologue
377216520Snwhitehornuniverse_${target}_prologue:
378216520Snwhitehorn	@echo ">> ${target} started on `LC_ALL=C date`"
379179232Sjb.if !defined(MAKE_JUST_KERNELS)
380216520Snwhitehorn.for target_arch in ${TARGET_ARCHES_${target}}
381216520Snwhitehornuniverse_${target}: universe_${target}_${target_arch}
382216520Snwhitehornuniverse_${target}_${target_arch}: universe_${target}_prologue
383218524Sjhb	@echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} started on `LC_ALL=C date`"
384185250Sdes	@(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
385218524Sjhb	    ${MAKE} ${JFLAG} ${UNIVERSE_TARGET} \
386162147Sru	    TARGET=${target} \
387216520Snwhitehorn	    TARGET_ARCH=${target_arch} \
388218524Sjhb	    > _.${target}.${target_arch}.${UNIVERSE_TARGET} 2>&1 || \
389218524Sjhb	    (echo "${target}.${target_arch} ${UNIVERSE_TARGET} failed," \
390218524Sjhb	    "check _.${target}.${target_arch}.${UNIVERSE_TARGET} for details" | \
391216520Snwhitehorn	    ${MAKEFAIL}))
392218524Sjhb	@echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} completed on `LC_ALL=C date`"
393216520Snwhitehorn.endfor
394179232Sjb.endif
395205290Sdougb.if !defined(MAKE_JUST_WORLDS)
396219137Sjhb.if exists(${KERNSRCDIR}/${target}/conf/NOTES)
397219137Sjhb	@(cd ${KERNSRCDIR}/${target}/conf && env __MAKE_CONF=/dev/null \
398185250Sdes	    ${MAKE} LINT > ${.CURDIR}/_.${target}.makeLINT 2>&1 || \
399185499Salfred	    (echo "${target} 'make LINT' failed," \
400185499Salfred	    "check _.${target}.makeLINT for details"| ${MAKEFAIL}))
401103985Sphk.endif
402201815Sbz	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} TARGET=${target} \
403201815Sbz	    universe_kernels
404205290Sdougb.endif
405201815Sbz	@echo ">> ${target} completed on `LC_ALL=C date`"
406201815Sbz.endfor
407201815Sbzuniverse_kernels: universe_kernconfs
408202095Sbz.if !defined(TARGET)
409202095SbzTARGET!=	uname -m
410202095Sbz.endif
411219137SjhbKERNCONFS!=	cd ${KERNSRCDIR}/${TARGET}/conf && \
412201815Sbz		find [A-Z0-9]*[A-Z0-9] -type f -maxdepth 0 \
413201815Sbz		! -name DEFAULTS ! -name NOTES
414201815Sbzuniverse_kernconfs:
415148154Sru.for kernel in ${KERNCONFS}
416219137SjhbTARGET_ARCH_${kernel}!=	cd ${KERNSRCDIR}/${TARGET}/conf && \
417219137Sjhb	config -m ${KERNSRCDIR}/${TARGET}/conf/${kernel} 2> /dev/null | \
418216934Simp	grep -v WARNING: | cut -f 2
419216934Simp.if empty(TARGET_ARCH_${kernel})
420216934Simp.error "Target architecture for ${TARGET}/conf/${kernel} unknown.  config(8) likely too old."
421216934Simp.endif
422216520Snwhitehornuniverse_kernconfs: universe_kernconf_${TARGET}_${kernel}
423216520Snwhitehornuniverse_kernconf_${TARGET}_${kernel}:
424185250Sdes	@(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
425185250Sdes	    ${MAKE} ${JFLAG} buildkernel \
426201815Sbz	    TARGET=${TARGET} \
427216520Snwhitehorn	    TARGET_ARCH=${TARGET_ARCH_${kernel}} \
428148154Sru	    KERNCONF=${kernel} \
429201815Sbz	    > _.${TARGET}.${kernel} 2>&1 || \
430201815Sbz	    (echo "${TARGET} ${kernel} kernel failed," \
431201815Sbz	    "check _.${TARGET}.${kernel} for details"| ${MAKEFAIL}))
432148154Sru.endfor
433133945Sruuniverse: universe_epilogue
434133945Sruuniverse_epilogue:
435103985Sphk	@echo "--------------------------------------------------------------"
436118531Sru	@echo ">>> make universe completed on `LC_ALL=C date`"
437118531Sru	@echo "                      (started ${STARTTIME})"
438103985Sphk	@echo "--------------------------------------------------------------"
439185499Salfred.if defined(DOING_TINDERBOX)
440185499Salfred	@if [ -e ${FAILFILE} ] ; then \
441185499Salfred		echo "Tinderbox failed:" ;\
442185499Salfred		cat ${FAILFILE} ;\
443185499Salfred		exit 1 ;\
444185499Salfred	fi
445133945Sru.endif
446185499Salfred.endif
447