Makefile revision 254417
171579Sdeischen#
271579Sdeischen# $FreeBSD: head/Makefile 254417 2013-08-16 16:26:23Z sjg $
371579Sdeischen#
471579Sdeischen# The user-driven targets are:
571579Sdeischen#
671579Sdeischen# universe            - *Really* build *everything* (buildworld and
771579Sdeischen#                       all kernels on all architectures).
871579Sdeischen# tinderbox           - Same as universe, but presents a list of failed build
971579Sdeischen#                       targets and exits with an error if there were any.
1071579Sdeischen# buildworld          - Rebuild *everything*, including glue to help do
1171579Sdeischen#                       upgrades.
1271579Sdeischen# installworld        - Install everything built by "buildworld".
1371579Sdeischen# world               - buildworld + installworld, no kernel.
1471579Sdeischen# buildkernel         - Rebuild the kernel and the kernel-modules.
1571579Sdeischen# installkernel       - Install the kernel and the kernel-modules.
1671579Sdeischen# installkernel.debug
1771579Sdeischen# reinstallkernel     - Reinstall the kernel and the kernel-modules.
1871579Sdeischen# reinstallkernel.debug
1971579Sdeischen# kernel              - buildkernel + installkernel.
2071579Sdeischen# kernel-toolchain    - Builds the subset of world necessary to build a kernel
2171579Sdeischen# kernel-toolchains   - Build kernel-toolchain for all universe targets.
2271579Sdeischen# doxygen             - Build API documentation of the kernel, needs doxygen.
2371579Sdeischen# update              - Convenient way to update your source tree(s).
2471579Sdeischen# check-old           - List obsolete directories/files/libraries.
2571579Sdeischen# check-old-dirs      - List obsolete directories.
2671579Sdeischen# check-old-files     - List obsolete files.
2771579Sdeischen# check-old-libs      - List obsolete libraries.
2871579Sdeischen# delete-old          - Delete obsolete directories/files.
2971579Sdeischen# delete-old-dirs     - Delete obsolete directories.
3071579Sdeischen# delete-old-files    - Delete obsolete files.
3171579Sdeischen# delete-old-libs     - Delete obsolete libraries.
3271579Sdeischen# targets             - Print a list of supported TARGET/TARGET_ARCH pairs
3382496Sbde#                       for world and kernel targets.
34106866Sdeischen# toolchains          - Build a toolchain for all world and kernel targets.
35106866Sdeischen# 
36106866Sdeischen# "quick" way to test all kernel builds:
3782496Sbde# 	_jflag=`sysctl -n hw.ncpu`
3882496Sbde# 	_jflag=$(($_jflag * 2))
3982496Sbde# 	[ $_jflag -gt 12 ] && _jflag=12
4082496Sbde# 	make universe -DMAKE_JUST_KERNELS JFLAG=-j${_jflag}
4182496Sbde#
4282496Sbde# This makefile is simple by design. The FreeBSD make automatically reads
4386250Sbde# the /usr/share/mk/sys.mk unless the -m argument is specified on the
4482496Sbde# command line. By keeping this makefile simple, it doesn't matter too
45113595Snectar# much how different the installed mk files are from those in the source
4682496Sbde# tree. This makefile executes a child make process, forcing it to use
4782496Sbde# the mk files from the source tree which are supposed to DTRT.
4871579Sdeischen#
4971579Sdeischen# Most of the user-driven targets (as listed above) are implemented in
5071579Sdeischen# Makefile.inc1.  The exceptions are universe, tinderbox and targets.
5171579Sdeischen#
5275186Stmm# If you want to build your system from source be sure that /usr/obj has
5375186Stmm# at least 1GB of diskspace available.  A complete 'universe' build requires
5475186Stmm# about 15GB of space.
5575186Stmm#
5671579Sdeischen# For individuals wanting to build from the sources currently on their
5775186Stmm# system, the simple instructions are:
5875186Stmm#
5971579Sdeischen# 1.  `cd /usr/src'  (or to the directory containing your source tree).
6071579Sdeischen# 2.  Define `HISTORICAL_MAKE_WORLD' variable (see README).
6171579Sdeischen# 3.  `make world'
6271579Sdeischen#
6371579Sdeischen# For individuals wanting to upgrade their sources (even if only a
6471579Sdeischen# delta of a few days):
6571579Sdeischen#
6671579Sdeischen#  1.  `cd /usr/src'       (or to the directory containing your source tree).
67111010Snectar#  2.  `make buildworld'
6871579Sdeischen#  3.  `make buildkernel KERNCONF=YOUR_KERNEL_HERE'     (default is GENERIC).
6971579Sdeischen#  4.  `make installkernel KERNCONF=YOUR_KERNEL_HERE'   (default is GENERIC).
7071579Sdeischen#       [steps 3. & 4. can be combined by using the "kernel" target]
7171579Sdeischen#  5.  `reboot'        (in single user mode: boot -s from the loader prompt).
7271579Sdeischen#  6.  `mergemaster -p'
7371579Sdeischen#  7.  `make installworld'
7471579Sdeischen#  8.  `mergemaster'		(you may wish to use -i, along with -U or -F).
7593399Smarkm#  9.  `make delete-old'
7671579Sdeischen# 10.  `reboot'
7771579Sdeischen# 11.  `make delete-old-libs' (in case no 3rd party program uses them anymore)
7871579Sdeischen#
7971579Sdeischen# See src/UPDATING `COMMON ITEMS' for more complete information.
8071579Sdeischen#
8171579Sdeischen# If TARGET=machine (e.g. ia64, sparc64, ...) is specified you can
8271579Sdeischen# cross build world for other machine types using the buildworld target,
83197968Sjilles# and once the world is built you can cross build a kernel using the
8474462Salfred# buildkernel target.
85156319Sdeischen#
86156319Sdeischen# Define the user-driven targets. These are listed here in alphabetical
87157218Sdes# order, but that's not important.
88177607Sru#
89156319Sdeischen# Targets that begin with underscore are internal targets intended for
90156319Sdeischen# developer convenience only.  They are intentionally not documented and
91156319Sdeischen# completely subject to change without notice.
92156319Sdeischen#
93156319Sdeischen# For more information, see the build(7) manual page.
94156319Sdeischen#
95157218SdesTGTS=	all all-man buildenv buildenvvars buildkernel buildworld \
96157218Sdes	check-old check-old-dirs check-old-files check-old-libs \
97157218Sdes	checkdpadd clean cleandepend cleandir \
98156319Sdeischen	delete-old delete-old-dirs delete-old-files delete-old-libs \
99177607Sru	depend distribute distributekernel distributekernel.debug \
100157218Sdes	distributeworld distrib-dirs distribution doxygen \
101156319Sdeischen	everything hier hierarchy install installcheck installkernel \
102156319Sdeischen	installkernel.debug packagekernel packageworld \
103156319Sdeischen	reinstallkernel reinstallkernel.debug \
104156319Sdeischen	installworld kernel-toolchain libraries lint maninstall \
105156319Sdeischen	obj objlink regress rerelease showconfig tags toolchain update \
106156319Sdeischen	_worldtmp _legacy _bootstrap-tools _cleanobj _obj \
107157218Sdes	_build-tools _cross-tools _includes _libraries _depend \
108157218Sdes	build32 builddtb distribute32 install32 xdev xdev-build xdev-install \
109157218Sdes
110157218SdesTGTS+=	${SUBDIR_TARGETS}
111157218Sdes
112157218SdesBITGTS=	files includes
113157218SdesBITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/}
114157218SdesTGTS+=	${BITGTS}
115157218Sdes
116157218Sdes.ORDER: buildworld installworld
117156319Sdeischen.ORDER: buildworld distributeworld
118106866Sdeischen.ORDER: buildworld buildkernel
119106866Sdeischen.ORDER: buildkernel installkernel
120106866Sdeischen.ORDER: buildkernel installkernel.debug
12174462Salfred.ORDER: buildkernel reinstallkernel
122106866Sdeischen.ORDER: buildkernel reinstallkernel.debug
12374462Salfred
124157218SdesPATH=	/sbin:/bin:/usr/sbin:/usr/bin
125157218SdesMAKEOBJDIRPREFIX?=	/usr/obj
126157218Sdes_MAKEOBJDIRPREFIX!= /usr/bin/env -i PATH=${PATH} ${MAKE} \
127157218Sdes    ${.MAKEFLAGS:MMAKEOBJDIRPREFIX=*} __MAKE_CONF=${__MAKE_CONF} \
128157218Sdes    -f /dev/null -V MAKEOBJDIRPREFIX dummy
129157218Sdes.if !empty(_MAKEOBJDIRPREFIX)
130157218Sdes.error MAKEOBJDIRPREFIX can only be set in environment, not as a global\
131156319Sdeischen	(in make.conf(5)) or command-line variable.
132156319Sdeischen.endif
13374462Salfred
134177855Sdavidxu# We often need to use the tree's version of make to build it.
135157218Sdes# Choices add to complexity though.
136177607Sru# We cannot blindly use a make which may not be the one we want
137157218Sdes# so be exlicit - until all choice is removed.
138157218Sdes.if !defined(WITHOUT_BMAKE)
13971579SdeischenWANT_MAKE=	bmake
140218414Sjkim.else
141156319SdeischenWANT_MAKE=	fmake
14271579Sdeischen.endif
14371579SdeischenMYMAKE=		${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE}/${WANT_MAKE}
144157218Sdes.if defined(.PARSEDIR)
14574462SalfredHAVE_MAKE=	bmake
146157218Sdes.else
14771579SdeischenHAVE_MAKE=	fmake
148157218Sdes.endif
14971579Sdeischen.if exists(${MYMAKE})
150176058SdesSUB_MAKE:= ${MYMAKE} -m ${.CURDIR}/share/mk
15171579Sdeischen.elif ${WANT_MAKE} != ${HAVE_MAKE} || ${WANT_MAKE} != "bmake"
152157218Sdes# It may not exist yet but we may cause it to.
153157218Sdes# In the case of fmake, upgrade_checks may cause a newer version to be built.
15471579SdeischenSUB_MAKE= `test -x ${MYMAKE} && echo ${MYMAKE} || echo ${MAKE}` \
15571579Sdeischen	-m ${.CURDIR}/share/mk
156106866Sdeischen.else
157157218SdesSUB_MAKE= ${MAKE} -m ${.CURDIR}/share/mk
158157218Sdes.endif
159157218Sdes
160157218Sdes_MAKE=	PATH=${PATH} ${SUB_MAKE} -f Makefile.inc1 TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH}
161157218Sdes
16271579Sdeischen# Guess machine architecture from machine type, and vice versa.
163157218Sdes.if !defined(TARGET_ARCH) && defined(TARGET)
164157218Sdes_TARGET_ARCH=	${TARGET:S/pc98/i386/}
165157218Sdes.elif !defined(TARGET) && defined(TARGET_ARCH) && \
166157218Sdes    ${TARGET_ARCH} != ${MACHINE_ARCH}
16771579Sdeischen_TARGET=		${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/}
16871579Sdeischen.endif
169157218Sdes# Legacy names, for another transition period mips:mips(n32|64)?eb -> mips:mips\1
170157218Sdes.if defined(TARGET) && defined(TARGET_ARCH) && \
171106866Sdeischen    ${TARGET} == "mips" && ${TARGET_ARCH:Mmips*eb}
17274462Salfred_TARGET_ARCH=		${TARGET_ARCH:C/eb$//}
17374462Salfred.warning "TARGET_ARCH of ${TARGET_ARCH} is deprecated in favor of ${_TARGET_ARCH}"
174157218Sdes.endif
175157218Sdes.if defined(TARGET) && ${TARGET} == "mips" && defined(TARGET_BIG_ENDIAN)
176106866Sdeischen.warning "TARGET_BIG_ENDIAN is no longer necessary for MIPS.  Big-endian is not the default."
177106866Sdeischen.endif
17874462Salfred# arm with TARGET_BIG_ENDIAN -> armeb
179157218Sdes.if defined(TARGET_ARCH) && ${TARGET_ARCH} == "arm" && defined(TARGET_BIG_ENDIAN)
180157218Sdes.warning "TARGET_ARCH of arm with TARGET_BIG_ENDIAN is deprecated.  use armeb"
181157218Sdes_TARGET_ARCH=armeb
182157218Sdes.endif
183157218Sdes.if defined(TARGET) && !defined(_TARGET)
18472373Sdeischen_TARGET=${TARGET}
185157218Sdes.endif
186177855Sdavidxu.if defined(TARGET_ARCH) && !defined(_TARGET_ARCH)
187156319Sdeischen_TARGET_ARCH=${TARGET_ARCH}
188156319Sdeischen.endif
189157218Sdes# Otherwise, default to current machine type and architecture.
190157218Sdes_TARGET?=	${MACHINE}
191157218Sdes_TARGET_ARCH?=	${MACHINE_ARCH}
19271579Sdeischen
19374462Salfred#
194157218Sdes# Make sure we have an up-to-date make(1). Only world and buildworld
195157218Sdes# should do this as those are the initial targets used for upgrades.
196157218Sdes# The user can define ALWAYS_CHECK_MAKE to have this check performed
197157218Sdes# for all targets.
198157218Sdes#
199157218Sdes.if defined(ALWAYS_CHECK_MAKE)
200157218Sdes${TGTS}: upgrade_checks
201157218Sdes.else
202157218Sdesbuildworld: upgrade_checks
203157218Sdes.endif
204156319Sdeischen
205157218Sdes#
206157218Sdes# This 'cleanworld' target is not included in TGTS, because it is not a
20771579Sdeischen# recursive target.  All of the work for it is done right here.   It is
20871579Sdeischen# expected that BW_CANONICALOBJDIR == the CANONICALOBJDIR as would be
20971579Sdeischen# created by bsd.obj.mk, except that we don't want to .include that file
21071579Sdeischen# in this makefile.  
21171579Sdeischen#
212157223Sdes# In the following, the first 'rm' in a series will usually remove all
213157223Sdes# files and directories.  If it does not, then there are probably some
214157223Sdes# files with file flags set, so this unsets them and tries the 'rm' a
215157223Sdes# second time.  There are situations where this target will be cleaning
216157223Sdes# some directories via more than one method, but that duplication is
217157223Sdes# needed to correctly handle all the possible situations.  Removing all
218157223Sdes# files without file flags set in the first 'rm' instance saves time,
219157223Sdes# because 'chflags' will need to operate on fewer files afterwards.
220157223Sdes#
221157223SdesBW_CANONICALOBJDIR:=${MAKEOBJDIRPREFIX}${.CURDIR}
22271579Sdeischencleanworld:
22371579Sdeischen.if ${.CURDIR} == ${.OBJDIR} || ${.CURDIR}/obj == ${.OBJDIR}
22471579Sdeischen.if exists(${BW_CANONICALOBJDIR}/)
22571579Sdeischen	-rm -rf ${BW_CANONICALOBJDIR}/*
22671579Sdeischen	-chflags -R 0 ${BW_CANONICALOBJDIR}
22771579Sdeischen	rm -rf ${BW_CANONICALOBJDIR}/*
22871579Sdeischen.endif
22971579Sdeischen	#   To be safe in this case, fall back to a 'make cleandir'
230148655Sdeischen	${_+_}@cd ${.CURDIR}; ${_MAKE} cleandir
23171579Sdeischen.else
232242960Skib	-rm -rf ${.OBJDIR}/*
233108864Stjr	-chflags -R 0 ${.OBJDIR}
23471579Sdeischen	rm -rf ${.OBJDIR}/*
23571579Sdeischen.endif
23671579Sdeischen
23771579Sdeischen#
23871579Sdeischen# Handle the user-driven targets, using the source relative mk files.
23971579Sdeischen#
24071579Sdeischen
24171579Sdeischen.if empty(.MAKEFLAGS:M-n)
24271579Sdeischen# skip this for -n to avoid changing previous behavior of 
24371579Sdeischen# 'make -n buildworld' etc.
24471579Sdeischen${TGTS}: .MAKE
24571579Sdeischentinderbox toolchains kernel-toolchains: .MAKE
24671579Sdeischen.endif
24771579Sdeischen
24871579Sdeischen${TGTS}:
24971579Sdeischen	${_+_}@cd ${.CURDIR}; ${_MAKE} ${.TARGET}
25071579Sdeischen
25171579Sdeischen# Set a reasonable default
25271579Sdeischen.MAIN:	all
25371579Sdeischen
25471579SdeischenSTARTTIME!= LC_ALL=C date
25571579SdeischenCHECK_TIME!= find ${.CURDIR}/sys/sys/param.h -mtime -0s ; echo
25671579Sdeischen.if !empty(CHECK_TIME)
25771579Sdeischen.error check your date/time: ${STARTTIME}
25871579Sdeischen.endif
25971579Sdeischen
26071579Sdeischen.if defined(HISTORICAL_MAKE_WORLD) || defined(DESTDIR)
26171579Sdeischen#
26271579Sdeischen# world
26371579Sdeischen#
26471579Sdeischen# Attempt to rebuild and reinstall everything. This target is not to be
26571579Sdeischen# used for upgrading an existing FreeBSD system, because the kernel is
26671579Sdeischen# not included. One can argue that this target doesn't build everything
267# then.
268#
269world: upgrade_checks
270	@echo "--------------------------------------------------------------"
271	@echo ">>> make world started on ${STARTTIME}"
272	@echo "--------------------------------------------------------------"
273.if target(pre-world)
274	@echo
275	@echo "--------------------------------------------------------------"
276	@echo ">>> Making 'pre-world' target"
277	@echo "--------------------------------------------------------------"
278	${_+_}@cd ${.CURDIR}; ${_MAKE} pre-world
279.endif
280	${_+_}@cd ${.CURDIR}; ${_MAKE} buildworld
281	${_+_}@cd ${.CURDIR}; ${_MAKE} -B installworld
282.if target(post-world)
283	@echo
284	@echo "--------------------------------------------------------------"
285	@echo ">>> Making 'post-world' target"
286	@echo "--------------------------------------------------------------"
287	${_+_}@cd ${.CURDIR}; ${_MAKE} post-world
288.endif
289	@echo
290	@echo "--------------------------------------------------------------"
291	@echo ">>> make world completed on `LC_ALL=C date`"
292	@echo "                   (started ${STARTTIME})"
293	@echo "--------------------------------------------------------------"
294.else
295world:
296	@echo "WARNING: make world will overwrite your existing FreeBSD"
297	@echo "installation without also building and installing a new"
298	@echo "kernel.  This can be dangerous.  Please read the handbook,"
299	@echo "'Rebuilding world', for how to upgrade your system."
300	@echo "Define DESTDIR to where you want to install FreeBSD,"
301	@echo "including /, to override this warning and proceed as usual."
302	@echo ""
303	@echo "Bailing out now..."
304	@false
305.endif
306
307#
308# kernel
309#
310# Short hand for `make buildkernel installkernel'
311#
312kernel: buildkernel installkernel
313
314#
315# Perform a few tests to determine if the installed tools are adequate
316# for building the world.
317#
318# Note: if we ever need to care about the version of bmake, simply testing
319# MAKE_VERSION against a required version should suffice.
320#
321upgrade_checks:
322.if ${HAVE_MAKE} != ${WANT_MAKE}
323	@(cd ${.CURDIR} && ${MAKE} ${WANT_MAKE:S,^f,,})
324.elif ${WANT_MAKE} == "fmake"
325	@if ! (cd ${.CURDIR}/tools/build/make_check && \
326	    PATH=${PATH} ${BINMAKE} obj >/dev/null 2>&1 && \
327	    PATH=${PATH} ${BINMAKE} >/dev/null 2>&1); \
328	then \
329	    (cd ${.CURDIR} && ${MAKE} make); \
330	fi
331.endif
332
333#
334# Upgrade make(1) to the current version using the installed
335# headers, libraries and tools.  Also, allow the location of
336# the system bsdmake-like utility to be overridden.
337#
338MMAKEENV=	MAKEOBJDIRPREFIX=${MYMAKE:H} \
339		DESTDIR= \
340		INSTALL="sh ${.CURDIR}/tools/install.sh"
341MMAKE=		${MMAKEENV} ${MAKE} \
342		-D_UPGRADING \
343		-DNOMAN -DNO_MAN -DNOSHARED -DNO_SHARED \
344		-DNO_CPU_CFLAGS -DNO_WERROR
345
346make bmake: .PHONY
347	@echo
348	@echo "--------------------------------------------------------------"
349	@echo ">>> Building an up-to-date make(1)"
350	@echo "--------------------------------------------------------------"
351	${_+_}@cd ${.CURDIR}/usr.bin/${.TARGET}; \
352		${MMAKE} obj && \
353		${MMAKE} depend && \
354		${MMAKE} all && \
355		${MMAKE} install DESTDIR=${MYMAKE:H} BINDIR= PROGNAME=${MYMAKE:T}
356
357tinderbox toolchains kernel-toolchains: upgrade_checks
358
359tinderbox:
360	@cd ${.CURDIR} && ${SUB_MAKE} DOING_TINDERBOX=YES universe
361
362toolchains:
363	@cd ${.CURDIR} && ${SUB_MAKE} UNIVERSE_TARGET=toolchain universe
364
365kernel-toolchains:
366	@cd ${.CURDIR} && ${SUB_MAKE} UNIVERSE_TARGET=kernel-toolchain universe
367
368#
369# universe
370#
371# Attempt to rebuild *everything* for all supported architectures,
372# with a reasonable chance of success, regardless of how old your
373# existing system is.
374#
375.if make(universe) || make(universe_kernels) || make(tinderbox) || make(targets)
376TARGETS?=amd64 arm i386 ia64 mips pc98 powerpc sparc64
377TARGET_ARCHES_arm?=	arm armeb armv6 armv6eb
378TARGET_ARCHES_mips?=	mipsel mips mips64el mips64 mipsn32
379TARGET_ARCHES_powerpc?=	powerpc powerpc64
380TARGET_ARCHES_pc98?=	i386
381.for target in ${TARGETS}
382TARGET_ARCHES_${target}?= ${target}
383.endfor
384
385.if defined(UNIVERSE_TARGET)
386MAKE_JUST_WORLDS=	YES
387.else
388UNIVERSE_TARGET?=	buildworld
389.endif
390KERNSRCDIR?=		${.CURDIR}/sys
391
392targets:
393	@echo "Supported TARGET/TARGET_ARCH pairs for world and kernel targets"
394.for target in ${TARGETS}
395.for target_arch in ${TARGET_ARCHES_${target}}
396	@echo "    ${target}/${target_arch}"
397.endfor
398.endfor
399
400.if defined(DOING_TINDERBOX)
401FAILFILE=${.CURDIR}/_.tinderbox.failed
402MAKEFAIL=tee -a ${FAILFILE}
403.else
404MAKEFAIL=cat
405.endif
406
407universe_prologue:  upgrade_checks
408universe: universe_prologue
409universe_prologue:
410	@echo "--------------------------------------------------------------"
411	@echo ">>> make universe started on ${STARTTIME}"
412	@echo "--------------------------------------------------------------"
413.if defined(DOING_TINDERBOX)
414	@rm -f ${FAILFILE}
415.endif
416.for target in ${TARGETS}
417universe: universe_${target}
418universe_epilogue: universe_${target}
419universe_${target}: universe_${target}_prologue
420universe_${target}_prologue: universe_prologue
421	@echo ">> ${target} started on `LC_ALL=C date`"
422.if !defined(MAKE_JUST_KERNELS)
423.for target_arch in ${TARGET_ARCHES_${target}}
424universe_${target}: universe_${target}_${target_arch}
425universe_${target}_${target_arch}: universe_${target}_prologue .MAKE
426	@echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} started on `LC_ALL=C date`"
427	@(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
428	    ${SUB_MAKE} ${JFLAG} ${UNIVERSE_TARGET} \
429	    TARGET=${target} \
430	    TARGET_ARCH=${target_arch} \
431	    > _.${target}.${target_arch}.${UNIVERSE_TARGET} 2>&1 || \
432	    (echo "${target}.${target_arch} ${UNIVERSE_TARGET} failed," \
433	    "check _.${target}.${target_arch}.${UNIVERSE_TARGET} for details" | \
434	    ${MAKEFAIL}))
435	@echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} completed on `LC_ALL=C date`"
436.endfor
437.endif
438.if !defined(MAKE_JUST_WORLDS)
439# If we are building world and kernels wait for the required worlds to finish
440.if !defined(MAKE_JUST_KERNELS)
441.for target_arch in ${TARGET_ARCHES_${target}}
442universe_${target}_kernels: universe_${target}_${target_arch}
443.endfor
444.endif
445universe_${target}: universe_${target}_kernels
446universe_${target}_kernels: universe_${target}_prologue .MAKE
447.if exists(${KERNSRCDIR}/${target}/conf/NOTES)
448	@(cd ${KERNSRCDIR}/${target}/conf && env __MAKE_CONF=/dev/null \
449	    ${SUB_MAKE} LINT > ${.CURDIR}/_.${target}.makeLINT 2>&1 || \
450	    (echo "${target} 'make LINT' failed," \
451	    "check _.${target}.makeLINT for details"| ${MAKEFAIL}))
452.endif
453	@cd ${.CURDIR} && ${SUB_MAKE} ${.MAKEFLAGS} TARGET=${target} \
454	    universe_kernels
455.endif
456	@echo ">> ${target} completed on `LC_ALL=C date`"
457.endfor
458universe_kernels: universe_kernconfs
459.if !defined(TARGET)
460TARGET!=	uname -m
461.endif
462KERNCONFS!=	cd ${KERNSRCDIR}/${TARGET}/conf && \
463		find [A-Z0-9]*[A-Z0-9] -type f -maxdepth 0 \
464		! -name DEFAULTS ! -name NOTES
465universe_kernconfs:
466.for kernel in ${KERNCONFS}
467TARGET_ARCH_${kernel}!=	cd ${KERNSRCDIR}/${TARGET}/conf && \
468	config -m ${KERNSRCDIR}/${TARGET}/conf/${kernel} 2> /dev/null | \
469	grep -v WARNING: | cut -f 2
470.if empty(TARGET_ARCH_${kernel})
471.error "Target architecture for ${TARGET}/conf/${kernel} unknown.  config(8) likely too old."
472.endif
473universe_kernconfs: universe_kernconf_${TARGET}_${kernel}
474universe_kernconf_${TARGET}_${kernel}: .MAKE
475	@(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
476	    ${SUB_MAKE} ${JFLAG} buildkernel \
477	    TARGET=${TARGET} \
478	    TARGET_ARCH=${TARGET_ARCH_${kernel}} \
479	    KERNCONF=${kernel} \
480	    > _.${TARGET}.${kernel} 2>&1 || \
481	    (echo "${TARGET} ${kernel} kernel failed," \
482	    "check _.${TARGET}.${kernel} for details"| ${MAKEFAIL}))
483.endfor
484universe: universe_epilogue
485universe_epilogue:
486	@echo "--------------------------------------------------------------"
487	@echo ">>> make universe completed on `LC_ALL=C date`"
488	@echo "                      (started ${STARTTIME})"
489	@echo "--------------------------------------------------------------"
490.if defined(DOING_TINDERBOX)
491	@if [ -e ${FAILFILE} ] ; then \
492		echo "Tinderbox failed:" ;\
493		cat ${FAILFILE} ;\
494		exit 1 ;\
495	fi
496.endif
497.endif
498
499buildLINT:
500	${MAKE} -C ${.CURDIR}/sys/${_TARGET}/conf LINT
501