Makefile revision 268598
12061Sjkh#
250479Speter# $FreeBSD: head/Makefile 268598 2014-07-13 23:53:41Z jmmv $
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
21232907Sjmallett# kernel-toolchains   - Build kernel-toolchain for all universe targets.
22158962Snetchild# doxygen             - Build API documentation of the kernel, needs doxygen.
23223148Sru# update              - Convenient way to update your source tree(s).
24169597Sdes# check-old           - List obsolete directories/files/libraries.
25169597Sdes# check-old-dirs      - List obsolete directories.
26169597Sdes# check-old-files     - List obsolete files.
27169597Sdes# check-old-libs      - List obsolete libraries.
28231821Spluknet# delete-old          - Delete obsolete directories/files.
29169597Sdes# delete-old-dirs     - Delete obsolete directories.
30169597Sdes# delete-old-files    - Delete obsolete files.
31169597Sdes# delete-old-libs     - Delete obsolete libraries.
32217815Sbz# targets             - Print a list of supported TARGET/TARGET_ARCH pairs
33217815Sbz#                       for world and kernel targets.
34218524Sjhb# toolchains          - Build a toolchain for all world and kernel targets.
35264460Sbrueffer# xdev                - xdev-build + xdev-install for the architecture
36264460Sbrueffer#                       specified with XDEV and XDEV_ARCH.
37264460Sbrueffer# xdev-build          - Build cross-development tools.
38264460Sbrueffer# xdev-install        - Install cross-development tools.
39268503Simp# xdev-links          - Create traditional links in /usr/bin for cc, etc
40253002Salfred# 
41253002Salfred# "quick" way to test all kernel builds:
42253002Salfred# 	_jflag=`sysctl -n hw.ncpu`
43253002Salfred# 	_jflag=$(($_jflag * 2))
44253002Salfred# 	[ $_jflag -gt 12 ] && _jflag=12
45253003Salfred# 	make universe -DMAKE_JUST_KERNELS JFLAG=-j${_jflag}
4632427Sjb#
4738666Sjb# This makefile is simple by design. The FreeBSD make automatically reads
48108451Sschweikh# the /usr/share/mk/sys.mk unless the -m argument is specified on the
4938666Sjb# command line. By keeping this makefile simple, it doesn't matter too
5038666Sjb# much how different the installed mk files are from those in the source
5138666Sjb# tree. This makefile executes a child make process, forcing it to use
5238666Sjb# the mk files from the source tree which are supposed to DTRT.
5317308Speter#
54217273Simp# Most of the user-driven targets (as listed above) are implemented in
55217294Simp# Makefile.inc1.  The exceptions are universe, tinderbox and targets.
5619175Sbde#
5796205Sjwd# If you want to build your system from source be sure that /usr/obj has
58217297Simp# at least 1GB of diskspace available.  A complete 'universe' build requires
59217297Simp# about 15GB of space.
6038042Sbde#
6196205Sjwd# For individuals wanting to build from the sources currently on their
6296205Sjwd# system, the simple instructions are:
6338042Sbde#
6496205Sjwd# 1.  `cd /usr/src'  (or to the directory containing your source tree).
65159363Strhodes# 2.  Define `HISTORICAL_MAKE_WORLD' variable (see README).
66159363Strhodes# 3.  `make world'
6717308Speter#
6896205Sjwd# For individuals wanting to upgrade their sources (even if only a
6996205Sjwd# delta of a few days):
7017308Speter#
71148330Snetchild#  1.  `cd /usr/src'       (or to the directory containing your source tree).
72148330Snetchild#  2.  `make buildworld'
73148330Snetchild#  3.  `make buildkernel KERNCONF=YOUR_KERNEL_HERE'     (default is GENERIC).
74148330Snetchild#  4.  `make installkernel KERNCONF=YOUR_KERNEL_HERE'   (default is GENERIC).
75159831Sobrien#       [steps 3. & 4. can be combined by using the "kernel" target]
76148330Snetchild#  5.  `reboot'        (in single user mode: boot -s from the loader prompt).
77148330Snetchild#  6.  `mergemaster -p'
78148330Snetchild#  7.  `make installworld'
79251107Screes#  8.  `mergemaster'		(you may wish to use -i, along with -U or -F).
80251107Screes#  9.  `make delete-old'
81148330Snetchild# 10.  `reboot'
82148330Snetchild# 11.  `make delete-old-libs' (in case no 3rd party program uses them anymore)
8396205Sjwd#
8496205Sjwd# See src/UPDATING `COMMON ITEMS' for more complete information.
8596205Sjwd#
86268191Smarcel# If TARGET=machine (e.g. powerpc, sparc64, ...) is specified you can
87162147Sru# cross build world for other machine types using the buildworld target,
8898723Sdillon# and once the world is built you can cross build a kernel using the
8998723Sdillon# buildkernel target.
9098723Sdillon#
9138666Sjb# Define the user-driven targets. These are listed here in alphabetical
9238666Sjb# order, but that's not important.
9317308Speter#
94123311Speter# Targets that begin with underscore are internal targets intended for
95123311Speter# developer convenience only.  They are intentionally not documented and
96123311Speter# completely subject to change without notice.
97123311Speter#
98175833Sjhb# For more information, see the build(7) manual page.
99175833Sjhb#
100169597SdesTGTS=	all all-man buildenv buildenvvars buildkernel buildworld \
101169597Sdes	check-old check-old-dirs check-old-files check-old-libs \
102169597Sdes	checkdpadd clean cleandepend cleandir \
103169597Sdes	delete-old delete-old-dirs delete-old-files delete-old-libs \
104219177Snwhitehorn	depend distribute distributekernel distributekernel.debug \
105219177Snwhitehorn	distributeworld distrib-dirs distribution doxygen \
106238051Sobrien	everything hier hierarchy install installcheck installkernel \
107219177Snwhitehorn	installkernel.debug packagekernel packageworld \
108219177Snwhitehorn	reinstallkernel reinstallkernel.debug \
109158962Snetchild	installworld kernel-toolchain libraries lint maninstall \
110156840Sru	obj objlink regress rerelease showconfig tags toolchain update \
111123311Speter	_worldtmp _legacy _bootstrap-tools _cleanobj _obj \
112137288Speter	_build-tools _cross-tools _includes _libraries _depend \
113209128Sraj	build32 builddtb distribute32 install32 xdev xdev-build xdev-install \
114268503Simp	xdev-links \
115209128Sraj
116156740SruTGTS+=	${SUBDIR_TARGETS}
1172061Sjkh
11897769SruBITGTS=	files includes
11997252SruBITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/}
120119579SruTGTS+=	${BITGTS}
12197252Sru
12295730Sru.ORDER: buildworld installworld
12395793Sru.ORDER: buildworld distributeworld
124111617Sru.ORDER: buildworld buildkernel
12595730Sru.ORDER: buildkernel installkernel
126116679Ssimokawa.ORDER: buildkernel installkernel.debug
12795730Sru.ORDER: buildkernel reinstallkernel
128116679Ssimokawa.ORDER: buildkernel reinstallkernel.debug
12995730Sru
130110035SruPATH=	/sbin:/bin:/usr/sbin:/usr/bin
131107516SruMAKEOBJDIRPREFIX?=	/usr/obj
132138921Sru_MAKEOBJDIRPREFIX!= /usr/bin/env -i PATH=${PATH} ${MAKE} \
133156145Syar    ${.MAKEFLAGS:MMAKEOBJDIRPREFIX=*} __MAKE_CONF=${__MAKE_CONF} \
134138921Sru    -f /dev/null -V MAKEOBJDIRPREFIX dummy
135133942Sru.if !empty(_MAKEOBJDIRPREFIX)
136133942Sru.error MAKEOBJDIRPREFIX can only be set in environment, not as a global\
137156145Syar	(in make.conf(5)) or command-line variable.
138133942Sru.endif
139253616Ssjg
140253616Ssjg# We often need to use the tree's version of make to build it.
141253616Ssjg# Choices add to complexity though.
142253616Ssjg# We cannot blindly use a make which may not be the one we want
143253616Ssjg# so be exlicit - until all choice is removed.
144253616SsjgWANT_MAKE=	bmake
145253616SsjgMYMAKE=		${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE}/${WANT_MAKE}
146253616Ssjg.if defined(.PARSEDIR)
147253616SsjgHAVE_MAKE=	bmake
148253616Ssjg.else
149253616SsjgHAVE_MAKE=	fmake
150253616Ssjg.endif
151253616Ssjg.if exists(${MYMAKE})
152253616SsjgSUB_MAKE:= ${MYMAKE} -m ${.CURDIR}/share/mk
153265423Simp.elif ${WANT_MAKE} != ${HAVE_MAKE}
154253616Ssjg# It may not exist yet but we may cause it to.
155253616Ssjg# In the case of fmake, upgrade_checks may cause a newer version to be built.
156253616SsjgSUB_MAKE= `test -x ${MYMAKE} && echo ${MYMAKE} || echo ${MAKE}` \
157117229Sru	-m ${.CURDIR}/share/mk
158253616Ssjg.else
159253616SsjgSUB_MAKE= ${MAKE} -m ${.CURDIR}/share/mk
160253616Ssjg.endif
16154324Smarcel
162253616Ssjg_MAKE=	PATH=${PATH} ${SUB_MAKE} -f Makefile.inc1 TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH}
163253616Ssjg
164218130Simp# Guess machine architecture from machine type, and vice versa.
165218130Simp.if !defined(TARGET_ARCH) && defined(TARGET)
166233644Sjmallett_TARGET_ARCH=	${TARGET:S/pc98/i386/}
167218130Simp.elif !defined(TARGET) && defined(TARGET_ARCH) && \
168218130Simp    ${TARGET_ARCH} != ${MACHINE_ARCH}
169263660Sandrew_TARGET=		${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb|hf)?/arm/}
170218130Simp.endif
171218130Simp.if defined(TARGET) && !defined(_TARGET)
172218130Simp_TARGET=${TARGET}
173218130Simp.endif
174218130Simp.if defined(TARGET_ARCH) && !defined(_TARGET_ARCH)
175218130Simp_TARGET_ARCH=${TARGET_ARCH}
176218130Simp.endif
177218130Simp# Otherwise, default to current machine type and architecture.
178218130Simp_TARGET?=	${MACHINE}
179218130Simp_TARGET_ARCH?=	${MACHINE_ARCH}
180218130Simp
18117308Speter#
182119519Smarcel# Make sure we have an up-to-date make(1). Only world and buildworld
183119519Smarcel# should do this as those are the initial targets used for upgrades.
184119519Smarcel# The user can define ALWAYS_CHECK_MAKE to have this check performed
185119519Smarcel# for all targets.
186119519Smarcel#
187119519Smarcel.if defined(ALWAYS_CHECK_MAKE)
188119579Sru${TGTS}: upgrade_checks
189119519Smarcel.else
190119519Smarcelbuildworld: upgrade_checks
191119519Smarcel.endif
192119519Smarcel
193119519Smarcel#
194126031Sgad# This 'cleanworld' target is not included in TGTS, because it is not a
195126024Sgad# recursive target.  All of the work for it is done right here.   It is
196126024Sgad# expected that BW_CANONICALOBJDIR == the CANONICALOBJDIR as would be
197126024Sgad# created by bsd.obj.mk, except that we don't want to .include that file
198126024Sgad# in this makefile.  
199126024Sgad#
200126024Sgad# In the following, the first 'rm' in a series will usually remove all
201126024Sgad# files and directories.  If it does not, then there are probably some
202227771Sgjb# files with file flags set, so this unsets them and tries the 'rm' a
203126024Sgad# second time.  There are situations where this target will be cleaning
204126024Sgad# some directories via more than one method, but that duplication is
205227769Sgjb# needed to correctly handle all the possible situations.  Removing all
206227771Sgjb# files without file flags set in the first 'rm' instance saves time,
207227771Sgjb# because 'chflags' will need to operate on fewer files afterwards.
208126024Sgad#
209126024SgadBW_CANONICALOBJDIR:=${MAKEOBJDIRPREFIX}${.CURDIR}
210126031Sgadcleanworld:
211126024Sgad.if ${.CURDIR} == ${.OBJDIR} || ${.CURDIR}/obj == ${.OBJDIR}
212126024Sgad.if exists(${BW_CANONICALOBJDIR}/)
213126024Sgad	-rm -rf ${BW_CANONICALOBJDIR}/*
214172744Sdelphij	-chflags -R 0 ${BW_CANONICALOBJDIR}
215126024Sgad	rm -rf ${BW_CANONICALOBJDIR}/*
216126024Sgad.endif
217126024Sgad	#   To be safe in this case, fall back to a 'make cleandir'
218133376Sharti	${_+_}@cd ${.CURDIR}; ${_MAKE} cleandir
219126024Sgad.else
220126024Sgad	-rm -rf ${.OBJDIR}/*
221172744Sdelphij	-chflags -R 0 ${.OBJDIR}
222126024Sgad	rm -rf ${.OBJDIR}/*
223126024Sgad.endif
224125885Sgad
225125885Sgad#
22638666Sjb# Handle the user-driven targets, using the source relative mk files.
22717308Speter#
228119519Smarcel
229251750Ssjg.if empty(.MAKEFLAGS:M-n)
230251750Ssjg# skip this for -n to avoid changing previous behavior of 
231251750Ssjg# 'make -n buildworld' etc.
232251750Ssjg${TGTS}: .MAKE
233254417Ssjgtinderbox toolchains kernel-toolchains: .MAKE
234251750Ssjg.endif
235251750Ssjg
236119579Sru${TGTS}:
237218206Simp	${_+_}@cd ${.CURDIR}; ${_MAKE} ${.TARGET}
2382302Spaul
239265097Sbrooks# The historic default "all" target creates files which may cause stale
240265097Sbrooks# or (in the cross build case) unlinkable results. Fail with an error
241265097Sbrooks# when no target is given. The users can explicitly specify "all"
242265097Sbrooks# if they want the historic behavior.
243265097Sbrooks.MAIN:	_guard
24439206Sjkh
245265097Sbrooks_guard:
246265097Sbrooks	@echo
247265097Sbrooks	@echo "Explicit target required (use \"all\" for historic behavior)"
248265097Sbrooks	@echo
249265097Sbrooks	@false
250265097Sbrooks
251133945SruSTARTTIME!= LC_ALL=C date
252240403SobrienCHECK_TIME!= find ${.CURDIR}/sys/sys/param.h -mtime -0s ; echo
253177609Sru.if !empty(CHECK_TIME)
254177609Sru.error check your date/time: ${STARTTIME}
255177609Sru.endif
256133945Sru
257132358Smarkm.if defined(HISTORICAL_MAKE_WORLD) || defined(DESTDIR)
25817308Speter#
25954324Smarcel# world
26054324Smarcel#
261132234Smarcel# Attempt to rebuild and reinstall everything. This target is not to be
262132234Smarcel# used for upgrading an existing FreeBSD system, because the kernel is
263132234Smarcel# not included. One can argue that this target doesn't build everything
264132234Smarcel# then.
26554324Smarcel#
26654324Smarcelworld: upgrade_checks
26754324Smarcel	@echo "--------------------------------------------------------------"
268118531Sru	@echo ">>> make world started on ${STARTTIME}"
26954324Smarcel	@echo "--------------------------------------------------------------"
27054324Smarcel.if target(pre-world)
27154324Smarcel	@echo
27254324Smarcel	@echo "--------------------------------------------------------------"
27354324Smarcel	@echo ">>> Making 'pre-world' target"
27454324Smarcel	@echo "--------------------------------------------------------------"
275133376Sharti	${_+_}@cd ${.CURDIR}; ${_MAKE} pre-world
27654324Smarcel.endif
277133376Sharti	${_+_}@cd ${.CURDIR}; ${_MAKE} buildworld
278133376Sharti	${_+_}@cd ${.CURDIR}; ${_MAKE} -B installworld
27954324Smarcel.if target(post-world)
28054324Smarcel	@echo
28154324Smarcel	@echo "--------------------------------------------------------------"
28254324Smarcel	@echo ">>> Making 'post-world' target"
28354324Smarcel	@echo "--------------------------------------------------------------"
284133376Sharti	${_+_}@cd ${.CURDIR}; ${_MAKE} post-world
28554324Smarcel.endif
28654324Smarcel	@echo
28754324Smarcel	@echo "--------------------------------------------------------------"
288118531Sru	@echo ">>> make world completed on `LC_ALL=C date`"
289118531Sru	@echo "                   (started ${STARTTIME})"
29054324Smarcel	@echo "--------------------------------------------------------------"
291132234Smarcel.else
292132234Smarcelworld:
293132234Smarcel	@echo "WARNING: make world will overwrite your existing FreeBSD"
294132234Smarcel	@echo "installation without also building and installing a new"
295132234Smarcel	@echo "kernel.  This can be dangerous.  Please read the handbook,"
296132588Skensmith	@echo "'Rebuilding world', for how to upgrade your system."
297132358Smarkm	@echo "Define DESTDIR to where you want to install FreeBSD,"
298132234Smarcel	@echo "including /, to override this warning and proceed as usual."
299132358Smarkm	@echo ""
300132234Smarcel	@echo "Bailing out now..."
301132234Smarcel	@false
302132234Smarcel.endif
30354324Smarcel
30454324Smarcel#
30595730Sru# kernel
30695730Sru#
30795730Sru# Short hand for `make buildkernel installkernel'
30895730Sru#
30995730Srukernel: buildkernel installkernel
31095730Sru
31195730Sru#
31238666Sjb# Perform a few tests to determine if the installed tools are adequate
313107374Sru# for building the world.
31417308Speter#
315253616Ssjg# Note: if we ever need to care about the version of bmake, simply testing
316253616Ssjg# MAKE_VERSION against a required version should suffice.
317253616Ssjg#
31855678Smarcelupgrade_checks:
319253616Ssjg.if ${HAVE_MAKE} != ${WANT_MAKE}
320253616Ssjg	@(cd ${.CURDIR} && ${MAKE} ${WANT_MAKE:S,^f,,})
321241298Smarcel.endif
3222061Sjkh
32317308Speter#
324107516Sru# Upgrade make(1) to the current version using the installed
325174539Simp# headers, libraries and tools.  Also, allow the location of
326174539Simp# the system bsdmake-like utility to be overridden.
32755678Smarcel#
328253616SsjgMMAKEENV=	MAKEOBJDIRPREFIX=${MYMAKE:H} \
329107516Sru		DESTDIR= \
330107516Sru		INSTALL="sh ${.CURDIR}/tools/install.sh"
331174564SimpMMAKE=		${MMAKEENV} ${MAKE} \
332265837Simp		-DNO_MAN -DNO_SHARED \
333264742Sjmmv		-DNO_CPU_CFLAGS -DNO_WERROR \
334268598Sjmmv		MK_TESTS=no \
335265827Simp		DESTDIR= PROGNAME=${MYMAKE:T}
336107516Sru
337265827Simpbmake: .PHONY
33855678Smarcel	@echo
33955678Smarcel	@echo "--------------------------------------------------------------"
340265827Simp	@echo ">>> Building an up-to-date ${.TARGET}(1)"
34155678Smarcel	@echo "--------------------------------------------------------------"
342249395Ssjg	${_+_}@cd ${.CURDIR}/usr.bin/${.TARGET}; \
343255713Semaste		${MMAKE} obj && \
344255713Semaste		${MMAKE} depend && \
345255713Semaste		${MMAKE} all && \
346265827Simp		${MMAKE} install DESTDIR=${MYMAKE:H} BINDIR=
34755678Smarcel
348254417Ssjgtinderbox toolchains kernel-toolchains: upgrade_checks
349254417Ssjg
350185499Salfredtinderbox:
351254417Ssjg	@cd ${.CURDIR} && ${SUB_MAKE} DOING_TINDERBOX=YES universe
352185499Salfred
353218524Sjhbtoolchains:
354254417Ssjg	@cd ${.CURDIR} && ${SUB_MAKE} UNIVERSE_TARGET=toolchain universe
355218524Sjhb
356232907Sjmallettkernel-toolchains:
357254417Ssjg	@cd ${.CURDIR} && ${SUB_MAKE} UNIVERSE_TARGET=kernel-toolchain universe
358232907Sjmallett
35955678Smarcel#
360111131Sru# universe
361111131Sru#
362111131Sru# Attempt to rebuild *everything* for all supported architectures,
363133945Sru# with a reasonable chance of success, regardless of how old your
364111131Sru# existing system is.
365111131Sru#
366217125Simp.if make(universe) || make(universe_kernels) || make(tinderbox) || make(targets)
367268191SmarcelTARGETS?=amd64 arm i386 mips pc98 powerpc sparc64
368263660SandrewTARGET_ARCHES_arm?=	arm armeb armv6 armv6hf
369233644SjmallettTARGET_ARCHES_mips?=	mipsel mips mips64el mips64 mipsn32
370216520SnwhitehornTARGET_ARCHES_powerpc?=	powerpc powerpc64
371216520SnwhitehornTARGET_ARCHES_pc98?=	i386
372216520Snwhitehorn.for target in ${TARGETS}
373216520SnwhitehornTARGET_ARCHES_${target}?= ${target}
374216520Snwhitehorn.endfor
375168280Smarcel
376218524Sjhb.if defined(UNIVERSE_TARGET)
377218524SjhbMAKE_JUST_WORLDS=	YES
378218524Sjhb.else
379218524SjhbUNIVERSE_TARGET?=	buildworld
380218524Sjhb.endif
381219137SjhbKERNSRCDIR?=		${.CURDIR}/sys
382218524Sjhb
383217125Simptargets:
384217815Sbz	@echo "Supported TARGET/TARGET_ARCH pairs for world and kernel targets"
385217125Simp.for target in ${TARGETS}
386217125Simp.for target_arch in ${TARGET_ARCHES_${target}}
387217125Simp	@echo "    ${target}/${target_arch}"
388217125Simp.endfor
389217125Simp.endfor
390217125Simp
391185499Salfred.if defined(DOING_TINDERBOX)
392217735SbzFAILFILE=${.CURDIR}/_.tinderbox.failed
393185499SalfredMAKEFAIL=tee -a ${FAILFILE}
394185499Salfred.else
395185499SalfredMAKEFAIL=cat
396185499Salfred.endif
397185499Salfred
398253616Ssjguniverse_prologue:  upgrade_checks
399253616Ssjguniverse: universe_prologue
400133945Sruuniverse_prologue:
401103985Sphk	@echo "--------------------------------------------------------------"
402103985Sphk	@echo ">>> make universe started on ${STARTTIME}"
403103985Sphk	@echo "--------------------------------------------------------------"
404185499Salfred.if defined(DOING_TINDERBOX)
405217754Sbz	@rm -f ${FAILFILE}
406185499Salfred.endif
407168280Smarcel.for target in ${TARGETS}
408162147Sruuniverse: universe_${target}
409253616Ssjguniverse_epilogue: universe_${target}
410216520Snwhitehornuniverse_${target}: universe_${target}_prologue
411253616Ssjguniverse_${target}_prologue: universe_prologue
412216520Snwhitehorn	@echo ">> ${target} started on `LC_ALL=C date`"
413179232Sjb.if !defined(MAKE_JUST_KERNELS)
414216520Snwhitehorn.for target_arch in ${TARGET_ARCHES_${target}}
415216520Snwhitehornuniverse_${target}: universe_${target}_${target_arch}
416254417Ssjguniverse_${target}_${target_arch}: universe_${target}_prologue .MAKE
417218524Sjhb	@echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} started on `LC_ALL=C date`"
418185250Sdes	@(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
419253616Ssjg	    ${SUB_MAKE} ${JFLAG} ${UNIVERSE_TARGET} \
420162147Sru	    TARGET=${target} \
421216520Snwhitehorn	    TARGET_ARCH=${target_arch} \
422218524Sjhb	    > _.${target}.${target_arch}.${UNIVERSE_TARGET} 2>&1 || \
423218524Sjhb	    (echo "${target}.${target_arch} ${UNIVERSE_TARGET} failed," \
424218524Sjhb	    "check _.${target}.${target_arch}.${UNIVERSE_TARGET} for details" | \
425216520Snwhitehorn	    ${MAKEFAIL}))
426218524Sjhb	@echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} completed on `LC_ALL=C date`"
427216520Snwhitehorn.endfor
428179232Sjb.endif
429205290Sdougb.if !defined(MAKE_JUST_WORLDS)
430248937Sandrew# If we are building world and kernels wait for the required worlds to finish
431248937Sandrew.if !defined(MAKE_JUST_KERNELS)
432248937Sandrew.for target_arch in ${TARGET_ARCHES_${target}}
433248937Sandrewuniverse_${target}_kernels: universe_${target}_${target_arch}
434248937Sandrew.endfor
435248937Sandrew.endif
436248937Sandrewuniverse_${target}: universe_${target}_kernels
437254417Ssjguniverse_${target}_kernels: universe_${target}_prologue .MAKE
438219137Sjhb.if exists(${KERNSRCDIR}/${target}/conf/NOTES)
439219137Sjhb	@(cd ${KERNSRCDIR}/${target}/conf && env __MAKE_CONF=/dev/null \
440253616Ssjg	    ${SUB_MAKE} LINT > ${.CURDIR}/_.${target}.makeLINT 2>&1 || \
441185499Salfred	    (echo "${target} 'make LINT' failed," \
442185499Salfred	    "check _.${target}.makeLINT for details"| ${MAKEFAIL}))
443103985Sphk.endif
444253616Ssjg	@cd ${.CURDIR} && ${SUB_MAKE} ${.MAKEFLAGS} TARGET=${target} \
445201815Sbz	    universe_kernels
446205290Sdougb.endif
447201815Sbz	@echo ">> ${target} completed on `LC_ALL=C date`"
448201815Sbz.endfor
449201815Sbzuniverse_kernels: universe_kernconfs
450202095Sbz.if !defined(TARGET)
451202095SbzTARGET!=	uname -m
452202095Sbz.endif
453265155Simp.if defined(MAKE_ALL_KERNELS)
454265155Simp_THINNER=cat
455265155Simp.else
456265840Simp_THINNER=xargs grep -L "^.NO_UNIVERSE" || true
457265155Simp.endif
458219137SjhbKERNCONFS!=	cd ${KERNSRCDIR}/${TARGET}/conf && \
459201815Sbz		find [A-Z0-9]*[A-Z0-9] -type f -maxdepth 0 \
460265155Simp		! -name DEFAULTS ! -name NOTES | \
461265155Simp		${_THINNER}
462201815Sbzuniverse_kernconfs:
463148154Sru.for kernel in ${KERNCONFS}
464219137SjhbTARGET_ARCH_${kernel}!=	cd ${KERNSRCDIR}/${TARGET}/conf && \
465219137Sjhb	config -m ${KERNSRCDIR}/${TARGET}/conf/${kernel} 2> /dev/null | \
466216934Simp	grep -v WARNING: | cut -f 2
467216934Simp.if empty(TARGET_ARCH_${kernel})
468216934Simp.error "Target architecture for ${TARGET}/conf/${kernel} unknown.  config(8) likely too old."
469216934Simp.endif
470216520Snwhitehornuniverse_kernconfs: universe_kernconf_${TARGET}_${kernel}
471254417Ssjguniverse_kernconf_${TARGET}_${kernel}: .MAKE
472185250Sdes	@(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
473253616Ssjg	    ${SUB_MAKE} ${JFLAG} buildkernel \
474201815Sbz	    TARGET=${TARGET} \
475216520Snwhitehorn	    TARGET_ARCH=${TARGET_ARCH_${kernel}} \
476148154Sru	    KERNCONF=${kernel} \
477201815Sbz	    > _.${TARGET}.${kernel} 2>&1 || \
478201815Sbz	    (echo "${TARGET} ${kernel} kernel failed," \
479201815Sbz	    "check _.${TARGET}.${kernel} for details"| ${MAKEFAIL}))
480148154Sru.endfor
481133945Sruuniverse: universe_epilogue
482133945Sruuniverse_epilogue:
483103985Sphk	@echo "--------------------------------------------------------------"
484118531Sru	@echo ">>> make universe completed on `LC_ALL=C date`"
485118531Sru	@echo "                      (started ${STARTTIME})"
486103985Sphk	@echo "--------------------------------------------------------------"
487185499Salfred.if defined(DOING_TINDERBOX)
488185499Salfred	@if [ -e ${FAILFILE} ] ; then \
489185499Salfred		echo "Tinderbox failed:" ;\
490185499Salfred		cat ${FAILFILE} ;\
491185499Salfred		exit 1 ;\
492185499Salfred	fi
493133945Sru.endif
494185499Salfred.endif
495242522Smarcel
496242522SmarcelbuildLINT:
497242522Smarcel	${MAKE} -C ${.CURDIR}/sys/${_TARGET}/conf LINT
498255286Ssjg
499255286Ssjg.if defined(.PARSEDIR)
500255286Ssjg.if make(universe)
501255286Ssjg# we do not want a failure of one branch abort all.
502255286SsjgMAKE_JOB_ERROR_TOKEN= no
503255286Ssjg.export MAKE_JOB_ERROR_TOKEN
504255286Ssjg.endif
505255286Ssjg.endif
506