xref: /freebsd/Makefile (revision 92f64fb9)
13540f0e1SJordan K. Hubbard#
297d92980SPeter Wemm# $FreeBSD$
3cf763a57SJohn Birrell#
411fb97daSJohn Birrell# The user-driven targets are:
5cf763a57SJohn Birrell#
61f4f7670SRuslan Ermilov# universe            - *Really* build *everything* (buildworld and
71f4f7670SRuslan Ermilov#                       all kernels on all architectures).
811fb97daSJohn Birrell# buildworld          - Rebuild *everything*, including glue to help do
911fb97daSJohn Birrell#                       upgrades.
1011fb97daSJohn Birrell# installworld        - Install everything built by "buildworld".
11fb55e855STom Rhodes# world               - buildworld + installworld, no kernel.
1200eb8cbdSAlexander Langer# buildkernel         - Rebuild the kernel and the kernel-modules.
1300eb8cbdSAlexander Langer# installkernel       - Install the kernel and the kernel-modules.
140147d2aaSHidetoshi Shimokawa# installkernel.debug
15737ffab7SMark Murray# reinstallkernel     - Reinstall the kernel and the kernel-modules.
160147d2aaSHidetoshi Shimokawa# reinstallkernel.debug
17bc4311beSDavid E. O'Brien# kernel              - buildkernel + installkernel.
18589fec8bSWarner Losh# kernel-toolchain    - Builds the subset of world necessary to build a kernel
19becc5c62SAlexander Leidinger# doxygen             - Build API documentation of the kernel, needs doxygen.
2011fb97daSJohn Birrell# update              - Convenient way to update your source tree (cvs).
2132cd239bSDag-Erling Smørgrav# check-old           - List obsolete directories/files/libraries.
2232cd239bSDag-Erling Smørgrav# check-old-dirs      - List obsolete directories.
2332cd239bSDag-Erling Smørgrav# check-old-files     - List obsolete files.
2432cd239bSDag-Erling Smørgrav# check-old-libs      - List obsolete libraries.
2532cd239bSDag-Erling Smørgrav# delete-old          - Delete obsolete directories/files/libraries.
2632cd239bSDag-Erling Smørgrav# delete-old-dirs     - Delete obsolete directories.
2732cd239bSDag-Erling Smørgrav# delete-old-files    - Delete obsolete files.
2832cd239bSDag-Erling Smørgrav# delete-old-libs     - Delete obsolete libraries.
293540f0e1SJordan K. Hubbard#
3011fb97daSJohn Birrell# This makefile is simple by design. The FreeBSD make automatically reads
3111fb97daSJohn Birrell# the /usr/share/mk/sys.mk unless the -m argument is specified on the
3211fb97daSJohn Birrell# command line. By keeping this makefile simple, it doesn't matter too
3311fb97daSJohn Birrell# much how different the installed mk files are from those in the source
3411fb97daSJohn Birrell# tree. This makefile executes a child make process, forcing it to use
3511fb97daSJohn Birrell# the mk files from the source tree which are supposed to DTRT.
3611fb97daSJohn Birrell#
37912422f0SGiorgos Keramidas# The user-driven targets (as listed above) are implemented in Makefile.inc1.
3811fb97daSJohn Birrell#
3976fdd728SJohn W. De Boskey# If you want to build your system from source be sure that /usr/obj has
40753eda06SPav Lucistnik# at least 800MB of diskspace available.
4111fb97daSJohn Birrell#
4276fdd728SJohn W. De Boskey# For individuals wanting to build from the sources currently on their
4376fdd728SJohn W. De Boskey# system, the simple instructions are:
4411fb97daSJohn Birrell#
4576fdd728SJohn W. De Boskey# 1.  `cd /usr/src'  (or to the directory containing your source tree).
46fb55e855STom Rhodes# 2.  Define `HISTORICAL_MAKE_WORLD' variable (see README).
47fb55e855STom Rhodes# 3.  `make world'
4811fb97daSJohn Birrell#
4976fdd728SJohn W. De Boskey# For individuals wanting to upgrade their sources (even if only a
5076fdd728SJohn W. De Boskey# delta of a few days):
5176fdd728SJohn W. De Boskey#
5276fdd728SJohn W. De Boskey#  1.  `cd /usr/src'       (or to the directory containing your source tree).
5376fdd728SJohn W. De Boskey#  2.  `make buildworld'
5476fdd728SJohn W. De Boskey#  3.  `make buildkernel KERNCONF=YOUR_KERNEL_HERE'     (default is GENERIC).
5576fdd728SJohn W. De Boskey#  4.  `make installkernel KERNCONF=YOUR_KERNEL_HERE'   (default is GENERIC).
562c5e89c2SDavid E. O'Brien#       [steps 3. & 4. can be combined by using the "kernel" target]
5776fdd728SJohn W. De Boskey#  5.  `reboot'        (in single user mode: boot -s from the loader prompt).
5876fdd728SJohn W. De Boskey#  6.  `mergemaster -p'
5976fdd728SJohn W. De Boskey#  7.  `make installworld'
60e2a36081SAlexander Leidinger#  8.  `make delete-old'
61fbf4979aSRobert Watson#  9.  `mergemaster'                         (you may wish to use -U or -ai).
62e2a36081SAlexander Leidinger# 10.  `reboot'
63e2a36081SAlexander Leidinger# 11.  `make delete-old-libs' (in case no 3rd party program uses them anymore)
6476fdd728SJohn W. De Boskey#
6576fdd728SJohn W. De Boskey# See src/UPDATING `COMMON ITEMS' for more complete information.
6611fb97daSJohn Birrell#
671fde59f3SRuslan Ermilov# If TARGET=machine (e.g. ia64, sparc64, ...) is specified you can
681fde59f3SRuslan Ermilov# cross build world for other machine types using the buildworld target,
69dbc3719dSMatthew Dillon# and once the world is built you can cross build a kernel using the
70dbc3719dSMatthew Dillon# buildkernel target.
71dbc3719dSMatthew Dillon#
7211fb97daSJohn Birrell# Define the user-driven targets. These are listed here in alphabetical
7311fb97daSJohn Birrell# order, but that's not important.
7411fb97daSJohn Birrell#
75ef7af95aSPeter Wemm# Targets that begin with underscore are internal targets intended for
76ef7af95aSPeter Wemm# developer convenience only.  They are intentionally not documented and
77ef7af95aSPeter Wemm# completely subject to change without notice.
78ef7af95aSPeter Wemm#
7979e19f08SJohn Baldwin# For more information, see the build(7) manual page.
8079e19f08SJohn Baldwin#
8132cd239bSDag-Erling SmørgravTGTS=	all all-man buildenv buildenvvars buildkernel buildworld \
8232cd239bSDag-Erling Smørgrav	check-old check-old-dirs check-old-files check-old-libs \
8332cd239bSDag-Erling Smørgrav	checkdpadd clean cleandepend cleandir \
8432cd239bSDag-Erling Smørgrav	delete-old delete-old-dirs delete-old-files delete-old-libs \
85621e4ae1SWarner Losh	depend distribute distributeworld distrib-dirs distribution doxygen \
86becc5c62SAlexander Leidinger	everything hierarchy install installcheck installkernel \
87becc5c62SAlexander Leidinger	installkernel.debug reinstallkernel reinstallkernel.debug \
88becc5c62SAlexander Leidinger	installworld kernel-toolchain libraries lint maninstall \
89c3ed02cfSRuslan Ermilov	obj objlink regress rerelease showconfig tags toolchain update \
90ef7af95aSPeter Wemm	_worldtmp _legacy _bootstrap-tools _cleanobj _obj \
911d9468eeSPeter Wemm	_build-tools _cross-tools _includes _libraries _depend \
923c5326bfSRafal Jaworowski	build32 builddtb distribute32 install32 xdev xdev-build xdev-install \
933c5326bfSRafal Jaworowski
94902f7c5bSRuslan ErmilovTGTS+=	${SUBDIR_TARGETS}
956e59a256SMarcel Moolenaar
96af2dc868SRuslan ErmilovBITGTS=	files includes
9728d2080aSRuslan ErmilovBITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/}
98b797df80SRuslan ErmilovTGTS+=	${BITGTS}
9928d2080aSRuslan Ermilov
100d672a609SRuslan Ermilov.ORDER: buildworld installworld
1018f1f55e9SRuslan Ermilov.ORDER: buildworld distributeworld
10220902bd3SRuslan Ermilov.ORDER: buildworld buildkernel
103d672a609SRuslan Ermilov.ORDER: buildkernel installkernel
1040147d2aaSHidetoshi Shimokawa.ORDER: buildkernel installkernel.debug
105d672a609SRuslan Ermilov.ORDER: buildkernel reinstallkernel
1060147d2aaSHidetoshi Shimokawa.ORDER: buildkernel reinstallkernel.debug
107d672a609SRuslan Ermilov
10876499f15SRuslan ErmilovPATH=	/sbin:/bin:/usr/sbin:/usr/bin
1092e84ab94SRuslan ErmilovMAKEOBJDIRPREFIX?=	/usr/obj
110e9bddef1SRuslan Ermilov_MAKEOBJDIRPREFIX!= /usr/bin/env -i PATH=${PATH} ${MAKE} \
111f1fb2096SYaroslav Tykhiy    ${.MAKEFLAGS:MMAKEOBJDIRPREFIX=*} __MAKE_CONF=${__MAKE_CONF} \
1120ec443a0SRuslan Ermilov    -f /dev/null -V MAKEOBJDIRPREFIX dummy
1130ec443a0SRuslan Ermilov.if !empty(_MAKEOBJDIRPREFIX)
1140ec443a0SRuslan Ermilov.error MAKEOBJDIRPREFIX can only be set in environment, not as a global\
115f1fb2096SYaroslav Tykhiy	(in make.conf(5)) or command-line variable.
1160ec443a0SRuslan Ermilov.endif
11776499f15SRuslan ErmilovMAKEPATH=	${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE}
118ead4296eSRuslan ErmilovBINMAKE= \
11976499f15SRuslan Ermilov	`if [ -x ${MAKEPATH}/make ]; then echo ${MAKEPATH}/make; else echo ${MAKE}; fi` \
1205dc63117SRuslan Ermilov	-m ${.CURDIR}/share/mk
121ead4296eSRuslan Ermilov_MAKE=	PATH=${PATH} ${BINMAKE} -f Makefile.inc1
122a962de47SPeter Wemm
123a962de47SPeter Wemm#
124d911f786SMarcel Moolenaar# Make sure we have an up-to-date make(1). Only world and buildworld
125d911f786SMarcel Moolenaar# should do this as those are the initial targets used for upgrades.
126d911f786SMarcel Moolenaar# The user can define ALWAYS_CHECK_MAKE to have this check performed
127d911f786SMarcel Moolenaar# for all targets.
128d911f786SMarcel Moolenaar#
129d911f786SMarcel Moolenaar.if defined(ALWAYS_CHECK_MAKE)
130b797df80SRuslan Ermilov${TGTS}: upgrade_checks
131d911f786SMarcel Moolenaar.else
132d911f786SMarcel Moolenaarbuildworld: upgrade_checks
133d911f786SMarcel Moolenaar.endif
134d911f786SMarcel Moolenaar
135d911f786SMarcel Moolenaar#
136224f0698SGarance A Drosehn# This 'cleanworld' target is not included in TGTS, because it is not a
1371a974787SGarance A Drosehn# recursive target.  All of the work for it is done right here.   It is
1381a974787SGarance A Drosehn# expected that BW_CANONICALOBJDIR == the CANONICALOBJDIR as would be
1391a974787SGarance A Drosehn# created by bsd.obj.mk, except that we don't want to .include that file
1401a974787SGarance A Drosehn# in this makefile.
1411a974787SGarance A Drosehn#
1421a974787SGarance A Drosehn# In the following, the first 'rm' in a series will usually remove all
1431a974787SGarance A Drosehn# files and directories.  If it does not, then there are probably some
1441a974787SGarance A Drosehn# files with chflags set, so this unsets them and tries the 'rm' a
1451a974787SGarance A Drosehn# second time.  There are situations where this target will be cleaning
1461a974787SGarance A Drosehn# some directories via more than one method, but that duplication is
1471a974787SGarance A Drosehn# needed to correctly handle all the possible situations.
1481a974787SGarance A Drosehn#
1491a974787SGarance A DrosehnBW_CANONICALOBJDIR:=${MAKEOBJDIRPREFIX}${.CURDIR}
150224f0698SGarance A Drosehncleanworld:
1511a974787SGarance A Drosehn.if ${.CURDIR} == ${.OBJDIR} || ${.CURDIR}/obj == ${.OBJDIR}
1521a974787SGarance A Drosehn.if exists(${BW_CANONICALOBJDIR}/)
1531a974787SGarance A Drosehn	-rm -rf ${BW_CANONICALOBJDIR}/*
15461858771SXin LI	-chflags -R 0 ${BW_CANONICALOBJDIR}
1551a974787SGarance A Drosehn	rm -rf ${BW_CANONICALOBJDIR}/*
1561a974787SGarance A Drosehn.endif
1571a974787SGarance A Drosehn	#   To be safe in this case, fall back to a 'make cleandir'
158088cf0fbSHartmut Brandt	${_+_}@cd ${.CURDIR}; ${_MAKE} cleandir
1591a974787SGarance A Drosehn.else
1601a974787SGarance A Drosehn	-rm -rf ${.OBJDIR}/*
16161858771SXin LI	-chflags -R 0 ${.OBJDIR}
1621a974787SGarance A Drosehn	rm -rf ${.OBJDIR}/*
1631a974787SGarance A Drosehn.endif
1642047c5d3SGarance A Drosehn
1652047c5d3SGarance A Drosehn#
16611fb97daSJohn Birrell# Handle the user-driven targets, using the source relative mk files.
167f3c4dd0dSBruce Evans#
168d911f786SMarcel Moolenaar
169b797df80SRuslan Ermilov${TGTS}:
170088cf0fbSHartmut Brandt	${_+_}@cd ${.CURDIR}; \
17176499f15SRuslan Ermilov		${_MAKE} ${.TARGET}
172c3d9b0f0SRodney W. Grimes
173ce53af53SJordan K. Hubbard# Set a reasonable default
174ce53af53SJordan K. Hubbard.MAIN:	all
175ce53af53SJordan K. Hubbard
176afcf05e4SRuslan ErmilovSTARTTIME!= LC_ALL=C date
177ec51d61fSRuslan ErmilovCHECK_TIME!= find ${.CURDIR}/sys/sys/param.h -mtime -0
178ec51d61fSRuslan Ermilov.if !empty(CHECK_TIME)
179ec51d61fSRuslan Ermilov.error check your date/time: ${STARTTIME}
180ec51d61fSRuslan Ermilov.endif
181d18c9906SRuslan Ermilov
182d18c9906SRuslan Ermilov.if defined(HISTORICAL_MAKE_WORLD) || defined(DESTDIR)
1836e59a256SMarcel Moolenaar#
1846e59a256SMarcel Moolenaar# world
1856e59a256SMarcel Moolenaar#
1860a945825SMarcel Moolenaar# Attempt to rebuild and reinstall everything. This target is not to be
1870a945825SMarcel Moolenaar# used for upgrading an existing FreeBSD system, because the kernel is
1880a945825SMarcel Moolenaar# not included. One can argue that this target doesn't build everything
1890a945825SMarcel Moolenaar# then.
1906e59a256SMarcel Moolenaar#
1916e59a256SMarcel Moolenaarworld: upgrade_checks
1926e59a256SMarcel Moolenaar	@echo "--------------------------------------------------------------"
1935ab77811SRuslan Ermilov	@echo ">>> make world started on ${STARTTIME}"
1946e59a256SMarcel Moolenaar	@echo "--------------------------------------------------------------"
1956e59a256SMarcel Moolenaar.if target(pre-world)
1966e59a256SMarcel Moolenaar	@echo
1976e59a256SMarcel Moolenaar	@echo "--------------------------------------------------------------"
1986e59a256SMarcel Moolenaar	@echo ">>> Making 'pre-world' target"
1996e59a256SMarcel Moolenaar	@echo "--------------------------------------------------------------"
200088cf0fbSHartmut Brandt	${_+_}@cd ${.CURDIR}; ${_MAKE} pre-world
2016e59a256SMarcel Moolenaar.endif
202088cf0fbSHartmut Brandt	${_+_}@cd ${.CURDIR}; ${_MAKE} buildworld
203088cf0fbSHartmut Brandt	${_+_}@cd ${.CURDIR}; ${_MAKE} -B installworld
2046e59a256SMarcel Moolenaar.if target(post-world)
2056e59a256SMarcel Moolenaar	@echo
2066e59a256SMarcel Moolenaar	@echo "--------------------------------------------------------------"
2076e59a256SMarcel Moolenaar	@echo ">>> Making 'post-world' target"
2086e59a256SMarcel Moolenaar	@echo "--------------------------------------------------------------"
209088cf0fbSHartmut Brandt	${_+_}@cd ${.CURDIR}; ${_MAKE} post-world
2106e59a256SMarcel Moolenaar.endif
2116e59a256SMarcel Moolenaar	@echo
2126e59a256SMarcel Moolenaar	@echo "--------------------------------------------------------------"
2135ab77811SRuslan Ermilov	@echo ">>> make world completed on `LC_ALL=C date`"
2145ab77811SRuslan Ermilov	@echo "                   (started ${STARTTIME})"
2156e59a256SMarcel Moolenaar	@echo "--------------------------------------------------------------"
2160a945825SMarcel Moolenaar.else
2170a945825SMarcel Moolenaarworld:
2180a945825SMarcel Moolenaar	@echo "WARNING: make world will overwrite your existing FreeBSD"
2190a945825SMarcel Moolenaar	@echo "installation without also building and installing a new"
2200a945825SMarcel Moolenaar	@echo "kernel.  This can be dangerous.  Please read the handbook,"
2211f6483e4SKen Smith	@echo "'Rebuilding world', for how to upgrade your system."
222954c5b43SMark Murray	@echo "Define DESTDIR to where you want to install FreeBSD,"
2230a945825SMarcel Moolenaar	@echo "including /, to override this warning and proceed as usual."
224954c5b43SMark Murray	@echo ""
2250a945825SMarcel Moolenaar	@echo "Bailing out now..."
2260a945825SMarcel Moolenaar	@false
2270a945825SMarcel Moolenaar.endif
2286e59a256SMarcel Moolenaar
229cf94fb21SBruce Evans#
230d672a609SRuslan Ermilov# kernel
231d672a609SRuslan Ermilov#
232d672a609SRuslan Ermilov# Short hand for `make buildkernel installkernel'
233d672a609SRuslan Ermilov#
234d672a609SRuslan Ermilovkernel: buildkernel installkernel
235d672a609SRuslan Ermilov
236d672a609SRuslan Ermilov#
23711fb97daSJohn Birrell# Perform a few tests to determine if the installed tools are adequate
238113cf9e6SRuslan Ermilov# for building the world.
23911fb97daSJohn Birrell#
24011fb97daSJohn Birrellupgrade_checks:
241012a8b3fSHartmut Brandt	@if ! (cd ${.CURDIR}/tools/build/make_check && \
24289f087e8SHartmut Brandt	    PATH=${PATH} ${BINMAKE} obj >/dev/null 2>&1 && \
243ef2c779bSRuslan Ermilov	    PATH=${PATH} ${BINMAKE} >/dev/null 2>&1); \
24476499f15SRuslan Ermilov	then \
245e2be0fd0SWarner Losh	    (cd ${.CURDIR} && ${MAKE} make); \
24676499f15SRuslan Ermilov	fi
2476a8d432dSMark Murray
248a962de47SPeter Wemm#
2492e84ab94SRuslan Ermilov# Upgrade make(1) to the current version using the installed
2506029ad99SWarner Losh# headers, libraries and tools.  Also, allow the location of
2516029ad99SWarner Losh# the system bsdmake-like utility to be overridden.
252549f978aSMarcel Moolenaar#
2532e84ab94SRuslan ErmilovMMAKEENV=	MAKEOBJDIRPREFIX=${MAKEPATH} \
2542e84ab94SRuslan Ermilov		DESTDIR= \
2552e84ab94SRuslan Ermilov		INSTALL="sh ${.CURDIR}/tools/install.sh"
256e2be0fd0SWarner LoshMMAKE=		${MMAKEENV} ${MAKE} \
2572e84ab94SRuslan Ermilov		-D_UPGRADING \
25883c7ade9SRuslan Ermilov		-DNOMAN -DNO_MAN -DNOSHARED -DNO_SHARED \
259ba70462cSJohn Birrell		-DNO_CPU_CFLAGS -DNO_WERROR
2602e84ab94SRuslan Ermilov
2612a6e9f88SKris Kennawaymake: .PHONY
262549f978aSMarcel Moolenaar	@echo
263549f978aSMarcel Moolenaar	@echo "--------------------------------------------------------------"
264b31745f5SRuslan Ermilov	@echo ">>> Building an up-to-date make(1)"
265549f978aSMarcel Moolenaar	@echo "--------------------------------------------------------------"
266088cf0fbSHartmut Brandt	${_+_}@cd ${.CURDIR}/usr.bin/make; \
2672e84ab94SRuslan Ermilov		${MMAKE} obj && \
2682e84ab94SRuslan Ermilov		${MMAKE} depend && \
2692e84ab94SRuslan Ermilov		${MMAKE} all && \
2702e84ab94SRuslan Ermilov		${MMAKE} install DESTDIR=${MAKEPATH} BINDIR=
271549f978aSMarcel Moolenaar
2724bb9ca57SAlfred Perlsteintinderbox:
2734bb9ca57SAlfred Perlstein	cd ${.CURDIR} && \
2746c054d2bSJohn Baldwin		DOING_TINDERBOX=YES ${MAKE} JFLAG=${JFLAG} universe
2754bb9ca57SAlfred Perlstein
276549f978aSMarcel Moolenaar#
2771f4f7670SRuslan Ermilov# universe
2781f4f7670SRuslan Ermilov#
2791f4f7670SRuslan Ermilov# Attempt to rebuild *everything* for all supported architectures,
280d18c9906SRuslan Ermilov# with a reasonable chance of success, regardless of how old your
2811f4f7670SRuslan Ermilov# existing system is.
2821f4f7670SRuslan Ermilov#
2833c55ed70SBjoern A. Zeeb.if make(universe) || make(universe_kernels) || make(tinderbox)
2848e7c4a05SNathan WhitehornTARGETS?=amd64 arm i386 ia64 mips pc98 powerpc sparc64 sun4v
2858e7c4a05SNathan WhitehornTARGET_ARCHES_arm?=	arm armeb
2868e7c4a05SNathan WhitehornTARGET_ARCHES_mips?=	mipsel mipseb
2878e7c4a05SNathan WhitehornTARGET_ARCHES_powerpc?=	powerpc powerpc64
2888e7c4a05SNathan WhitehornTARGET_ARCHES_pc98?=	i386
2898e7c4a05SNathan WhitehornTARGET_ARCHES_sun4v?=	sparc64
2908e7c4a05SNathan Whitehorn.for target in ${TARGETS}
2918e7c4a05SNathan WhitehornTARGET_ARCHES_${target}?= ${target}
2928e7c4a05SNathan Whitehorn.endfor
2931bdb3fb9SMarcel Moolenaar
2944bb9ca57SAlfred Perlstein.if defined(DOING_TINDERBOX)
2954bb9ca57SAlfred PerlsteinFAILFILE=tinderbox.failed
2964bb9ca57SAlfred PerlsteinMAKEFAIL=tee -a ${FAILFILE}
2974bb9ca57SAlfred Perlstein.else
2984bb9ca57SAlfred PerlsteinMAKEFAIL=cat
2994bb9ca57SAlfred Perlstein.endif
3004bb9ca57SAlfred Perlstein
301d18c9906SRuslan Ermilovuniverse: universe_prologue
302d18c9906SRuslan Ermilovuniverse_prologue:
30377c1699fSPoul-Henning Kamp	@echo "--------------------------------------------------------------"
30477c1699fSPoul-Henning Kamp	@echo ">>> make universe started on ${STARTTIME}"
30577c1699fSPoul-Henning Kamp	@echo "--------------------------------------------------------------"
3064bb9ca57SAlfred Perlstein.if defined(DOING_TINDERBOX)
3074bb9ca57SAlfred Perlstein	rm -f ${FAILFILE}
3084bb9ca57SAlfred Perlstein.endif
3091bdb3fb9SMarcel Moolenaar.for target in ${TARGETS}
3101fde59f3SRuslan Ermilovuniverse: universe_${target}
3111fde59f3SRuslan Ermilov.ORDER: universe_prologue universe_${target} universe_epilogue
3128e7c4a05SNathan Whitehornuniverse_${target}: universe_${target}_prologue
3138e7c4a05SNathan Whitehornuniverse_${target}_prologue:
3141fde59f3SRuslan Ermilov	@echo ">> ${target} started on `LC_ALL=C date`"
3158e7c4a05SNathan Whitehorn.if !defined(MAKE_JUST_KERNELS)
3168e7c4a05SNathan Whitehorn.for target_arch in ${TARGET_ARCHES_${target}}
3178e7c4a05SNathan Whitehornuniverse_${target}: universe_${target}_${target_arch}
3188e7c4a05SNathan Whitehornuniverse_${target}_${target_arch}: universe_${target}_prologue
3198e7c4a05SNathan Whitehorn	@echo ">> ${target}.${target_arch} buildworld started on `LC_ALL=C date`"
32033367c7fSDag-Erling Smørgrav	@(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
321b7490d8fSEd Schouten	    ${MAKE} ${JFLAG} buildworld \
3221fde59f3SRuslan Ermilov	    TARGET=${target} \
3238e7c4a05SNathan Whitehorn	    TARGET_ARCH=${target_arch} \
3248e7c4a05SNathan Whitehorn	    > _.${target}.${target_arch}.buildworld 2>&1 || \
3258e7c4a05SNathan Whitehorn	    (echo "${target}.${target_arch} world failed," \
3268e7c4a05SNathan Whitehorn	    "check _.${target}.${target_arch}.buildworld for details" | \
3278e7c4a05SNathan Whitehorn	    ${MAKEFAIL}))
3288e7c4a05SNathan Whitehorn	@echo ">> ${target}.${target_arch} buildworld completed on `LC_ALL=C date`"
3298e7c4a05SNathan Whitehorn.endfor
330139fb43dSJohn Birrell.endif
3313453d746SDoug Barton.if !defined(MAKE_JUST_WORLDS)
3321fde59f3SRuslan Ermilov.if exists(${.CURDIR}/sys/${target}/conf/NOTES)
33333367c7fSDag-Erling Smørgrav	@(cd ${.CURDIR}/sys/${target}/conf && env __MAKE_CONF=/dev/null \
33433367c7fSDag-Erling Smørgrav	    ${MAKE} LINT > ${.CURDIR}/_.${target}.makeLINT 2>&1 || \
3354bb9ca57SAlfred Perlstein	    (echo "${target} 'make LINT' failed," \
3364bb9ca57SAlfred Perlstein	    "check _.${target}.makeLINT for details"| ${MAKEFAIL}))
33777c1699fSPoul-Henning Kamp.endif
3383c55ed70SBjoern A. Zeeb	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} TARGET=${target} \
3393c55ed70SBjoern A. Zeeb	    universe_kernels
3403453d746SDoug Barton.endif
3413c55ed70SBjoern A. Zeeb	@echo ">> ${target} completed on `LC_ALL=C date`"
3423c55ed70SBjoern A. Zeeb.endfor
3433c55ed70SBjoern A. Zeebuniverse_kernels: universe_kernconfs
3445f5bb1d1SBjoern A. Zeeb.if !defined(TARGET)
3455f5bb1d1SBjoern A. ZeebTARGET!=	uname -m
3465f5bb1d1SBjoern A. Zeeb.endif
3473c55ed70SBjoern A. ZeebKERNCONFS!=	cd ${.CURDIR}/sys/${TARGET}/conf && \
3483c55ed70SBjoern A. Zeeb		find [A-Z0-9]*[A-Z0-9] -type f -maxdepth 0 \
3493c55ed70SBjoern A. Zeeb		! -name DEFAULTS ! -name NOTES
3503c55ed70SBjoern A. Zeebuniverse_kernconfs:
351dd0f3923SRuslan Ermilov.for kernel in ${KERNCONFS}
3528e7c4a05SNathan WhitehornTARGET_ARCH_${kernel}!=	cd ${.CURDIR}/sys/${TARGET}/conf && \
3535f523ccdSWarner Losh	config -m ${.CURDIR}/sys/${TARGET}/conf/${kernel} 2> /dev/null | \
35492f64fb9SWarner Losh	grep -v WARNING: | cut -f 2
35592f64fb9SWarner Losh.if empty(TARGET_ARCH_${kernel})
35692f64fb9SWarner Losh.error "Target architecture for ${TARGET}/conf/${kernel} unknown.  config(8) likely too old."
35792f64fb9SWarner Losh.endif
3588e7c4a05SNathan Whitehornuniverse_kernconfs: universe_kernconf_${TARGET}_${kernel}
3598e7c4a05SNathan Whitehornuniverse_kernconf_${TARGET}_${kernel}:
36033367c7fSDag-Erling Smørgrav	@(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
36133367c7fSDag-Erling Smørgrav	    ${MAKE} ${JFLAG} buildkernel \
3623c55ed70SBjoern A. Zeeb	    TARGET=${TARGET} \
3638e7c4a05SNathan Whitehorn	    TARGET_ARCH=${TARGET_ARCH_${kernel}} \
364dd0f3923SRuslan Ermilov	    KERNCONF=${kernel} \
3653c55ed70SBjoern A. Zeeb	    > _.${TARGET}.${kernel} 2>&1 || \
3663c55ed70SBjoern A. Zeeb	    (echo "${TARGET} ${kernel} kernel failed," \
3673c55ed70SBjoern A. Zeeb	    "check _.${TARGET}.${kernel} for details"| ${MAKEFAIL}))
368d18c9906SRuslan Ermilov.endfor
369d18c9906SRuslan Ermilovuniverse: universe_epilogue
370d18c9906SRuslan Ermilovuniverse_epilogue:
37177c1699fSPoul-Henning Kamp	@echo "--------------------------------------------------------------"
3725ab77811SRuslan Ermilov	@echo ">>> make universe completed on `LC_ALL=C date`"
3735ab77811SRuslan Ermilov	@echo "                      (started ${STARTTIME})"
37477c1699fSPoul-Henning Kamp	@echo "--------------------------------------------------------------"
3754bb9ca57SAlfred Perlstein.if defined(DOING_TINDERBOX)
3764bb9ca57SAlfred Perlstein	@if [ -e ${FAILFILE} ] ; then \
3774bb9ca57SAlfred Perlstein		echo "Tinderbox failed:" ;\
3784bb9ca57SAlfred Perlstein		cat ${FAILFILE} ;\
3794bb9ca57SAlfred Perlstein		exit 1 ;\
3804bb9ca57SAlfred Perlstein	fi
3814bb9ca57SAlfred Perlstein.endif
382d18c9906SRuslan Ermilov.endif
383