12061Sjkh# 250479Speter# $FreeBSD: stable/10/Makefile 335927 2018-07-04 03:24:11Z dteske $ 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). 24313790Sngie# 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. 36264811Sbrueffer# xdev - xdev-build + xdev-install for the architecture 37264811Sbrueffer# specified with XDEV and XDEV_ARCH. 38264811Sbrueffer# xdev-build - Build cross-development tools. 39264811Sbrueffer# xdev-install - Install cross-development tools. 40281836Sgarga# native-xtools - Create host binaries that produce target objects 41281836Sgarga# for use in qemu user-mode jails. 42253002Salfred# 43253002Salfred# "quick" way to test all kernel builds: 44253002Salfred# _jflag=`sysctl -n hw.ncpu` 45253002Salfred# _jflag=$(($_jflag * 2)) 46253002Salfred# [ $_jflag -gt 12 ] && _jflag=12 47253003Salfred# make universe -DMAKE_JUST_KERNELS JFLAG=-j${_jflag} 4832427Sjb# 4938666Sjb# This makefile is simple by design. The FreeBSD make automatically reads 50108451Sschweikh# the /usr/share/mk/sys.mk unless the -m argument is specified on the 5138666Sjb# command line. By keeping this makefile simple, it doesn't matter too 5238666Sjb# much how different the installed mk files are from those in the source 5338666Sjb# tree. This makefile executes a child make process, forcing it to use 5438666Sjb# the mk files from the source tree which are supposed to DTRT. 5517308Speter# 56217273Simp# Most of the user-driven targets (as listed above) are implemented in 57217294Simp# Makefile.inc1. The exceptions are universe, tinderbox and targets. 5819175Sbde# 5996205Sjwd# If you want to build your system from source be sure that /usr/obj has 60217297Simp# at least 1GB of diskspace available. A complete 'universe' build requires 61217297Simp# about 15GB of space. 6238042Sbde# 6396205Sjwd# For individuals wanting to build from the sources currently on their 6496205Sjwd# system, the simple instructions are: 6538042Sbde# 6696205Sjwd# 1. `cd /usr/src' (or to the directory containing your source tree). 67159363Strhodes# 2. Define `HISTORICAL_MAKE_WORLD' variable (see README). 68159363Strhodes# 3. `make world' 6917308Speter# 7096205Sjwd# For individuals wanting to upgrade their sources (even if only a 7196205Sjwd# delta of a few days): 7217308Speter# 73148330Snetchild# 1. `cd /usr/src' (or to the directory containing your source tree). 74148330Snetchild# 2. `make buildworld' 75148330Snetchild# 3. `make buildkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC). 76148330Snetchild# 4. `make installkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC). 77159831Sobrien# [steps 3. & 4. can be combined by using the "kernel" target] 78148330Snetchild# 5. `reboot' (in single user mode: boot -s from the loader prompt). 79148330Snetchild# 6. `mergemaster -p' 80148330Snetchild# 7. `make installworld' 81251107Screes# 8. `mergemaster' (you may wish to use -i, along with -U or -F). 82251107Screes# 9. `make delete-old' 83148330Snetchild# 10. `reboot' 84148330Snetchild# 11. `make delete-old-libs' (in case no 3rd party program uses them anymore) 8596205Sjwd# 8696205Sjwd# See src/UPDATING `COMMON ITEMS' for more complete information. 8796205Sjwd# 88162147Sru# If TARGET=machine (e.g. ia64, sparc64, ...) is specified you can 89162147Sru# cross build world for other machine types using the buildworld target, 9098723Sdillon# and once the world is built you can cross build a kernel using the 9198723Sdillon# buildkernel target. 9298723Sdillon# 9338666Sjb# Define the user-driven targets. These are listed here in alphabetical 9438666Sjb# order, but that's not important. 9517308Speter# 96123311Speter# Targets that begin with underscore are internal targets intended for 97123311Speter# developer convenience only. They are intentionally not documented and 98123311Speter# completely subject to change without notice. 99123311Speter# 100175833Sjhb# For more information, see the build(7) manual page. 101175833Sjhb# 102169597SdesTGTS= all all-man buildenv buildenvvars buildkernel buildworld \ 103313790Sngie check check-old check-old-dirs check-old-files check-old-libs \ 104313790Sngie checkdpadd checkworld clean cleandepend cleandir \ 105169597Sdes delete-old delete-old-dirs delete-old-files delete-old-libs \ 106219177Snwhitehorn depend distribute distributekernel distributekernel.debug \ 107219177Snwhitehorn distributeworld distrib-dirs distribution doxygen \ 108238051Sobrien everything hier hierarchy install installcheck installkernel \ 109219177Snwhitehorn installkernel.debug packagekernel packageworld \ 110219177Snwhitehorn reinstallkernel reinstallkernel.debug \ 111158962Snetchild installworld kernel-toolchain libraries lint maninstall \ 112313790Sngie obj objlink rerelease showconfig tags toolchain update \ 113123311Speter _worldtmp _legacy _bootstrap-tools _cleanobj _obj \ 114137288Speter _build-tools _cross-tools _includes _libraries _depend \ 115209128Sraj build32 builddtb distribute32 install32 xdev xdev-build xdev-install \ 116281836Sgarga native-xtools \ 117209128Sraj 118156740SruTGTS+= ${SUBDIR_TARGETS} 1192061Sjkh 12097769SruBITGTS= files includes 12197252SruBITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/} 122119579SruTGTS+= ${BITGTS} 12397252Sru 12495730Sru.ORDER: buildworld installworld 12595793Sru.ORDER: buildworld distributeworld 126111617Sru.ORDER: buildworld buildkernel 127296748Sbdrewery.ORDER: installworld distribution 128296748Sbdrewery.ORDER: installworld installkernel 12995730Sru.ORDER: buildkernel installkernel 130116679Ssimokawa.ORDER: buildkernel installkernel.debug 13195730Sru.ORDER: buildkernel reinstallkernel 132116679Ssimokawa.ORDER: buildkernel reinstallkernel.debug 13395730Sru 134110035SruPATH= /sbin:/bin:/usr/sbin:/usr/bin 135107516SruMAKEOBJDIRPREFIX?= /usr/obj 136138921Sru_MAKEOBJDIRPREFIX!= /usr/bin/env -i PATH=${PATH} ${MAKE} \ 137156145Syar ${.MAKEFLAGS:MMAKEOBJDIRPREFIX=*} __MAKE_CONF=${__MAKE_CONF} \ 138138921Sru -f /dev/null -V MAKEOBJDIRPREFIX dummy 139133942Sru.if !empty(_MAKEOBJDIRPREFIX) 140133942Sru.error MAKEOBJDIRPREFIX can only be set in environment, not as a global\ 141156145Syar (in make.conf(5)) or command-line variable. 142133942Sru.endif 143253616Ssjg 144253616Ssjg# We often need to use the tree's version of make to build it. 145253616Ssjg# Choices add to complexity though. 146253616Ssjg# We cannot blindly use a make which may not be the one we want 147335927Sdteske# so be explicit - until all choice is removed. 148253616Ssjg.if !defined(WITHOUT_BMAKE) 149253616SsjgWANT_MAKE= bmake 150253616Ssjg.else 151253616SsjgWANT_MAKE= fmake 152253616Ssjg.endif 153253616SsjgMYMAKE= ${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE}/${WANT_MAKE} 154253616Ssjg.if defined(.PARSEDIR) 155253616SsjgHAVE_MAKE= bmake 156253616Ssjg.else 157253616SsjgHAVE_MAKE= fmake 158253616Ssjg.endif 159321341Sbdrewery.if defined(ALWAYS_BOOTSTRAP_MAKE) || \ 160321341Sbdrewery ${HAVE_MAKE} != ${WANT_MAKE} || \ 161301738Sbdrewery (defined(WANT_MAKE_VERSION) && ${MAKE_VERSION} < ${WANT_MAKE_VERSION}) 162301738SbdreweryNEED_MAKE_UPGRADE= t 163301738Sbdrewery.endif 164253616Ssjg.if exists(${MYMAKE}) 165253616SsjgSUB_MAKE:= ${MYMAKE} -m ${.CURDIR}/share/mk 166301738Sbdrewery.elif defined(NEED_MAKE_UPGRADE) || ${WANT_MAKE} != "bmake" 167253616Ssjg# It may not exist yet but we may cause it to. 168253616Ssjg# In the case of fmake, upgrade_checks may cause a newer version to be built. 169253616SsjgSUB_MAKE= `test -x ${MYMAKE} && echo ${MYMAKE} || echo ${MAKE}` \ 170117229Sru -m ${.CURDIR}/share/mk 171253616Ssjg.else 172253616SsjgSUB_MAKE= ${MAKE} -m ${.CURDIR}/share/mk 173253616Ssjg.endif 17454324Smarcel 175253616Ssjg_MAKE= PATH=${PATH} ${SUB_MAKE} -f Makefile.inc1 TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH} 176253616Ssjg 177218130Simp# Guess machine architecture from machine type, and vice versa. 178218130Simp.if !defined(TARGET_ARCH) && defined(TARGET) 179233644Sjmallett_TARGET_ARCH= ${TARGET:S/pc98/i386/} 180218130Simp.elif !defined(TARGET) && defined(TARGET_ARCH) && \ 181218130Simp ${TARGET_ARCH} != ${MACHINE_ARCH} 182239272Sgonzo_TARGET= ${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/} 183218130Simp.endif 184233644Sjmallett# Legacy names, for another transition period mips:mips(n32|64)?eb -> mips:mips\1 185218130Simp.if defined(TARGET) && defined(TARGET_ARCH) && \ 186233644Sjmallett ${TARGET} == "mips" && ${TARGET_ARCH:Mmips*eb} 187233644Sjmallett_TARGET_ARCH= ${TARGET_ARCH:C/eb$//} 188233644Sjmallett.warning "TARGET_ARCH of ${TARGET_ARCH} is deprecated in favor of ${_TARGET_ARCH}" 189218130Simp.endif 190233644Sjmallett.if defined(TARGET) && ${TARGET} == "mips" && defined(TARGET_BIG_ENDIAN) 191233644Sjmallett.warning "TARGET_BIG_ENDIAN is no longer necessary for MIPS. Big-endian is not the default." 192218130Simp.endif 193218130Simp# arm with TARGET_BIG_ENDIAN -> armeb 194218130Simp.if defined(TARGET_ARCH) && ${TARGET_ARCH} == "arm" && defined(TARGET_BIG_ENDIAN) 195218130Simp.warning "TARGET_ARCH of arm with TARGET_BIG_ENDIAN is deprecated. use armeb" 196218130Simp_TARGET_ARCH=armeb 197218130Simp.endif 198218130Simp.if defined(TARGET) && !defined(_TARGET) 199218130Simp_TARGET=${TARGET} 200218130Simp.endif 201218130Simp.if defined(TARGET_ARCH) && !defined(_TARGET_ARCH) 202218130Simp_TARGET_ARCH=${TARGET_ARCH} 203218130Simp.endif 204218130Simp# Otherwise, default to current machine type and architecture. 205218130Simp_TARGET?= ${MACHINE} 206218130Simp_TARGET_ARCH?= ${MACHINE_ARCH} 207218130Simp 20817308Speter# 209119519Smarcel# Make sure we have an up-to-date make(1). Only world and buildworld 210119519Smarcel# should do this as those are the initial targets used for upgrades. 211119519Smarcel# The user can define ALWAYS_CHECK_MAKE to have this check performed 212119519Smarcel# for all targets. 213119519Smarcel# 214294045Sbdrewery.if defined(ALWAYS_CHECK_MAKE) || !defined(.PARSEDIR) 215119579Sru${TGTS}: upgrade_checks 216119519Smarcel.else 217119519Smarcelbuildworld: upgrade_checks 218119519Smarcel.endif 219119519Smarcel 220119519Smarcel# 221126031Sgad# This 'cleanworld' target is not included in TGTS, because it is not a 222126024Sgad# recursive target. All of the work for it is done right here. It is 223126024Sgad# expected that BW_CANONICALOBJDIR == the CANONICALOBJDIR as would be 224126024Sgad# created by bsd.obj.mk, except that we don't want to .include that file 225126024Sgad# in this makefile. 226126024Sgad# 227126024Sgad# In the following, the first 'rm' in a series will usually remove all 228126024Sgad# files and directories. If it does not, then there are probably some 229227771Sgjb# files with file flags set, so this unsets them and tries the 'rm' a 230126024Sgad# second time. There are situations where this target will be cleaning 231126024Sgad# some directories via more than one method, but that duplication is 232227769Sgjb# needed to correctly handle all the possible situations. Removing all 233227771Sgjb# files without file flags set in the first 'rm' instance saves time, 234227771Sgjb# because 'chflags' will need to operate on fewer files afterwards. 235126024Sgad# 236126024SgadBW_CANONICALOBJDIR:=${MAKEOBJDIRPREFIX}${.CURDIR} 237126031Sgadcleanworld: 238126024Sgad.if ${.CURDIR} == ${.OBJDIR} || ${.CURDIR}/obj == ${.OBJDIR} 239126024Sgad.if exists(${BW_CANONICALOBJDIR}/) 240126024Sgad -rm -rf ${BW_CANONICALOBJDIR}/* 241172744Sdelphij -chflags -R 0 ${BW_CANONICALOBJDIR} 242126024Sgad rm -rf ${BW_CANONICALOBJDIR}/* 243126024Sgad.endif 244126024Sgad # To be safe in this case, fall back to a 'make cleandir' 245133376Sharti ${_+_}@cd ${.CURDIR}; ${_MAKE} cleandir 246126024Sgad.else 247126024Sgad -rm -rf ${.OBJDIR}/* 248172744Sdelphij -chflags -R 0 ${.OBJDIR} 249126024Sgad rm -rf ${.OBJDIR}/* 250126024Sgad.endif 251125885Sgad 252125885Sgad# 25338666Sjb# Handle the user-driven targets, using the source relative mk files. 25417308Speter# 255119519Smarcel 256289248Sbdrewery.if !(!empty(.MAKEFLAGS:M-n) && ${.MAKEFLAGS:M-n} == "-n") 257251750Ssjg# skip this for -n to avoid changing previous behavior of 258289248Sbdrewery# 'make -n buildworld' etc. Using -n -n will run it. 259251750Ssjg${TGTS}: .MAKE 260254417Ssjgtinderbox toolchains kernel-toolchains: .MAKE 261251750Ssjg.endif 262251750Ssjg 263291777Sbdrewery${TGTS}: .PHONY 264218206Simp ${_+_}@cd ${.CURDIR}; ${_MAKE} ${.TARGET} 2652302Spaul 266265449Sbrooks# The historic default "all" target creates files which may cause stale 267265449Sbrooks# or (in the cross build case) unlinkable results. Fail with an error 268265449Sbrooks# when no target is given. The users can explicitly specify "all" 269265449Sbrooks# if they want the historic behavior. 270265449Sbrooks.MAIN: _guard 27139206Sjkh 272265449Sbrooks_guard: 273265449Sbrooks @echo 274265449Sbrooks @echo "Explicit target required (use \"all\" for historic behavior)" 275265449Sbrooks @echo 276265449Sbrooks @false 277265449Sbrooks 278133945SruSTARTTIME!= LC_ALL=C date 279240403SobrienCHECK_TIME!= find ${.CURDIR}/sys/sys/param.h -mtime -0s ; echo 280177609Sru.if !empty(CHECK_TIME) 281177609Sru.error check your date/time: ${STARTTIME} 282177609Sru.endif 283133945Sru 284132358Smarkm.if defined(HISTORICAL_MAKE_WORLD) || defined(DESTDIR) 28517308Speter# 28654324Smarcel# world 28754324Smarcel# 288132234Smarcel# Attempt to rebuild and reinstall everything. This target is not to be 289132234Smarcel# used for upgrading an existing FreeBSD system, because the kernel is 290132234Smarcel# not included. One can argue that this target doesn't build everything 291132234Smarcel# then. 29254324Smarcel# 29354324Smarcelworld: upgrade_checks 29454324Smarcel @echo "--------------------------------------------------------------" 295118531Sru @echo ">>> make world started on ${STARTTIME}" 29654324Smarcel @echo "--------------------------------------------------------------" 29754324Smarcel.if target(pre-world) 29854324Smarcel @echo 29954324Smarcel @echo "--------------------------------------------------------------" 30054324Smarcel @echo ">>> Making 'pre-world' target" 30154324Smarcel @echo "--------------------------------------------------------------" 302133376Sharti ${_+_}@cd ${.CURDIR}; ${_MAKE} pre-world 30354324Smarcel.endif 304133376Sharti ${_+_}@cd ${.CURDIR}; ${_MAKE} buildworld 305133376Sharti ${_+_}@cd ${.CURDIR}; ${_MAKE} -B installworld 30654324Smarcel.if target(post-world) 30754324Smarcel @echo 30854324Smarcel @echo "--------------------------------------------------------------" 30954324Smarcel @echo ">>> Making 'post-world' target" 31054324Smarcel @echo "--------------------------------------------------------------" 311133376Sharti ${_+_}@cd ${.CURDIR}; ${_MAKE} post-world 31254324Smarcel.endif 31354324Smarcel @echo 31454324Smarcel @echo "--------------------------------------------------------------" 315118531Sru @echo ">>> make world completed on `LC_ALL=C date`" 316118531Sru @echo " (started ${STARTTIME})" 31754324Smarcel @echo "--------------------------------------------------------------" 318132234Smarcel.else 319132234Smarcelworld: 320132234Smarcel @echo "WARNING: make world will overwrite your existing FreeBSD" 321132234Smarcel @echo "installation without also building and installing a new" 322132234Smarcel @echo "kernel. This can be dangerous. Please read the handbook," 323132588Skensmith @echo "'Rebuilding world', for how to upgrade your system." 324132358Smarkm @echo "Define DESTDIR to where you want to install FreeBSD," 325132234Smarcel @echo "including /, to override this warning and proceed as usual." 326132358Smarkm @echo "" 327132234Smarcel @echo "Bailing out now..." 328132234Smarcel @false 329132234Smarcel.endif 33054324Smarcel 33154324Smarcel# 33295730Sru# kernel 33395730Sru# 33495730Sru# Short hand for `make buildkernel installkernel' 33595730Sru# 33695730Srukernel: buildkernel installkernel 33795730Sru 33895730Sru# 33938666Sjb# Perform a few tests to determine if the installed tools are adequate 340107374Sru# for building the world. 34117308Speter# 34255678Smarcelupgrade_checks: 343301738Sbdrewery.if defined(NEED_MAKE_UPGRADE) 344297035Sbdrewery @${_+_}(cd ${.CURDIR} && ${MAKE} ${WANT_MAKE:S,^f,,}) 345253616Ssjg.elif ${WANT_MAKE} == "fmake" 346143032Sharti @if ! (cd ${.CURDIR}/tools/build/make_check && \ 347138515Sharti PATH=${PATH} ${BINMAKE} obj >/dev/null 2>&1 && \ 348117793Sru PATH=${PATH} ${BINMAKE} >/dev/null 2>&1); \ 349110035Sru then \ 350174564Simp (cd ${.CURDIR} && ${MAKE} make); \ 351110035Sru fi 352241298Smarcel.endif 3532061Sjkh 35417308Speter# 355107516Sru# Upgrade make(1) to the current version using the installed 356174539Simp# headers, libraries and tools. Also, allow the location of 357174539Simp# the system bsdmake-like utility to be overridden. 35855678Smarcel# 359253616SsjgMMAKEENV= MAKEOBJDIRPREFIX=${MYMAKE:H} \ 360107516Sru DESTDIR= \ 361107516Sru INSTALL="sh ${.CURDIR}/tools/install.sh" 362174564SimpMMAKE= ${MMAKEENV} ${MAKE} \ 363107516Sru -D_UPGRADING \ 364139112Sru -DNOMAN -DNO_MAN -DNOSHARED -DNO_SHARED \ 365264996Sjmmv -DNO_CPU_CFLAGS -DNO_WERROR \ 366294044Sbdrewery DESTDIR= -DNO_TESTS PROGNAME=${MYMAKE:T} 367107516Sru 368249395Ssjgmake bmake: .PHONY 36955678Smarcel @echo 37055678Smarcel @echo "--------------------------------------------------------------" 371116696Sru @echo ">>> Building an up-to-date make(1)" 37255678Smarcel @echo "--------------------------------------------------------------" 373249395Ssjg ${_+_}@cd ${.CURDIR}/usr.bin/${.TARGET}; \ 374291976Sbdrewery ${MMAKE} obj; \ 375291976Sbdrewery ${MMAKE} depend; \ 376291976Sbdrewery ${MMAKE} all; \ 377255713Semaste ${MMAKE} install DESTDIR=${MYMAKE:H} BINDIR= 37855678Smarcel 379313790Sngieregress: .PHONY 380313790Sngie @echo "'make regress' has been renamed 'make check'" | /usr/bin/fmt 381313790Sngie @false 382313790Sngie 383254417Ssjgtinderbox toolchains kernel-toolchains: upgrade_checks 384254417Ssjg 385185499Salfredtinderbox: 386291976Sbdrewery @cd ${.CURDIR}; ${SUB_MAKE} DOING_TINDERBOX=YES universe 387185499Salfred 388218524Sjhbtoolchains: 389291976Sbdrewery @cd ${.CURDIR}; ${SUB_MAKE} UNIVERSE_TARGET=toolchain universe 390218524Sjhb 391232907Sjmallettkernel-toolchains: 392291976Sbdrewery @cd ${.CURDIR}; ${SUB_MAKE} UNIVERSE_TARGET=kernel-toolchain universe 393232907Sjmallett 39455678Smarcel# 395111131Sru# universe 396111131Sru# 397111131Sru# Attempt to rebuild *everything* for all supported architectures, 398133945Sru# with a reasonable chance of success, regardless of how old your 399111131Sru# existing system is. 400111131Sru# 401217125Simp.if make(universe) || make(universe_kernels) || make(tinderbox) || make(targets) 402221869SattilioTARGETS?=amd64 arm i386 ia64 mips pc98 powerpc sparc64 403255784SandrewTARGET_ARCHES_arm?= arm armeb armv6 404233644SjmallettTARGET_ARCHES_mips?= mipsel mips mips64el mips64 mipsn32 405216520SnwhitehornTARGET_ARCHES_powerpc?= powerpc powerpc64 406216520SnwhitehornTARGET_ARCHES_pc98?= i386 407216520Snwhitehorn.for target in ${TARGETS} 408216520SnwhitehornTARGET_ARCHES_${target}?= ${target} 409216520Snwhitehorn.endfor 410168280Smarcel 411218524Sjhb.if defined(UNIVERSE_TARGET) 412218524SjhbMAKE_JUST_WORLDS= YES 413218524Sjhb.else 414218524SjhbUNIVERSE_TARGET?= buildworld 415218524Sjhb.endif 416219137SjhbKERNSRCDIR?= ${.CURDIR}/sys 417218524Sjhb 418217125Simptargets: 419217815Sbz @echo "Supported TARGET/TARGET_ARCH pairs for world and kernel targets" 420217125Simp.for target in ${TARGETS} 421217125Simp.for target_arch in ${TARGET_ARCHES_${target}} 422217125Simp @echo " ${target}/${target_arch}" 423217125Simp.endfor 424217125Simp.endfor 425217125Simp 426185499Salfred.if defined(DOING_TINDERBOX) 427217735SbzFAILFILE=${.CURDIR}/_.tinderbox.failed 428185499SalfredMAKEFAIL=tee -a ${FAILFILE} 429185499Salfred.else 430185499SalfredMAKEFAIL=cat 431185499Salfred.endif 432185499Salfred 433253616Ssjguniverse_prologue: upgrade_checks 434253616Ssjguniverse: universe_prologue 435133945Sruuniverse_prologue: 436103985Sphk @echo "--------------------------------------------------------------" 437103985Sphk @echo ">>> make universe started on ${STARTTIME}" 438103985Sphk @echo "--------------------------------------------------------------" 439185499Salfred.if defined(DOING_TINDERBOX) 440217754Sbz @rm -f ${FAILFILE} 441185499Salfred.endif 442168280Smarcel.for target in ${TARGETS} 443162147Sruuniverse: universe_${target} 444253616Ssjguniverse_epilogue: universe_${target} 445216520Snwhitehornuniverse_${target}: universe_${target}_prologue 446253616Ssjguniverse_${target}_prologue: universe_prologue 447216520Snwhitehorn @echo ">> ${target} started on `LC_ALL=C date`" 448179232Sjb.if !defined(MAKE_JUST_KERNELS) 449216520Snwhitehorn.for target_arch in ${TARGET_ARCHES_${target}} 450216520Snwhitehornuniverse_${target}: universe_${target}_${target_arch} 451254417Ssjguniverse_${target}_${target_arch}: universe_${target}_prologue .MAKE 452218524Sjhb @echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} started on `LC_ALL=C date`" 453185250Sdes @(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \ 454253616Ssjg ${SUB_MAKE} ${JFLAG} ${UNIVERSE_TARGET} \ 455162147Sru TARGET=${target} \ 456216520Snwhitehorn TARGET_ARCH=${target_arch} \ 457218524Sjhb > _.${target}.${target_arch}.${UNIVERSE_TARGET} 2>&1 || \ 458218524Sjhb (echo "${target}.${target_arch} ${UNIVERSE_TARGET} failed," \ 459218524Sjhb "check _.${target}.${target_arch}.${UNIVERSE_TARGET} for details" | \ 460216520Snwhitehorn ${MAKEFAIL})) 461218524Sjhb @echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} completed on `LC_ALL=C date`" 462216520Snwhitehorn.endfor 463179232Sjb.endif 464205290Sdougb.if !defined(MAKE_JUST_WORLDS) 465248937Sandrew# If we are building world and kernels wait for the required worlds to finish 466248937Sandrew.if !defined(MAKE_JUST_KERNELS) 467248937Sandrew.for target_arch in ${TARGET_ARCHES_${target}} 468248937Sandrewuniverse_${target}_kernels: universe_${target}_${target_arch} 469248937Sandrew.endfor 470248937Sandrew.endif 471248937Sandrewuniverse_${target}: universe_${target}_kernels 472254417Ssjguniverse_${target}_kernels: universe_${target}_prologue .MAKE 473219137Sjhb.if exists(${KERNSRCDIR}/${target}/conf/NOTES) 474219137Sjhb @(cd ${KERNSRCDIR}/${target}/conf && env __MAKE_CONF=/dev/null \ 475253616Ssjg ${SUB_MAKE} LINT > ${.CURDIR}/_.${target}.makeLINT 2>&1 || \ 476185499Salfred (echo "${target} 'make LINT' failed," \ 477185499Salfred "check _.${target}.makeLINT for details"| ${MAKEFAIL})) 478103985Sphk.endif 479291976Sbdrewery @cd ${.CURDIR}; ${SUB_MAKE} ${.MAKEFLAGS} TARGET=${target} \ 480201815Sbz universe_kernels 481205290Sdougb.endif 482201815Sbz @echo ">> ${target} completed on `LC_ALL=C date`" 483201815Sbz.endfor 484201815Sbzuniverse_kernels: universe_kernconfs 485202095Sbz.if !defined(TARGET) 486202095SbzTARGET!= uname -m 487202095Sbz.endif 488266383Sian.if defined(MAKE_ALL_KERNELS) 489266383Sian_THINNER=cat 490266383Sian.else 491276281Sian_THINNER=xargs grep -L "^.NO_UNIVERSE" || true 492266383Sian.endif 493219137SjhbKERNCONFS!= cd ${KERNSRCDIR}/${TARGET}/conf && \ 494295679Sbapt find [[:upper:][:digit:]]*[[:upper:][:digit:]] \ 495295679Sbapt -type f -maxdepth 0 \ 496266383Sian ! -name DEFAULTS ! -name NOTES | \ 497266383Sian ${_THINNER} 498201815Sbzuniverse_kernconfs: 499148154Sru.for kernel in ${KERNCONFS} 500219137SjhbTARGET_ARCH_${kernel}!= cd ${KERNSRCDIR}/${TARGET}/conf && \ 501219137Sjhb config -m ${KERNSRCDIR}/${TARGET}/conf/${kernel} 2> /dev/null | \ 502216934Simp grep -v WARNING: | cut -f 2 503216934Simp.if empty(TARGET_ARCH_${kernel}) 504216934Simp.error "Target architecture for ${TARGET}/conf/${kernel} unknown. config(8) likely too old." 505216934Simp.endif 506216520Snwhitehornuniverse_kernconfs: universe_kernconf_${TARGET}_${kernel} 507254417Ssjguniverse_kernconf_${TARGET}_${kernel}: .MAKE 508185250Sdes @(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \ 509253616Ssjg ${SUB_MAKE} ${JFLAG} buildkernel \ 510201815Sbz TARGET=${TARGET} \ 511216520Snwhitehorn TARGET_ARCH=${TARGET_ARCH_${kernel}} \ 512148154Sru KERNCONF=${kernel} \ 513201815Sbz > _.${TARGET}.${kernel} 2>&1 || \ 514201815Sbz (echo "${TARGET} ${kernel} kernel failed," \ 515201815Sbz "check _.${TARGET}.${kernel} for details"| ${MAKEFAIL})) 516148154Sru.endfor 517133945Sruuniverse: universe_epilogue 518133945Sruuniverse_epilogue: 519103985Sphk @echo "--------------------------------------------------------------" 520118531Sru @echo ">>> make universe completed on `LC_ALL=C date`" 521118531Sru @echo " (started ${STARTTIME})" 522103985Sphk @echo "--------------------------------------------------------------" 523185499Salfred.if defined(DOING_TINDERBOX) 524185499Salfred @if [ -e ${FAILFILE} ] ; then \ 525185499Salfred echo "Tinderbox failed:" ;\ 526185499Salfred cat ${FAILFILE} ;\ 527185499Salfred exit 1 ;\ 528185499Salfred fi 529133945Sru.endif 530185499Salfred.endif 531242522Smarcel 532242522SmarcelbuildLINT: 533242522Smarcel ${MAKE} -C ${.CURDIR}/sys/${_TARGET}/conf LINT 534255286Ssjg 535255286Ssjg.if defined(.PARSEDIR) 536255286Ssjg.if make(universe) 537255286Ssjg# we do not want a failure of one branch abort all. 538255286SsjgMAKE_JOB_ERROR_TOKEN= no 539255286Ssjg.export MAKE_JOB_ERROR_TOKEN 540255286Ssjg.endif 541255286Ssjg.endif 542