Makefile revision 253616
12061Sjkh#
250479Speter# $FreeBSD: head/Makefile 253616 2013-07-24 17:55:08Z sjg $
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.
35253002Salfred# 
36253002Salfred# "quick" way to test all kernel builds:
37253002Salfred# 	_jflag=`sysctl -n hw.ncpu`
38253002Salfred# 	_jflag=$(($_jflag * 2))
39253002Salfred# 	[ $_jflag -gt 12 ] && _jflag=12
40253003Salfred# 	make universe -DMAKE_JUST_KERNELS JFLAG=-j${_jflag}
4132427Sjb#
4238666Sjb# This makefile is simple by design. The FreeBSD make automatically reads
43108451Sschweikh# the /usr/share/mk/sys.mk unless the -m argument is specified on the
4438666Sjb# command line. By keeping this makefile simple, it doesn't matter too
4538666Sjb# much how different the installed mk files are from those in the source
4638666Sjb# tree. This makefile executes a child make process, forcing it to use
4738666Sjb# the mk files from the source tree which are supposed to DTRT.
4817308Speter#
49217273Simp# Most of the user-driven targets (as listed above) are implemented in
50217294Simp# Makefile.inc1.  The exceptions are universe, tinderbox and targets.
5119175Sbde#
5296205Sjwd# If you want to build your system from source be sure that /usr/obj has
53217297Simp# at least 1GB of diskspace available.  A complete 'universe' build requires
54217297Simp# about 15GB of space.
5538042Sbde#
5696205Sjwd# For individuals wanting to build from the sources currently on their
5796205Sjwd# system, the simple instructions are:
5838042Sbde#
5996205Sjwd# 1.  `cd /usr/src'  (or to the directory containing your source tree).
60159363Strhodes# 2.  Define `HISTORICAL_MAKE_WORLD' variable (see README).
61159363Strhodes# 3.  `make world'
6217308Speter#
6396205Sjwd# For individuals wanting to upgrade their sources (even if only a
6496205Sjwd# delta of a few days):
6517308Speter#
66148330Snetchild#  1.  `cd /usr/src'       (or to the directory containing your source tree).
67148330Snetchild#  2.  `make buildworld'
68148330Snetchild#  3.  `make buildkernel KERNCONF=YOUR_KERNEL_HERE'     (default is GENERIC).
69148330Snetchild#  4.  `make installkernel KERNCONF=YOUR_KERNEL_HERE'   (default is GENERIC).
70159831Sobrien#       [steps 3. & 4. can be combined by using the "kernel" target]
71148330Snetchild#  5.  `reboot'        (in single user mode: boot -s from the loader prompt).
72148330Snetchild#  6.  `mergemaster -p'
73148330Snetchild#  7.  `make installworld'
74251107Screes#  8.  `mergemaster'		(you may wish to use -i, along with -U or -F).
75251107Screes#  9.  `make delete-old'
76148330Snetchild# 10.  `reboot'
77148330Snetchild# 11.  `make delete-old-libs' (in case no 3rd party program uses them anymore)
7896205Sjwd#
7996205Sjwd# See src/UPDATING `COMMON ITEMS' for more complete information.
8096205Sjwd#
81162147Sru# If TARGET=machine (e.g. ia64, sparc64, ...) is specified you can
82162147Sru# cross build world for other machine types using the buildworld target,
8398723Sdillon# and once the world is built you can cross build a kernel using the
8498723Sdillon# buildkernel target.
8598723Sdillon#
8638666Sjb# Define the user-driven targets. These are listed here in alphabetical
8738666Sjb# order, but that's not important.
8817308Speter#
89123311Speter# Targets that begin with underscore are internal targets intended for
90123311Speter# developer convenience only.  They are intentionally not documented and
91123311Speter# completely subject to change without notice.
92123311Speter#
93175833Sjhb# For more information, see the build(7) manual page.
94175833Sjhb#
95169597SdesTGTS=	all all-man buildenv buildenvvars buildkernel buildworld \
96169597Sdes	check-old check-old-dirs check-old-files check-old-libs \
97169597Sdes	checkdpadd clean cleandepend cleandir \
98169597Sdes	delete-old delete-old-dirs delete-old-files delete-old-libs \
99219177Snwhitehorn	depend distribute distributekernel distributekernel.debug \
100219177Snwhitehorn	distributeworld distrib-dirs distribution doxygen \
101238051Sobrien	everything hier hierarchy install installcheck installkernel \
102219177Snwhitehorn	installkernel.debug packagekernel packageworld \
103219177Snwhitehorn	reinstallkernel reinstallkernel.debug \
104158962Snetchild	installworld kernel-toolchain libraries lint maninstall \
105156840Sru	obj objlink regress rerelease showconfig tags toolchain update \
106123311Speter	_worldtmp _legacy _bootstrap-tools _cleanobj _obj \
107137288Speter	_build-tools _cross-tools _includes _libraries _depend \
108209128Sraj	build32 builddtb distribute32 install32 xdev xdev-build xdev-install \
109209128Sraj
110156740SruTGTS+=	${SUBDIR_TARGETS}
1112061Sjkh
11297769SruBITGTS=	files includes
11397252SruBITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/}
114119579SruTGTS+=	${BITGTS}
11597252Sru
11695730Sru.ORDER: buildworld installworld
11795793Sru.ORDER: buildworld distributeworld
118111617Sru.ORDER: buildworld buildkernel
11995730Sru.ORDER: buildkernel installkernel
120116679Ssimokawa.ORDER: buildkernel installkernel.debug
12195730Sru.ORDER: buildkernel reinstallkernel
122116679Ssimokawa.ORDER: buildkernel reinstallkernel.debug
12395730Sru
124110035SruPATH=	/sbin:/bin:/usr/sbin:/usr/bin
125107516SruMAKEOBJDIRPREFIX?=	/usr/obj
126138921Sru_MAKEOBJDIRPREFIX!= /usr/bin/env -i PATH=${PATH} ${MAKE} \
127156145Syar    ${.MAKEFLAGS:MMAKEOBJDIRPREFIX=*} __MAKE_CONF=${__MAKE_CONF} \
128138921Sru    -f /dev/null -V MAKEOBJDIRPREFIX dummy
129133942Sru.if !empty(_MAKEOBJDIRPREFIX)
130133942Sru.error MAKEOBJDIRPREFIX can only be set in environment, not as a global\
131156145Syar	(in make.conf(5)) or command-line variable.
132133942Sru.endif
133253616Ssjg
134253616Ssjg# We often need to use the tree's version of make to build it.
135253616Ssjg# Choices add to complexity though.
136253616Ssjg# We cannot blindly use a make which may not be the one we want
137253616Ssjg# so be exlicit - until all choice is removed.
138253616Ssjg.if !defined(WITHOUT_BMAKE)
139253616SsjgWANT_MAKE=	bmake
140253616Ssjg.else
141253616SsjgWANT_MAKE=	fmake
142253616Ssjg.endif
143253616SsjgMYMAKE=		${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE}/${WANT_MAKE}
144253616Ssjg.if defined(.PARSEDIR)
145253616SsjgHAVE_MAKE=	bmake
146253616Ssjg.else
147253616SsjgHAVE_MAKE=	fmake
148253616Ssjg.endif
149253616Ssjg.if exists(${MYMAKE})
150253616SsjgSUB_MAKE:= ${MYMAKE} -m ${.CURDIR}/share/mk
151253616Ssjg.elif ${WANT_MAKE} != ${HAVE_MAKE} || ${WANT_MAKE} != "bmake"
152253616Ssjg# It may not exist yet but we may cause it to.
153253616Ssjg# In the case of fmake, upgrade_checks may cause a newer version to be built.
154253616SsjgSUB_MAKE= `test -x ${MYMAKE} && echo ${MYMAKE} || echo ${MAKE}` \
155117229Sru	-m ${.CURDIR}/share/mk
156253616Ssjg.else
157253616SsjgSUB_MAKE= ${MAKE} -m ${.CURDIR}/share/mk
158253616Ssjg.endif
15954324Smarcel
160253616Ssjg_MAKE=	PATH=${PATH} ${SUB_MAKE} -f Makefile.inc1 TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH}
161253616Ssjg
162218130Simp# Guess machine architecture from machine type, and vice versa.
163218130Simp.if !defined(TARGET_ARCH) && defined(TARGET)
164233644Sjmallett_TARGET_ARCH=	${TARGET:S/pc98/i386/}
165218130Simp.elif !defined(TARGET) && defined(TARGET_ARCH) && \
166218130Simp    ${TARGET_ARCH} != ${MACHINE_ARCH}
167239272Sgonzo_TARGET=		${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/}
168218130Simp.endif
169233644Sjmallett# Legacy names, for another transition period mips:mips(n32|64)?eb -> mips:mips\1
170218130Simp.if defined(TARGET) && defined(TARGET_ARCH) && \
171233644Sjmallett    ${TARGET} == "mips" && ${TARGET_ARCH:Mmips*eb}
172233644Sjmallett_TARGET_ARCH=		${TARGET_ARCH:C/eb$//}
173233644Sjmallett.warning "TARGET_ARCH of ${TARGET_ARCH} is deprecated in favor of ${_TARGET_ARCH}"
174218130Simp.endif
175233644Sjmallett.if defined(TARGET) && ${TARGET} == "mips" && defined(TARGET_BIG_ENDIAN)
176233644Sjmallett.warning "TARGET_BIG_ENDIAN is no longer necessary for MIPS.  Big-endian is not the default."
177218130Simp.endif
178218130Simp# arm with TARGET_BIG_ENDIAN -> armeb
179218130Simp.if defined(TARGET_ARCH) && ${TARGET_ARCH} == "arm" && defined(TARGET_BIG_ENDIAN)
180218130Simp.warning "TARGET_ARCH of arm with TARGET_BIG_ENDIAN is deprecated.  use armeb"
181218130Simp_TARGET_ARCH=armeb
182218130Simp.endif
183218130Simp.if defined(TARGET) && !defined(_TARGET)
184218130Simp_TARGET=${TARGET}
185218130Simp.endif
186218130Simp.if defined(TARGET_ARCH) && !defined(_TARGET_ARCH)
187218130Simp_TARGET_ARCH=${TARGET_ARCH}
188218130Simp.endif
189218130Simp# Otherwise, default to current machine type and architecture.
190218130Simp_TARGET?=	${MACHINE}
191218130Simp_TARGET_ARCH?=	${MACHINE_ARCH}
192218130Simp
19317308Speter#
194119519Smarcel# Make sure we have an up-to-date make(1). Only world and buildworld
195119519Smarcel# should do this as those are the initial targets used for upgrades.
196119519Smarcel# The user can define ALWAYS_CHECK_MAKE to have this check performed
197119519Smarcel# for all targets.
198119519Smarcel#
199119519Smarcel.if defined(ALWAYS_CHECK_MAKE)
200119579Sru${TGTS}: upgrade_checks
201119519Smarcel.else
202119519Smarcelbuildworld: upgrade_checks
203119519Smarcel.endif
204119519Smarcel
205119519Smarcel#
206126031Sgad# This 'cleanworld' target is not included in TGTS, because it is not a
207126024Sgad# recursive target.  All of the work for it is done right here.   It is
208126024Sgad# expected that BW_CANONICALOBJDIR == the CANONICALOBJDIR as would be
209126024Sgad# created by bsd.obj.mk, except that we don't want to .include that file
210126024Sgad# in this makefile.  
211126024Sgad#
212126024Sgad# In the following, the first 'rm' in a series will usually remove all
213126024Sgad# files and directories.  If it does not, then there are probably some
214227771Sgjb# files with file flags set, so this unsets them and tries the 'rm' a
215126024Sgad# second time.  There are situations where this target will be cleaning
216126024Sgad# some directories via more than one method, but that duplication is
217227769Sgjb# needed to correctly handle all the possible situations.  Removing all
218227771Sgjb# files without file flags set in the first 'rm' instance saves time,
219227771Sgjb# because 'chflags' will need to operate on fewer files afterwards.
220126024Sgad#
221126024SgadBW_CANONICALOBJDIR:=${MAKEOBJDIRPREFIX}${.CURDIR}
222126031Sgadcleanworld:
223126024Sgad.if ${.CURDIR} == ${.OBJDIR} || ${.CURDIR}/obj == ${.OBJDIR}
224126024Sgad.if exists(${BW_CANONICALOBJDIR}/)
225126024Sgad	-rm -rf ${BW_CANONICALOBJDIR}/*
226172744Sdelphij	-chflags -R 0 ${BW_CANONICALOBJDIR}
227126024Sgad	rm -rf ${BW_CANONICALOBJDIR}/*
228126024Sgad.endif
229126024Sgad	#   To be safe in this case, fall back to a 'make cleandir'
230133376Sharti	${_+_}@cd ${.CURDIR}; ${_MAKE} cleandir
231126024Sgad.else
232126024Sgad	-rm -rf ${.OBJDIR}/*
233172744Sdelphij	-chflags -R 0 ${.OBJDIR}
234126024Sgad	rm -rf ${.OBJDIR}/*
235126024Sgad.endif
236125885Sgad
237125885Sgad#
23838666Sjb# Handle the user-driven targets, using the source relative mk files.
23917308Speter#
240119519Smarcel
241251750Ssjg.if empty(.MAKEFLAGS:M-n)
242251750Ssjg# skip this for -n to avoid changing previous behavior of 
243251750Ssjg# 'make -n buildworld' etc.
244251750Ssjg${TGTS}: .MAKE
245251750Ssjg.endif
246251750Ssjg
247119579Sru${TGTS}:
248218206Simp	${_+_}@cd ${.CURDIR}; ${_MAKE} ${.TARGET}
2492302Spaul
25039206Sjkh# Set a reasonable default
25139206Sjkh.MAIN:	all
25239206Sjkh
253133945SruSTARTTIME!= LC_ALL=C date
254240403SobrienCHECK_TIME!= find ${.CURDIR}/sys/sys/param.h -mtime -0s ; echo
255177609Sru.if !empty(CHECK_TIME)
256177609Sru.error check your date/time: ${STARTTIME}
257177609Sru.endif
258133945Sru
259132358Smarkm.if defined(HISTORICAL_MAKE_WORLD) || defined(DESTDIR)
26017308Speter#
26154324Smarcel# world
26254324Smarcel#
263132234Smarcel# Attempt to rebuild and reinstall everything. This target is not to be
264132234Smarcel# used for upgrading an existing FreeBSD system, because the kernel is
265132234Smarcel# not included. One can argue that this target doesn't build everything
266132234Smarcel# then.
26754324Smarcel#
26854324Smarcelworld: upgrade_checks
26954324Smarcel	@echo "--------------------------------------------------------------"
270118531Sru	@echo ">>> make world started on ${STARTTIME}"
27154324Smarcel	@echo "--------------------------------------------------------------"
27254324Smarcel.if target(pre-world)
27354324Smarcel	@echo
27454324Smarcel	@echo "--------------------------------------------------------------"
27554324Smarcel	@echo ">>> Making 'pre-world' target"
27654324Smarcel	@echo "--------------------------------------------------------------"
277133376Sharti	${_+_}@cd ${.CURDIR}; ${_MAKE} pre-world
27854324Smarcel.endif
279133376Sharti	${_+_}@cd ${.CURDIR}; ${_MAKE} buildworld
280133376Sharti	${_+_}@cd ${.CURDIR}; ${_MAKE} -B installworld
28154324Smarcel.if target(post-world)
28254324Smarcel	@echo
28354324Smarcel	@echo "--------------------------------------------------------------"
28454324Smarcel	@echo ">>> Making 'post-world' target"
28554324Smarcel	@echo "--------------------------------------------------------------"
286133376Sharti	${_+_}@cd ${.CURDIR}; ${_MAKE} post-world
28754324Smarcel.endif
28854324Smarcel	@echo
28954324Smarcel	@echo "--------------------------------------------------------------"
290118531Sru	@echo ">>> make world completed on `LC_ALL=C date`"
291118531Sru	@echo "                   (started ${STARTTIME})"
29254324Smarcel	@echo "--------------------------------------------------------------"
293132234Smarcel.else
294132234Smarcelworld:
295132234Smarcel	@echo "WARNING: make world will overwrite your existing FreeBSD"
296132234Smarcel	@echo "installation without also building and installing a new"
297132234Smarcel	@echo "kernel.  This can be dangerous.  Please read the handbook,"
298132588Skensmith	@echo "'Rebuilding world', for how to upgrade your system."
299132358Smarkm	@echo "Define DESTDIR to where you want to install FreeBSD,"
300132234Smarcel	@echo "including /, to override this warning and proceed as usual."
301132358Smarkm	@echo ""
302132234Smarcel	@echo "Bailing out now..."
303132234Smarcel	@false
304132234Smarcel.endif
30554324Smarcel
30654324Smarcel#
30795730Sru# kernel
30895730Sru#
30995730Sru# Short hand for `make buildkernel installkernel'
31095730Sru#
31195730Srukernel: buildkernel installkernel
31295730Sru
31395730Sru#
31438666Sjb# Perform a few tests to determine if the installed tools are adequate
315107374Sru# for building the world.
31617308Speter#
317253616Ssjg# Note: if we ever need to care about the version of bmake, simply testing
318253616Ssjg# MAKE_VERSION against a required version should suffice.
319253616Ssjg#
32055678Smarcelupgrade_checks:
321253616Ssjg.if ${HAVE_MAKE} != ${WANT_MAKE}
322253616Ssjg	@(cd ${.CURDIR} && ${MAKE} ${WANT_MAKE:S,^f,,})
323253616Ssjg.elif ${WANT_MAKE} == "fmake"
324143032Sharti	@if ! (cd ${.CURDIR}/tools/build/make_check && \
325138515Sharti	    PATH=${PATH} ${BINMAKE} obj >/dev/null 2>&1 && \
326117793Sru	    PATH=${PATH} ${BINMAKE} >/dev/null 2>&1); \
327110035Sru	then \
328174564Simp	    (cd ${.CURDIR} && ${MAKE} make); \
329110035Sru	fi
330241298Smarcel.endif
3312061Sjkh
33217308Speter#
333107516Sru# Upgrade make(1) to the current version using the installed
334174539Simp# headers, libraries and tools.  Also, allow the location of
335174539Simp# the system bsdmake-like utility to be overridden.
33655678Smarcel#
337253616SsjgMMAKEENV=	MAKEOBJDIRPREFIX=${MYMAKE:H} \
338107516Sru		DESTDIR= \
339107516Sru		INSTALL="sh ${.CURDIR}/tools/install.sh"
340174564SimpMMAKE=		${MMAKEENV} ${MAKE} \
341107516Sru		-D_UPGRADING \
342139112Sru		-DNOMAN -DNO_MAN -DNOSHARED -DNO_SHARED \
343164470Sjb		-DNO_CPU_CFLAGS -DNO_WERROR
344107516Sru
345249395Ssjgmake bmake: .PHONY
34655678Smarcel	@echo
34755678Smarcel	@echo "--------------------------------------------------------------"
348116696Sru	@echo ">>> Building an up-to-date make(1)"
34955678Smarcel	@echo "--------------------------------------------------------------"
350249395Ssjg	${_+_}@cd ${.CURDIR}/usr.bin/${.TARGET}; \
351107516Sru		${MMAKE} obj && \
352107516Sru		${MMAKE} depend && \
353107516Sru		${MMAKE} all && \
354253616Ssjg		${MMAKE} install DESTDIR=${MYMAKE:H} BINDIR= PROGNAME=${MYMAKE:T}
35555678Smarcel
356185499Salfredtinderbox:
357218524Sjhb	@cd ${.CURDIR} && ${MAKE} DOING_TINDERBOX=YES universe
358185499Salfred
359218524Sjhbtoolchains:
360218524Sjhb	@cd ${.CURDIR} && ${MAKE} UNIVERSE_TARGET=toolchain universe
361218524Sjhb
362232907Sjmallettkernel-toolchains:
363232907Sjmallett	@cd ${.CURDIR} && ${MAKE} UNIVERSE_TARGET=kernel-toolchain universe
364232907Sjmallett
36555678Smarcel#
366111131Sru# universe
367111131Sru#
368111131Sru# Attempt to rebuild *everything* for all supported architectures,
369133945Sru# with a reasonable chance of success, regardless of how old your
370111131Sru# existing system is.
371111131Sru#
372217125Simp.if make(universe) || make(universe_kernels) || make(tinderbox) || make(targets)
373221869SattilioTARGETS?=amd64 arm i386 ia64 mips pc98 powerpc sparc64
374239272SgonzoTARGET_ARCHES_arm?=	arm armeb armv6 armv6eb
375233644SjmallettTARGET_ARCHES_mips?=	mipsel mips mips64el mips64 mipsn32
376216520SnwhitehornTARGET_ARCHES_powerpc?=	powerpc powerpc64
377216520SnwhitehornTARGET_ARCHES_pc98?=	i386
378216520Snwhitehorn.for target in ${TARGETS}
379216520SnwhitehornTARGET_ARCHES_${target}?= ${target}
380216520Snwhitehorn.endfor
381168280Smarcel
382218524Sjhb.if defined(UNIVERSE_TARGET)
383218524SjhbMAKE_JUST_WORLDS=	YES
384218524Sjhb.else
385218524SjhbUNIVERSE_TARGET?=	buildworld
386218524Sjhb.endif
387219137SjhbKERNSRCDIR?=		${.CURDIR}/sys
388218524Sjhb
389217125Simptargets:
390217815Sbz	@echo "Supported TARGET/TARGET_ARCH pairs for world and kernel targets"
391217125Simp.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
413168280Smarcel.for target in ${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`"
419179232Sjb.if !defined(MAKE_JUST_KERNELS)
420216520Snwhitehorn.for target_arch in ${TARGET_ARCHES_${target}}
421216520Snwhitehornuniverse_${target}: universe_${target}_${target_arch}
422216520Snwhitehornuniverse_${target}_${target_arch}: universe_${target}_prologue
423218524Sjhb	@echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} started on `LC_ALL=C date`"
424185250Sdes	@(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
425253616Ssjg	    ${SUB_MAKE} ${JFLAG} ${UNIVERSE_TARGET} \
426162147Sru	    TARGET=${target} \
427216520Snwhitehorn	    TARGET_ARCH=${target_arch} \
428218524Sjhb	    > _.${target}.${target_arch}.${UNIVERSE_TARGET} 2>&1 || \
429218524Sjhb	    (echo "${target}.${target_arch} ${UNIVERSE_TARGET} failed," \
430218524Sjhb	    "check _.${target}.${target_arch}.${UNIVERSE_TARGET} for details" | \
431216520Snwhitehorn	    ${MAKEFAIL}))
432218524Sjhb	@echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} completed on `LC_ALL=C date`"
433216520Snwhitehorn.endfor
434179232Sjb.endif
435205290Sdougb.if !defined(MAKE_JUST_WORLDS)
436248937Sandrew# If we are building world and kernels wait for the required worlds to finish
437248937Sandrew.if !defined(MAKE_JUST_KERNELS)
438248937Sandrew.for target_arch in ${TARGET_ARCHES_${target}}
439248937Sandrewuniverse_${target}_kernels: universe_${target}_${target_arch}
440248937Sandrew.endfor
441248937Sandrew.endif
442248937Sandrewuniverse_${target}: universe_${target}_kernels
443248937Sandrewuniverse_${target}_kernels: universe_${target}_prologue
444219137Sjhb.if exists(${KERNSRCDIR}/${target}/conf/NOTES)
445219137Sjhb	@(cd ${KERNSRCDIR}/${target}/conf && env __MAKE_CONF=/dev/null \
446253616Ssjg	    ${SUB_MAKE} LINT > ${.CURDIR}/_.${target}.makeLINT 2>&1 || \
447185499Salfred	    (echo "${target} 'make LINT' failed," \
448185499Salfred	    "check _.${target}.makeLINT for details"| ${MAKEFAIL}))
449103985Sphk.endif
450253616Ssjg	@cd ${.CURDIR} && ${SUB_MAKE} ${.MAKEFLAGS} TARGET=${target} \
451201815Sbz	    universe_kernels
452205290Sdougb.endif
453201815Sbz	@echo ">> ${target} completed on `LC_ALL=C date`"
454201815Sbz.endfor
455201815Sbzuniverse_kernels: universe_kernconfs
456202095Sbz.if !defined(TARGET)
457202095SbzTARGET!=	uname -m
458202095Sbz.endif
459219137SjhbKERNCONFS!=	cd ${KERNSRCDIR}/${TARGET}/conf && \
460201815Sbz		find [A-Z0-9]*[A-Z0-9] -type f -maxdepth 0 \
461201815Sbz		! -name DEFAULTS ! -name NOTES
462201815Sbzuniverse_kernconfs:
463148154Sru.for kernel in ${KERNCONFS}
464219137SjhbTARGET_ARCH_${kernel}!=	cd ${KERNSRCDIR}/${TARGET}/conf && \
465219137Sjhb	config -m ${KERNSRCDIR}/${TARGET}/conf/${kernel} 2> /dev/null | \
466216934Simp	grep -v WARNING: | cut -f 2
467216934Simp.if empty(TARGET_ARCH_${kernel})
468216934Simp.error "Target architecture for ${TARGET}/conf/${kernel} unknown.  config(8) likely too old."
469216934Simp.endif
470216520Snwhitehornuniverse_kernconfs: universe_kernconf_${TARGET}_${kernel}
471216520Snwhitehornuniverse_kernconf_${TARGET}_${kernel}:
472185250Sdes	@(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
473253616Ssjg	    ${SUB_MAKE} ${JFLAG} buildkernel \
474201815Sbz	    TARGET=${TARGET} \
475216520Snwhitehorn	    TARGET_ARCH=${TARGET_ARCH_${kernel}} \
476148154Sru	    KERNCONF=${kernel} \
477201815Sbz	    > _.${TARGET}.${kernel} 2>&1 || \
478201815Sbz	    (echo "${TARGET} ${kernel} kernel failed," \
479201815Sbz	    "check _.${TARGET}.${kernel} for details"| ${MAKEFAIL}))
480148154Sru.endfor
481133945Sruuniverse: universe_epilogue
482133945Sruuniverse_epilogue:
483103985Sphk	@echo "--------------------------------------------------------------"
484118531Sru	@echo ">>> make universe completed on `LC_ALL=C date`"
485118531Sru	@echo "                      (started ${STARTTIME})"
486103985Sphk	@echo "--------------------------------------------------------------"
487185499Salfred.if defined(DOING_TINDERBOX)
488185499Salfred	@if [ -e ${FAILFILE} ] ; then \
489185499Salfred		echo "Tinderbox failed:" ;\
490185499Salfred		cat ${FAILFILE} ;\
491185499Salfred		exit 1 ;\
492185499Salfred	fi
493133945Sru.endif
494185499Salfred.endif
495242522Smarcel
496242522SmarcelbuildLINT:
497242522Smarcel	${MAKE} -C ${.CURDIR}/sys/${_TARGET}/conf LINT
498