xref: /freebsd/Makefile (revision eee8163b)
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).
8eee8163bSBjoern A. Zeeb# tinderbox           - Same as universe, but presents a list of failed build
9eee8163bSBjoern A. Zeeb#                       targets and exits with an error if there were any.
1011fb97daSJohn Birrell# buildworld          - Rebuild *everything*, including glue to help do
1111fb97daSJohn Birrell#                       upgrades.
1211fb97daSJohn Birrell# installworld        - Install everything built by "buildworld".
13fb55e855STom Rhodes# world               - buildworld + installworld, no kernel.
1400eb8cbdSAlexander Langer# buildkernel         - Rebuild the kernel and the kernel-modules.
1500eb8cbdSAlexander Langer# installkernel       - Install the kernel and the kernel-modules.
160147d2aaSHidetoshi Shimokawa# installkernel.debug
17737ffab7SMark Murray# reinstallkernel     - Reinstall the kernel and the kernel-modules.
180147d2aaSHidetoshi Shimokawa# reinstallkernel.debug
19bc4311beSDavid E. O'Brien# kernel              - buildkernel + installkernel.
20589fec8bSWarner Losh# kernel-toolchain    - Builds the subset of world necessary to build a kernel
21becc5c62SAlexander Leidinger# doxygen             - Build API documentation of the kernel, needs doxygen.
2211fb97daSJohn Birrell# update              - Convenient way to update your source tree (cvs).
2332cd239bSDag-Erling Smørgrav# check-old           - List obsolete directories/files/libraries.
2432cd239bSDag-Erling Smørgrav# check-old-dirs      - List obsolete directories.
2532cd239bSDag-Erling Smørgrav# check-old-files     - List obsolete files.
2632cd239bSDag-Erling Smørgrav# check-old-libs      - List obsolete libraries.
2732cd239bSDag-Erling Smørgrav# delete-old          - Delete obsolete directories/files/libraries.
2832cd239bSDag-Erling Smørgrav# delete-old-dirs     - Delete obsolete directories.
2932cd239bSDag-Erling Smørgrav# delete-old-files    - Delete obsolete files.
3032cd239bSDag-Erling Smørgrav# delete-old-libs     - Delete obsolete libraries.
3164fe77a5SWarner Losh# targets             - Print a list of supported TARGET/TARGET_ARCH pairs.
323540f0e1SJordan K. Hubbard#
3311fb97daSJohn Birrell# This makefile is simple by design. The FreeBSD make automatically reads
3411fb97daSJohn Birrell# the /usr/share/mk/sys.mk unless the -m argument is specified on the
3511fb97daSJohn Birrell# command line. By keeping this makefile simple, it doesn't matter too
3611fb97daSJohn Birrell# much how different the installed mk files are from those in the source
3711fb97daSJohn Birrell# tree. This makefile executes a child make process, forcing it to use
3811fb97daSJohn Birrell# the mk files from the source tree which are supposed to DTRT.
3911fb97daSJohn Birrell#
403acc4367SWarner Losh# Most of the user-driven targets (as listed above) are implemented in
41ff34e7e3SWarner Losh# Makefile.inc1.  The exceptions are universe, tinderbox and targets.
4211fb97daSJohn Birrell#
4376fdd728SJohn W. De Boskey# If you want to build your system from source be sure that /usr/obj has
4447c221b6SWarner Losh# at least 1GB of diskspace available.  A complete 'universe' build requires
4547c221b6SWarner Losh# about 15GB of space.
4611fb97daSJohn Birrell#
4776fdd728SJohn W. De Boskey# For individuals wanting to build from the sources currently on their
4876fdd728SJohn W. De Boskey# system, the simple instructions are:
4911fb97daSJohn Birrell#
5076fdd728SJohn W. De Boskey# 1.  `cd /usr/src'  (or to the directory containing your source tree).
51fb55e855STom Rhodes# 2.  Define `HISTORICAL_MAKE_WORLD' variable (see README).
52fb55e855STom Rhodes# 3.  `make world'
5311fb97daSJohn Birrell#
5476fdd728SJohn W. De Boskey# For individuals wanting to upgrade their sources (even if only a
5576fdd728SJohn W. De Boskey# delta of a few days):
5676fdd728SJohn W. De Boskey#
5776fdd728SJohn W. De Boskey#  1.  `cd /usr/src'       (or to the directory containing your source tree).
5876fdd728SJohn W. De Boskey#  2.  `make buildworld'
5976fdd728SJohn W. De Boskey#  3.  `make buildkernel KERNCONF=YOUR_KERNEL_HERE'     (default is GENERIC).
6076fdd728SJohn W. De Boskey#  4.  `make installkernel KERNCONF=YOUR_KERNEL_HERE'   (default is GENERIC).
612c5e89c2SDavid E. O'Brien#       [steps 3. & 4. can be combined by using the "kernel" target]
6276fdd728SJohn W. De Boskey#  5.  `reboot'        (in single user mode: boot -s from the loader prompt).
6376fdd728SJohn W. De Boskey#  6.  `mergemaster -p'
6476fdd728SJohn W. De Boskey#  7.  `make installworld'
65e2a36081SAlexander Leidinger#  8.  `make delete-old'
66fbf4979aSRobert Watson#  9.  `mergemaster'                         (you may wish to use -U or -ai).
67e2a36081SAlexander Leidinger# 10.  `reboot'
68e2a36081SAlexander Leidinger# 11.  `make delete-old-libs' (in case no 3rd party program uses them anymore)
6976fdd728SJohn W. De Boskey#
7076fdd728SJohn W. De Boskey# See src/UPDATING `COMMON ITEMS' for more complete information.
7111fb97daSJohn Birrell#
721fde59f3SRuslan Ermilov# If TARGET=machine (e.g. ia64, sparc64, ...) is specified you can
731fde59f3SRuslan Ermilov# cross build world for other machine types using the buildworld target,
74dbc3719dSMatthew Dillon# and once the world is built you can cross build a kernel using the
75dbc3719dSMatthew Dillon# buildkernel target.
76dbc3719dSMatthew Dillon#
7711fb97daSJohn Birrell# Define the user-driven targets. These are listed here in alphabetical
7811fb97daSJohn Birrell# order, but that's not important.
7911fb97daSJohn Birrell#
80ef7af95aSPeter Wemm# Targets that begin with underscore are internal targets intended for
81ef7af95aSPeter Wemm# developer convenience only.  They are intentionally not documented and
82ef7af95aSPeter Wemm# completely subject to change without notice.
83ef7af95aSPeter Wemm#
8479e19f08SJohn Baldwin# For more information, see the build(7) manual page.
8579e19f08SJohn Baldwin#
8632cd239bSDag-Erling SmørgravTGTS=	all all-man buildenv buildenvvars buildkernel buildworld \
8732cd239bSDag-Erling Smørgrav	check-old check-old-dirs check-old-files check-old-libs \
8832cd239bSDag-Erling Smørgrav	checkdpadd clean cleandepend cleandir \
8932cd239bSDag-Erling Smørgrav	delete-old delete-old-dirs delete-old-files delete-old-libs \
90621e4ae1SWarner Losh	depend distribute distributeworld distrib-dirs distribution doxygen \
91becc5c62SAlexander Leidinger	everything hierarchy install installcheck installkernel \
92becc5c62SAlexander Leidinger	installkernel.debug reinstallkernel reinstallkernel.debug \
93becc5c62SAlexander Leidinger	installworld kernel-toolchain libraries lint maninstall \
94c3ed02cfSRuslan Ermilov	obj objlink regress rerelease showconfig tags toolchain update \
95ef7af95aSPeter Wemm	_worldtmp _legacy _bootstrap-tools _cleanobj _obj \
961d9468eeSPeter Wemm	_build-tools _cross-tools _includes _libraries _depend \
973c5326bfSRafal Jaworowski	build32 builddtb distribute32 install32 xdev xdev-build xdev-install \
983c5326bfSRafal Jaworowski
99902f7c5bSRuslan ErmilovTGTS+=	${SUBDIR_TARGETS}
1006e59a256SMarcel Moolenaar
101af2dc868SRuslan ErmilovBITGTS=	files includes
10228d2080aSRuslan ErmilovBITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/}
103b797df80SRuslan ErmilovTGTS+=	${BITGTS}
10428d2080aSRuslan Ermilov
105d672a609SRuslan Ermilov.ORDER: buildworld installworld
1068f1f55e9SRuslan Ermilov.ORDER: buildworld distributeworld
10720902bd3SRuslan Ermilov.ORDER: buildworld buildkernel
108d672a609SRuslan Ermilov.ORDER: buildkernel installkernel
1090147d2aaSHidetoshi Shimokawa.ORDER: buildkernel installkernel.debug
110d672a609SRuslan Ermilov.ORDER: buildkernel reinstallkernel
1110147d2aaSHidetoshi Shimokawa.ORDER: buildkernel reinstallkernel.debug
112d672a609SRuslan Ermilov
11376499f15SRuslan ErmilovPATH=	/sbin:/bin:/usr/sbin:/usr/bin
1142e84ab94SRuslan ErmilovMAKEOBJDIRPREFIX?=	/usr/obj
115e9bddef1SRuslan Ermilov_MAKEOBJDIRPREFIX!= /usr/bin/env -i PATH=${PATH} ${MAKE} \
116f1fb2096SYaroslav Tykhiy    ${.MAKEFLAGS:MMAKEOBJDIRPREFIX=*} __MAKE_CONF=${__MAKE_CONF} \
1170ec443a0SRuslan Ermilov    -f /dev/null -V MAKEOBJDIRPREFIX dummy
1180ec443a0SRuslan Ermilov.if !empty(_MAKEOBJDIRPREFIX)
1190ec443a0SRuslan Ermilov.error MAKEOBJDIRPREFIX can only be set in environment, not as a global\
120f1fb2096SYaroslav Tykhiy	(in make.conf(5)) or command-line variable.
1210ec443a0SRuslan Ermilov.endif
12276499f15SRuslan ErmilovMAKEPATH=	${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE}
123ead4296eSRuslan ErmilovBINMAKE= \
12476499f15SRuslan Ermilov	`if [ -x ${MAKEPATH}/make ]; then echo ${MAKEPATH}/make; else echo ${MAKE}; fi` \
1255dc63117SRuslan Ermilov	-m ${.CURDIR}/share/mk
126ead4296eSRuslan Ermilov_MAKE=	PATH=${PATH} ${BINMAKE} -f Makefile.inc1
127a962de47SPeter Wemm
128a962de47SPeter Wemm#
129d911f786SMarcel Moolenaar# Make sure we have an up-to-date make(1). Only world and buildworld
130d911f786SMarcel Moolenaar# should do this as those are the initial targets used for upgrades.
131d911f786SMarcel Moolenaar# The user can define ALWAYS_CHECK_MAKE to have this check performed
132d911f786SMarcel Moolenaar# for all targets.
133d911f786SMarcel Moolenaar#
134d911f786SMarcel Moolenaar.if defined(ALWAYS_CHECK_MAKE)
135b797df80SRuslan Ermilov${TGTS}: upgrade_checks
136d911f786SMarcel Moolenaar.else
137d911f786SMarcel Moolenaarbuildworld: upgrade_checks
138d911f786SMarcel Moolenaar.endif
139d911f786SMarcel Moolenaar
140d911f786SMarcel Moolenaar#
141224f0698SGarance A Drosehn# This 'cleanworld' target is not included in TGTS, because it is not a
1421a974787SGarance A Drosehn# recursive target.  All of the work for it is done right here.   It is
1431a974787SGarance A Drosehn# expected that BW_CANONICALOBJDIR == the CANONICALOBJDIR as would be
1441a974787SGarance A Drosehn# created by bsd.obj.mk, except that we don't want to .include that file
1451a974787SGarance A Drosehn# in this makefile.
1461a974787SGarance A Drosehn#
1471a974787SGarance A Drosehn# In the following, the first 'rm' in a series will usually remove all
1481a974787SGarance A Drosehn# files and directories.  If it does not, then there are probably some
1491a974787SGarance A Drosehn# files with chflags set, so this unsets them and tries the 'rm' a
1501a974787SGarance A Drosehn# second time.  There are situations where this target will be cleaning
1511a974787SGarance A Drosehn# some directories via more than one method, but that duplication is
1521a974787SGarance A Drosehn# needed to correctly handle all the possible situations.
1531a974787SGarance A Drosehn#
1541a974787SGarance A DrosehnBW_CANONICALOBJDIR:=${MAKEOBJDIRPREFIX}${.CURDIR}
155224f0698SGarance A Drosehncleanworld:
1561a974787SGarance A Drosehn.if ${.CURDIR} == ${.OBJDIR} || ${.CURDIR}/obj == ${.OBJDIR}
1571a974787SGarance A Drosehn.if exists(${BW_CANONICALOBJDIR}/)
1581a974787SGarance A Drosehn	-rm -rf ${BW_CANONICALOBJDIR}/*
15961858771SXin LI	-chflags -R 0 ${BW_CANONICALOBJDIR}
1601a974787SGarance A Drosehn	rm -rf ${BW_CANONICALOBJDIR}/*
1611a974787SGarance A Drosehn.endif
1621a974787SGarance A Drosehn	#   To be safe in this case, fall back to a 'make cleandir'
163088cf0fbSHartmut Brandt	${_+_}@cd ${.CURDIR}; ${_MAKE} cleandir
1641a974787SGarance A Drosehn.else
1651a974787SGarance A Drosehn	-rm -rf ${.OBJDIR}/*
16661858771SXin LI	-chflags -R 0 ${.OBJDIR}
1671a974787SGarance A Drosehn	rm -rf ${.OBJDIR}/*
1681a974787SGarance A Drosehn.endif
1692047c5d3SGarance A Drosehn
1702047c5d3SGarance A Drosehn#
17111fb97daSJohn Birrell# Handle the user-driven targets, using the source relative mk files.
172f3c4dd0dSBruce Evans#
173d911f786SMarcel Moolenaar
174b797df80SRuslan Ermilov${TGTS}:
175088cf0fbSHartmut Brandt	${_+_}@cd ${.CURDIR}; \
17676499f15SRuslan Ermilov		${_MAKE} ${.TARGET}
177c3d9b0f0SRodney W. Grimes
178ce53af53SJordan K. Hubbard# Set a reasonable default
179ce53af53SJordan K. Hubbard.MAIN:	all
180ce53af53SJordan K. Hubbard
181afcf05e4SRuslan ErmilovSTARTTIME!= LC_ALL=C date
182ec51d61fSRuslan ErmilovCHECK_TIME!= find ${.CURDIR}/sys/sys/param.h -mtime -0
183ec51d61fSRuslan Ermilov.if !empty(CHECK_TIME)
184ec51d61fSRuslan Ermilov.error check your date/time: ${STARTTIME}
185ec51d61fSRuslan Ermilov.endif
186d18c9906SRuslan Ermilov
187d18c9906SRuslan Ermilov.if defined(HISTORICAL_MAKE_WORLD) || defined(DESTDIR)
1886e59a256SMarcel Moolenaar#
1896e59a256SMarcel Moolenaar# world
1906e59a256SMarcel Moolenaar#
1910a945825SMarcel Moolenaar# Attempt to rebuild and reinstall everything. This target is not to be
1920a945825SMarcel Moolenaar# used for upgrading an existing FreeBSD system, because the kernel is
1930a945825SMarcel Moolenaar# not included. One can argue that this target doesn't build everything
1940a945825SMarcel Moolenaar# then.
1956e59a256SMarcel Moolenaar#
1966e59a256SMarcel Moolenaarworld: upgrade_checks
1976e59a256SMarcel Moolenaar	@echo "--------------------------------------------------------------"
1985ab77811SRuslan Ermilov	@echo ">>> make world started on ${STARTTIME}"
1996e59a256SMarcel Moolenaar	@echo "--------------------------------------------------------------"
2006e59a256SMarcel Moolenaar.if target(pre-world)
2016e59a256SMarcel Moolenaar	@echo
2026e59a256SMarcel Moolenaar	@echo "--------------------------------------------------------------"
2036e59a256SMarcel Moolenaar	@echo ">>> Making 'pre-world' target"
2046e59a256SMarcel Moolenaar	@echo "--------------------------------------------------------------"
205088cf0fbSHartmut Brandt	${_+_}@cd ${.CURDIR}; ${_MAKE} pre-world
2066e59a256SMarcel Moolenaar.endif
207088cf0fbSHartmut Brandt	${_+_}@cd ${.CURDIR}; ${_MAKE} buildworld
208088cf0fbSHartmut Brandt	${_+_}@cd ${.CURDIR}; ${_MAKE} -B installworld
2096e59a256SMarcel Moolenaar.if target(post-world)
2106e59a256SMarcel Moolenaar	@echo
2116e59a256SMarcel Moolenaar	@echo "--------------------------------------------------------------"
2126e59a256SMarcel Moolenaar	@echo ">>> Making 'post-world' target"
2136e59a256SMarcel Moolenaar	@echo "--------------------------------------------------------------"
214088cf0fbSHartmut Brandt	${_+_}@cd ${.CURDIR}; ${_MAKE} post-world
2156e59a256SMarcel Moolenaar.endif
2166e59a256SMarcel Moolenaar	@echo
2176e59a256SMarcel Moolenaar	@echo "--------------------------------------------------------------"
2185ab77811SRuslan Ermilov	@echo ">>> make world completed on `LC_ALL=C date`"
2195ab77811SRuslan Ermilov	@echo "                   (started ${STARTTIME})"
2206e59a256SMarcel Moolenaar	@echo "--------------------------------------------------------------"
2210a945825SMarcel Moolenaar.else
2220a945825SMarcel Moolenaarworld:
2230a945825SMarcel Moolenaar	@echo "WARNING: make world will overwrite your existing FreeBSD"
2240a945825SMarcel Moolenaar	@echo "installation without also building and installing a new"
2250a945825SMarcel Moolenaar	@echo "kernel.  This can be dangerous.  Please read the handbook,"
2261f6483e4SKen Smith	@echo "'Rebuilding world', for how to upgrade your system."
227954c5b43SMark Murray	@echo "Define DESTDIR to where you want to install FreeBSD,"
2280a945825SMarcel Moolenaar	@echo "including /, to override this warning and proceed as usual."
229954c5b43SMark Murray	@echo ""
2300a945825SMarcel Moolenaar	@echo "Bailing out now..."
2310a945825SMarcel Moolenaar	@false
2320a945825SMarcel Moolenaar.endif
2336e59a256SMarcel Moolenaar
234cf94fb21SBruce Evans#
235d672a609SRuslan Ermilov# kernel
236d672a609SRuslan Ermilov#
237d672a609SRuslan Ermilov# Short hand for `make buildkernel installkernel'
238d672a609SRuslan Ermilov#
239d672a609SRuslan Ermilovkernel: buildkernel installkernel
240d672a609SRuslan Ermilov
241d672a609SRuslan Ermilov#
24211fb97daSJohn Birrell# Perform a few tests to determine if the installed tools are adequate
243113cf9e6SRuslan Ermilov# for building the world.
24411fb97daSJohn Birrell#
24511fb97daSJohn Birrellupgrade_checks:
246012a8b3fSHartmut Brandt	@if ! (cd ${.CURDIR}/tools/build/make_check && \
24789f087e8SHartmut Brandt	    PATH=${PATH} ${BINMAKE} obj >/dev/null 2>&1 && \
248ef2c779bSRuslan Ermilov	    PATH=${PATH} ${BINMAKE} >/dev/null 2>&1); \
24976499f15SRuslan Ermilov	then \
250e2be0fd0SWarner Losh	    (cd ${.CURDIR} && ${MAKE} make); \
25176499f15SRuslan Ermilov	fi
2526a8d432dSMark Murray
253a962de47SPeter Wemm#
2542e84ab94SRuslan Ermilov# Upgrade make(1) to the current version using the installed
2556029ad99SWarner Losh# headers, libraries and tools.  Also, allow the location of
2566029ad99SWarner Losh# the system bsdmake-like utility to be overridden.
257549f978aSMarcel Moolenaar#
2582e84ab94SRuslan ErmilovMMAKEENV=	MAKEOBJDIRPREFIX=${MAKEPATH} \
2592e84ab94SRuslan Ermilov		DESTDIR= \
2602e84ab94SRuslan Ermilov		INSTALL="sh ${.CURDIR}/tools/install.sh"
261e2be0fd0SWarner LoshMMAKE=		${MMAKEENV} ${MAKE} \
2622e84ab94SRuslan Ermilov		-D_UPGRADING \
26383c7ade9SRuslan Ermilov		-DNOMAN -DNO_MAN -DNOSHARED -DNO_SHARED \
264ba70462cSJohn Birrell		-DNO_CPU_CFLAGS -DNO_WERROR
2652e84ab94SRuslan Ermilov
2662a6e9f88SKris Kennawaymake: .PHONY
267549f978aSMarcel Moolenaar	@echo
268549f978aSMarcel Moolenaar	@echo "--------------------------------------------------------------"
269b31745f5SRuslan Ermilov	@echo ">>> Building an up-to-date make(1)"
270549f978aSMarcel Moolenaar	@echo "--------------------------------------------------------------"
271088cf0fbSHartmut Brandt	${_+_}@cd ${.CURDIR}/usr.bin/make; \
2722e84ab94SRuslan Ermilov		${MMAKE} obj && \
2732e84ab94SRuslan Ermilov		${MMAKE} depend && \
2742e84ab94SRuslan Ermilov		${MMAKE} all && \
2752e84ab94SRuslan Ermilov		${MMAKE} install DESTDIR=${MAKEPATH} BINDIR=
276549f978aSMarcel Moolenaar
2774bb9ca57SAlfred Perlsteintinderbox:
2784bb9ca57SAlfred Perlstein	cd ${.CURDIR} && \
2796c054d2bSJohn Baldwin		DOING_TINDERBOX=YES ${MAKE} JFLAG=${JFLAG} universe
2804bb9ca57SAlfred Perlstein
281549f978aSMarcel Moolenaar#
2821f4f7670SRuslan Ermilov# universe
2831f4f7670SRuslan Ermilov#
2841f4f7670SRuslan Ermilov# Attempt to rebuild *everything* for all supported architectures,
285d18c9906SRuslan Ermilov# with a reasonable chance of success, regardless of how old your
2861f4f7670SRuslan Ermilov# existing system is.
2871f4f7670SRuslan Ermilov#
28864fe77a5SWarner Losh.if make(universe) || make(universe_kernels) || make(tinderbox) || make(targets)
2898e7c4a05SNathan WhitehornTARGETS?=amd64 arm i386 ia64 mips pc98 powerpc sparc64 sun4v
2908e7c4a05SNathan WhitehornTARGET_ARCHES_arm?=	arm armeb
291cd2ae253SWarner LoshTARGET_ARCHES_mips?=	mipsel mipseb mips64el mips64eb
2928e7c4a05SNathan WhitehornTARGET_ARCHES_powerpc?=	powerpc powerpc64
2938e7c4a05SNathan WhitehornTARGET_ARCHES_pc98?=	i386
2948e7c4a05SNathan WhitehornTARGET_ARCHES_sun4v?=	sparc64
2958e7c4a05SNathan Whitehorn.for target in ${TARGETS}
2968e7c4a05SNathan WhitehornTARGET_ARCHES_${target}?= ${target}
2978e7c4a05SNathan Whitehorn.endfor
2981bdb3fb9SMarcel Moolenaar
29964fe77a5SWarner Loshtargets:
30064fe77a5SWarner Losh	@echo "Supported TARGET/TARGET_ARCH pairs"
30164fe77a5SWarner Losh.for target in ${TARGETS}
30264fe77a5SWarner Losh.for target_arch in ${TARGET_ARCHES_${target}}
30364fe77a5SWarner Losh	@echo "    ${target}/${target_arch}"
30464fe77a5SWarner Losh.endfor
30564fe77a5SWarner Losh.endfor
30664fe77a5SWarner Losh
3074bb9ca57SAlfred Perlstein.if defined(DOING_TINDERBOX)
3084bb9ca57SAlfred PerlsteinFAILFILE=tinderbox.failed
3094bb9ca57SAlfred PerlsteinMAKEFAIL=tee -a ${FAILFILE}
3104bb9ca57SAlfred Perlstein.else
3114bb9ca57SAlfred PerlsteinMAKEFAIL=cat
3124bb9ca57SAlfred Perlstein.endif
3134bb9ca57SAlfred Perlstein
314d18c9906SRuslan Ermilovuniverse: universe_prologue
315d18c9906SRuslan Ermilovuniverse_prologue:
31677c1699fSPoul-Henning Kamp	@echo "--------------------------------------------------------------"
31777c1699fSPoul-Henning Kamp	@echo ">>> make universe started on ${STARTTIME}"
31877c1699fSPoul-Henning Kamp	@echo "--------------------------------------------------------------"
3194bb9ca57SAlfred Perlstein.if defined(DOING_TINDERBOX)
3204bb9ca57SAlfred Perlstein	rm -f ${FAILFILE}
3214bb9ca57SAlfred Perlstein.endif
3221bdb3fb9SMarcel Moolenaar.for target in ${TARGETS}
3231fde59f3SRuslan Ermilovuniverse: universe_${target}
3241fde59f3SRuslan Ermilov.ORDER: universe_prologue universe_${target} universe_epilogue
3258e7c4a05SNathan Whitehornuniverse_${target}: universe_${target}_prologue
3268e7c4a05SNathan Whitehornuniverse_${target}_prologue:
3271fde59f3SRuslan Ermilov	@echo ">> ${target} started on `LC_ALL=C date`"
3288e7c4a05SNathan Whitehorn.if !defined(MAKE_JUST_KERNELS)
3298e7c4a05SNathan Whitehorn.for target_arch in ${TARGET_ARCHES_${target}}
3308e7c4a05SNathan Whitehornuniverse_${target}: universe_${target}_${target_arch}
3318e7c4a05SNathan Whitehornuniverse_${target}_${target_arch}: universe_${target}_prologue
3328e7c4a05SNathan Whitehorn	@echo ">> ${target}.${target_arch} buildworld started on `LC_ALL=C date`"
33333367c7fSDag-Erling Smørgrav	@(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
334b7490d8fSEd Schouten	    ${MAKE} ${JFLAG} buildworld \
3351fde59f3SRuslan Ermilov	    TARGET=${target} \
3368e7c4a05SNathan Whitehorn	    TARGET_ARCH=${target_arch} \
3378e7c4a05SNathan Whitehorn	    > _.${target}.${target_arch}.buildworld 2>&1 || \
3388e7c4a05SNathan Whitehorn	    (echo "${target}.${target_arch} world failed," \
3398e7c4a05SNathan Whitehorn	    "check _.${target}.${target_arch}.buildworld for details" | \
3408e7c4a05SNathan Whitehorn	    ${MAKEFAIL}))
3418e7c4a05SNathan Whitehorn	@echo ">> ${target}.${target_arch} buildworld completed on `LC_ALL=C date`"
3428e7c4a05SNathan Whitehorn.endfor
343139fb43dSJohn Birrell.endif
3443453d746SDoug Barton.if !defined(MAKE_JUST_WORLDS)
3451fde59f3SRuslan Ermilov.if exists(${.CURDIR}/sys/${target}/conf/NOTES)
34633367c7fSDag-Erling Smørgrav	@(cd ${.CURDIR}/sys/${target}/conf && env __MAKE_CONF=/dev/null \
34733367c7fSDag-Erling Smørgrav	    ${MAKE} LINT > ${.CURDIR}/_.${target}.makeLINT 2>&1 || \
3484bb9ca57SAlfred Perlstein	    (echo "${target} 'make LINT' failed," \
3494bb9ca57SAlfred Perlstein	    "check _.${target}.makeLINT for details"| ${MAKEFAIL}))
35077c1699fSPoul-Henning Kamp.endif
3513c55ed70SBjoern A. Zeeb	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} TARGET=${target} \
3523c55ed70SBjoern A. Zeeb	    universe_kernels
3533453d746SDoug Barton.endif
3543c55ed70SBjoern A. Zeeb	@echo ">> ${target} completed on `LC_ALL=C date`"
3553c55ed70SBjoern A. Zeeb.endfor
3563c55ed70SBjoern A. Zeebuniverse_kernels: universe_kernconfs
3575f5bb1d1SBjoern A. Zeeb.if !defined(TARGET)
3585f5bb1d1SBjoern A. ZeebTARGET!=	uname -m
3595f5bb1d1SBjoern A. Zeeb.endif
3603c55ed70SBjoern A. ZeebKERNCONFS!=	cd ${.CURDIR}/sys/${TARGET}/conf && \
3613c55ed70SBjoern A. Zeeb		find [A-Z0-9]*[A-Z0-9] -type f -maxdepth 0 \
3623c55ed70SBjoern A. Zeeb		! -name DEFAULTS ! -name NOTES
3633c55ed70SBjoern A. Zeebuniverse_kernconfs:
364dd0f3923SRuslan Ermilov.for kernel in ${KERNCONFS}
3658e7c4a05SNathan WhitehornTARGET_ARCH_${kernel}!=	cd ${.CURDIR}/sys/${TARGET}/conf && \
3665f523ccdSWarner Losh	config -m ${.CURDIR}/sys/${TARGET}/conf/${kernel} 2> /dev/null | \
36792f64fb9SWarner Losh	grep -v WARNING: | cut -f 2
36892f64fb9SWarner Losh.if empty(TARGET_ARCH_${kernel})
36992f64fb9SWarner Losh.error "Target architecture for ${TARGET}/conf/${kernel} unknown.  config(8) likely too old."
37092f64fb9SWarner Losh.endif
3718e7c4a05SNathan Whitehornuniverse_kernconfs: universe_kernconf_${TARGET}_${kernel}
3728e7c4a05SNathan Whitehornuniverse_kernconf_${TARGET}_${kernel}:
37333367c7fSDag-Erling Smørgrav	@(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
37433367c7fSDag-Erling Smørgrav	    ${MAKE} ${JFLAG} buildkernel \
3753c55ed70SBjoern A. Zeeb	    TARGET=${TARGET} \
3768e7c4a05SNathan Whitehorn	    TARGET_ARCH=${TARGET_ARCH_${kernel}} \
377dd0f3923SRuslan Ermilov	    KERNCONF=${kernel} \
3783c55ed70SBjoern A. Zeeb	    > _.${TARGET}.${kernel} 2>&1 || \
3793c55ed70SBjoern A. Zeeb	    (echo "${TARGET} ${kernel} kernel failed," \
3803c55ed70SBjoern A. Zeeb	    "check _.${TARGET}.${kernel} for details"| ${MAKEFAIL}))
381d18c9906SRuslan Ermilov.endfor
382d18c9906SRuslan Ermilovuniverse: universe_epilogue
383d18c9906SRuslan Ermilovuniverse_epilogue:
38477c1699fSPoul-Henning Kamp	@echo "--------------------------------------------------------------"
3855ab77811SRuslan Ermilov	@echo ">>> make universe completed on `LC_ALL=C date`"
3865ab77811SRuslan Ermilov	@echo "                      (started ${STARTTIME})"
38777c1699fSPoul-Henning Kamp	@echo "--------------------------------------------------------------"
3884bb9ca57SAlfred Perlstein.if defined(DOING_TINDERBOX)
3894bb9ca57SAlfred Perlstein	@if [ -e ${FAILFILE} ] ; then \
3904bb9ca57SAlfred Perlstein		echo "Tinderbox failed:" ;\
3914bb9ca57SAlfred Perlstein		cat ${FAILFILE} ;\
3924bb9ca57SAlfred Perlstein		exit 1 ;\
3934bb9ca57SAlfred Perlstein	fi
3944bb9ca57SAlfred Perlstein.endif
395d18c9906SRuslan Ermilov.endif
396