Makefile revision 301472
12061Sjkh# 250479Speter# $FreeBSD: head/Makefile 301472 2016-06-05 23:05:17Z bdrewery $ 32061Sjkh# 438666Sjb# The user-driven targets are: 532427Sjb# 6111131Sru# universe - *Really* build *everything* (buildworld and 7111131Sru# all kernels on all architectures). 8217733Sbz# tinderbox - Same as universe, but presents a list of failed build 9217733Sbz# targets and exits with an error if there were any. 1038666Sjb# buildworld - Rebuild *everything*, including glue to help do 1138666Sjb# upgrades. 1238666Sjb# installworld - Install everything built by "buildworld". 13159363Strhodes# world - buildworld + installworld, no kernel. 1464049Salex# buildkernel - Rebuild the kernel and the kernel-modules. 1564049Salex# installkernel - Install the kernel and the kernel-modules. 16116679Ssimokawa# installkernel.debug 1766071Smarkm# reinstallkernel - Reinstall the kernel and the kernel-modules. 18116679Ssimokawa# reinstallkernel.debug 1973504Sobrien# kernel - buildkernel + installkernel. 20204661Simp# kernel-toolchain - Builds the subset of world necessary to build a kernel 21232907Sjmallett# kernel-toolchains - Build kernel-toolchain for all universe targets. 22158962Snetchild# doxygen - Build API documentation of the kernel, needs doxygen. 23223148Sru# update - Convenient way to update your source tree(s). 24295380Sngie# checkworld - Run test suite on installed world. 25169597Sdes# check-old - List obsolete directories/files/libraries. 26169597Sdes# check-old-dirs - List obsolete directories. 27169597Sdes# check-old-files - List obsolete files. 28169597Sdes# check-old-libs - List obsolete libraries. 29231821Spluknet# delete-old - Delete obsolete directories/files. 30169597Sdes# delete-old-dirs - Delete obsolete directories. 31169597Sdes# delete-old-files - Delete obsolete files. 32169597Sdes# delete-old-libs - Delete obsolete libraries. 33217815Sbz# targets - Print a list of supported TARGET/TARGET_ARCH pairs 34217815Sbz# for world and kernel targets. 35218524Sjhb# toolchains - Build a toolchain for all world and kernel targets. 36264460Sbrueffer# xdev - xdev-build + xdev-install for the architecture 37264460Sbrueffer# specified with XDEV and XDEV_ARCH. 38264460Sbrueffer# xdev-build - Build cross-development tools. 39264460Sbrueffer# xdev-install - Install cross-development tools. 40268503Simp# xdev-links - Create traditional links in /usr/bin for cc, etc 41270155Simp# native-xtools - Create host binaries that produce target objects 42270155Simp# for use in qemu user-mode jails. 43253002Salfred# 44253002Salfred# "quick" way to test all kernel builds: 45253002Salfred# _jflag=`sysctl -n hw.ncpu` 46253002Salfred# _jflag=$(($_jflag * 2)) 47253002Salfred# [ $_jflag -gt 12 ] && _jflag=12 48253003Salfred# make universe -DMAKE_JUST_KERNELS JFLAG=-j${_jflag} 4932427Sjb# 5038666Sjb# This makefile is simple by design. The FreeBSD make automatically reads 51108451Sschweikh# the /usr/share/mk/sys.mk unless the -m argument is specified on the 5238666Sjb# command line. By keeping this makefile simple, it doesn't matter too 5338666Sjb# much how different the installed mk files are from those in the source 5438666Sjb# tree. This makefile executes a child make process, forcing it to use 5538666Sjb# the mk files from the source tree which are supposed to DTRT. 5617308Speter# 57217273Simp# Most of the user-driven targets (as listed above) are implemented in 58217294Simp# Makefile.inc1. The exceptions are universe, tinderbox and targets. 5919175Sbde# 6096205Sjwd# If you want to build your system from source be sure that /usr/obj has 61292217Semaste# at least 6GB of diskspace available. A complete 'universe' build requires 62292217Semaste# about 100GB of space. 6338042Sbde# 6496205Sjwd# For individuals wanting to build from the sources currently on their 6596205Sjwd# system, the simple instructions are: 6638042Sbde# 6796205Sjwd# 1. `cd /usr/src' (or to the directory containing your source tree). 68159363Strhodes# 2. Define `HISTORICAL_MAKE_WORLD' variable (see README). 69159363Strhodes# 3. `make world' 7017308Speter# 7196205Sjwd# For individuals wanting to upgrade their sources (even if only a 7296205Sjwd# delta of a few days): 7317308Speter# 74148330Snetchild# 1. `cd /usr/src' (or to the directory containing your source tree). 75148330Snetchild# 2. `make buildworld' 76148330Snetchild# 3. `make buildkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC). 77148330Snetchild# 4. `make installkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC). 78159831Sobrien# [steps 3. & 4. can be combined by using the "kernel" target] 79148330Snetchild# 5. `reboot' (in single user mode: boot -s from the loader prompt). 80148330Snetchild# 6. `mergemaster -p' 81148330Snetchild# 7. `make installworld' 82251107Screes# 8. `mergemaster' (you may wish to use -i, along with -U or -F). 83251107Screes# 9. `make delete-old' 84148330Snetchild# 10. `reboot' 85148330Snetchild# 11. `make delete-old-libs' (in case no 3rd party program uses them anymore) 8696205Sjwd# 8796205Sjwd# See src/UPDATING `COMMON ITEMS' for more complete information. 8896205Sjwd# 89268191Smarcel# If TARGET=machine (e.g. powerpc, sparc64, ...) is specified you can 90162147Sru# cross build world for other machine types using the buildworld target, 9198723Sdillon# and once the world is built you can cross build a kernel using the 9298723Sdillon# buildkernel target. 9398723Sdillon# 9438666Sjb# Define the user-driven targets. These are listed here in alphabetical 9538666Sjb# order, but that's not important. 9617308Speter# 97123311Speter# Targets that begin with underscore are internal targets intended for 98123311Speter# developer convenience only. They are intentionally not documented and 99123311Speter# completely subject to change without notice. 100123311Speter# 101175833Sjhb# For more information, see the build(7) manual page. 102175833Sjhb# 103284454Simp 104290526Sbdrewery# This is included so CC is set to ccache for -V, and COMPILER_TYPE/VERSION 105290526Sbdrewery# can be cached for sub-makes. 106301472Sbdrewery.if ${MAKE_VERSION} >= 20140620 107290526Sbdrewery.include <bsd.compiler.mk> 108301472Sbdrewery.endif 109290526Sbdrewery 110284454Simp# Note: we use this awkward construct to be compatible with FreeBSD's 111284454Simp# old make used in 10.0 and 9.2 and earlier. 112290816Ssjg.if defined(MK_DIRDEPS_BUILD) && ${MK_DIRDEPS_BUILD} == "yes" && !make(showconfig) 113284345Ssjg# targets/Makefile plays the role of top-level 114284345Ssjg.include "targets/Makefile" 115284345Ssjg.else 116284345Ssjg 117169597SdesTGTS= all all-man buildenv buildenvvars buildkernel buildworld \ 118295380Sngie check check-old check-old-dirs check-old-files check-old-libs \ 119295380Sngie checkdpadd checkworld clean cleandepend cleandir cleanworld \ 120169597Sdes delete-old delete-old-dirs delete-old-files delete-old-libs \ 121219177Snwhitehorn depend distribute distributekernel distributekernel.debug \ 122219177Snwhitehorn distributeworld distrib-dirs distribution doxygen \ 123238051Sobrien everything hier hierarchy install installcheck installkernel \ 124219177Snwhitehorn installkernel.debug packagekernel packageworld \ 125219177Snwhitehorn reinstallkernel reinstallkernel.debug \ 126158962Snetchild installworld kernel-toolchain libraries lint maninstall \ 127295380Sngie obj objlink rerelease showconfig tags toolchain update \ 128123311Speter _worldtmp _legacy _bootstrap-tools _cleanobj _obj \ 129297434Sbdrewery _build-tools _cross-tools _includes _libraries \ 130297988Sbdrewery build32 distribute32 install32 buildsoft distributesoft installsoft \ 131296779Simp builddtb xdev xdev-build xdev-install \ 132298107Sgjb xdev-links native-xtools stageworld stagekernel stage-packages \ 133298107Sgjb create-world-packages create-kernel-packages create-packages \ 134298107Sgjb packages installconfig real-packages sign-packages package-pkg 135209128Sraj 136156740SruTGTS+= ${SUBDIR_TARGETS} 1372061Sjkh 13897769SruBITGTS= files includes 13997252SruBITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/} 140119579SruTGTS+= ${BITGTS} 14197252Sru 14295730Sru.ORDER: buildworld installworld 14395793Sru.ORDER: buildworld distributeworld 144111617Sru.ORDER: buildworld buildkernel 145295161Sbdrewery.ORDER: installworld distribution 146296014Sbdrewery.ORDER: installworld installkernel 14795730Sru.ORDER: buildkernel installkernel 148116679Ssimokawa.ORDER: buildkernel installkernel.debug 14995730Sru.ORDER: buildkernel reinstallkernel 150116679Ssimokawa.ORDER: buildkernel reinstallkernel.debug 15195730Sru 152110035SruPATH= /sbin:/bin:/usr/sbin:/usr/bin 153107516SruMAKEOBJDIRPREFIX?= /usr/obj 154296549Sbdrewery_MAKEOBJDIRPREFIX!= /usr/bin/env -i PATH=${PATH} MK_AUTO_OBJ=no ${MAKE} \ 155293288Sbdrewery ${.MAKEFLAGS:MMAKEOBJDIRPREFIX=*} __MAKE_CONF=${__MAKE_CONF} \ 156293288Sbdrewery -f /dev/null -V MAKEOBJDIRPREFIX dummy 157293288Sbdrewery.if !empty(_MAKEOBJDIRPREFIX) 158293288Sbdrewery.error MAKEOBJDIRPREFIX can only be set in environment, not as a global\ 159293288Sbdrewery (in make.conf(5)) or command-line variable. 160293288Sbdrewery.endif 161253616Ssjg 162253616Ssjg# We often need to use the tree's version of make to build it. 163253616Ssjg# Choices add to complexity though. 164253616Ssjg# We cannot blindly use a make which may not be the one we want 165253616Ssjg# so be exlicit - until all choice is removed. 166253616SsjgWANT_MAKE= bmake 167301466Sbdrewery.if !empty(.MAKE.MODE:Mmeta) 168301466Sbdrewery# 20160604 - support missing-meta,missing-filemon and performance improvements 169301466SbdreweryWANT_MAKE_VERSION= 20160604 170301466Sbdrewery.else 171296646Sbdrewery# 20160220 - support .dinclude for FAST_DEPEND. 172296646SbdreweryWANT_MAKE_VERSION= 20160220 173301466Sbdrewery.endif 174253616SsjgMYMAKE= ${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE}/${WANT_MAKE} 175253616Ssjg.if defined(.PARSEDIR) 176253616SsjgHAVE_MAKE= bmake 177253616Ssjg.else 178253616SsjgHAVE_MAKE= fmake 179253616Ssjg.endif 180301465Sbdrewery.if ${HAVE_MAKE} != ${WANT_MAKE} || \ 181301465Sbdrewery (defined(WANT_MAKE_VERSION) && ${MAKE_VERSION} < ${WANT_MAKE_VERSION}) 182301465SbdreweryNEED_MAKE_UPGRADE= t 183301465Sbdrewery.endif 184253616Ssjg.if exists(${MYMAKE}) 185253616SsjgSUB_MAKE:= ${MYMAKE} -m ${.CURDIR}/share/mk 186301465Sbdrewery.elif defined(NEED_MAKE_UPGRADE) 187253616Ssjg# It may not exist yet but we may cause it to. 188253616Ssjg# In the case of fmake, upgrade_checks may cause a newer version to be built. 189253616SsjgSUB_MAKE= `test -x ${MYMAKE} && echo ${MYMAKE} || echo ${MAKE}` \ 190117229Sru -m ${.CURDIR}/share/mk 191253616Ssjg.else 192253616SsjgSUB_MAKE= ${MAKE} -m ${.CURDIR}/share/mk 193253616Ssjg.endif 19454324Smarcel 195253616Ssjg_MAKE= PATH=${PATH} ${SUB_MAKE} -f Makefile.inc1 TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH} 196253616Ssjg 197298220Sbdrewery# Must disable META_MODE when installing to avoid missing anything. The 198298220Sbdrewery# main problem is that buildworld will create cookies for install targets 199298220Sbdrewery# since they are being installed into WORLDTMP. This avoids unneeded and 200298220Sbdrewery# redundant restaging but is dangerous for user install targets. 201298220Sbdrewery.if make(distrib*) || make(*install*) 202298220Sbdrewery_MAKE+= MK_META_MODE=no 203298221Sbdrewery.unexport META_MODE 204298220Sbdrewery.endif 205298220Sbdrewery 206218130Simp# Guess machine architecture from machine type, and vice versa. 207218130Simp.if !defined(TARGET_ARCH) && defined(TARGET) 208280259Sandrew_TARGET_ARCH= ${TARGET:S/pc98/i386/:S/arm64/aarch64/} 209218130Simp.elif !defined(TARGET) && defined(TARGET_ARCH) && \ 210218130Simp ${TARGET_ARCH} != ${MACHINE_ARCH} 211300119Simp_TARGET= ${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/aarch64/arm64/:C/powerpc64/powerpc/:C/riscv64/riscv/} 212218130Simp.endif 213218130Simp.if defined(TARGET) && !defined(_TARGET) 214218130Simp_TARGET=${TARGET} 215218130Simp.endif 216218130Simp.if defined(TARGET_ARCH) && !defined(_TARGET_ARCH) 217218130Simp_TARGET_ARCH=${TARGET_ARCH} 218218130Simp.endif 219269048Simp# for historical compatibility for xdev targets 220269048Simp.if defined(XDEV) 221269048Simp_TARGET= ${XDEV} 222269048Simp.endif 223269048Simp.if defined(XDEV_ARCH) 224269048Simp_TARGET_ARCH= ${XDEV_ARCH} 225269048Simp.endif 226218130Simp# Otherwise, default to current machine type and architecture. 227218130Simp_TARGET?= ${MACHINE} 228218130Simp_TARGET_ARCH?= ${MACHINE_ARCH} 229218130Simp 23017308Speter# 231119519Smarcel# Make sure we have an up-to-date make(1). Only world and buildworld 232119519Smarcel# should do this as those are the initial targets used for upgrades. 233119519Smarcel# The user can define ALWAYS_CHECK_MAKE to have this check performed 234119519Smarcel# for all targets. 235119519Smarcel# 236293342Sbdrewery.if defined(ALWAYS_CHECK_MAKE) || !defined(.PARSEDIR) 237119579Sru${TGTS}: upgrade_checks 238119519Smarcel.else 239119519Smarcelbuildworld: upgrade_checks 240119519Smarcel.endif 241119519Smarcel 242119519Smarcel# 24338666Sjb# Handle the user-driven targets, using the source relative mk files. 24417308Speter# 245119519Smarcel 246254417Ssjgtinderbox toolchains kernel-toolchains: .MAKE 247289460Sbdrewery${TGTS}: .PHONY .MAKE 248218206Simp ${_+_}@cd ${.CURDIR}; ${_MAKE} ${.TARGET} 2492302Spaul 250265097Sbrooks# The historic default "all" target creates files which may cause stale 251265097Sbrooks# or (in the cross build case) unlinkable results. Fail with an error 252265097Sbrooks# when no target is given. The users can explicitly specify "all" 253265097Sbrooks# if they want the historic behavior. 254265097Sbrooks.MAIN: _guard 25539206Sjkh 256289411Sbdrewery_guard: .PHONY 257265097Sbrooks @echo 258289432Sbdrewery @echo "Explicit target required. Likely \"${SUBDIR_OVERRIDE:Dall:Ubuildworld}\" is wanted. See build(7)." 259265097Sbrooks @echo 260265097Sbrooks @false 261265097Sbrooks 262133945SruSTARTTIME!= LC_ALL=C date 263240403SobrienCHECK_TIME!= find ${.CURDIR}/sys/sys/param.h -mtime -0s ; echo 264177609Sru.if !empty(CHECK_TIME) 265177609Sru.error check your date/time: ${STARTTIME} 266177609Sru.endif 267133945Sru 268132358Smarkm.if defined(HISTORICAL_MAKE_WORLD) || defined(DESTDIR) 26917308Speter# 27054324Smarcel# world 27154324Smarcel# 272132234Smarcel# Attempt to rebuild and reinstall everything. This target is not to be 273132234Smarcel# used for upgrading an existing FreeBSD system, because the kernel is 274132234Smarcel# not included. One can argue that this target doesn't build everything 275132234Smarcel# then. 27654324Smarcel# 27754324Smarcelworld: upgrade_checks 27854324Smarcel @echo "--------------------------------------------------------------" 279118531Sru @echo ">>> make world started on ${STARTTIME}" 28054324Smarcel @echo "--------------------------------------------------------------" 28154324Smarcel.if target(pre-world) 28254324Smarcel @echo 28354324Smarcel @echo "--------------------------------------------------------------" 28454324Smarcel @echo ">>> Making 'pre-world' target" 28554324Smarcel @echo "--------------------------------------------------------------" 286133376Sharti ${_+_}@cd ${.CURDIR}; ${_MAKE} pre-world 28754324Smarcel.endif 288133376Sharti ${_+_}@cd ${.CURDIR}; ${_MAKE} buildworld 289133376Sharti ${_+_}@cd ${.CURDIR}; ${_MAKE} -B installworld 29054324Smarcel.if target(post-world) 29154324Smarcel @echo 29254324Smarcel @echo "--------------------------------------------------------------" 29354324Smarcel @echo ">>> Making 'post-world' target" 29454324Smarcel @echo "--------------------------------------------------------------" 295133376Sharti ${_+_}@cd ${.CURDIR}; ${_MAKE} post-world 29654324Smarcel.endif 29754324Smarcel @echo 29854324Smarcel @echo "--------------------------------------------------------------" 299118531Sru @echo ">>> make world completed on `LC_ALL=C date`" 300118531Sru @echo " (started ${STARTTIME})" 30154324Smarcel @echo "--------------------------------------------------------------" 302132234Smarcel.else 303132234Smarcelworld: 304132234Smarcel @echo "WARNING: make world will overwrite your existing FreeBSD" 305132234Smarcel @echo "installation without also building and installing a new" 306132234Smarcel @echo "kernel. This can be dangerous. Please read the handbook," 307132588Skensmith @echo "'Rebuilding world', for how to upgrade your system." 308132358Smarkm @echo "Define DESTDIR to where you want to install FreeBSD," 309132234Smarcel @echo "including /, to override this warning and proceed as usual." 310132358Smarkm @echo "" 311132234Smarcel @echo "Bailing out now..." 312132234Smarcel @false 313132234Smarcel.endif 31454324Smarcel 31554324Smarcel# 31695730Sru# kernel 31795730Sru# 31895730Sru# Short hand for `make buildkernel installkernel' 31995730Sru# 32095730Srukernel: buildkernel installkernel 32195730Sru 32295730Sru# 32338666Sjb# Perform a few tests to determine if the installed tools are adequate 324107374Sru# for building the world. 32517308Speter# 32655678Smarcelupgrade_checks: 327301465Sbdrewery.if defined(NEED_MAKE_UPGRADE) 328296643Sbdrewery @${_+_}(cd ${.CURDIR} && ${MAKE} ${WANT_MAKE:S,^f,,}) 329241298Smarcel.endif 3302061Sjkh 33117308Speter# 332107516Sru# Upgrade make(1) to the current version using the installed 333174539Simp# headers, libraries and tools. Also, allow the location of 334174539Simp# the system bsdmake-like utility to be overridden. 33555678Smarcel# 336253616SsjgMMAKEENV= MAKEOBJDIRPREFIX=${MYMAKE:H} \ 337107516Sru DESTDIR= \ 338107516Sru INSTALL="sh ${.CURDIR}/tools/install.sh" 339174564SimpMMAKE= ${MMAKEENV} ${MAKE} \ 340296675Sbdrewery MAN= -DNO_SHARED \ 341264742Sjmmv -DNO_CPU_CFLAGS -DNO_WERROR \ 342296676Sbdrewery -DNO_SUBDIR \ 343265827Simp DESTDIR= PROGNAME=${MYMAKE:T} 344107516Sru 345265827Simpbmake: .PHONY 34655678Smarcel @echo 34755678Smarcel @echo "--------------------------------------------------------------" 348265827Simp @echo ">>> Building an up-to-date ${.TARGET}(1)" 34955678Smarcel @echo "--------------------------------------------------------------" 350249395Ssjg ${_+_}@cd ${.CURDIR}/usr.bin/${.TARGET}; \ 351291605Sbdrewery ${MMAKE} obj; \ 352291605Sbdrewery ${MMAKE} depend; \ 353291605Sbdrewery ${MMAKE} all; \ 354265827Simp ${MMAKE} install DESTDIR=${MYMAKE:H} BINDIR= 35555678Smarcel 356295380Sngieregress: .PHONY 357295380Sngie @echo "'make regress' has been renamed 'make check'" | /usr/bin/fmt 358295380Sngie @false 359295380Sngie 360295099Siantinderbox toolchains kernel-toolchains kernels worlds: upgrade_checks 361254417Ssjg 362185499Salfredtinderbox: 363291605Sbdrewery @cd ${.CURDIR}; ${SUB_MAKE} DOING_TINDERBOX=YES universe 364185499Salfred 365218524Sjhbtoolchains: 366291605Sbdrewery @cd ${.CURDIR}; ${SUB_MAKE} UNIVERSE_TARGET=toolchain universe 367218524Sjhb 368232907Sjmallettkernel-toolchains: 369291605Sbdrewery @cd ${.CURDIR}; ${SUB_MAKE} UNIVERSE_TARGET=kernel-toolchain universe 370232907Sjmallett 371295099Siankernels: 372295099Sian @cd ${.CURDIR}; ${SUB_MAKE} UNIVERSE_TARGET=buildkernel universe 373295099Sian 374295099Sianworlds: 375295099Sian @cd ${.CURDIR}; ${SUB_MAKE} UNIVERSE_TARGET=buildworld universe 376295099Sian 37755678Smarcel# 378111131Sru# universe 379111131Sru# 380111131Sru# Attempt to rebuild *everything* for all supported architectures, 381133945Sru# with a reasonable chance of success, regardless of how old your 382111131Sru# existing system is. 383111131Sru# 384217125Simp.if make(universe) || make(universe_kernels) || make(tinderbox) || make(targets) 385287903SbdreweryTARGETS?=amd64 arm arm64 i386 mips pc98 powerpc sparc64 386287903Sbdrewery_UNIVERSE_TARGETS= ${TARGETS} 387300119SimpTARGET_ARCHES_arm?= arm armeb armv6 388282156SemasteTARGET_ARCHES_arm64?= aarch64 389233644SjmallettTARGET_ARCHES_mips?= mipsel mips mips64el mips64 mipsn32 390216520SnwhitehornTARGET_ARCHES_powerpc?= powerpc powerpc64 391216520SnwhitehornTARGET_ARCHES_pc98?= i386 392287903Sbdrewery.for target in ${TARGETS} 393216520SnwhitehornTARGET_ARCHES_${target}?= ${target} 394216520Snwhitehorn.endfor 395168280Smarcel 396287903Sbdrewery# XXX Add arm64 to universe only if we have an external binutils installed. 397287903Sbdrewery# It does not build with the in-tree linker. 398287903Sbdrewery.if !exists(/usr/local/aarch64-freebsd/bin/ld) && empty(${TARGETS}) 399287903Sbdrewery_UNIVERSE_TARGETS:= ${_UNIVERSE_TARGETS:Narm64} 400287903Sbdreweryuniverse: universe_arm64_skip 401287903Sbdreweryuniverse_epilogue: universe_arm64_skip 402287903Sbdreweryuniverse_arm64_skip: universe_prologue 403287903Sbdrewery @echo ">> arm64 skipped - install aarch64-binutils port or package to build" 404287903Sbdrewery.endif 405287903Sbdrewery 406218524Sjhb.if defined(UNIVERSE_TARGET) 407218524SjhbMAKE_JUST_WORLDS= YES 408218524Sjhb.else 409218524SjhbUNIVERSE_TARGET?= buildworld 410218524Sjhb.endif 411219137SjhbKERNSRCDIR?= ${.CURDIR}/sys 412218524Sjhb 413284699Ssjgtargets: .PHONY 414217815Sbz @echo "Supported TARGET/TARGET_ARCH pairs for world and kernel targets" 415287903Sbdrewery.for target in ${TARGETS} 416217125Simp.for target_arch in ${TARGET_ARCHES_${target}} 417217125Simp @echo " ${target}/${target_arch}" 418217125Simp.endfor 419217125Simp.endfor 420217125Simp 421185499Salfred.if defined(DOING_TINDERBOX) 422217735SbzFAILFILE=${.CURDIR}/_.tinderbox.failed 423185499SalfredMAKEFAIL=tee -a ${FAILFILE} 424185499Salfred.else 425185499SalfredMAKEFAIL=cat 426185499Salfred.endif 427185499Salfred 428253616Ssjguniverse_prologue: upgrade_checks 429253616Ssjguniverse: universe_prologue 430297993Sbdreweryuniverse_prologue: .PHONY 431103985Sphk @echo "--------------------------------------------------------------" 432103985Sphk @echo ">>> make universe started on ${STARTTIME}" 433103985Sphk @echo "--------------------------------------------------------------" 434185499Salfred.if defined(DOING_TINDERBOX) 435217754Sbz @rm -f ${FAILFILE} 436185499Salfred.endif 437287903Sbdrewery.for target in ${_UNIVERSE_TARGETS} 438162147Sruuniverse: universe_${target} 439253616Ssjguniverse_epilogue: universe_${target} 440216520Snwhitehornuniverse_${target}: universe_${target}_prologue 441253616Ssjguniverse_${target}_prologue: universe_prologue 442216520Snwhitehorn @echo ">> ${target} started on `LC_ALL=C date`" 443284456Sandrewuniverse_${target}_worlds: 444284456Sandrew 445179232Sjb.if !defined(MAKE_JUST_KERNELS) 446284471Sandrewuniverse_${target}_done: universe_${target}_worlds 447216520Snwhitehorn.for target_arch in ${TARGET_ARCHES_${target}} 448284456Sandrewuniverse_${target}_worlds: universe_${target}_${target_arch} 449254417Ssjguniverse_${target}_${target_arch}: universe_${target}_prologue .MAKE 450218524Sjhb @echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} started on `LC_ALL=C date`" 451185250Sdes @(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \ 452253616Ssjg ${SUB_MAKE} ${JFLAG} ${UNIVERSE_TARGET} \ 453162147Sru TARGET=${target} \ 454216520Snwhitehorn TARGET_ARCH=${target_arch} \ 455218524Sjhb > _.${target}.${target_arch}.${UNIVERSE_TARGET} 2>&1 || \ 456218524Sjhb (echo "${target}.${target_arch} ${UNIVERSE_TARGET} failed," \ 457218524Sjhb "check _.${target}.${target_arch}.${UNIVERSE_TARGET} for details" | \ 458216520Snwhitehorn ${MAKEFAIL})) 459218524Sjhb @echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} completed on `LC_ALL=C date`" 460216520Snwhitehorn.endfor 461284453Sandrew.endif # !MAKE_JUST_KERNELS 462284453Sandrew 463205290Sdougb.if !defined(MAKE_JUST_WORLDS) 464284457Sandrewuniverse_${target}_done: universe_${target}_kernels 465284456Sandrewuniverse_${target}_kernels: universe_${target}_worlds 466254417Ssjguniverse_${target}_kernels: universe_${target}_prologue .MAKE 467219137Sjhb.if exists(${KERNSRCDIR}/${target}/conf/NOTES) 468219137Sjhb @(cd ${KERNSRCDIR}/${target}/conf && env __MAKE_CONF=/dev/null \ 469253616Ssjg ${SUB_MAKE} LINT > ${.CURDIR}/_.${target}.makeLINT 2>&1 || \ 470185499Salfred (echo "${target} 'make LINT' failed," \ 471185499Salfred "check _.${target}.makeLINT for details"| ${MAKEFAIL})) 472103985Sphk.endif 473291605Sbdrewery @cd ${.CURDIR}; ${SUB_MAKE} ${.MAKEFLAGS} TARGET=${target} \ 474201815Sbz universe_kernels 475284453Sandrew.endif # !MAKE_JUST_WORLDS 476284457Sandrew 477284457Sandrew# Tell the user the worlds and kernels have completed 478284457Sandrewuniverse_${target}: universe_${target}_done 479284457Sandrewuniverse_${target}_done: 480201815Sbz @echo ">> ${target} completed on `LC_ALL=C date`" 481201815Sbz.endfor 482201815Sbzuniverse_kernels: universe_kernconfs 483202095Sbz.if !defined(TARGET) 484202095SbzTARGET!= uname -m 485202095Sbz.endif 486265155Simp.if defined(MAKE_ALL_KERNELS) 487265155Simp_THINNER=cat 488265155Simp.else 489265840Simp_THINNER=xargs grep -L "^.NO_UNIVERSE" || true 490265155Simp.endif 491219137SjhbKERNCONFS!= cd ${KERNSRCDIR}/${TARGET}/conf && \ 492295455Sbapt find [[:upper:][:digit:]]*[[:upper:][:digit:]] \ 493295455Sbapt -type f -maxdepth 0 \ 494265155Simp ! -name DEFAULTS ! -name NOTES | \ 495265155Simp ${_THINNER} 496201815Sbzuniverse_kernconfs: 497148154Sru.for kernel in ${KERNCONFS} 498219137SjhbTARGET_ARCH_${kernel}!= cd ${KERNSRCDIR}/${TARGET}/conf && \ 499219137Sjhb config -m ${KERNSRCDIR}/${TARGET}/conf/${kernel} 2> /dev/null | \ 500216934Simp grep -v WARNING: | cut -f 2 501216934Simp.if empty(TARGET_ARCH_${kernel}) 502216934Simp.error "Target architecture for ${TARGET}/conf/${kernel} unknown. config(8) likely too old." 503216934Simp.endif 504216520Snwhitehornuniverse_kernconfs: universe_kernconf_${TARGET}_${kernel} 505254417Ssjguniverse_kernconf_${TARGET}_${kernel}: .MAKE 506185250Sdes @(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \ 507253616Ssjg ${SUB_MAKE} ${JFLAG} buildkernel \ 508201815Sbz TARGET=${TARGET} \ 509216520Snwhitehorn TARGET_ARCH=${TARGET_ARCH_${kernel}} \ 510148154Sru KERNCONF=${kernel} \ 511201815Sbz > _.${TARGET}.${kernel} 2>&1 || \ 512201815Sbz (echo "${TARGET} ${kernel} kernel failed," \ 513201815Sbz "check _.${TARGET}.${kernel} for details"| ${MAKEFAIL})) 514148154Sru.endfor 515133945Sruuniverse: universe_epilogue 516297993Sbdreweryuniverse_epilogue: .PHONY 517103985Sphk @echo "--------------------------------------------------------------" 518118531Sru @echo ">>> make universe completed on `LC_ALL=C date`" 519118531Sru @echo " (started ${STARTTIME})" 520103985Sphk @echo "--------------------------------------------------------------" 521185499Salfred.if defined(DOING_TINDERBOX) 522185499Salfred @if [ -e ${FAILFILE} ] ; then \ 523185499Salfred echo "Tinderbox failed:" ;\ 524185499Salfred cat ${FAILFILE} ;\ 525185499Salfred exit 1 ;\ 526185499Salfred fi 527133945Sru.endif 528185499Salfred.endif 529242522Smarcel 530242522SmarcelbuildLINT: 531242522Smarcel ${MAKE} -C ${.CURDIR}/sys/${_TARGET}/conf LINT 532255286Ssjg 533284454Simp.if defined(.PARSEDIR) 534284345Ssjg# This makefile does not run in meta mode 535284345Ssjg.MAKE.MODE= normal 536284345Ssjg# Normally the things we run from here don't either. 537290816Ssjg# Using -DWITH_META_MODE 538284345Ssjg# we can buildworld with meta files created which are useful 539284345Ssjg# for debugging, but without any of the rest of a meta mode build. 540290816SsjgMK_DIRDEPS_BUILD= no 541284345SsjgMK_STAGING= no 542284345Ssjg# tell meta.autodep.mk to not even think about updating anything. 543284345SsjgUPDATE_DEPENDFILE= NO 544285080Ssjg.if !make(showconfig) 545290816Ssjg.export MK_DIRDEPS_BUILD MK_STAGING UPDATE_DEPENDFILE 546285080Ssjg.endif 547284345Ssjg 548255286Ssjg.if make(universe) 549255286Ssjg# we do not want a failure of one branch abort all. 550255286SsjgMAKE_JOB_ERROR_TOKEN= no 551255286Ssjg.export MAKE_JOB_ERROR_TOKEN 552255286Ssjg.endif 553284454Simp.endif # bmake 554284345Ssjg 555290816Ssjg.endif # DIRDEPS_BUILD 556