Makefile revision 296014
12061Sjkh#
250479Speter# $FreeBSD: head/Makefile 296014 2016-02-24 22:27:25Z bdrewery $
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).
24295380Sngie# checkworld          - Run test suite on installed world.
25169597Sdes# check-old           - List obsolete directories/files/libraries.
26169597Sdes# check-old-dirs      - List obsolete directories.
27169597Sdes# check-old-files     - List obsolete files.
28169597Sdes# check-old-libs      - List obsolete libraries.
29231821Spluknet# delete-old          - Delete obsolete directories/files.
30169597Sdes# delete-old-dirs     - Delete obsolete directories.
31169597Sdes# delete-old-files    - Delete obsolete files.
32169597Sdes# delete-old-libs     - Delete obsolete libraries.
33217815Sbz# targets             - Print a list of supported TARGET/TARGET_ARCH pairs
34217815Sbz#                       for world and kernel targets.
35218524Sjhb# toolchains          - Build a toolchain for all world and kernel targets.
36264460Sbrueffer# xdev                - xdev-build + xdev-install for the architecture
37264460Sbrueffer#                       specified with XDEV and XDEV_ARCH.
38264460Sbrueffer# xdev-build          - Build cross-development tools.
39264460Sbrueffer# xdev-install        - Install cross-development tools.
40268503Simp# xdev-links          - Create traditional links in /usr/bin for cc, etc
41270155Simp# native-xtools       - Create host binaries that produce target objects
42270155Simp#                       for use in qemu user-mode jails.
43253002Salfred# 
44253002Salfred# "quick" way to test all kernel builds:
45253002Salfred# 	_jflag=`sysctl -n hw.ncpu`
46253002Salfred# 	_jflag=$(($_jflag * 2))
47253002Salfred# 	[ $_jflag -gt 12 ] && _jflag=12
48253003Salfred# 	make universe -DMAKE_JUST_KERNELS JFLAG=-j${_jflag}
4932427Sjb#
5038666Sjb# This makefile is simple by design. The FreeBSD make automatically reads
51108451Sschweikh# the /usr/share/mk/sys.mk unless the -m argument is specified on the
5238666Sjb# command line. By keeping this makefile simple, it doesn't matter too
5338666Sjb# much how different the installed mk files are from those in the source
5438666Sjb# tree. This makefile executes a child make process, forcing it to use
5538666Sjb# the mk files from the source tree which are supposed to DTRT.
5617308Speter#
57217273Simp# Most of the user-driven targets (as listed above) are implemented in
58217294Simp# Makefile.inc1.  The exceptions are universe, tinderbox and targets.
5919175Sbde#
6096205Sjwd# If you want to build your system from source be sure that /usr/obj has
61292217Semaste# at least 6GB of diskspace available.  A complete 'universe' build requires
62292217Semaste# about 100GB of space.
6338042Sbde#
6496205Sjwd# For individuals wanting to build from the sources currently on their
6596205Sjwd# system, the simple instructions are:
6638042Sbde#
6796205Sjwd# 1.  `cd /usr/src'  (or to the directory containing your source tree).
68159363Strhodes# 2.  Define `HISTORICAL_MAKE_WORLD' variable (see README).
69159363Strhodes# 3.  `make world'
7017308Speter#
7196205Sjwd# For individuals wanting to upgrade their sources (even if only a
7296205Sjwd# delta of a few days):
7317308Speter#
74148330Snetchild#  1.  `cd /usr/src'       (or to the directory containing your source tree).
75148330Snetchild#  2.  `make buildworld'
76148330Snetchild#  3.  `make buildkernel KERNCONF=YOUR_KERNEL_HERE'     (default is GENERIC).
77148330Snetchild#  4.  `make installkernel KERNCONF=YOUR_KERNEL_HERE'   (default is GENERIC).
78159831Sobrien#       [steps 3. & 4. can be combined by using the "kernel" target]
79148330Snetchild#  5.  `reboot'        (in single user mode: boot -s from the loader prompt).
80148330Snetchild#  6.  `mergemaster -p'
81148330Snetchild#  7.  `make installworld'
82251107Screes#  8.  `mergemaster'		(you may wish to use -i, along with -U or -F).
83251107Screes#  9.  `make delete-old'
84148330Snetchild# 10.  `reboot'
85148330Snetchild# 11.  `make delete-old-libs' (in case no 3rd party program uses them anymore)
8696205Sjwd#
8796205Sjwd# See src/UPDATING `COMMON ITEMS' for more complete information.
8896205Sjwd#
89268191Smarcel# If TARGET=machine (e.g. powerpc, sparc64, ...) is specified you can
90162147Sru# cross build world for other machine types using the buildworld target,
9198723Sdillon# and once the world is built you can cross build a kernel using the
9298723Sdillon# buildkernel target.
9398723Sdillon#
9438666Sjb# Define the user-driven targets. These are listed here in alphabetical
9538666Sjb# order, but that's not important.
9617308Speter#
97123311Speter# Targets that begin with underscore are internal targets intended for
98123311Speter# developer convenience only.  They are intentionally not documented and
99123311Speter# completely subject to change without notice.
100123311Speter#
101175833Sjhb# For more information, see the build(7) manual page.
102175833Sjhb#
103284454Simp
104290526Sbdrewery# This is included so CC is set to ccache for -V, and COMPILER_TYPE/VERSION
105290526Sbdrewery# can be cached for sub-makes.
106290526Sbdrewery.include <bsd.compiler.mk>
107290526Sbdrewery
108284454Simp# Note: we use this awkward construct to be compatible with FreeBSD's
109284454Simp# old make used in 10.0 and 9.2 and earlier.
110290816Ssjg.if defined(MK_DIRDEPS_BUILD) && ${MK_DIRDEPS_BUILD} == "yes" && !make(showconfig)
111284345Ssjg# targets/Makefile plays the role of top-level
112284345Ssjg.include "targets/Makefile"
113284345Ssjg.else
114284345Ssjg
115169597SdesTGTS=	all all-man buildenv buildenvvars buildkernel buildworld \
116295380Sngie	check check-old check-old-dirs check-old-files check-old-libs \
117295380Sngie	checkdpadd checkworld clean cleandepend cleandir cleanworld \
118169597Sdes	delete-old delete-old-dirs delete-old-files delete-old-libs \
119219177Snwhitehorn	depend distribute distributekernel distributekernel.debug \
120219177Snwhitehorn	distributeworld distrib-dirs distribution doxygen \
121238051Sobrien	everything hier hierarchy install installcheck installkernel \
122219177Snwhitehorn	installkernel.debug packagekernel packageworld \
123219177Snwhitehorn	reinstallkernel reinstallkernel.debug \
124158962Snetchild	installworld kernel-toolchain libraries lint maninstall \
125295380Sngie	obj objlink rerelease showconfig tags toolchain update \
126123311Speter	_worldtmp _legacy _bootstrap-tools _cleanobj _obj \
127137288Speter	_build-tools _cross-tools _includes _libraries _depend \
128209128Sraj	build32 builddtb distribute32 install32 xdev xdev-build xdev-install \
129289089Sbapt	xdev-links native-xtools installconfig \
130209128Sraj
131156740SruTGTS+=	${SUBDIR_TARGETS}
1322061Sjkh
13397769SruBITGTS=	files includes
13497252SruBITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/}
135119579SruTGTS+=	${BITGTS}
13697252Sru
13795730Sru.ORDER: buildworld installworld
13895793Sru.ORDER: buildworld distributeworld
139111617Sru.ORDER: buildworld buildkernel
140295161Sbdrewery.ORDER: installworld distribution
141296014Sbdrewery.ORDER: installworld installkernel
14295730Sru.ORDER: buildkernel installkernel
143116679Ssimokawa.ORDER: buildkernel installkernel.debug
14495730Sru.ORDER: buildkernel reinstallkernel
145116679Ssimokawa.ORDER: buildkernel reinstallkernel.debug
14695730Sru
147110035SruPATH=	/sbin:/bin:/usr/sbin:/usr/bin
148107516SruMAKEOBJDIRPREFIX?=	/usr/obj
149293288Sbdrewery_MAKEOBJDIRPREFIX!= /usr/bin/env -i PATH=${PATH} ${MAKE} \
150293288Sbdrewery    ${.MAKEFLAGS:MMAKEOBJDIRPREFIX=*} __MAKE_CONF=${__MAKE_CONF} \
151293288Sbdrewery    -f /dev/null -V MAKEOBJDIRPREFIX dummy
152293288Sbdrewery.if !empty(_MAKEOBJDIRPREFIX)
153293288Sbdrewery.error MAKEOBJDIRPREFIX can only be set in environment, not as a global\
154293288Sbdrewery	(in make.conf(5)) or command-line variable.
155293288Sbdrewery.endif
156253616Ssjg
157253616Ssjg# We often need to use the tree's version of make to build it.
158253616Ssjg# Choices add to complexity though.
159253616Ssjg# We cannot blindly use a make which may not be the one we want
160253616Ssjg# so be exlicit - until all choice is removed.
161253616SsjgWANT_MAKE=	bmake
162253616SsjgMYMAKE=		${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE}/${WANT_MAKE}
163253616Ssjg.if defined(.PARSEDIR)
164253616SsjgHAVE_MAKE=	bmake
165253616Ssjg.else
166253616SsjgHAVE_MAKE=	fmake
167253616Ssjg.endif
168253616Ssjg.if exists(${MYMAKE})
169253616SsjgSUB_MAKE:= ${MYMAKE} -m ${.CURDIR}/share/mk
170265423Simp.elif ${WANT_MAKE} != ${HAVE_MAKE}
171253616Ssjg# It may not exist yet but we may cause it to.
172253616Ssjg# In the case of fmake, upgrade_checks may cause a newer version to be built.
173253616SsjgSUB_MAKE= `test -x ${MYMAKE} && echo ${MYMAKE} || echo ${MAKE}` \
174117229Sru	-m ${.CURDIR}/share/mk
175253616Ssjg.else
176253616SsjgSUB_MAKE= ${MAKE} -m ${.CURDIR}/share/mk
177253616Ssjg.endif
17854324Smarcel
179253616Ssjg_MAKE=	PATH=${PATH} ${SUB_MAKE} -f Makefile.inc1 TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH}
180253616Ssjg
181218130Simp# Guess machine architecture from machine type, and vice versa.
182218130Simp.if !defined(TARGET_ARCH) && defined(TARGET)
183280259Sandrew_TARGET_ARCH=	${TARGET:S/pc98/i386/:S/arm64/aarch64/}
184218130Simp.elif !defined(TARGET) && defined(TARGET_ARCH) && \
185218130Simp    ${TARGET_ARCH} != ${MACHINE_ARCH}
186292124Sbr_TARGET=		${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb|hf)?/arm/:C/aarch64/arm64/:C/powerpc64/powerpc/:C/riscv64/riscv/}
187218130Simp.endif
188218130Simp.if defined(TARGET) && !defined(_TARGET)
189218130Simp_TARGET=${TARGET}
190218130Simp.endif
191218130Simp.if defined(TARGET_ARCH) && !defined(_TARGET_ARCH)
192218130Simp_TARGET_ARCH=${TARGET_ARCH}
193218130Simp.endif
194269048Simp# for historical compatibility for xdev targets
195269048Simp.if defined(XDEV)
196269048Simp_TARGET=	${XDEV}
197269048Simp.endif
198269048Simp.if defined(XDEV_ARCH)
199269048Simp_TARGET_ARCH=	${XDEV_ARCH}
200269048Simp.endif
201218130Simp# Otherwise, default to current machine type and architecture.
202218130Simp_TARGET?=	${MACHINE}
203218130Simp_TARGET_ARCH?=	${MACHINE_ARCH}
204218130Simp
20517308Speter#
206119519Smarcel# Make sure we have an up-to-date make(1). Only world and buildworld
207119519Smarcel# should do this as those are the initial targets used for upgrades.
208119519Smarcel# The user can define ALWAYS_CHECK_MAKE to have this check performed
209119519Smarcel# for all targets.
210119519Smarcel#
211293342Sbdrewery.if defined(ALWAYS_CHECK_MAKE) || !defined(.PARSEDIR)
212119579Sru${TGTS}: upgrade_checks
213119519Smarcel.else
214119519Smarcelbuildworld: upgrade_checks
215119519Smarcel.endif
216119519Smarcel
217119519Smarcel#
21838666Sjb# Handle the user-driven targets, using the source relative mk files.
21917308Speter#
220119519Smarcel
221254417Ssjgtinderbox toolchains kernel-toolchains: .MAKE
222289460Sbdrewery${TGTS}: .PHONY .MAKE
223218206Simp	${_+_}@cd ${.CURDIR}; ${_MAKE} ${.TARGET}
2242302Spaul
225265097Sbrooks# The historic default "all" target creates files which may cause stale
226265097Sbrooks# or (in the cross build case) unlinkable results. Fail with an error
227265097Sbrooks# when no target is given. The users can explicitly specify "all"
228265097Sbrooks# if they want the historic behavior.
229265097Sbrooks.MAIN:	_guard
23039206Sjkh
231289411Sbdrewery_guard: .PHONY
232265097Sbrooks	@echo
233289432Sbdrewery	@echo "Explicit target required.  Likely \"${SUBDIR_OVERRIDE:Dall:Ubuildworld}\" is wanted.  See build(7)."
234265097Sbrooks	@echo
235265097Sbrooks	@false
236265097Sbrooks
237133945SruSTARTTIME!= LC_ALL=C date
238240403SobrienCHECK_TIME!= find ${.CURDIR}/sys/sys/param.h -mtime -0s ; echo
239177609Sru.if !empty(CHECK_TIME)
240177609Sru.error check your date/time: ${STARTTIME}
241177609Sru.endif
242133945Sru
243132358Smarkm.if defined(HISTORICAL_MAKE_WORLD) || defined(DESTDIR)
24417308Speter#
24554324Smarcel# world
24654324Smarcel#
247132234Smarcel# Attempt to rebuild and reinstall everything. This target is not to be
248132234Smarcel# used for upgrading an existing FreeBSD system, because the kernel is
249132234Smarcel# not included. One can argue that this target doesn't build everything
250132234Smarcel# then.
25154324Smarcel#
25254324Smarcelworld: upgrade_checks
25354324Smarcel	@echo "--------------------------------------------------------------"
254118531Sru	@echo ">>> make world started on ${STARTTIME}"
25554324Smarcel	@echo "--------------------------------------------------------------"
25654324Smarcel.if target(pre-world)
25754324Smarcel	@echo
25854324Smarcel	@echo "--------------------------------------------------------------"
25954324Smarcel	@echo ">>> Making 'pre-world' target"
26054324Smarcel	@echo "--------------------------------------------------------------"
261133376Sharti	${_+_}@cd ${.CURDIR}; ${_MAKE} pre-world
26254324Smarcel.endif
263133376Sharti	${_+_}@cd ${.CURDIR}; ${_MAKE} buildworld
264133376Sharti	${_+_}@cd ${.CURDIR}; ${_MAKE} -B installworld
26554324Smarcel.if target(post-world)
26654324Smarcel	@echo
26754324Smarcel	@echo "--------------------------------------------------------------"
26854324Smarcel	@echo ">>> Making 'post-world' target"
26954324Smarcel	@echo "--------------------------------------------------------------"
270133376Sharti	${_+_}@cd ${.CURDIR}; ${_MAKE} post-world
27154324Smarcel.endif
27254324Smarcel	@echo
27354324Smarcel	@echo "--------------------------------------------------------------"
274118531Sru	@echo ">>> make world completed on `LC_ALL=C date`"
275118531Sru	@echo "                   (started ${STARTTIME})"
27654324Smarcel	@echo "--------------------------------------------------------------"
277132234Smarcel.else
278132234Smarcelworld:
279132234Smarcel	@echo "WARNING: make world will overwrite your existing FreeBSD"
280132234Smarcel	@echo "installation without also building and installing a new"
281132234Smarcel	@echo "kernel.  This can be dangerous.  Please read the handbook,"
282132588Skensmith	@echo "'Rebuilding world', for how to upgrade your system."
283132358Smarkm	@echo "Define DESTDIR to where you want to install FreeBSD,"
284132234Smarcel	@echo "including /, to override this warning and proceed as usual."
285132358Smarkm	@echo ""
286132234Smarcel	@echo "Bailing out now..."
287132234Smarcel	@false
288132234Smarcel.endif
28954324Smarcel
29054324Smarcel#
29195730Sru# kernel
29295730Sru#
29395730Sru# Short hand for `make buildkernel installkernel'
29495730Sru#
29595730Srukernel: buildkernel installkernel
29695730Sru
29795730Sru#
29838666Sjb# Perform a few tests to determine if the installed tools are adequate
299107374Sru# for building the world.
30017308Speter#
30155678Smarcelupgrade_checks:
302295980Sbdrewery.if ${HAVE_MAKE} != ${WANT_MAKE} || \
303295980Sbdrewery    (defined(WANT_MAKE_VERSION) && ${MAKE_VERSION} < ${WANT_MAKE_VERSION})
304253616Ssjg	@(cd ${.CURDIR} && ${MAKE} ${WANT_MAKE:S,^f,,})
305241298Smarcel.endif
3062061Sjkh
30717308Speter#
308107516Sru# Upgrade make(1) to the current version using the installed
309174539Simp# headers, libraries and tools.  Also, allow the location of
310174539Simp# the system bsdmake-like utility to be overridden.
31155678Smarcel#
312253616SsjgMMAKEENV=	MAKEOBJDIRPREFIX=${MYMAKE:H} \
313107516Sru		DESTDIR= \
314107516Sru		INSTALL="sh ${.CURDIR}/tools/install.sh"
315174564SimpMMAKE=		${MMAKEENV} ${MAKE} \
316265837Simp		-DNO_MAN -DNO_SHARED \
317264742Sjmmv		-DNO_CPU_CFLAGS -DNO_WERROR \
318268598Sjmmv		MK_TESTS=no \
319265827Simp		DESTDIR= PROGNAME=${MYMAKE:T}
320107516Sru
321265827Simpbmake: .PHONY
32255678Smarcel	@echo
32355678Smarcel	@echo "--------------------------------------------------------------"
324265827Simp	@echo ">>> Building an up-to-date ${.TARGET}(1)"
32555678Smarcel	@echo "--------------------------------------------------------------"
326249395Ssjg	${_+_}@cd ${.CURDIR}/usr.bin/${.TARGET}; \
327291605Sbdrewery		${MMAKE} obj; \
328291605Sbdrewery		${MMAKE} depend; \
329291605Sbdrewery		${MMAKE} all; \
330265827Simp		${MMAKE} install DESTDIR=${MYMAKE:H} BINDIR=
33155678Smarcel
332295380Sngieregress: .PHONY
333295380Sngie	@echo "'make regress' has been renamed 'make check'" | /usr/bin/fmt
334295380Sngie	@false
335295380Sngie
336295099Siantinderbox toolchains kernel-toolchains kernels worlds: upgrade_checks
337254417Ssjg
338185499Salfredtinderbox:
339291605Sbdrewery	@cd ${.CURDIR}; ${SUB_MAKE} DOING_TINDERBOX=YES universe
340185499Salfred
341218524Sjhbtoolchains:
342291605Sbdrewery	@cd ${.CURDIR}; ${SUB_MAKE} UNIVERSE_TARGET=toolchain universe
343218524Sjhb
344232907Sjmallettkernel-toolchains:
345291605Sbdrewery	@cd ${.CURDIR}; ${SUB_MAKE} UNIVERSE_TARGET=kernel-toolchain universe
346232907Sjmallett
347295099Siankernels:
348295099Sian	@cd ${.CURDIR}; ${SUB_MAKE} UNIVERSE_TARGET=buildkernel universe
349295099Sian
350295099Sianworlds:
351295099Sian	@cd ${.CURDIR}; ${SUB_MAKE} UNIVERSE_TARGET=buildworld universe
352295099Sian
35355678Smarcel#
354111131Sru# universe
355111131Sru#
356111131Sru# Attempt to rebuild *everything* for all supported architectures,
357133945Sru# with a reasonable chance of success, regardless of how old your
358111131Sru# existing system is.
359111131Sru#
360217125Simp.if make(universe) || make(universe_kernels) || make(tinderbox) || make(targets)
361287903SbdreweryTARGETS?=amd64 arm arm64 i386 mips pc98 powerpc sparc64
362287903Sbdrewery_UNIVERSE_TARGETS=	${TARGETS}
363263660SandrewTARGET_ARCHES_arm?=	arm armeb armv6 armv6hf
364282156SemasteTARGET_ARCHES_arm64?=	aarch64
365233644SjmallettTARGET_ARCHES_mips?=	mipsel mips mips64el mips64 mipsn32
366216520SnwhitehornTARGET_ARCHES_powerpc?=	powerpc powerpc64
367216520SnwhitehornTARGET_ARCHES_pc98?=	i386
368287903Sbdrewery.for target in ${TARGETS}
369216520SnwhitehornTARGET_ARCHES_${target}?= ${target}
370216520Snwhitehorn.endfor
371168280Smarcel
372287903Sbdrewery# XXX Add arm64 to universe only if we have an external binutils installed.
373287903Sbdrewery# It does not build with the in-tree linker.
374287903Sbdrewery.if !exists(/usr/local/aarch64-freebsd/bin/ld) && empty(${TARGETS})
375287903Sbdrewery_UNIVERSE_TARGETS:= ${_UNIVERSE_TARGETS:Narm64}
376287903Sbdreweryuniverse: universe_arm64_skip
377287903Sbdreweryuniverse_epilogue: universe_arm64_skip
378287903Sbdreweryuniverse_arm64_skip: universe_prologue
379287903Sbdrewery	@echo ">> arm64 skipped - install aarch64-binutils port or package to build"
380287903Sbdrewery.endif
381287903Sbdrewery
382218524Sjhb.if defined(UNIVERSE_TARGET)
383218524SjhbMAKE_JUST_WORLDS=	YES
384218524Sjhb.else
385218524SjhbUNIVERSE_TARGET?=	buildworld
386218524Sjhb.endif
387219137SjhbKERNSRCDIR?=		${.CURDIR}/sys
388218524Sjhb
389284699Ssjgtargets:	.PHONY
390217815Sbz	@echo "Supported TARGET/TARGET_ARCH pairs for world and kernel targets"
391287903Sbdrewery.for target in ${TARGETS}
392217125Simp.for target_arch in ${TARGET_ARCHES_${target}}
393217125Simp	@echo "    ${target}/${target_arch}"
394217125Simp.endfor
395217125Simp.endfor
396217125Simp
397185499Salfred.if defined(DOING_TINDERBOX)
398217735SbzFAILFILE=${.CURDIR}/_.tinderbox.failed
399185499SalfredMAKEFAIL=tee -a ${FAILFILE}
400185499Salfred.else
401185499SalfredMAKEFAIL=cat
402185499Salfred.endif
403185499Salfred
404253616Ssjguniverse_prologue:  upgrade_checks
405253616Ssjguniverse: universe_prologue
406133945Sruuniverse_prologue:
407103985Sphk	@echo "--------------------------------------------------------------"
408103985Sphk	@echo ">>> make universe started on ${STARTTIME}"
409103985Sphk	@echo "--------------------------------------------------------------"
410185499Salfred.if defined(DOING_TINDERBOX)
411217754Sbz	@rm -f ${FAILFILE}
412185499Salfred.endif
413287903Sbdrewery.for target in ${_UNIVERSE_TARGETS}
414162147Sruuniverse: universe_${target}
415253616Ssjguniverse_epilogue: universe_${target}
416216520Snwhitehornuniverse_${target}: universe_${target}_prologue
417253616Ssjguniverse_${target}_prologue: universe_prologue
418216520Snwhitehorn	@echo ">> ${target} started on `LC_ALL=C date`"
419284456Sandrewuniverse_${target}_worlds:
420284456Sandrew
421179232Sjb.if !defined(MAKE_JUST_KERNELS)
422284471Sandrewuniverse_${target}_done: universe_${target}_worlds
423216520Snwhitehorn.for target_arch in ${TARGET_ARCHES_${target}}
424284456Sandrewuniverse_${target}_worlds: universe_${target}_${target_arch}
425254417Ssjguniverse_${target}_${target_arch}: universe_${target}_prologue .MAKE
426218524Sjhb	@echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} started on `LC_ALL=C date`"
427185250Sdes	@(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
428253616Ssjg	    ${SUB_MAKE} ${JFLAG} ${UNIVERSE_TARGET} \
429162147Sru	    TARGET=${target} \
430216520Snwhitehorn	    TARGET_ARCH=${target_arch} \
431218524Sjhb	    > _.${target}.${target_arch}.${UNIVERSE_TARGET} 2>&1 || \
432218524Sjhb	    (echo "${target}.${target_arch} ${UNIVERSE_TARGET} failed," \
433218524Sjhb	    "check _.${target}.${target_arch}.${UNIVERSE_TARGET} for details" | \
434216520Snwhitehorn	    ${MAKEFAIL}))
435218524Sjhb	@echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} completed on `LC_ALL=C date`"
436216520Snwhitehorn.endfor
437284453Sandrew.endif # !MAKE_JUST_KERNELS
438284453Sandrew
439205290Sdougb.if !defined(MAKE_JUST_WORLDS)
440284457Sandrewuniverse_${target}_done: universe_${target}_kernels
441284456Sandrewuniverse_${target}_kernels: universe_${target}_worlds
442254417Ssjguniverse_${target}_kernels: universe_${target}_prologue .MAKE
443219137Sjhb.if exists(${KERNSRCDIR}/${target}/conf/NOTES)
444219137Sjhb	@(cd ${KERNSRCDIR}/${target}/conf && env __MAKE_CONF=/dev/null \
445253616Ssjg	    ${SUB_MAKE} LINT > ${.CURDIR}/_.${target}.makeLINT 2>&1 || \
446185499Salfred	    (echo "${target} 'make LINT' failed," \
447185499Salfred	    "check _.${target}.makeLINT for details"| ${MAKEFAIL}))
448103985Sphk.endif
449291605Sbdrewery	@cd ${.CURDIR}; ${SUB_MAKE} ${.MAKEFLAGS} TARGET=${target} \
450201815Sbz	    universe_kernels
451284453Sandrew.endif # !MAKE_JUST_WORLDS
452284457Sandrew
453284457Sandrew# Tell the user the worlds and kernels have completed
454284457Sandrewuniverse_${target}: universe_${target}_done
455284457Sandrewuniverse_${target}_done:
456201815Sbz	@echo ">> ${target} completed on `LC_ALL=C date`"
457201815Sbz.endfor
458201815Sbzuniverse_kernels: universe_kernconfs
459202095Sbz.if !defined(TARGET)
460202095SbzTARGET!=	uname -m
461202095Sbz.endif
462265155Simp.if defined(MAKE_ALL_KERNELS)
463265155Simp_THINNER=cat
464265155Simp.else
465265840Simp_THINNER=xargs grep -L "^.NO_UNIVERSE" || true
466265155Simp.endif
467219137SjhbKERNCONFS!=	cd ${KERNSRCDIR}/${TARGET}/conf && \
468295455Sbapt		find [[:upper:][:digit:]]*[[:upper:][:digit:]] \
469295455Sbapt		-type f -maxdepth 0 \
470265155Simp		! -name DEFAULTS ! -name NOTES | \
471265155Simp		${_THINNER}
472201815Sbzuniverse_kernconfs:
473148154Sru.for kernel in ${KERNCONFS}
474219137SjhbTARGET_ARCH_${kernel}!=	cd ${KERNSRCDIR}/${TARGET}/conf && \
475219137Sjhb	config -m ${KERNSRCDIR}/${TARGET}/conf/${kernel} 2> /dev/null | \
476216934Simp	grep -v WARNING: | cut -f 2
477216934Simp.if empty(TARGET_ARCH_${kernel})
478216934Simp.error "Target architecture for ${TARGET}/conf/${kernel} unknown.  config(8) likely too old."
479216934Simp.endif
480216520Snwhitehornuniverse_kernconfs: universe_kernconf_${TARGET}_${kernel}
481254417Ssjguniverse_kernconf_${TARGET}_${kernel}: .MAKE
482185250Sdes	@(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
483253616Ssjg	    ${SUB_MAKE} ${JFLAG} buildkernel \
484201815Sbz	    TARGET=${TARGET} \
485216520Snwhitehorn	    TARGET_ARCH=${TARGET_ARCH_${kernel}} \
486148154Sru	    KERNCONF=${kernel} \
487201815Sbz	    > _.${TARGET}.${kernel} 2>&1 || \
488201815Sbz	    (echo "${TARGET} ${kernel} kernel failed," \
489201815Sbz	    "check _.${TARGET}.${kernel} for details"| ${MAKEFAIL}))
490148154Sru.endfor
491133945Sruuniverse: universe_epilogue
492133945Sruuniverse_epilogue:
493103985Sphk	@echo "--------------------------------------------------------------"
494118531Sru	@echo ">>> make universe completed on `LC_ALL=C date`"
495118531Sru	@echo "                      (started ${STARTTIME})"
496103985Sphk	@echo "--------------------------------------------------------------"
497185499Salfred.if defined(DOING_TINDERBOX)
498185499Salfred	@if [ -e ${FAILFILE} ] ; then \
499185499Salfred		echo "Tinderbox failed:" ;\
500185499Salfred		cat ${FAILFILE} ;\
501185499Salfred		exit 1 ;\
502185499Salfred	fi
503133945Sru.endif
504185499Salfred.endif
505242522Smarcel
506242522SmarcelbuildLINT:
507242522Smarcel	${MAKE} -C ${.CURDIR}/sys/${_TARGET}/conf LINT
508255286Ssjg
509284454Simp.if defined(.PARSEDIR)
510284345Ssjg# This makefile does not run in meta mode
511284345Ssjg.MAKE.MODE= normal
512284345Ssjg# Normally the things we run from here don't either.
513290816Ssjg# Using -DWITH_META_MODE
514284345Ssjg# we can buildworld with meta files created which are useful 
515284345Ssjg# for debugging, but without any of the rest of a meta mode build.
516290816SsjgMK_DIRDEPS_BUILD= no
517284345SsjgMK_STAGING= no
518284345Ssjg# tell meta.autodep.mk to not even think about updating anything.
519284345SsjgUPDATE_DEPENDFILE= NO
520285080Ssjg.if !make(showconfig)
521290816Ssjg.export MK_DIRDEPS_BUILD MK_STAGING UPDATE_DEPENDFILE
522285080Ssjg.endif
523284345Ssjg
524255286Ssjg.if make(universe)
525255286Ssjg# we do not want a failure of one branch abort all.
526255286SsjgMAKE_JOB_ERROR_TOKEN= no
527255286Ssjg.export MAKE_JOB_ERROR_TOKEN
528255286Ssjg.endif
529284454Simp.endif # bmake
530284345Ssjg
531290816Ssjg.endif				# DIRDEPS_BUILD
532