Makefile revision 249395
12061Sjkh#
250479Speter# $FreeBSD: head/Makefile 249395 2013-04-12 00:34:19Z 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.
3532427Sjb#
3638666Sjb# This makefile is simple by design. The FreeBSD make automatically reads
37108451Sschweikh# the /usr/share/mk/sys.mk unless the -m argument is specified on the
3838666Sjb# command line. By keeping this makefile simple, it doesn't matter too
3938666Sjb# much how different the installed mk files are from those in the source
4038666Sjb# tree. This makefile executes a child make process, forcing it to use
4138666Sjb# the mk files from the source tree which are supposed to DTRT.
4217308Speter#
43217273Simp# Most of the user-driven targets (as listed above) are implemented in
44217294Simp# Makefile.inc1.  The exceptions are universe, tinderbox and targets.
4519175Sbde#
4696205Sjwd# If you want to build your system from source be sure that /usr/obj has
47217297Simp# at least 1GB of diskspace available.  A complete 'universe' build requires
48217297Simp# about 15GB of space.
4938042Sbde#
5096205Sjwd# For individuals wanting to build from the sources currently on their
5196205Sjwd# system, the simple instructions are:
5238042Sbde#
5396205Sjwd# 1.  `cd /usr/src'  (or to the directory containing your source tree).
54159363Strhodes# 2.  Define `HISTORICAL_MAKE_WORLD' variable (see README).
55159363Strhodes# 3.  `make world'
5617308Speter#
5796205Sjwd# For individuals wanting to upgrade their sources (even if only a
5896205Sjwd# delta of a few days):
5917308Speter#
60148330Snetchild#  1.  `cd /usr/src'       (or to the directory containing your source tree).
61148330Snetchild#  2.  `make buildworld'
62148330Snetchild#  3.  `make buildkernel KERNCONF=YOUR_KERNEL_HERE'     (default is GENERIC).
63148330Snetchild#  4.  `make installkernel KERNCONF=YOUR_KERNEL_HERE'   (default is GENERIC).
64159831Sobrien#       [steps 3. & 4. can be combined by using the "kernel" target]
65148330Snetchild#  5.  `reboot'        (in single user mode: boot -s from the loader prompt).
66148330Snetchild#  6.  `mergemaster -p'
67148330Snetchild#  7.  `make installworld'
68148330Snetchild#  8.  `make delete-old'
69220512Sdougb#  9.  `mergemaster'		(you may wish to use -i, along with -U or -F).
70148330Snetchild# 10.  `reboot'
71148330Snetchild# 11.  `make delete-old-libs' (in case no 3rd party program uses them anymore)
7296205Sjwd#
7396205Sjwd# See src/UPDATING `COMMON ITEMS' for more complete information.
7496205Sjwd#
75162147Sru# If TARGET=machine (e.g. ia64, sparc64, ...) is specified you can
76162147Sru# cross build world for other machine types using the buildworld target,
7798723Sdillon# and once the world is built you can cross build a kernel using the
7898723Sdillon# buildkernel target.
7998723Sdillon#
8038666Sjb# Define the user-driven targets. These are listed here in alphabetical
8138666Sjb# order, but that's not important.
8217308Speter#
83123311Speter# Targets that begin with underscore are internal targets intended for
84123311Speter# developer convenience only.  They are intentionally not documented and
85123311Speter# completely subject to change without notice.
86123311Speter#
87175833Sjhb# For more information, see the build(7) manual page.
88175833Sjhb#
89169597SdesTGTS=	all all-man buildenv buildenvvars buildkernel buildworld \
90169597Sdes	check-old check-old-dirs check-old-files check-old-libs \
91169597Sdes	checkdpadd clean cleandepend cleandir \
92169597Sdes	delete-old delete-old-dirs delete-old-files delete-old-libs \
93219177Snwhitehorn	depend distribute distributekernel distributekernel.debug \
94219177Snwhitehorn	distributeworld distrib-dirs distribution doxygen \
95238051Sobrien	everything hier hierarchy install installcheck installkernel \
96219177Snwhitehorn	installkernel.debug packagekernel packageworld \
97219177Snwhitehorn	reinstallkernel reinstallkernel.debug \
98158962Snetchild	installworld kernel-toolchain libraries lint maninstall \
99156840Sru	obj objlink regress rerelease showconfig tags toolchain update \
100123311Speter	_worldtmp _legacy _bootstrap-tools _cleanobj _obj \
101137288Speter	_build-tools _cross-tools _includes _libraries _depend \
102209128Sraj	build32 builddtb distribute32 install32 xdev xdev-build xdev-install \
103209128Sraj
104156740SruTGTS+=	${SUBDIR_TARGETS}
1052061Sjkh
10697769SruBITGTS=	files includes
10797252SruBITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/}
108119579SruTGTS+=	${BITGTS}
10997252Sru
11095730Sru.ORDER: buildworld installworld
11195793Sru.ORDER: buildworld distributeworld
112111617Sru.ORDER: buildworld buildkernel
11395730Sru.ORDER: buildkernel installkernel
114116679Ssimokawa.ORDER: buildkernel installkernel.debug
11595730Sru.ORDER: buildkernel reinstallkernel
116116679Ssimokawa.ORDER: buildkernel reinstallkernel.debug
11795730Sru
118110035SruPATH=	/sbin:/bin:/usr/sbin:/usr/bin
119107516SruMAKEOBJDIRPREFIX?=	/usr/obj
120138921Sru_MAKEOBJDIRPREFIX!= /usr/bin/env -i PATH=${PATH} ${MAKE} \
121156145Syar    ${.MAKEFLAGS:MMAKEOBJDIRPREFIX=*} __MAKE_CONF=${__MAKE_CONF} \
122138921Sru    -f /dev/null -V MAKEOBJDIRPREFIX dummy
123133942Sru.if !empty(_MAKEOBJDIRPREFIX)
124133942Sru.error MAKEOBJDIRPREFIX can only be set in environment, not as a global\
125156145Syar	(in make.conf(5)) or command-line variable.
126133942Sru.endif
127110035SruMAKEPATH=	${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE}
128117234SruBINMAKE= \
129110035Sru	`if [ -x ${MAKEPATH}/make ]; then echo ${MAKEPATH}/make; else echo ${MAKE}; fi` \
130117229Sru	-m ${.CURDIR}/share/mk
131218206Simp_MAKE=	PATH=${PATH} ${BINMAKE} -f Makefile.inc1 TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH}
13254324Smarcel
133218130Simp# Guess machine architecture from machine type, and vice versa.
134218130Simp.if !defined(TARGET_ARCH) && defined(TARGET)
135233644Sjmallett_TARGET_ARCH=	${TARGET:S/pc98/i386/}
136218130Simp.elif !defined(TARGET) && defined(TARGET_ARCH) && \
137218130Simp    ${TARGET_ARCH} != ${MACHINE_ARCH}
138239272Sgonzo_TARGET=		${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/}
139218130Simp.endif
140233644Sjmallett# Legacy names, for another transition period mips:mips(n32|64)?eb -> mips:mips\1
141218130Simp.if defined(TARGET) && defined(TARGET_ARCH) && \
142233644Sjmallett    ${TARGET} == "mips" && ${TARGET_ARCH:Mmips*eb}
143233644Sjmallett_TARGET_ARCH=		${TARGET_ARCH:C/eb$//}
144233644Sjmallett.warning "TARGET_ARCH of ${TARGET_ARCH} is deprecated in favor of ${_TARGET_ARCH}"
145218130Simp.endif
146233644Sjmallett.if defined(TARGET) && ${TARGET} == "mips" && defined(TARGET_BIG_ENDIAN)
147233644Sjmallett.warning "TARGET_BIG_ENDIAN is no longer necessary for MIPS.  Big-endian is not the default."
148218130Simp.endif
149218130Simp# arm with TARGET_BIG_ENDIAN -> armeb
150218130Simp.if defined(TARGET_ARCH) && ${TARGET_ARCH} == "arm" && defined(TARGET_BIG_ENDIAN)
151218130Simp.warning "TARGET_ARCH of arm with TARGET_BIG_ENDIAN is deprecated.  use armeb"
152218130Simp_TARGET_ARCH=armeb
153218130Simp.endif
154218130Simp.if defined(TARGET) && !defined(_TARGET)
155218130Simp_TARGET=${TARGET}
156218130Simp.endif
157218130Simp.if defined(TARGET_ARCH) && !defined(_TARGET_ARCH)
158218130Simp_TARGET_ARCH=${TARGET_ARCH}
159218130Simp.endif
160218130Simp# Otherwise, default to current machine type and architecture.
161218130Simp_TARGET?=	${MACHINE}
162218130Simp_TARGET_ARCH?=	${MACHINE_ARCH}
163218130Simp
16417308Speter#
165119519Smarcel# Make sure we have an up-to-date make(1). Only world and buildworld
166119519Smarcel# should do this as those are the initial targets used for upgrades.
167119519Smarcel# The user can define ALWAYS_CHECK_MAKE to have this check performed
168119519Smarcel# for all targets.
169119519Smarcel#
170119519Smarcel.if defined(ALWAYS_CHECK_MAKE)
171119579Sru${TGTS}: upgrade_checks
172119519Smarcel.else
173119519Smarcelbuildworld: upgrade_checks
174119519Smarcel.endif
175119519Smarcel
176119519Smarcel#
177126031Sgad# This 'cleanworld' target is not included in TGTS, because it is not a
178126024Sgad# recursive target.  All of the work for it is done right here.   It is
179126024Sgad# expected that BW_CANONICALOBJDIR == the CANONICALOBJDIR as would be
180126024Sgad# created by bsd.obj.mk, except that we don't want to .include that file
181126024Sgad# in this makefile.  
182126024Sgad#
183126024Sgad# In the following, the first 'rm' in a series will usually remove all
184126024Sgad# files and directories.  If it does not, then there are probably some
185227771Sgjb# files with file flags set, so this unsets them and tries the 'rm' a
186126024Sgad# second time.  There are situations where this target will be cleaning
187126024Sgad# some directories via more than one method, but that duplication is
188227769Sgjb# needed to correctly handle all the possible situations.  Removing all
189227771Sgjb# files without file flags set in the first 'rm' instance saves time,
190227771Sgjb# because 'chflags' will need to operate on fewer files afterwards.
191126024Sgad#
192126024SgadBW_CANONICALOBJDIR:=${MAKEOBJDIRPREFIX}${.CURDIR}
193126031Sgadcleanworld:
194126024Sgad.if ${.CURDIR} == ${.OBJDIR} || ${.CURDIR}/obj == ${.OBJDIR}
195126024Sgad.if exists(${BW_CANONICALOBJDIR}/)
196126024Sgad	-rm -rf ${BW_CANONICALOBJDIR}/*
197172744Sdelphij	-chflags -R 0 ${BW_CANONICALOBJDIR}
198126024Sgad	rm -rf ${BW_CANONICALOBJDIR}/*
199126024Sgad.endif
200126024Sgad	#   To be safe in this case, fall back to a 'make cleandir'
201133376Sharti	${_+_}@cd ${.CURDIR}; ${_MAKE} cleandir
202126024Sgad.else
203126024Sgad	-rm -rf ${.OBJDIR}/*
204172744Sdelphij	-chflags -R 0 ${.OBJDIR}
205126024Sgad	rm -rf ${.OBJDIR}/*
206126024Sgad.endif
207125885Sgad
208125885Sgad#
20938666Sjb# Handle the user-driven targets, using the source relative mk files.
21017308Speter#
211119519Smarcel
212119579Sru${TGTS}:
213218206Simp	${_+_}@cd ${.CURDIR}; ${_MAKE} ${.TARGET}
2142302Spaul
21539206Sjkh# Set a reasonable default
21639206Sjkh.MAIN:	all
21739206Sjkh
218133945SruSTARTTIME!= LC_ALL=C date
219240403SobrienCHECK_TIME!= find ${.CURDIR}/sys/sys/param.h -mtime -0s ; echo
220177609Sru.if !empty(CHECK_TIME)
221177609Sru.error check your date/time: ${STARTTIME}
222177609Sru.endif
223133945Sru
224132358Smarkm.if defined(HISTORICAL_MAKE_WORLD) || defined(DESTDIR)
22517308Speter#
22654324Smarcel# world
22754324Smarcel#
228132234Smarcel# Attempt to rebuild and reinstall everything. This target is not to be
229132234Smarcel# used for upgrading an existing FreeBSD system, because the kernel is
230132234Smarcel# not included. One can argue that this target doesn't build everything
231132234Smarcel# then.
23254324Smarcel#
23354324Smarcelworld: upgrade_checks
23454324Smarcel	@echo "--------------------------------------------------------------"
235118531Sru	@echo ">>> make world started on ${STARTTIME}"
23654324Smarcel	@echo "--------------------------------------------------------------"
23754324Smarcel.if target(pre-world)
23854324Smarcel	@echo
23954324Smarcel	@echo "--------------------------------------------------------------"
24054324Smarcel	@echo ">>> Making 'pre-world' target"
24154324Smarcel	@echo "--------------------------------------------------------------"
242133376Sharti	${_+_}@cd ${.CURDIR}; ${_MAKE} pre-world
24354324Smarcel.endif
244133376Sharti	${_+_}@cd ${.CURDIR}; ${_MAKE} buildworld
245133376Sharti	${_+_}@cd ${.CURDIR}; ${_MAKE} -B installworld
24654324Smarcel.if target(post-world)
24754324Smarcel	@echo
24854324Smarcel	@echo "--------------------------------------------------------------"
24954324Smarcel	@echo ">>> Making 'post-world' target"
25054324Smarcel	@echo "--------------------------------------------------------------"
251133376Sharti	${_+_}@cd ${.CURDIR}; ${_MAKE} post-world
25254324Smarcel.endif
25354324Smarcel	@echo
25454324Smarcel	@echo "--------------------------------------------------------------"
255118531Sru	@echo ">>> make world completed on `LC_ALL=C date`"
256118531Sru	@echo "                   (started ${STARTTIME})"
25754324Smarcel	@echo "--------------------------------------------------------------"
258132234Smarcel.else
259132234Smarcelworld:
260132234Smarcel	@echo "WARNING: make world will overwrite your existing FreeBSD"
261132234Smarcel	@echo "installation without also building and installing a new"
262132234Smarcel	@echo "kernel.  This can be dangerous.  Please read the handbook,"
263132588Skensmith	@echo "'Rebuilding world', for how to upgrade your system."
264132358Smarkm	@echo "Define DESTDIR to where you want to install FreeBSD,"
265132234Smarcel	@echo "including /, to override this warning and proceed as usual."
266132358Smarkm	@echo ""
267132234Smarcel	@echo "Bailing out now..."
268132234Smarcel	@false
269132234Smarcel.endif
27054324Smarcel
27154324Smarcel#
27295730Sru# kernel
27395730Sru#
27495730Sru# Short hand for `make buildkernel installkernel'
27595730Sru#
27695730Srukernel: buildkernel installkernel
27795730Sru
27895730Sru#
27938666Sjb# Perform a few tests to determine if the installed tools are adequate
280107374Sru# for building the world.
28117308Speter#
28255678Smarcelupgrade_checks:
283241298Smarcel.if !defined(.PARSEDIR)
284249395Ssjg.if defined(WITH_BMAKE)
285249395Ssjg	(cd ${.CURDIR} && ${MAKE} bmake)
286249395Ssjg.else
287143032Sharti	@if ! (cd ${.CURDIR}/tools/build/make_check && \
288138515Sharti	    PATH=${PATH} ${BINMAKE} obj >/dev/null 2>&1 && \
289117793Sru	    PATH=${PATH} ${BINMAKE} >/dev/null 2>&1); \
290110035Sru	then \
291174564Simp	    (cd ${.CURDIR} && ${MAKE} make); \
292110035Sru	fi
293241298Smarcel.endif
294249395Ssjg.endif
2952061Sjkh
29617308Speter#
297107516Sru# Upgrade make(1) to the current version using the installed
298174539Simp# headers, libraries and tools.  Also, allow the location of
299174539Simp# the system bsdmake-like utility to be overridden.
30055678Smarcel#
301107516SruMMAKEENV=	MAKEOBJDIRPREFIX=${MAKEPATH} \
302107516Sru		DESTDIR= \
303107516Sru		INSTALL="sh ${.CURDIR}/tools/install.sh"
304174564SimpMMAKE=		${MMAKEENV} ${MAKE} \
305107516Sru		-D_UPGRADING \
306139112Sru		-DNOMAN -DNO_MAN -DNOSHARED -DNO_SHARED \
307164470Sjb		-DNO_CPU_CFLAGS -DNO_WERROR
308107516Sru
309249395Ssjgmake bmake: .PHONY
31055678Smarcel	@echo
31155678Smarcel	@echo "--------------------------------------------------------------"
312116696Sru	@echo ">>> Building an up-to-date make(1)"
31355678Smarcel	@echo "--------------------------------------------------------------"
314249395Ssjg	${_+_}@cd ${.CURDIR}/usr.bin/${.TARGET}; \
315107516Sru		${MMAKE} obj && \
316107516Sru		${MMAKE} depend && \
317107516Sru		${MMAKE} all && \
318107516Sru		${MMAKE} install DESTDIR=${MAKEPATH} BINDIR=
31955678Smarcel
320185499Salfredtinderbox:
321218524Sjhb	@cd ${.CURDIR} && ${MAKE} DOING_TINDERBOX=YES universe
322185499Salfred
323218524Sjhbtoolchains:
324218524Sjhb	@cd ${.CURDIR} && ${MAKE} UNIVERSE_TARGET=toolchain universe
325218524Sjhb
326232907Sjmallettkernel-toolchains:
327232907Sjmallett	@cd ${.CURDIR} && ${MAKE} UNIVERSE_TARGET=kernel-toolchain universe
328232907Sjmallett
32955678Smarcel#
330111131Sru# universe
331111131Sru#
332111131Sru# Attempt to rebuild *everything* for all supported architectures,
333133945Sru# with a reasonable chance of success, regardless of how old your
334111131Sru# existing system is.
335111131Sru#
336217125Simp.if make(universe) || make(universe_kernels) || make(tinderbox) || make(targets)
337221869SattilioTARGETS?=amd64 arm i386 ia64 mips pc98 powerpc sparc64
338239272SgonzoTARGET_ARCHES_arm?=	arm armeb armv6 armv6eb
339233644SjmallettTARGET_ARCHES_mips?=	mipsel mips mips64el mips64 mipsn32
340216520SnwhitehornTARGET_ARCHES_powerpc?=	powerpc powerpc64
341216520SnwhitehornTARGET_ARCHES_pc98?=	i386
342216520Snwhitehorn.for target in ${TARGETS}
343216520SnwhitehornTARGET_ARCHES_${target}?= ${target}
344216520Snwhitehorn.endfor
345168280Smarcel
346218524Sjhb.if defined(UNIVERSE_TARGET)
347218524SjhbMAKE_JUST_WORLDS=	YES
348218524Sjhb.else
349218524SjhbUNIVERSE_TARGET?=	buildworld
350218524Sjhb.endif
351219137SjhbKERNSRCDIR?=		${.CURDIR}/sys
352218524Sjhb
353217125Simptargets:
354217815Sbz	@echo "Supported TARGET/TARGET_ARCH pairs for world and kernel targets"
355217125Simp.for target in ${TARGETS}
356217125Simp.for target_arch in ${TARGET_ARCHES_${target}}
357217125Simp	@echo "    ${target}/${target_arch}"
358217125Simp.endfor
359217125Simp.endfor
360217125Simp
361185499Salfred.if defined(DOING_TINDERBOX)
362217735SbzFAILFILE=${.CURDIR}/_.tinderbox.failed
363185499SalfredMAKEFAIL=tee -a ${FAILFILE}
364185499Salfred.else
365185499SalfredMAKEFAIL=cat
366185499Salfred.endif
367185499Salfred
368249316Sdimuniverse: universe_prologue upgrade_checks
369133945Sruuniverse_prologue:
370103985Sphk	@echo "--------------------------------------------------------------"
371103985Sphk	@echo ">>> make universe started on ${STARTTIME}"
372103985Sphk	@echo "--------------------------------------------------------------"
373185499Salfred.if defined(DOING_TINDERBOX)
374217754Sbz	@rm -f ${FAILFILE}
375185499Salfred.endif
376168280Smarcel.for target in ${TARGETS}
377162147Sruuniverse: universe_${target}
378249316Sdim.ORDER: universe_prologue upgrade_checks universe_${target}_prologue universe_${target} universe_epilogue
379216520Snwhitehornuniverse_${target}: universe_${target}_prologue
380216520Snwhitehornuniverse_${target}_prologue:
381216520Snwhitehorn	@echo ">> ${target} started on `LC_ALL=C date`"
382179232Sjb.if !defined(MAKE_JUST_KERNELS)
383216520Snwhitehorn.for target_arch in ${TARGET_ARCHES_${target}}
384216520Snwhitehornuniverse_${target}: universe_${target}_${target_arch}
385216520Snwhitehornuniverse_${target}_${target_arch}: universe_${target}_prologue
386218524Sjhb	@echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} started on `LC_ALL=C date`"
387185250Sdes	@(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
388218524Sjhb	    ${MAKE} ${JFLAG} ${UNIVERSE_TARGET} \
389162147Sru	    TARGET=${target} \
390216520Snwhitehorn	    TARGET_ARCH=${target_arch} \
391218524Sjhb	    > _.${target}.${target_arch}.${UNIVERSE_TARGET} 2>&1 || \
392218524Sjhb	    (echo "${target}.${target_arch} ${UNIVERSE_TARGET} failed," \
393218524Sjhb	    "check _.${target}.${target_arch}.${UNIVERSE_TARGET} for details" | \
394216520Snwhitehorn	    ${MAKEFAIL}))
395218524Sjhb	@echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} completed on `LC_ALL=C date`"
396216520Snwhitehorn.endfor
397179232Sjb.endif
398205290Sdougb.if !defined(MAKE_JUST_WORLDS)
399248937Sandrew# If we are building world and kernels wait for the required worlds to finish
400248937Sandrew.if !defined(MAKE_JUST_KERNELS)
401248937Sandrew.for target_arch in ${TARGET_ARCHES_${target}}
402248937Sandrewuniverse_${target}_kernels: universe_${target}_${target_arch}
403248937Sandrew.endfor
404248937Sandrew.endif
405248937Sandrewuniverse_${target}: universe_${target}_kernels
406248937Sandrewuniverse_${target}_kernels: universe_${target}_prologue
407219137Sjhb.if exists(${KERNSRCDIR}/${target}/conf/NOTES)
408219137Sjhb	@(cd ${KERNSRCDIR}/${target}/conf && env __MAKE_CONF=/dev/null \
409185250Sdes	    ${MAKE} LINT > ${.CURDIR}/_.${target}.makeLINT 2>&1 || \
410185499Salfred	    (echo "${target} 'make LINT' failed," \
411185499Salfred	    "check _.${target}.makeLINT for details"| ${MAKEFAIL}))
412103985Sphk.endif
413201815Sbz	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} TARGET=${target} \
414201815Sbz	    universe_kernels
415205290Sdougb.endif
416201815Sbz	@echo ">> ${target} completed on `LC_ALL=C date`"
417201815Sbz.endfor
418201815Sbzuniverse_kernels: universe_kernconfs
419202095Sbz.if !defined(TARGET)
420202095SbzTARGET!=	uname -m
421202095Sbz.endif
422219137SjhbKERNCONFS!=	cd ${KERNSRCDIR}/${TARGET}/conf && \
423201815Sbz		find [A-Z0-9]*[A-Z0-9] -type f -maxdepth 0 \
424201815Sbz		! -name DEFAULTS ! -name NOTES
425201815Sbzuniverse_kernconfs:
426148154Sru.for kernel in ${KERNCONFS}
427219137SjhbTARGET_ARCH_${kernel}!=	cd ${KERNSRCDIR}/${TARGET}/conf && \
428219137Sjhb	config -m ${KERNSRCDIR}/${TARGET}/conf/${kernel} 2> /dev/null | \
429216934Simp	grep -v WARNING: | cut -f 2
430216934Simp.if empty(TARGET_ARCH_${kernel})
431216934Simp.error "Target architecture for ${TARGET}/conf/${kernel} unknown.  config(8) likely too old."
432216934Simp.endif
433216520Snwhitehornuniverse_kernconfs: universe_kernconf_${TARGET}_${kernel}
434216520Snwhitehornuniverse_kernconf_${TARGET}_${kernel}:
435185250Sdes	@(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
436185250Sdes	    ${MAKE} ${JFLAG} buildkernel \
437201815Sbz	    TARGET=${TARGET} \
438216520Snwhitehorn	    TARGET_ARCH=${TARGET_ARCH_${kernel}} \
439148154Sru	    KERNCONF=${kernel} \
440201815Sbz	    > _.${TARGET}.${kernel} 2>&1 || \
441201815Sbz	    (echo "${TARGET} ${kernel} kernel failed," \
442201815Sbz	    "check _.${TARGET}.${kernel} for details"| ${MAKEFAIL}))
443148154Sru.endfor
444133945Sruuniverse: universe_epilogue
445133945Sruuniverse_epilogue:
446103985Sphk	@echo "--------------------------------------------------------------"
447118531Sru	@echo ">>> make universe completed on `LC_ALL=C date`"
448118531Sru	@echo "                      (started ${STARTTIME})"
449103985Sphk	@echo "--------------------------------------------------------------"
450185499Salfred.if defined(DOING_TINDERBOX)
451185499Salfred	@if [ -e ${FAILFILE} ] ; then \
452185499Salfred		echo "Tinderbox failed:" ;\
453185499Salfred		cat ${FAILFILE} ;\
454185499Salfred		exit 1 ;\
455185499Salfred	fi
456133945Sru.endif
457185499Salfred.endif
458242522Smarcel
459242522SmarcelbuildLINT:
460242522Smarcel	${MAKE} -C ${.CURDIR}/sys/${_TARGET}/conf LINT
461