12061Sjkh# 250479Speter# $FreeBSD: releng/11.0/Makefile 304494 2016-08-19 19:16:10Z 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. 106302067Sbdrewery.if ${MAKE_VERSION} >= 20140620 && defined(.PARSEDIR) 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 \ 134303359Sbdrewery packages installconfig real-packages sign-packages package-pkg \ 135303359Sbdrewery test-system-compiler 136209128Sraj 137301887Sbdrewery# XXX: r156740: This can't work since bsd.subdir.mk is not included ever. 138301887Sbdrewery# It will only work for SUBDIR_TARGETS in make.conf. 139156740SruTGTS+= ${SUBDIR_TARGETS} 1402061Sjkh 14197769SruBITGTS= files includes 14297252SruBITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/} 143119579SruTGTS+= ${BITGTS} 14497252Sru 145301887Sbdrewery# Only some targets are allowed to use meta mode. Others get it 146301887Sbdrewery# disabled. In some cases, such as 'install', meta mode can be dangerous 147301887Sbdrewery# as a cookie may be used to prevent redundant installations (such as 148301887Sbdrewery# for WORLDTMP staging). For DESTDIR=/ we always want to install though. 149301887Sbdrewery# For other cases, such as delete-old-libs, meta mode may break 150301887Sbdrewery# the interactive tty prompt. The safest route is to just whitelist 151301887Sbdrewery# the ones that benefit from it. 152301887SbdreweryMETA_TGT_WHITELIST+= \ 153301887Sbdrewery _* build32 buildfiles buildincludes buildkernel buildsoft \ 154302088Sbdrewery buildworld everything kernel-toolchain kernel-toolchains kernel \ 155303359Sbdrewery kernels libraries native-xtools showconfig test-system-compiler \ 156303359Sbdrewery tinderbox toolchain \ 157302088Sbdrewery toolchains universe world worlds xdev xdev-build 158301887Sbdrewery 15995730Sru.ORDER: buildworld installworld 16095793Sru.ORDER: buildworld distributeworld 161111617Sru.ORDER: buildworld buildkernel 162295161Sbdrewery.ORDER: installworld distribution 163296014Sbdrewery.ORDER: installworld installkernel 16495730Sru.ORDER: buildkernel installkernel 165116679Ssimokawa.ORDER: buildkernel installkernel.debug 16695730Sru.ORDER: buildkernel reinstallkernel 167116679Ssimokawa.ORDER: buildkernel reinstallkernel.debug 16895730Sru 169110035SruPATH= /sbin:/bin:/usr/sbin:/usr/bin 170107516SruMAKEOBJDIRPREFIX?= /usr/obj 171296549Sbdrewery_MAKEOBJDIRPREFIX!= /usr/bin/env -i PATH=${PATH} MK_AUTO_OBJ=no ${MAKE} \ 172293288Sbdrewery ${.MAKEFLAGS:MMAKEOBJDIRPREFIX=*} __MAKE_CONF=${__MAKE_CONF} \ 173293288Sbdrewery -f /dev/null -V MAKEOBJDIRPREFIX dummy 174293288Sbdrewery.if !empty(_MAKEOBJDIRPREFIX) 175293288Sbdrewery.error MAKEOBJDIRPREFIX can only be set in environment, not as a global\ 176293288Sbdrewery (in make.conf(5)) or command-line variable. 177293288Sbdrewery.endif 178253616Ssjg 179253616Ssjg# We often need to use the tree's version of make to build it. 180253616Ssjg# Choices add to complexity though. 181253616Ssjg# We cannot blindly use a make which may not be the one we want 182253616Ssjg# so be exlicit - until all choice is removed. 183253616SsjgWANT_MAKE= bmake 184301466Sbdrewery.if !empty(.MAKE.MODE:Mmeta) 185301466Sbdrewery# 20160604 - support missing-meta,missing-filemon and performance improvements 186301466SbdreweryWANT_MAKE_VERSION= 20160604 187301466Sbdrewery.else 188296646Sbdrewery# 20160220 - support .dinclude for FAST_DEPEND. 189296646SbdreweryWANT_MAKE_VERSION= 20160220 190301466Sbdrewery.endif 191253616SsjgMYMAKE= ${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE}/${WANT_MAKE} 192253616Ssjg.if defined(.PARSEDIR) 193253616SsjgHAVE_MAKE= bmake 194253616Ssjg.else 195253616SsjgHAVE_MAKE= fmake 196253616Ssjg.endif 197301465Sbdrewery.if ${HAVE_MAKE} != ${WANT_MAKE} || \ 198301465Sbdrewery (defined(WANT_MAKE_VERSION) && ${MAKE_VERSION} < ${WANT_MAKE_VERSION}) 199301465SbdreweryNEED_MAKE_UPGRADE= t 200301465Sbdrewery.endif 201253616Ssjg.if exists(${MYMAKE}) 202253616SsjgSUB_MAKE:= ${MYMAKE} -m ${.CURDIR}/share/mk 203301465Sbdrewery.elif defined(NEED_MAKE_UPGRADE) 204253616Ssjg# It may not exist yet but we may cause it to. 205253616Ssjg# In the case of fmake, upgrade_checks may cause a newer version to be built. 206253616SsjgSUB_MAKE= `test -x ${MYMAKE} && echo ${MYMAKE} || echo ${MAKE}` \ 207117229Sru -m ${.CURDIR}/share/mk 208253616Ssjg.else 209253616SsjgSUB_MAKE= ${MAKE} -m ${.CURDIR}/share/mk 210253616Ssjg.endif 21154324Smarcel 212304494Sbdrewery_MAKE= PATH=${PATH} MAKE_CMD=${MAKE} ${SUB_MAKE} -f Makefile.inc1 \ 213304494Sbdrewery TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH} 214253616Ssjg 215301887Sbdrewery# Only allow meta mode for the whitelisted targets. See META_TGT_WHITELIST 216301887Sbdrewery# above. 217301887Sbdrewery.for _tgt in ${META_TGT_WHITELIST} 218301887Sbdrewery.if make(${_tgt}) 219301887Sbdrewery_CAN_USE_META_MODE?= yes 220301887Sbdrewery.endif 221301887Sbdrewery.endfor 222301887Sbdrewery.if !defined(_CAN_USE_META_MODE) 223298220Sbdrewery_MAKE+= MK_META_MODE=no 224302067Sbdrewery.if defined(.PARSEDIR) 225298221Sbdrewery.unexport META_MODE 226302067Sbdrewery.endif 227301893Sbdrewery.elif defined(MK_META_MODE) && ${MK_META_MODE} == "yes" 228301888Sbdrewery.if !exists(/dev/filemon) && !defined(NO_FILEMON) && !make(showconfig) 229301888Sbdrewery# Require filemon be loaded to provide a working incremental build 230301888Sbdrewery.error ${.newline}ERROR: The filemon module (/dev/filemon) is not loaded. \ 231301888Sbdrewery ${.newline}ERROR: WITH_META_MODE is enabled but requires filemon for an incremental build. \ 232301888Sbdrewery ${.newline}ERROR: 'kldload filemon' or pass -DNO_FILEMON to suppress this error. 233301888Sbdrewery.endif # !exists(/dev/filemon) && !defined(NO_FILEMON) 234301887Sbdrewery.endif # !defined(_CAN_USE_META_MODE) 235298220Sbdrewery 236218130Simp# Guess machine architecture from machine type, and vice versa. 237218130Simp.if !defined(TARGET_ARCH) && defined(TARGET) 238280259Sandrew_TARGET_ARCH= ${TARGET:S/pc98/i386/:S/arm64/aarch64/} 239218130Simp.elif !defined(TARGET) && defined(TARGET_ARCH) && \ 240218130Simp ${TARGET_ARCH} != ${MACHINE_ARCH} 241300119Simp_TARGET= ${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/aarch64/arm64/:C/powerpc64/powerpc/:C/riscv64/riscv/} 242218130Simp.endif 243218130Simp.if defined(TARGET) && !defined(_TARGET) 244218130Simp_TARGET=${TARGET} 245218130Simp.endif 246218130Simp.if defined(TARGET_ARCH) && !defined(_TARGET_ARCH) 247218130Simp_TARGET_ARCH=${TARGET_ARCH} 248218130Simp.endif 249269048Simp# for historical compatibility for xdev targets 250269048Simp.if defined(XDEV) 251269048Simp_TARGET= ${XDEV} 252269048Simp.endif 253269048Simp.if defined(XDEV_ARCH) 254269048Simp_TARGET_ARCH= ${XDEV_ARCH} 255269048Simp.endif 256218130Simp# Otherwise, default to current machine type and architecture. 257218130Simp_TARGET?= ${MACHINE} 258218130Simp_TARGET_ARCH?= ${MACHINE_ARCH} 259218130Simp 26017308Speter# 261119519Smarcel# Make sure we have an up-to-date make(1). Only world and buildworld 262119519Smarcel# should do this as those are the initial targets used for upgrades. 263119519Smarcel# The user can define ALWAYS_CHECK_MAKE to have this check performed 264119519Smarcel# for all targets. 265119519Smarcel# 266293342Sbdrewery.if defined(ALWAYS_CHECK_MAKE) || !defined(.PARSEDIR) 267119579Sru${TGTS}: upgrade_checks 268119519Smarcel.else 269119519Smarcelbuildworld: upgrade_checks 270119519Smarcel.endif 271119519Smarcel 272119519Smarcel# 27338666Sjb# Handle the user-driven targets, using the source relative mk files. 27417308Speter# 275119519Smarcel 276254417Ssjgtinderbox toolchains kernel-toolchains: .MAKE 277289460Sbdrewery${TGTS}: .PHONY .MAKE 278218206Simp ${_+_}@cd ${.CURDIR}; ${_MAKE} ${.TARGET} 2792302Spaul 280265097Sbrooks# The historic default "all" target creates files which may cause stale 281265097Sbrooks# or (in the cross build case) unlinkable results. Fail with an error 282265097Sbrooks# when no target is given. The users can explicitly specify "all" 283265097Sbrooks# if they want the historic behavior. 284265097Sbrooks.MAIN: _guard 28539206Sjkh 286289411Sbdrewery_guard: .PHONY 287265097Sbrooks @echo 288289432Sbdrewery @echo "Explicit target required. Likely \"${SUBDIR_OVERRIDE:Dall:Ubuildworld}\" is wanted. See build(7)." 289265097Sbrooks @echo 290265097Sbrooks @false 291265097Sbrooks 292133945SruSTARTTIME!= LC_ALL=C date 293240403SobrienCHECK_TIME!= find ${.CURDIR}/sys/sys/param.h -mtime -0s ; echo 294177609Sru.if !empty(CHECK_TIME) 295177609Sru.error check your date/time: ${STARTTIME} 296177609Sru.endif 297133945Sru 298132358Smarkm.if defined(HISTORICAL_MAKE_WORLD) || defined(DESTDIR) 29917308Speter# 30054324Smarcel# world 30154324Smarcel# 302132234Smarcel# Attempt to rebuild and reinstall everything. This target is not to be 303132234Smarcel# used for upgrading an existing FreeBSD system, because the kernel is 304132234Smarcel# not included. One can argue that this target doesn't build everything 305132234Smarcel# then. 30654324Smarcel# 307301885Sbdreweryworld: upgrade_checks .PHONY 30854324Smarcel @echo "--------------------------------------------------------------" 309118531Sru @echo ">>> make world started on ${STARTTIME}" 31054324Smarcel @echo "--------------------------------------------------------------" 31154324Smarcel.if target(pre-world) 31254324Smarcel @echo 31354324Smarcel @echo "--------------------------------------------------------------" 31454324Smarcel @echo ">>> Making 'pre-world' target" 31554324Smarcel @echo "--------------------------------------------------------------" 316133376Sharti ${_+_}@cd ${.CURDIR}; ${_MAKE} pre-world 31754324Smarcel.endif 318133376Sharti ${_+_}@cd ${.CURDIR}; ${_MAKE} buildworld 319133376Sharti ${_+_}@cd ${.CURDIR}; ${_MAKE} -B installworld 32054324Smarcel.if target(post-world) 32154324Smarcel @echo 32254324Smarcel @echo "--------------------------------------------------------------" 32354324Smarcel @echo ">>> Making 'post-world' target" 32454324Smarcel @echo "--------------------------------------------------------------" 325133376Sharti ${_+_}@cd ${.CURDIR}; ${_MAKE} post-world 32654324Smarcel.endif 32754324Smarcel @echo 32854324Smarcel @echo "--------------------------------------------------------------" 329118531Sru @echo ">>> make world completed on `LC_ALL=C date`" 330118531Sru @echo " (started ${STARTTIME})" 33154324Smarcel @echo "--------------------------------------------------------------" 332132234Smarcel.else 333301885Sbdreweryworld: .PHONY 334132234Smarcel @echo "WARNING: make world will overwrite your existing FreeBSD" 335132234Smarcel @echo "installation without also building and installing a new" 336132234Smarcel @echo "kernel. This can be dangerous. Please read the handbook," 337132588Skensmith @echo "'Rebuilding world', for how to upgrade your system." 338132358Smarkm @echo "Define DESTDIR to where you want to install FreeBSD," 339132234Smarcel @echo "including /, to override this warning and proceed as usual." 340132358Smarkm @echo "" 341132234Smarcel @echo "Bailing out now..." 342132234Smarcel @false 343132234Smarcel.endif 34454324Smarcel 34554324Smarcel# 34695730Sru# kernel 34795730Sru# 34895730Sru# Short hand for `make buildkernel installkernel' 34995730Sru# 350301885Sbdrewerykernel: buildkernel installkernel .PHONY 35195730Sru 35295730Sru# 35338666Sjb# Perform a few tests to determine if the installed tools are adequate 354107374Sru# for building the world. 35517308Speter# 356301885Sbdreweryupgrade_checks: .PHONY 357301465Sbdrewery.if defined(NEED_MAKE_UPGRADE) 358296643Sbdrewery @${_+_}(cd ${.CURDIR} && ${MAKE} ${WANT_MAKE:S,^f,,}) 359241298Smarcel.endif 3602061Sjkh 36117308Speter# 362107516Sru# Upgrade make(1) to the current version using the installed 363174539Simp# headers, libraries and tools. Also, allow the location of 364174539Simp# the system bsdmake-like utility to be overridden. 36555678Smarcel# 366253616SsjgMMAKEENV= MAKEOBJDIRPREFIX=${MYMAKE:H} \ 367107516Sru DESTDIR= \ 368107516Sru INSTALL="sh ${.CURDIR}/tools/install.sh" 369174564SimpMMAKE= ${MMAKEENV} ${MAKE} \ 370296675Sbdrewery MAN= -DNO_SHARED \ 371264742Sjmmv -DNO_CPU_CFLAGS -DNO_WERROR \ 372296676Sbdrewery -DNO_SUBDIR \ 373265827Simp DESTDIR= PROGNAME=${MYMAKE:T} 374107516Sru 375265827Simpbmake: .PHONY 37655678Smarcel @echo 37755678Smarcel @echo "--------------------------------------------------------------" 378265827Simp @echo ">>> Building an up-to-date ${.TARGET}(1)" 37955678Smarcel @echo "--------------------------------------------------------------" 380249395Ssjg ${_+_}@cd ${.CURDIR}/usr.bin/${.TARGET}; \ 381291605Sbdrewery ${MMAKE} obj; \ 382291605Sbdrewery ${MMAKE} depend; \ 383291605Sbdrewery ${MMAKE} all; \ 384265827Simp ${MMAKE} install DESTDIR=${MYMAKE:H} BINDIR= 38555678Smarcel 386295380Sngieregress: .PHONY 387295380Sngie @echo "'make regress' has been renamed 'make check'" | /usr/bin/fmt 388295380Sngie @false 389295380Sngie 390295099Siantinderbox toolchains kernel-toolchains kernels worlds: upgrade_checks 391254417Ssjg 392301885Sbdrewerytinderbox: .PHONY 393291605Sbdrewery @cd ${.CURDIR}; ${SUB_MAKE} DOING_TINDERBOX=YES universe 394185499Salfred 395301885Sbdrewerytoolchains: .PHONY 396291605Sbdrewery @cd ${.CURDIR}; ${SUB_MAKE} UNIVERSE_TARGET=toolchain universe 397218524Sjhb 398301885Sbdrewerykernel-toolchains: .PHONY 399291605Sbdrewery @cd ${.CURDIR}; ${SUB_MAKE} UNIVERSE_TARGET=kernel-toolchain universe 400232907Sjmallett 401301885Sbdrewerykernels: .PHONY 402295099Sian @cd ${.CURDIR}; ${SUB_MAKE} UNIVERSE_TARGET=buildkernel universe 403295099Sian 404301885Sbdreweryworlds: .PHONY 405295099Sian @cd ${.CURDIR}; ${SUB_MAKE} UNIVERSE_TARGET=buildworld universe 406295099Sian 40755678Smarcel# 408111131Sru# universe 409111131Sru# 410111131Sru# Attempt to rebuild *everything* for all supported architectures, 411133945Sru# with a reasonable chance of success, regardless of how old your 412111131Sru# existing system is. 413111131Sru# 414217125Simp.if make(universe) || make(universe_kernels) || make(tinderbox) || make(targets) 415287903SbdreweryTARGETS?=amd64 arm arm64 i386 mips pc98 powerpc sparc64 416287903Sbdrewery_UNIVERSE_TARGETS= ${TARGETS} 417300119SimpTARGET_ARCHES_arm?= arm armeb armv6 418282156SemasteTARGET_ARCHES_arm64?= aarch64 419233644SjmallettTARGET_ARCHES_mips?= mipsel mips mips64el mips64 mipsn32 420216520SnwhitehornTARGET_ARCHES_powerpc?= powerpc powerpc64 421216520SnwhitehornTARGET_ARCHES_pc98?= i386 422287903Sbdrewery.for target in ${TARGETS} 423216520SnwhitehornTARGET_ARCHES_${target}?= ${target} 424216520Snwhitehorn.endfor 425168280Smarcel 426301938Sbdrewery# XXX Remove arm64 from universe if the required binutils package is missing. 427287903Sbdrewery# It does not build with the in-tree linker. 428301938Sbdrewery.if !exists(/usr/local/aarch64-freebsd/bin/ld) && ${TARGETS:Marm64} 429287903Sbdrewery_UNIVERSE_TARGETS:= ${_UNIVERSE_TARGETS:Narm64} 430301885Sbdreweryuniverse: universe_arm64_skip .PHONY 431301885Sbdreweryuniverse_epilogue: universe_arm64_skip .PHONY 432301885Sbdreweryuniverse_arm64_skip: universe_prologue .PHONY 433287903Sbdrewery @echo ">> arm64 skipped - install aarch64-binutils port or package to build" 434287903Sbdrewery.endif 435287903Sbdrewery 436218524Sjhb.if defined(UNIVERSE_TARGET) 437218524SjhbMAKE_JUST_WORLDS= YES 438218524Sjhb.else 439218524SjhbUNIVERSE_TARGET?= buildworld 440218524Sjhb.endif 441219137SjhbKERNSRCDIR?= ${.CURDIR}/sys 442218524Sjhb 443284699Ssjgtargets: .PHONY 444217815Sbz @echo "Supported TARGET/TARGET_ARCH pairs for world and kernel targets" 445287903Sbdrewery.for target in ${TARGETS} 446217125Simp.for target_arch in ${TARGET_ARCHES_${target}} 447217125Simp @echo " ${target}/${target_arch}" 448217125Simp.endfor 449217125Simp.endfor 450217125Simp 451185499Salfred.if defined(DOING_TINDERBOX) 452217735SbzFAILFILE=${.CURDIR}/_.tinderbox.failed 453185499SalfredMAKEFAIL=tee -a ${FAILFILE} 454185499Salfred.else 455185499SalfredMAKEFAIL=cat 456185499Salfred.endif 457185499Salfred 458253616Ssjguniverse_prologue: upgrade_checks 459253616Ssjguniverse: universe_prologue 460297993Sbdreweryuniverse_prologue: .PHONY 461103985Sphk @echo "--------------------------------------------------------------" 462103985Sphk @echo ">>> make universe started on ${STARTTIME}" 463103985Sphk @echo "--------------------------------------------------------------" 464185499Salfred.if defined(DOING_TINDERBOX) 465217754Sbz @rm -f ${FAILFILE} 466185499Salfred.endif 467287903Sbdrewery.for target in ${_UNIVERSE_TARGETS} 468162147Sruuniverse: universe_${target} 469253616Ssjguniverse_epilogue: universe_${target} 470301885Sbdreweryuniverse_${target}: universe_${target}_prologue .PHONY 471301885Sbdreweryuniverse_${target}_prologue: universe_prologue .PHONY 472216520Snwhitehorn @echo ">> ${target} started on `LC_ALL=C date`" 473301885Sbdreweryuniverse_${target}_worlds: .PHONY 474284456Sandrew 475179232Sjb.if !defined(MAKE_JUST_KERNELS) 476301885Sbdreweryuniverse_${target}_done: universe_${target}_worlds .PHONY 477216520Snwhitehorn.for target_arch in ${TARGET_ARCHES_${target}} 478301885Sbdreweryuniverse_${target}_worlds: universe_${target}_${target_arch} .PHONY 479301885Sbdreweryuniverse_${target}_${target_arch}: universe_${target}_prologue .MAKE .PHONY 480218524Sjhb @echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} started on `LC_ALL=C date`" 481185250Sdes @(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \ 482253616Ssjg ${SUB_MAKE} ${JFLAG} ${UNIVERSE_TARGET} \ 483162147Sru TARGET=${target} \ 484216520Snwhitehorn TARGET_ARCH=${target_arch} \ 485218524Sjhb > _.${target}.${target_arch}.${UNIVERSE_TARGET} 2>&1 || \ 486218524Sjhb (echo "${target}.${target_arch} ${UNIVERSE_TARGET} failed," \ 487218524Sjhb "check _.${target}.${target_arch}.${UNIVERSE_TARGET} for details" | \ 488216520Snwhitehorn ${MAKEFAIL})) 489218524Sjhb @echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} completed on `LC_ALL=C date`" 490216520Snwhitehorn.endfor 491284453Sandrew.endif # !MAKE_JUST_KERNELS 492284453Sandrew 493205290Sdougb.if !defined(MAKE_JUST_WORLDS) 494301885Sbdreweryuniverse_${target}_done: universe_${target}_kernels .PHONY 495301885Sbdreweryuniverse_${target}_kernels: universe_${target}_worlds .PHONY 496301885Sbdreweryuniverse_${target}_kernels: universe_${target}_prologue .MAKE .PHONY 497219137Sjhb.if exists(${KERNSRCDIR}/${target}/conf/NOTES) 498219137Sjhb @(cd ${KERNSRCDIR}/${target}/conf && env __MAKE_CONF=/dev/null \ 499253616Ssjg ${SUB_MAKE} LINT > ${.CURDIR}/_.${target}.makeLINT 2>&1 || \ 500185499Salfred (echo "${target} 'make LINT' failed," \ 501185499Salfred "check _.${target}.makeLINT for details"| ${MAKEFAIL})) 502103985Sphk.endif 503291605Sbdrewery @cd ${.CURDIR}; ${SUB_MAKE} ${.MAKEFLAGS} TARGET=${target} \ 504201815Sbz universe_kernels 505284453Sandrew.endif # !MAKE_JUST_WORLDS 506284457Sandrew 507284457Sandrew# Tell the user the worlds and kernels have completed 508284457Sandrewuniverse_${target}: universe_${target}_done 509284457Sandrewuniverse_${target}_done: 510201815Sbz @echo ">> ${target} completed on `LC_ALL=C date`" 511201815Sbz.endfor 512301885Sbdreweryuniverse_kernels: universe_kernconfs .PHONY 513202095Sbz.if !defined(TARGET) 514202095SbzTARGET!= uname -m 515202095Sbz.endif 516265155Simp.if defined(MAKE_ALL_KERNELS) 517265155Simp_THINNER=cat 518265155Simp.else 519265840Simp_THINNER=xargs grep -L "^.NO_UNIVERSE" || true 520265155Simp.endif 521219137SjhbKERNCONFS!= cd ${KERNSRCDIR}/${TARGET}/conf && \ 522295455Sbapt find [[:upper:][:digit:]]*[[:upper:][:digit:]] \ 523295455Sbapt -type f -maxdepth 0 \ 524265155Simp ! -name DEFAULTS ! -name NOTES | \ 525265155Simp ${_THINNER} 526301885Sbdreweryuniverse_kernconfs: .PHONY 527148154Sru.for kernel in ${KERNCONFS} 528219137SjhbTARGET_ARCH_${kernel}!= cd ${KERNSRCDIR}/${TARGET}/conf && \ 529219137Sjhb config -m ${KERNSRCDIR}/${TARGET}/conf/${kernel} 2> /dev/null | \ 530216934Simp grep -v WARNING: | cut -f 2 531216934Simp.if empty(TARGET_ARCH_${kernel}) 532216934Simp.error "Target architecture for ${TARGET}/conf/${kernel} unknown. config(8) likely too old." 533216934Simp.endif 534216520Snwhitehornuniverse_kernconfs: universe_kernconf_${TARGET}_${kernel} 535254417Ssjguniverse_kernconf_${TARGET}_${kernel}: .MAKE 536185250Sdes @(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \ 537253616Ssjg ${SUB_MAKE} ${JFLAG} buildkernel \ 538201815Sbz TARGET=${TARGET} \ 539216520Snwhitehorn TARGET_ARCH=${TARGET_ARCH_${kernel}} \ 540148154Sru KERNCONF=${kernel} \ 541201815Sbz > _.${TARGET}.${kernel} 2>&1 || \ 542201815Sbz (echo "${TARGET} ${kernel} kernel failed," \ 543201815Sbz "check _.${TARGET}.${kernel} for details"| ${MAKEFAIL})) 544148154Sru.endfor 545133945Sruuniverse: universe_epilogue 546297993Sbdreweryuniverse_epilogue: .PHONY 547103985Sphk @echo "--------------------------------------------------------------" 548118531Sru @echo ">>> make universe completed on `LC_ALL=C date`" 549118531Sru @echo " (started ${STARTTIME})" 550103985Sphk @echo "--------------------------------------------------------------" 551185499Salfred.if defined(DOING_TINDERBOX) 552185499Salfred @if [ -e ${FAILFILE} ] ; then \ 553185499Salfred echo "Tinderbox failed:" ;\ 554185499Salfred cat ${FAILFILE} ;\ 555185499Salfred exit 1 ;\ 556185499Salfred fi 557133945Sru.endif 558185499Salfred.endif 559242522Smarcel 560301885SbdrewerybuildLINT: .PHONY 561242522Smarcel ${MAKE} -C ${.CURDIR}/sys/${_TARGET}/conf LINT 562255286Ssjg 563284454Simp.if defined(.PARSEDIR) 564284345Ssjg# This makefile does not run in meta mode 565284345Ssjg.MAKE.MODE= normal 566284345Ssjg# Normally the things we run from here don't either. 567290816Ssjg# Using -DWITH_META_MODE 568284345Ssjg# we can buildworld with meta files created which are useful 569284345Ssjg# for debugging, but without any of the rest of a meta mode build. 570290816SsjgMK_DIRDEPS_BUILD= no 571284345SsjgMK_STAGING= no 572284345Ssjg# tell meta.autodep.mk to not even think about updating anything. 573284345SsjgUPDATE_DEPENDFILE= NO 574285080Ssjg.if !make(showconfig) 575290816Ssjg.export MK_DIRDEPS_BUILD MK_STAGING UPDATE_DEPENDFILE 576285080Ssjg.endif 577284345Ssjg 578255286Ssjg.if make(universe) 579255286Ssjg# we do not want a failure of one branch abort all. 580255286SsjgMAKE_JOB_ERROR_TOKEN= no 581255286Ssjg.export MAKE_JOB_ERROR_TOKEN 582255286Ssjg.endif 583284454Simp.endif # bmake 584284345Ssjg 585290816Ssjg.endif # DIRDEPS_BUILD 586