Makefile revision 264460
12061Sjkh#
250479Speter# $FreeBSD: head/Makefile 264460 2014-04-14 16:15:11Z brueffer $
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.
39253002Salfred# 
40253002Salfred# "quick" way to test all kernel builds:
41253002Salfred# 	_jflag=`sysctl -n hw.ncpu`
42253002Salfred# 	_jflag=$(($_jflag * 2))
43253002Salfred# 	[ $_jflag -gt 12 ] && _jflag=12
44253003Salfred# 	make universe -DMAKE_JUST_KERNELS JFLAG=-j${_jflag}
4532427Sjb#
4638666Sjb# This makefile is simple by design. The FreeBSD make automatically reads
47108451Sschweikh# the /usr/share/mk/sys.mk unless the -m argument is specified on the
4838666Sjb# command line. By keeping this makefile simple, it doesn't matter too
4938666Sjb# much how different the installed mk files are from those in the source
5038666Sjb# tree. This makefile executes a child make process, forcing it to use
5138666Sjb# the mk files from the source tree which are supposed to DTRT.
5217308Speter#
53217273Simp# Most of the user-driven targets (as listed above) are implemented in
54217294Simp# Makefile.inc1.  The exceptions are universe, tinderbox and targets.
5519175Sbde#
5696205Sjwd# If you want to build your system from source be sure that /usr/obj has
57217297Simp# at least 1GB of diskspace available.  A complete 'universe' build requires
58217297Simp# about 15GB of space.
5938042Sbde#
6096205Sjwd# For individuals wanting to build from the sources currently on their
6196205Sjwd# system, the simple instructions are:
6238042Sbde#
6396205Sjwd# 1.  `cd /usr/src'  (or to the directory containing your source tree).
64159363Strhodes# 2.  Define `HISTORICAL_MAKE_WORLD' variable (see README).
65159363Strhodes# 3.  `make world'
6617308Speter#
6796205Sjwd# For individuals wanting to upgrade their sources (even if only a
6896205Sjwd# delta of a few days):
6917308Speter#
70148330Snetchild#  1.  `cd /usr/src'       (or to the directory containing your source tree).
71148330Snetchild#  2.  `make buildworld'
72148330Snetchild#  3.  `make buildkernel KERNCONF=YOUR_KERNEL_HERE'     (default is GENERIC).
73148330Snetchild#  4.  `make installkernel KERNCONF=YOUR_KERNEL_HERE'   (default is GENERIC).
74159831Sobrien#       [steps 3. & 4. can be combined by using the "kernel" target]
75148330Snetchild#  5.  `reboot'        (in single user mode: boot -s from the loader prompt).
76148330Snetchild#  6.  `mergemaster -p'
77148330Snetchild#  7.  `make installworld'
78251107Screes#  8.  `mergemaster'		(you may wish to use -i, along with -U or -F).
79251107Screes#  9.  `make delete-old'
80148330Snetchild# 10.  `reboot'
81148330Snetchild# 11.  `make delete-old-libs' (in case no 3rd party program uses them anymore)
8296205Sjwd#
8396205Sjwd# See src/UPDATING `COMMON ITEMS' for more complete information.
8496205Sjwd#
85162147Sru# If TARGET=machine (e.g. ia64, sparc64, ...) is specified you can
86162147Sru# cross build world for other machine types using the buildworld target,
8798723Sdillon# and once the world is built you can cross build a kernel using the
8898723Sdillon# buildkernel target.
8998723Sdillon#
9038666Sjb# Define the user-driven targets. These are listed here in alphabetical
9138666Sjb# order, but that's not important.
9217308Speter#
93123311Speter# Targets that begin with underscore are internal targets intended for
94123311Speter# developer convenience only.  They are intentionally not documented and
95123311Speter# completely subject to change without notice.
96123311Speter#
97175833Sjhb# For more information, see the build(7) manual page.
98175833Sjhb#
99169597SdesTGTS=	all all-man buildenv buildenvvars buildkernel buildworld \
100169597Sdes	check-old check-old-dirs check-old-files check-old-libs \
101169597Sdes	checkdpadd clean cleandepend cleandir \
102169597Sdes	delete-old delete-old-dirs delete-old-files delete-old-libs \
103219177Snwhitehorn	depend distribute distributekernel distributekernel.debug \
104219177Snwhitehorn	distributeworld distrib-dirs distribution doxygen \
105238051Sobrien	everything hier hierarchy install installcheck installkernel \
106219177Snwhitehorn	installkernel.debug packagekernel packageworld \
107219177Snwhitehorn	reinstallkernel reinstallkernel.debug \
108158962Snetchild	installworld kernel-toolchain libraries lint maninstall \
109156840Sru	obj objlink regress rerelease showconfig tags toolchain update \
110123311Speter	_worldtmp _legacy _bootstrap-tools _cleanobj _obj \
111137288Speter	_build-tools _cross-tools _includes _libraries _depend \
112209128Sraj	build32 builddtb distribute32 install32 xdev xdev-build xdev-install \
113209128Sraj
114156740SruTGTS+=	${SUBDIR_TARGETS}
1152061Sjkh
11697769SruBITGTS=	files includes
11797252SruBITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/}
118119579SruTGTS+=	${BITGTS}
11997252Sru
12095730Sru.ORDER: buildworld installworld
12195793Sru.ORDER: buildworld distributeworld
122111617Sru.ORDER: buildworld buildkernel
12395730Sru.ORDER: buildkernel installkernel
124116679Ssimokawa.ORDER: buildkernel installkernel.debug
12595730Sru.ORDER: buildkernel reinstallkernel
126116679Ssimokawa.ORDER: buildkernel reinstallkernel.debug
12795730Sru
128110035SruPATH=	/sbin:/bin:/usr/sbin:/usr/bin
129107516SruMAKEOBJDIRPREFIX?=	/usr/obj
130138921Sru_MAKEOBJDIRPREFIX!= /usr/bin/env -i PATH=${PATH} ${MAKE} \
131156145Syar    ${.MAKEFLAGS:MMAKEOBJDIRPREFIX=*} __MAKE_CONF=${__MAKE_CONF} \
132138921Sru    -f /dev/null -V MAKEOBJDIRPREFIX dummy
133133942Sru.if !empty(_MAKEOBJDIRPREFIX)
134133942Sru.error MAKEOBJDIRPREFIX can only be set in environment, not as a global\
135156145Syar	(in make.conf(5)) or command-line variable.
136133942Sru.endif
137253616Ssjg
138253616Ssjg# We often need to use the tree's version of make to build it.
139253616Ssjg# Choices add to complexity though.
140253616Ssjg# We cannot blindly use a make which may not be the one we want
141253616Ssjg# so be exlicit - until all choice is removed.
142253616Ssjg.if !defined(WITHOUT_BMAKE)
143253616SsjgWANT_MAKE=	bmake
144253616Ssjg.else
145253616SsjgWANT_MAKE=	fmake
146253616Ssjg.endif
147253616SsjgMYMAKE=		${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE}/${WANT_MAKE}
148253616Ssjg.if defined(.PARSEDIR)
149253616SsjgHAVE_MAKE=	bmake
150253616Ssjg.else
151253616SsjgHAVE_MAKE=	fmake
152253616Ssjg.endif
153253616Ssjg.if exists(${MYMAKE})
154253616SsjgSUB_MAKE:= ${MYMAKE} -m ${.CURDIR}/share/mk
155253616Ssjg.elif ${WANT_MAKE} != ${HAVE_MAKE} || ${WANT_MAKE} != "bmake"
156253616Ssjg# It may not exist yet but we may cause it to.
157253616Ssjg# In the case of fmake, upgrade_checks may cause a newer version to be built.
158253616SsjgSUB_MAKE= `test -x ${MYMAKE} && echo ${MYMAKE} || echo ${MAKE}` \
159117229Sru	-m ${.CURDIR}/share/mk
160253616Ssjg.else
161253616SsjgSUB_MAKE= ${MAKE} -m ${.CURDIR}/share/mk
162253616Ssjg.endif
16354324Smarcel
164253616Ssjg_MAKE=	PATH=${PATH} ${SUB_MAKE} -f Makefile.inc1 TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH}
165253616Ssjg
166218130Simp# Guess machine architecture from machine type, and vice versa.
167218130Simp.if !defined(TARGET_ARCH) && defined(TARGET)
168233644Sjmallett_TARGET_ARCH=	${TARGET:S/pc98/i386/}
169218130Simp.elif !defined(TARGET) && defined(TARGET_ARCH) && \
170218130Simp    ${TARGET_ARCH} != ${MACHINE_ARCH}
171263660Sandrew_TARGET=		${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb|hf)?/arm/}
172218130Simp.endif
173218130Simp.if defined(TARGET) && !defined(_TARGET)
174218130Simp_TARGET=${TARGET}
175218130Simp.endif
176218130Simp.if defined(TARGET_ARCH) && !defined(_TARGET_ARCH)
177218130Simp_TARGET_ARCH=${TARGET_ARCH}
178218130Simp.endif
179218130Simp# Otherwise, default to current machine type and architecture.
180218130Simp_TARGET?=	${MACHINE}
181218130Simp_TARGET_ARCH?=	${MACHINE_ARCH}
182218130Simp
18317308Speter#
184119519Smarcel# Make sure we have an up-to-date make(1). Only world and buildworld
185119519Smarcel# should do this as those are the initial targets used for upgrades.
186119519Smarcel# The user can define ALWAYS_CHECK_MAKE to have this check performed
187119519Smarcel# for all targets.
188119519Smarcel#
189119519Smarcel.if defined(ALWAYS_CHECK_MAKE)
190119579Sru${TGTS}: upgrade_checks
191119519Smarcel.else
192119519Smarcelbuildworld: upgrade_checks
193119519Smarcel.endif
194119519Smarcel
195119519Smarcel#
196126031Sgad# This 'cleanworld' target is not included in TGTS, because it is not a
197126024Sgad# recursive target.  All of the work for it is done right here.   It is
198126024Sgad# expected that BW_CANONICALOBJDIR == the CANONICALOBJDIR as would be
199126024Sgad# created by bsd.obj.mk, except that we don't want to .include that file
200126024Sgad# in this makefile.  
201126024Sgad#
202126024Sgad# In the following, the first 'rm' in a series will usually remove all
203126024Sgad# files and directories.  If it does not, then there are probably some
204227771Sgjb# files with file flags set, so this unsets them and tries the 'rm' a
205126024Sgad# second time.  There are situations where this target will be cleaning
206126024Sgad# some directories via more than one method, but that duplication is
207227769Sgjb# needed to correctly handle all the possible situations.  Removing all
208227771Sgjb# files without file flags set in the first 'rm' instance saves time,
209227771Sgjb# because 'chflags' will need to operate on fewer files afterwards.
210126024Sgad#
211126024SgadBW_CANONICALOBJDIR:=${MAKEOBJDIRPREFIX}${.CURDIR}
212126031Sgadcleanworld:
213126024Sgad.if ${.CURDIR} == ${.OBJDIR} || ${.CURDIR}/obj == ${.OBJDIR}
214126024Sgad.if exists(${BW_CANONICALOBJDIR}/)
215126024Sgad	-rm -rf ${BW_CANONICALOBJDIR}/*
216172744Sdelphij	-chflags -R 0 ${BW_CANONICALOBJDIR}
217126024Sgad	rm -rf ${BW_CANONICALOBJDIR}/*
218126024Sgad.endif
219126024Sgad	#   To be safe in this case, fall back to a 'make cleandir'
220133376Sharti	${_+_}@cd ${.CURDIR}; ${_MAKE} cleandir
221126024Sgad.else
222126024Sgad	-rm -rf ${.OBJDIR}/*
223172744Sdelphij	-chflags -R 0 ${.OBJDIR}
224126024Sgad	rm -rf ${.OBJDIR}/*
225126024Sgad.endif
226125885Sgad
227125885Sgad#
22838666Sjb# Handle the user-driven targets, using the source relative mk files.
22917308Speter#
230119519Smarcel
231251750Ssjg.if empty(.MAKEFLAGS:M-n)
232251750Ssjg# skip this for -n to avoid changing previous behavior of 
233251750Ssjg# 'make -n buildworld' etc.
234251750Ssjg${TGTS}: .MAKE
235254417Ssjgtinderbox toolchains kernel-toolchains: .MAKE
236251750Ssjg.endif
237251750Ssjg
238119579Sru${TGTS}:
239218206Simp	${_+_}@cd ${.CURDIR}; ${_MAKE} ${.TARGET}
2402302Spaul
24139206Sjkh# Set a reasonable default
24239206Sjkh.MAIN:	all
24339206Sjkh
244133945SruSTARTTIME!= LC_ALL=C date
245240403SobrienCHECK_TIME!= find ${.CURDIR}/sys/sys/param.h -mtime -0s ; echo
246177609Sru.if !empty(CHECK_TIME)
247177609Sru.error check your date/time: ${STARTTIME}
248177609Sru.endif
249133945Sru
250132358Smarkm.if defined(HISTORICAL_MAKE_WORLD) || defined(DESTDIR)
25117308Speter#
25254324Smarcel# world
25354324Smarcel#
254132234Smarcel# Attempt to rebuild and reinstall everything. This target is not to be
255132234Smarcel# used for upgrading an existing FreeBSD system, because the kernel is
256132234Smarcel# not included. One can argue that this target doesn't build everything
257132234Smarcel# then.
25854324Smarcel#
25954324Smarcelworld: upgrade_checks
26054324Smarcel	@echo "--------------------------------------------------------------"
261118531Sru	@echo ">>> make world started on ${STARTTIME}"
26254324Smarcel	@echo "--------------------------------------------------------------"
26354324Smarcel.if target(pre-world)
26454324Smarcel	@echo
26554324Smarcel	@echo "--------------------------------------------------------------"
26654324Smarcel	@echo ">>> Making 'pre-world' target"
26754324Smarcel	@echo "--------------------------------------------------------------"
268133376Sharti	${_+_}@cd ${.CURDIR}; ${_MAKE} pre-world
26954324Smarcel.endif
270133376Sharti	${_+_}@cd ${.CURDIR}; ${_MAKE} buildworld
271133376Sharti	${_+_}@cd ${.CURDIR}; ${_MAKE} -B installworld
27254324Smarcel.if target(post-world)
27354324Smarcel	@echo
27454324Smarcel	@echo "--------------------------------------------------------------"
27554324Smarcel	@echo ">>> Making 'post-world' target"
27654324Smarcel	@echo "--------------------------------------------------------------"
277133376Sharti	${_+_}@cd ${.CURDIR}; ${_MAKE} post-world
27854324Smarcel.endif
27954324Smarcel	@echo
28054324Smarcel	@echo "--------------------------------------------------------------"
281118531Sru	@echo ">>> make world completed on `LC_ALL=C date`"
282118531Sru	@echo "                   (started ${STARTTIME})"
28354324Smarcel	@echo "--------------------------------------------------------------"
284132234Smarcel.else
285132234Smarcelworld:
286132234Smarcel	@echo "WARNING: make world will overwrite your existing FreeBSD"
287132234Smarcel	@echo "installation without also building and installing a new"
288132234Smarcel	@echo "kernel.  This can be dangerous.  Please read the handbook,"
289132588Skensmith	@echo "'Rebuilding world', for how to upgrade your system."
290132358Smarkm	@echo "Define DESTDIR to where you want to install FreeBSD,"
291132234Smarcel	@echo "including /, to override this warning and proceed as usual."
292132358Smarkm	@echo ""
293132234Smarcel	@echo "Bailing out now..."
294132234Smarcel	@false
295132234Smarcel.endif
29654324Smarcel
29754324Smarcel#
29895730Sru# kernel
29995730Sru#
30095730Sru# Short hand for `make buildkernel installkernel'
30195730Sru#
30295730Srukernel: buildkernel installkernel
30395730Sru
30495730Sru#
30538666Sjb# Perform a few tests to determine if the installed tools are adequate
306107374Sru# for building the world.
30717308Speter#
308253616Ssjg# Note: if we ever need to care about the version of bmake, simply testing
309253616Ssjg# MAKE_VERSION against a required version should suffice.
310253616Ssjg#
31155678Smarcelupgrade_checks:
312253616Ssjg.if ${HAVE_MAKE} != ${WANT_MAKE}
313253616Ssjg	@(cd ${.CURDIR} && ${MAKE} ${WANT_MAKE:S,^f,,})
314253616Ssjg.elif ${WANT_MAKE} == "fmake"
315143032Sharti	@if ! (cd ${.CURDIR}/tools/build/make_check && \
316138515Sharti	    PATH=${PATH} ${BINMAKE} obj >/dev/null 2>&1 && \
317117793Sru	    PATH=${PATH} ${BINMAKE} >/dev/null 2>&1); \
318110035Sru	then \
319174564Simp	    (cd ${.CURDIR} && ${MAKE} make); \
320110035Sru	fi
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} \
332264397Simp		-D_UPGRADING -DNO_MAN -DNO_SHARED \
333255713Semaste		-DNO_CPU_CFLAGS -DNO_WERROR DESTDIR= PROGNAME=${MYMAKE:T}
334107516Sru
335249395Ssjgmake bmake: .PHONY
33655678Smarcel	@echo
33755678Smarcel	@echo "--------------------------------------------------------------"
338116696Sru	@echo ">>> Building an up-to-date make(1)"
33955678Smarcel	@echo "--------------------------------------------------------------"
340249395Ssjg	${_+_}@cd ${.CURDIR}/usr.bin/${.TARGET}; \
341255713Semaste		${MMAKE} obj && \
342255713Semaste		${MMAKE} depend && \
343255713Semaste		${MMAKE} all && \
344255713Semaste		${MMAKE} install DESTDIR=${MYMAKE:H} BINDIR=
34555678Smarcel
346254417Ssjgtinderbox toolchains kernel-toolchains: upgrade_checks
347254417Ssjg
348185499Salfredtinderbox:
349254417Ssjg	@cd ${.CURDIR} && ${SUB_MAKE} DOING_TINDERBOX=YES universe
350185499Salfred
351218524Sjhbtoolchains:
352254417Ssjg	@cd ${.CURDIR} && ${SUB_MAKE} UNIVERSE_TARGET=toolchain universe
353218524Sjhb
354232907Sjmallettkernel-toolchains:
355254417Ssjg	@cd ${.CURDIR} && ${SUB_MAKE} UNIVERSE_TARGET=kernel-toolchain universe
356232907Sjmallett
35755678Smarcel#
358111131Sru# universe
359111131Sru#
360111131Sru# Attempt to rebuild *everything* for all supported architectures,
361133945Sru# with a reasonable chance of success, regardless of how old your
362111131Sru# existing system is.
363111131Sru#
364217125Simp.if make(universe) || make(universe_kernels) || make(tinderbox) || make(targets)
365221869SattilioTARGETS?=amd64 arm i386 ia64 mips pc98 powerpc sparc64
366263660SandrewTARGET_ARCHES_arm?=	arm armeb armv6 armv6hf
367233644SjmallettTARGET_ARCHES_mips?=	mipsel mips mips64el mips64 mipsn32
368216520SnwhitehornTARGET_ARCHES_powerpc?=	powerpc powerpc64
369216520SnwhitehornTARGET_ARCHES_pc98?=	i386
370216520Snwhitehorn.for target in ${TARGETS}
371216520SnwhitehornTARGET_ARCHES_${target}?= ${target}
372216520Snwhitehorn.endfor
373168280Smarcel
374218524Sjhb.if defined(UNIVERSE_TARGET)
375218524SjhbMAKE_JUST_WORLDS=	YES
376218524Sjhb.else
377218524SjhbUNIVERSE_TARGET?=	buildworld
378218524Sjhb.endif
379219137SjhbKERNSRCDIR?=		${.CURDIR}/sys
380218524Sjhb
381217125Simptargets:
382217815Sbz	@echo "Supported TARGET/TARGET_ARCH pairs for world and kernel targets"
383217125Simp.for target in ${TARGETS}
384217125Simp.for target_arch in ${TARGET_ARCHES_${target}}
385217125Simp	@echo "    ${target}/${target_arch}"
386217125Simp.endfor
387217125Simp.endfor
388217125Simp
389185499Salfred.if defined(DOING_TINDERBOX)
390217735SbzFAILFILE=${.CURDIR}/_.tinderbox.failed
391185499SalfredMAKEFAIL=tee -a ${FAILFILE}
392185499Salfred.else
393185499SalfredMAKEFAIL=cat
394185499Salfred.endif
395185499Salfred
396253616Ssjguniverse_prologue:  upgrade_checks
397253616Ssjguniverse: universe_prologue
398133945Sruuniverse_prologue:
399103985Sphk	@echo "--------------------------------------------------------------"
400103985Sphk	@echo ">>> make universe started on ${STARTTIME}"
401103985Sphk	@echo "--------------------------------------------------------------"
402185499Salfred.if defined(DOING_TINDERBOX)
403217754Sbz	@rm -f ${FAILFILE}
404185499Salfred.endif
405168280Smarcel.for target in ${TARGETS}
406162147Sruuniverse: universe_${target}
407253616Ssjguniverse_epilogue: universe_${target}
408216520Snwhitehornuniverse_${target}: universe_${target}_prologue
409253616Ssjguniverse_${target}_prologue: universe_prologue
410216520Snwhitehorn	@echo ">> ${target} started on `LC_ALL=C date`"
411179232Sjb.if !defined(MAKE_JUST_KERNELS)
412216520Snwhitehorn.for target_arch in ${TARGET_ARCHES_${target}}
413216520Snwhitehornuniverse_${target}: universe_${target}_${target_arch}
414254417Ssjguniverse_${target}_${target_arch}: universe_${target}_prologue .MAKE
415218524Sjhb	@echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} started on `LC_ALL=C date`"
416185250Sdes	@(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
417253616Ssjg	    ${SUB_MAKE} ${JFLAG} ${UNIVERSE_TARGET} \
418162147Sru	    TARGET=${target} \
419216520Snwhitehorn	    TARGET_ARCH=${target_arch} \
420218524Sjhb	    > _.${target}.${target_arch}.${UNIVERSE_TARGET} 2>&1 || \
421218524Sjhb	    (echo "${target}.${target_arch} ${UNIVERSE_TARGET} failed," \
422218524Sjhb	    "check _.${target}.${target_arch}.${UNIVERSE_TARGET} for details" | \
423216520Snwhitehorn	    ${MAKEFAIL}))
424218524Sjhb	@echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} completed on `LC_ALL=C date`"
425216520Snwhitehorn.endfor
426179232Sjb.endif
427205290Sdougb.if !defined(MAKE_JUST_WORLDS)
428248937Sandrew# If we are building world and kernels wait for the required worlds to finish
429248937Sandrew.if !defined(MAKE_JUST_KERNELS)
430248937Sandrew.for target_arch in ${TARGET_ARCHES_${target}}
431248937Sandrewuniverse_${target}_kernels: universe_${target}_${target_arch}
432248937Sandrew.endfor
433248937Sandrew.endif
434248937Sandrewuniverse_${target}: universe_${target}_kernels
435254417Ssjguniverse_${target}_kernels: universe_${target}_prologue .MAKE
436219137Sjhb.if exists(${KERNSRCDIR}/${target}/conf/NOTES)
437219137Sjhb	@(cd ${KERNSRCDIR}/${target}/conf && env __MAKE_CONF=/dev/null \
438253616Ssjg	    ${SUB_MAKE} LINT > ${.CURDIR}/_.${target}.makeLINT 2>&1 || \
439185499Salfred	    (echo "${target} 'make LINT' failed," \
440185499Salfred	    "check _.${target}.makeLINT for details"| ${MAKEFAIL}))
441103985Sphk.endif
442253616Ssjg	@cd ${.CURDIR} && ${SUB_MAKE} ${.MAKEFLAGS} TARGET=${target} \
443201815Sbz	    universe_kernels
444205290Sdougb.endif
445201815Sbz	@echo ">> ${target} completed on `LC_ALL=C date`"
446201815Sbz.endfor
447201815Sbzuniverse_kernels: universe_kernconfs
448202095Sbz.if !defined(TARGET)
449202095SbzTARGET!=	uname -m
450202095Sbz.endif
451219137SjhbKERNCONFS!=	cd ${KERNSRCDIR}/${TARGET}/conf && \
452201815Sbz		find [A-Z0-9]*[A-Z0-9] -type f -maxdepth 0 \
453201815Sbz		! -name DEFAULTS ! -name NOTES
454201815Sbzuniverse_kernconfs:
455148154Sru.for kernel in ${KERNCONFS}
456219137SjhbTARGET_ARCH_${kernel}!=	cd ${KERNSRCDIR}/${TARGET}/conf && \
457219137Sjhb	config -m ${KERNSRCDIR}/${TARGET}/conf/${kernel} 2> /dev/null | \
458216934Simp	grep -v WARNING: | cut -f 2
459216934Simp.if empty(TARGET_ARCH_${kernel})
460216934Simp.error "Target architecture for ${TARGET}/conf/${kernel} unknown.  config(8) likely too old."
461216934Simp.endif
462216520Snwhitehornuniverse_kernconfs: universe_kernconf_${TARGET}_${kernel}
463254417Ssjguniverse_kernconf_${TARGET}_${kernel}: .MAKE
464185250Sdes	@(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
465253616Ssjg	    ${SUB_MAKE} ${JFLAG} buildkernel \
466201815Sbz	    TARGET=${TARGET} \
467216520Snwhitehorn	    TARGET_ARCH=${TARGET_ARCH_${kernel}} \
468148154Sru	    KERNCONF=${kernel} \
469201815Sbz	    > _.${TARGET}.${kernel} 2>&1 || \
470201815Sbz	    (echo "${TARGET} ${kernel} kernel failed," \
471201815Sbz	    "check _.${TARGET}.${kernel} for details"| ${MAKEFAIL}))
472148154Sru.endfor
473133945Sruuniverse: universe_epilogue
474133945Sruuniverse_epilogue:
475103985Sphk	@echo "--------------------------------------------------------------"
476118531Sru	@echo ">>> make universe completed on `LC_ALL=C date`"
477118531Sru	@echo "                      (started ${STARTTIME})"
478103985Sphk	@echo "--------------------------------------------------------------"
479185499Salfred.if defined(DOING_TINDERBOX)
480185499Salfred	@if [ -e ${FAILFILE} ] ; then \
481185499Salfred		echo "Tinderbox failed:" ;\
482185499Salfred		cat ${FAILFILE} ;\
483185499Salfred		exit 1 ;\
484185499Salfred	fi
485133945Sru.endif
486185499Salfred.endif
487242522Smarcel
488242522SmarcelbuildLINT:
489242522Smarcel	${MAKE} -C ${.CURDIR}/sys/${_TARGET}/conf LINT
490255286Ssjg
491255286Ssjg.if defined(.PARSEDIR)
492255286Ssjg.if make(universe)
493255286Ssjg# we do not want a failure of one branch abort all.
494255286SsjgMAKE_JOB_ERROR_TOKEN= no
495255286Ssjg.export MAKE_JOB_ERROR_TOKEN
496255286Ssjg.endif
497255286Ssjg.endif
498