13540f0e1SJordan K. Hubbard# 297d92980SPeter Wemm# $FreeBSD$ 3cf763a57SJohn Birrell# 411fb97daSJohn Birrell# The user-driven targets are: 5cf763a57SJohn Birrell# 61f4f7670SRuslan Ermilov# universe - *Really* build *everything* (buildworld and 71f4f7670SRuslan Ermilov# all kernels on all architectures). 8eee8163bSBjoern A. Zeeb# tinderbox - Same as universe, but presents a list of failed build 9eee8163bSBjoern A. Zeeb# targets and exits with an error if there were any. 1011fb97daSJohn Birrell# buildworld - Rebuild *everything*, including glue to help do 1111fb97daSJohn Birrell# upgrades. 1211fb97daSJohn Birrell# installworld - Install everything built by "buildworld". 13fb55e855STom Rhodes# world - buildworld + installworld, no kernel. 1400eb8cbdSAlexander Langer# buildkernel - Rebuild the kernel and the kernel-modules. 1500eb8cbdSAlexander Langer# installkernel - Install the kernel and the kernel-modules. 160147d2aaSHidetoshi Shimokawa# installkernel.debug 17737ffab7SMark Murray# reinstallkernel - Reinstall the kernel and the kernel-modules. 180147d2aaSHidetoshi Shimokawa# reinstallkernel.debug 19bc4311beSDavid E. O'Brien# kernel - buildkernel + installkernel. 20589fec8bSWarner Losh# kernel-toolchain - Builds the subset of world necessary to build a kernel 213e95821fSJuli Mallett# kernel-toolchains - Build kernel-toolchain for all universe targets. 22becc5c62SAlexander Leidinger# doxygen - Build API documentation of the kernel, needs doxygen. 2369c488cdSRuslan Ermilov# update - Convenient way to update your source tree(s). 2432cd239bSDag-Erling Smørgrav# check-old - List obsolete directories/files/libraries. 2532cd239bSDag-Erling Smørgrav# check-old-dirs - List obsolete directories. 2632cd239bSDag-Erling Smørgrav# check-old-files - List obsolete files. 2732cd239bSDag-Erling Smørgrav# check-old-libs - List obsolete libraries. 28262eab04SSergey Kandaurov# delete-old - Delete obsolete directories/files. 2932cd239bSDag-Erling Smørgrav# delete-old-dirs - Delete obsolete directories. 3032cd239bSDag-Erling Smørgrav# delete-old-files - Delete obsolete files. 3132cd239bSDag-Erling Smørgrav# delete-old-libs - Delete obsolete libraries. 32f1d16bd8SBjoern A. Zeeb# targets - Print a list of supported TARGET/TARGET_ARCH pairs 33f1d16bd8SBjoern A. Zeeb# for world and kernel targets. 344e889921SJohn Baldwin# toolchains - Build a toolchain for all world and kernel targets. 353540f0e1SJordan K. Hubbard# 3611fb97daSJohn Birrell# This makefile is simple by design. The FreeBSD make automatically reads 3711fb97daSJohn Birrell# the /usr/share/mk/sys.mk unless the -m argument is specified on the 3811fb97daSJohn Birrell# command line. By keeping this makefile simple, it doesn't matter too 3911fb97daSJohn Birrell# much how different the installed mk files are from those in the source 4011fb97daSJohn Birrell# tree. This makefile executes a child make process, forcing it to use 4111fb97daSJohn Birrell# the mk files from the source tree which are supposed to DTRT. 4211fb97daSJohn Birrell# 433acc4367SWarner Losh# Most of the user-driven targets (as listed above) are implemented in 44ff34e7e3SWarner Losh# Makefile.inc1. The exceptions are universe, tinderbox and targets. 4511fb97daSJohn Birrell# 4676fdd728SJohn W. De Boskey# If you want to build your system from source be sure that /usr/obj has 4747c221b6SWarner Losh# at least 1GB of diskspace available. A complete 'universe' build requires 4847c221b6SWarner Losh# about 15GB of space. 4911fb97daSJohn Birrell# 5076fdd728SJohn W. De Boskey# For individuals wanting to build from the sources currently on their 5176fdd728SJohn W. De Boskey# system, the simple instructions are: 5211fb97daSJohn Birrell# 5376fdd728SJohn W. De Boskey# 1. `cd /usr/src' (or to the directory containing your source tree). 54fb55e855STom Rhodes# 2. Define `HISTORICAL_MAKE_WORLD' variable (see README). 55fb55e855STom Rhodes# 3. `make world' 5611fb97daSJohn Birrell# 5776fdd728SJohn W. De Boskey# For individuals wanting to upgrade their sources (even if only a 5876fdd728SJohn W. De Boskey# delta of a few days): 5976fdd728SJohn W. De Boskey# 6076fdd728SJohn W. De Boskey# 1. `cd /usr/src' (or to the directory containing your source tree). 6176fdd728SJohn W. De Boskey# 2. `make buildworld' 6276fdd728SJohn W. De Boskey# 3. `make buildkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC). 6376fdd728SJohn W. De Boskey# 4. `make installkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC). 642c5e89c2SDavid E. O'Brien# [steps 3. & 4. can be combined by using the "kernel" target] 6576fdd728SJohn W. De Boskey# 5. `reboot' (in single user mode: boot -s from the loader prompt). 6676fdd728SJohn W. De Boskey# 6. `mergemaster -p' 6776fdd728SJohn W. De Boskey# 7. `make installworld' 68021a0587SChris Rees# 8. `mergemaster' (you may wish to use -i, along with -U or -F). 69021a0587SChris Rees# 9. `make delete-old' 70e2a36081SAlexander Leidinger# 10. `reboot' 71e2a36081SAlexander Leidinger# 11. `make delete-old-libs' (in case no 3rd party program uses them anymore) 7276fdd728SJohn W. De Boskey# 7376fdd728SJohn W. De Boskey# See src/UPDATING `COMMON ITEMS' for more complete information. 7411fb97daSJohn Birrell# 751fde59f3SRuslan Ermilov# If TARGET=machine (e.g. ia64, sparc64, ...) is specified you can 761fde59f3SRuslan Ermilov# cross build world for other machine types using the buildworld target, 77dbc3719dSMatthew Dillon# and once the world is built you can cross build a kernel using the 78dbc3719dSMatthew Dillon# buildkernel target. 79dbc3719dSMatthew Dillon# 8011fb97daSJohn Birrell# Define the user-driven targets. These are listed here in alphabetical 8111fb97daSJohn Birrell# order, but that's not important. 8211fb97daSJohn Birrell# 83ef7af95aSPeter Wemm# Targets that begin with underscore are internal targets intended for 84ef7af95aSPeter Wemm# developer convenience only. They are intentionally not documented and 85ef7af95aSPeter Wemm# completely subject to change without notice. 86ef7af95aSPeter Wemm# 8779e19f08SJohn Baldwin# For more information, see the build(7) manual page. 8879e19f08SJohn Baldwin# 8932cd239bSDag-Erling SmørgravTGTS= all all-man buildenv buildenvvars buildkernel buildworld \ 9032cd239bSDag-Erling Smørgrav check-old check-old-dirs check-old-files check-old-libs \ 9132cd239bSDag-Erling Smørgrav checkdpadd clean cleandepend cleandir \ 9232cd239bSDag-Erling Smørgrav delete-old delete-old-dirs delete-old-files delete-old-libs \ 9399ad39c8SNathan Whitehorn depend distribute distributekernel distributekernel.debug \ 9499ad39c8SNathan Whitehorn distributeworld distrib-dirs distribution doxygen \ 95e324b4bcSDavid E. O'Brien everything hier hierarchy install installcheck installkernel \ 9699ad39c8SNathan Whitehorn installkernel.debug packagekernel packageworld \ 9799ad39c8SNathan Whitehorn reinstallkernel reinstallkernel.debug \ 98becc5c62SAlexander Leidinger installworld kernel-toolchain libraries lint maninstall \ 99c3ed02cfSRuslan Ermilov obj objlink regress rerelease showconfig tags toolchain update \ 100ef7af95aSPeter Wemm _worldtmp _legacy _bootstrap-tools _cleanobj _obj \ 1011d9468eeSPeter Wemm _build-tools _cross-tools _includes _libraries _depend \ 1023c5326bfSRafal Jaworowski build32 builddtb distribute32 install32 xdev xdev-build xdev-install \ 1033c5326bfSRafal Jaworowski 104902f7c5bSRuslan ErmilovTGTS+= ${SUBDIR_TARGETS} 1056e59a256SMarcel Moolenaar 106af2dc868SRuslan ErmilovBITGTS= files includes 10728d2080aSRuslan ErmilovBITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/} 108b797df80SRuslan ErmilovTGTS+= ${BITGTS} 10928d2080aSRuslan Ermilov 110d672a609SRuslan Ermilov.ORDER: buildworld installworld 1118f1f55e9SRuslan Ermilov.ORDER: buildworld distributeworld 11220902bd3SRuslan Ermilov.ORDER: buildworld buildkernel 113d672a609SRuslan Ermilov.ORDER: buildkernel installkernel 1140147d2aaSHidetoshi Shimokawa.ORDER: buildkernel installkernel.debug 115d672a609SRuslan Ermilov.ORDER: buildkernel reinstallkernel 1160147d2aaSHidetoshi Shimokawa.ORDER: buildkernel reinstallkernel.debug 117d672a609SRuslan Ermilov 11876499f15SRuslan ErmilovPATH= /sbin:/bin:/usr/sbin:/usr/bin 1192e84ab94SRuslan ErmilovMAKEOBJDIRPREFIX?= /usr/obj 120e9bddef1SRuslan Ermilov_MAKEOBJDIRPREFIX!= /usr/bin/env -i PATH=${PATH} ${MAKE} \ 121f1fb2096SYaroslav Tykhiy ${.MAKEFLAGS:MMAKEOBJDIRPREFIX=*} __MAKE_CONF=${__MAKE_CONF} \ 1220ec443a0SRuslan Ermilov -f /dev/null -V MAKEOBJDIRPREFIX dummy 1230ec443a0SRuslan Ermilov.if !empty(_MAKEOBJDIRPREFIX) 1240ec443a0SRuslan Ermilov.error MAKEOBJDIRPREFIX can only be set in environment, not as a global\ 125f1fb2096SYaroslav Tykhiy (in make.conf(5)) or command-line variable. 1260ec443a0SRuslan Ermilov.endif 12776499f15SRuslan ErmilovMAKEPATH= ${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE} 128ead4296eSRuslan ErmilovBINMAKE= \ 12976499f15SRuslan Ermilov `if [ -x ${MAKEPATH}/make ]; then echo ${MAKEPATH}/make; else echo ${MAKE}; fi` \ 1305dc63117SRuslan Ermilov -m ${.CURDIR}/share/mk 131b3840844SWarner Losh_MAKE= PATH=${PATH} ${BINMAKE} -f Makefile.inc1 TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH} 132a962de47SPeter Wemm 133fda074e4SWarner Losh# Guess machine architecture from machine type, and vice versa. 134fda074e4SWarner Losh.if !defined(TARGET_ARCH) && defined(TARGET) 13584db023eSJuli Mallett_TARGET_ARCH= ${TARGET:S/pc98/i386/} 136fda074e4SWarner Losh.elif !defined(TARGET) && defined(TARGET_ARCH) && \ 137fda074e4SWarner Losh ${TARGET_ARCH} != ${MACHINE_ARCH} 1384da573d9SOleksandr Tymoshenko_TARGET= ${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/} 139fda074e4SWarner Losh.endif 14084db023eSJuli Mallett# Legacy names, for another transition period mips:mips(n32|64)?eb -> mips:mips\1 141fda074e4SWarner Losh.if defined(TARGET) && defined(TARGET_ARCH) && \ 14284db023eSJuli Mallett ${TARGET} == "mips" && ${TARGET_ARCH:Mmips*eb} 14384db023eSJuli Mallett_TARGET_ARCH= ${TARGET_ARCH:C/eb$//} 14484db023eSJuli Mallett.warning "TARGET_ARCH of ${TARGET_ARCH} is deprecated in favor of ${_TARGET_ARCH}" 145fda074e4SWarner Losh.endif 14684db023eSJuli Mallett.if defined(TARGET) && ${TARGET} == "mips" && defined(TARGET_BIG_ENDIAN) 14784db023eSJuli Mallett.warning "TARGET_BIG_ENDIAN is no longer necessary for MIPS. Big-endian is not the default." 148fda074e4SWarner Losh.endif 149fda074e4SWarner Losh# arm with TARGET_BIG_ENDIAN -> armeb 150fda074e4SWarner Losh.if defined(TARGET_ARCH) && ${TARGET_ARCH} == "arm" && defined(TARGET_BIG_ENDIAN) 151fda074e4SWarner Losh.warning "TARGET_ARCH of arm with TARGET_BIG_ENDIAN is deprecated. use armeb" 152fda074e4SWarner Losh_TARGET_ARCH=armeb 153fda074e4SWarner Losh.endif 154fda074e4SWarner Losh.if defined(TARGET) && !defined(_TARGET) 155fda074e4SWarner Losh_TARGET=${TARGET} 156fda074e4SWarner Losh.endif 157fda074e4SWarner Losh.if defined(TARGET_ARCH) && !defined(_TARGET_ARCH) 158fda074e4SWarner Losh_TARGET_ARCH=${TARGET_ARCH} 159fda074e4SWarner Losh.endif 160fda074e4SWarner Losh# Otherwise, default to current machine type and architecture. 161fda074e4SWarner Losh_TARGET?= ${MACHINE} 162fda074e4SWarner Losh_TARGET_ARCH?= ${MACHINE_ARCH} 163fda074e4SWarner Losh 164a962de47SPeter Wemm# 165d911f786SMarcel Moolenaar# Make sure we have an up-to-date make(1). Only world and buildworld 166d911f786SMarcel Moolenaar# should do this as those are the initial targets used for upgrades. 167d911f786SMarcel Moolenaar# The user can define ALWAYS_CHECK_MAKE to have this check performed 168d911f786SMarcel Moolenaar# for all targets. 169d911f786SMarcel Moolenaar# 170d911f786SMarcel Moolenaar.if defined(ALWAYS_CHECK_MAKE) 171b797df80SRuslan Ermilov${TGTS}: upgrade_checks 172d911f786SMarcel Moolenaar.else 173d911f786SMarcel Moolenaarbuildworld: upgrade_checks 174d911f786SMarcel Moolenaar.endif 175d911f786SMarcel Moolenaar 176d911f786SMarcel Moolenaar# 177224f0698SGarance A Drosehn# This 'cleanworld' target is not included in TGTS, because it is not a 1781a974787SGarance A Drosehn# recursive target. All of the work for it is done right here. It is 1791a974787SGarance A Drosehn# expected that BW_CANONICALOBJDIR == the CANONICALOBJDIR as would be 1801a974787SGarance A Drosehn# created by bsd.obj.mk, except that we don't want to .include that file 1811a974787SGarance A Drosehn# in this makefile. 1821a974787SGarance A Drosehn# 1831a974787SGarance A Drosehn# In the following, the first 'rm' in a series will usually remove all 1841a974787SGarance A Drosehn# files and directories. If it does not, then there are probably some 185f73031b4SGlen Barber# files with file flags set, so this unsets them and tries the 'rm' a 1861a974787SGarance A Drosehn# second time. There are situations where this target will be cleaning 1871a974787SGarance A Drosehn# some directories via more than one method, but that duplication is 188123ba50fSGlen Barber# needed to correctly handle all the possible situations. Removing all 189f73031b4SGlen Barber# files without file flags set in the first 'rm' instance saves time, 190f73031b4SGlen Barber# because 'chflags' will need to operate on fewer files afterwards. 1911a974787SGarance A Drosehn# 1921a974787SGarance A DrosehnBW_CANONICALOBJDIR:=${MAKEOBJDIRPREFIX}${.CURDIR} 193224f0698SGarance A Drosehncleanworld: 1941a974787SGarance A Drosehn.if ${.CURDIR} == ${.OBJDIR} || ${.CURDIR}/obj == ${.OBJDIR} 1951a974787SGarance A Drosehn.if exists(${BW_CANONICALOBJDIR}/) 1961a974787SGarance A Drosehn -rm -rf ${BW_CANONICALOBJDIR}/* 19761858771SXin LI -chflags -R 0 ${BW_CANONICALOBJDIR} 1981a974787SGarance A Drosehn rm -rf ${BW_CANONICALOBJDIR}/* 1991a974787SGarance A Drosehn.endif 2001a974787SGarance A Drosehn # To be safe in this case, fall back to a 'make cleandir' 201088cf0fbSHartmut Brandt ${_+_}@cd ${.CURDIR}; ${_MAKE} cleandir 2021a974787SGarance A Drosehn.else 2031a974787SGarance A Drosehn -rm -rf ${.OBJDIR}/* 20461858771SXin LI -chflags -R 0 ${.OBJDIR} 2051a974787SGarance A Drosehn rm -rf ${.OBJDIR}/* 2061a974787SGarance A Drosehn.endif 2072047c5d3SGarance A Drosehn 2082047c5d3SGarance A Drosehn# 20911fb97daSJohn Birrell# Handle the user-driven targets, using the source relative mk files. 210f3c4dd0dSBruce Evans# 211d911f786SMarcel Moolenaar 212b797df80SRuslan Ermilov${TGTS}: 213b3840844SWarner Losh ${_+_}@cd ${.CURDIR}; ${_MAKE} ${.TARGET} 214c3d9b0f0SRodney W. Grimes 215ce53af53SJordan K. Hubbard# Set a reasonable default 216ce53af53SJordan K. Hubbard.MAIN: all 217ce53af53SJordan K. Hubbard 218afcf05e4SRuslan ErmilovSTARTTIME!= LC_ALL=C date 219f59c1f67SDavid E. O'BrienCHECK_TIME!= find ${.CURDIR}/sys/sys/param.h -mtime -0s ; echo 220ec51d61fSRuslan Ermilov.if !empty(CHECK_TIME) 221ec51d61fSRuslan Ermilov.error check your date/time: ${STARTTIME} 222ec51d61fSRuslan Ermilov.endif 223d18c9906SRuslan Ermilov 224d18c9906SRuslan Ermilov.if defined(HISTORICAL_MAKE_WORLD) || defined(DESTDIR) 2256e59a256SMarcel Moolenaar# 2266e59a256SMarcel Moolenaar# world 2276e59a256SMarcel Moolenaar# 2280a945825SMarcel Moolenaar# Attempt to rebuild and reinstall everything. This target is not to be 2290a945825SMarcel Moolenaar# used for upgrading an existing FreeBSD system, because the kernel is 2300a945825SMarcel Moolenaar# not included. One can argue that this target doesn't build everything 2310a945825SMarcel Moolenaar# then. 2326e59a256SMarcel Moolenaar# 2336e59a256SMarcel Moolenaarworld: upgrade_checks 2346e59a256SMarcel Moolenaar @echo "--------------------------------------------------------------" 2355ab77811SRuslan Ermilov @echo ">>> make world started on ${STARTTIME}" 2366e59a256SMarcel Moolenaar @echo "--------------------------------------------------------------" 2376e59a256SMarcel Moolenaar.if target(pre-world) 2386e59a256SMarcel Moolenaar @echo 2396e59a256SMarcel Moolenaar @echo "--------------------------------------------------------------" 2406e59a256SMarcel Moolenaar @echo ">>> Making 'pre-world' target" 2416e59a256SMarcel Moolenaar @echo "--------------------------------------------------------------" 242088cf0fbSHartmut Brandt ${_+_}@cd ${.CURDIR}; ${_MAKE} pre-world 2436e59a256SMarcel Moolenaar.endif 244088cf0fbSHartmut Brandt ${_+_}@cd ${.CURDIR}; ${_MAKE} buildworld 245088cf0fbSHartmut Brandt ${_+_}@cd ${.CURDIR}; ${_MAKE} -B installworld 2466e59a256SMarcel Moolenaar.if target(post-world) 2476e59a256SMarcel Moolenaar @echo 2486e59a256SMarcel Moolenaar @echo "--------------------------------------------------------------" 2496e59a256SMarcel Moolenaar @echo ">>> Making 'post-world' target" 2506e59a256SMarcel Moolenaar @echo "--------------------------------------------------------------" 251088cf0fbSHartmut Brandt ${_+_}@cd ${.CURDIR}; ${_MAKE} post-world 2526e59a256SMarcel Moolenaar.endif 2536e59a256SMarcel Moolenaar @echo 2546e59a256SMarcel Moolenaar @echo "--------------------------------------------------------------" 2555ab77811SRuslan Ermilov @echo ">>> make world completed on `LC_ALL=C date`" 2565ab77811SRuslan Ermilov @echo " (started ${STARTTIME})" 2576e59a256SMarcel Moolenaar @echo "--------------------------------------------------------------" 2580a945825SMarcel Moolenaar.else 2590a945825SMarcel Moolenaarworld: 2600a945825SMarcel Moolenaar @echo "WARNING: make world will overwrite your existing FreeBSD" 2610a945825SMarcel Moolenaar @echo "installation without also building and installing a new" 2620a945825SMarcel Moolenaar @echo "kernel. This can be dangerous. Please read the handbook," 2631f6483e4SKen Smith @echo "'Rebuilding world', for how to upgrade your system." 264954c5b43SMark Murray @echo "Define DESTDIR to where you want to install FreeBSD," 2650a945825SMarcel Moolenaar @echo "including /, to override this warning and proceed as usual." 266954c5b43SMark Murray @echo "" 2670a945825SMarcel Moolenaar @echo "Bailing out now..." 2680a945825SMarcel Moolenaar @false 2690a945825SMarcel Moolenaar.endif 2706e59a256SMarcel Moolenaar 271cf94fb21SBruce Evans# 272d672a609SRuslan Ermilov# kernel 273d672a609SRuslan Ermilov# 274d672a609SRuslan Ermilov# Short hand for `make buildkernel installkernel' 275d672a609SRuslan Ermilov# 276d672a609SRuslan Ermilovkernel: buildkernel installkernel 277d672a609SRuslan Ermilov 278d672a609SRuslan Ermilov# 27911fb97daSJohn Birrell# Perform a few tests to determine if the installed tools are adequate 280113cf9e6SRuslan Ermilov# for building the world. 28111fb97daSJohn Birrell# 28211fb97daSJohn Birrellupgrade_checks: 2830815243cSMarcel Moolenaar.if !defined(.PARSEDIR) 2844c67ba2cSSimon J. Gerraty.if !defined(WITHOUT_BMAKE) 28513c9cf4cSSimon J. Gerraty (cd ${.CURDIR} && ${MAKE} bmake) 28613c9cf4cSSimon J. Gerraty.else 287012a8b3fSHartmut Brandt @if ! (cd ${.CURDIR}/tools/build/make_check && \ 28889f087e8SHartmut Brandt PATH=${PATH} ${BINMAKE} obj >/dev/null 2>&1 && \ 289ef2c779bSRuslan Ermilov PATH=${PATH} ${BINMAKE} >/dev/null 2>&1); \ 29076499f15SRuslan Ermilov then \ 291e2be0fd0SWarner Losh (cd ${.CURDIR} && ${MAKE} make); \ 29276499f15SRuslan Ermilov fi 2930815243cSMarcel Moolenaar.endif 29413c9cf4cSSimon J. Gerraty.endif 2956a8d432dSMark Murray 296a962de47SPeter Wemm# 2972e84ab94SRuslan Ermilov# Upgrade make(1) to the current version using the installed 2986029ad99SWarner Losh# headers, libraries and tools. Also, allow the location of 2996029ad99SWarner Losh# the system bsdmake-like utility to be overridden. 300549f978aSMarcel Moolenaar# 3012e84ab94SRuslan ErmilovMMAKEENV= MAKEOBJDIRPREFIX=${MAKEPATH} \ 3022e84ab94SRuslan Ermilov DESTDIR= \ 3032e84ab94SRuslan Ermilov INSTALL="sh ${.CURDIR}/tools/install.sh" 304e2be0fd0SWarner LoshMMAKE= ${MMAKEENV} ${MAKE} \ 3052e84ab94SRuslan Ermilov -D_UPGRADING \ 30683c7ade9SRuslan Ermilov -DNOMAN -DNO_MAN -DNOSHARED -DNO_SHARED \ 307ba70462cSJohn Birrell -DNO_CPU_CFLAGS -DNO_WERROR 3082e84ab94SRuslan Ermilov 30913c9cf4cSSimon J. Gerratymake bmake: .PHONY 310549f978aSMarcel Moolenaar @echo 311549f978aSMarcel Moolenaar @echo "--------------------------------------------------------------" 312b31745f5SRuslan Ermilov @echo ">>> Building an up-to-date make(1)" 313549f978aSMarcel Moolenaar @echo "--------------------------------------------------------------" 31413c9cf4cSSimon J. Gerraty ${_+_}@cd ${.CURDIR}/usr.bin/${.TARGET}; \ 3152e84ab94SRuslan Ermilov ${MMAKE} obj && \ 3162e84ab94SRuslan Ermilov ${MMAKE} depend && \ 3172e84ab94SRuslan Ermilov ${MMAKE} all && \ 3182e84ab94SRuslan Ermilov ${MMAKE} install DESTDIR=${MAKEPATH} BINDIR= 319549f978aSMarcel Moolenaar 3204bb9ca57SAlfred Perlsteintinderbox: 3214e889921SJohn Baldwin @cd ${.CURDIR} && ${MAKE} DOING_TINDERBOX=YES universe 3224e889921SJohn Baldwin 3234e889921SJohn Baldwintoolchains: 3244e889921SJohn Baldwin @cd ${.CURDIR} && ${MAKE} UNIVERSE_TARGET=toolchain universe 3254bb9ca57SAlfred Perlstein 3263e95821fSJuli Mallettkernel-toolchains: 3273e95821fSJuli Mallett @cd ${.CURDIR} && ${MAKE} UNIVERSE_TARGET=kernel-toolchain universe 3283e95821fSJuli Mallett 329549f978aSMarcel Moolenaar# 3301f4f7670SRuslan Ermilov# universe 3311f4f7670SRuslan Ermilov# 3321f4f7670SRuslan Ermilov# Attempt to rebuild *everything* for all supported architectures, 333d18c9906SRuslan Ermilov# with a reasonable chance of success, regardless of how old your 3341f4f7670SRuslan Ermilov# existing system is. 3351f4f7670SRuslan Ermilov# 33664fe77a5SWarner Losh.if make(universe) || make(universe_kernels) || make(tinderbox) || make(targets) 3374b547324SAttilio RaoTARGETS?=amd64 arm i386 ia64 mips pc98 powerpc sparc64 3384da573d9SOleksandr TymoshenkoTARGET_ARCHES_arm?= arm armeb armv6 armv6eb 33984db023eSJuli MallettTARGET_ARCHES_mips?= mipsel mips mips64el mips64 mipsn32 3408e7c4a05SNathan WhitehornTARGET_ARCHES_powerpc?= powerpc powerpc64 3418e7c4a05SNathan WhitehornTARGET_ARCHES_pc98?= i386 3428e7c4a05SNathan Whitehorn.for target in ${TARGETS} 3438e7c4a05SNathan WhitehornTARGET_ARCHES_${target}?= ${target} 3448e7c4a05SNathan Whitehorn.endfor 3451bdb3fb9SMarcel Moolenaar 3464e889921SJohn Baldwin.if defined(UNIVERSE_TARGET) 3474e889921SJohn BaldwinMAKE_JUST_WORLDS= YES 3484e889921SJohn Baldwin.else 3494e889921SJohn BaldwinUNIVERSE_TARGET?= buildworld 3504e889921SJohn Baldwin.endif 351141aca1fSJohn BaldwinKERNSRCDIR?= ${.CURDIR}/sys 3524e889921SJohn Baldwin 35364fe77a5SWarner Loshtargets: 354f1d16bd8SBjoern A. Zeeb @echo "Supported TARGET/TARGET_ARCH pairs for world and kernel targets" 35564fe77a5SWarner Losh.for target in ${TARGETS} 35664fe77a5SWarner Losh.for target_arch in ${TARGET_ARCHES_${target}} 35764fe77a5SWarner Losh @echo " ${target}/${target_arch}" 35864fe77a5SWarner Losh.endfor 35964fe77a5SWarner Losh.endfor 36064fe77a5SWarner Losh 3614bb9ca57SAlfred Perlstein.if defined(DOING_TINDERBOX) 3622933a1ceSBjoern A. ZeebFAILFILE=${.CURDIR}/_.tinderbox.failed 3634bb9ca57SAlfred PerlsteinMAKEFAIL=tee -a ${FAILFILE} 3644bb9ca57SAlfred Perlstein.else 3654bb9ca57SAlfred PerlsteinMAKEFAIL=cat 3664bb9ca57SAlfred Perlstein.endif 3674bb9ca57SAlfred Perlstein 368a3058216SDimitry Andricuniverse: universe_prologue upgrade_checks 369d18c9906SRuslan Ermilovuniverse_prologue: 37077c1699fSPoul-Henning Kamp @echo "--------------------------------------------------------------" 37177c1699fSPoul-Henning Kamp @echo ">>> make universe started on ${STARTTIME}" 37277c1699fSPoul-Henning Kamp @echo "--------------------------------------------------------------" 3734bb9ca57SAlfred Perlstein.if defined(DOING_TINDERBOX) 3741ffa3abdSBjoern A. Zeeb @rm -f ${FAILFILE} 3754bb9ca57SAlfred Perlstein.endif 3761bdb3fb9SMarcel Moolenaar.for target in ${TARGETS} 3771fde59f3SRuslan Ermilovuniverse: universe_${target} 378a3058216SDimitry Andric.ORDER: universe_prologue upgrade_checks universe_${target}_prologue universe_${target} universe_epilogue 3798e7c4a05SNathan Whitehornuniverse_${target}: universe_${target}_prologue 3808e7c4a05SNathan Whitehornuniverse_${target}_prologue: 3811fde59f3SRuslan Ermilov @echo ">> ${target} started on `LC_ALL=C date`" 3828e7c4a05SNathan Whitehorn.if !defined(MAKE_JUST_KERNELS) 3838e7c4a05SNathan Whitehorn.for target_arch in ${TARGET_ARCHES_${target}} 3848e7c4a05SNathan Whitehornuniverse_${target}: universe_${target}_${target_arch} 3858e7c4a05SNathan Whitehornuniverse_${target}_${target_arch}: universe_${target}_prologue 3864e889921SJohn Baldwin @echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} started on `LC_ALL=C date`" 38733367c7fSDag-Erling Smørgrav @(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \ 3884e889921SJohn Baldwin ${MAKE} ${JFLAG} ${UNIVERSE_TARGET} \ 3891fde59f3SRuslan Ermilov TARGET=${target} \ 3908e7c4a05SNathan Whitehorn TARGET_ARCH=${target_arch} \ 3914e889921SJohn Baldwin > _.${target}.${target_arch}.${UNIVERSE_TARGET} 2>&1 || \ 3924e889921SJohn Baldwin (echo "${target}.${target_arch} ${UNIVERSE_TARGET} failed," \ 3934e889921SJohn Baldwin "check _.${target}.${target_arch}.${UNIVERSE_TARGET} for details" | \ 3948e7c4a05SNathan Whitehorn ${MAKEFAIL})) 3954e889921SJohn Baldwin @echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} completed on `LC_ALL=C date`" 3968e7c4a05SNathan Whitehorn.endfor 397139fb43dSJohn Birrell.endif 3983453d746SDoug Barton.if !defined(MAKE_JUST_WORLDS) 39910098a6eSAndrew Turner# If we are building world and kernels wait for the required worlds to finish 40010098a6eSAndrew Turner.if !defined(MAKE_JUST_KERNELS) 40110098a6eSAndrew Turner.for target_arch in ${TARGET_ARCHES_${target}} 40210098a6eSAndrew Turneruniverse_${target}_kernels: universe_${target}_${target_arch} 40310098a6eSAndrew Turner.endfor 40410098a6eSAndrew Turner.endif 40510098a6eSAndrew Turneruniverse_${target}: universe_${target}_kernels 40610098a6eSAndrew Turneruniverse_${target}_kernels: universe_${target}_prologue 407141aca1fSJohn Baldwin.if exists(${KERNSRCDIR}/${target}/conf/NOTES) 408141aca1fSJohn Baldwin @(cd ${KERNSRCDIR}/${target}/conf && env __MAKE_CONF=/dev/null \ 40933367c7fSDag-Erling Smørgrav ${MAKE} LINT > ${.CURDIR}/_.${target}.makeLINT 2>&1 || \ 4104bb9ca57SAlfred Perlstein (echo "${target} 'make LINT' failed," \ 4114bb9ca57SAlfred Perlstein "check _.${target}.makeLINT for details"| ${MAKEFAIL})) 41277c1699fSPoul-Henning Kamp.endif 4133c55ed70SBjoern A. Zeeb @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} TARGET=${target} \ 4143c55ed70SBjoern A. Zeeb universe_kernels 4153453d746SDoug Barton.endif 4163c55ed70SBjoern A. Zeeb @echo ">> ${target} completed on `LC_ALL=C date`" 4173c55ed70SBjoern A. Zeeb.endfor 4183c55ed70SBjoern A. Zeebuniverse_kernels: universe_kernconfs 4195f5bb1d1SBjoern A. Zeeb.if !defined(TARGET) 4205f5bb1d1SBjoern A. ZeebTARGET!= uname -m 4215f5bb1d1SBjoern A. Zeeb.endif 422141aca1fSJohn BaldwinKERNCONFS!= cd ${KERNSRCDIR}/${TARGET}/conf && \ 4233c55ed70SBjoern A. Zeeb find [A-Z0-9]*[A-Z0-9] -type f -maxdepth 0 \ 4243c55ed70SBjoern A. Zeeb ! -name DEFAULTS ! -name NOTES 4253c55ed70SBjoern A. Zeebuniverse_kernconfs: 426dd0f3923SRuslan Ermilov.for kernel in ${KERNCONFS} 427141aca1fSJohn BaldwinTARGET_ARCH_${kernel}!= cd ${KERNSRCDIR}/${TARGET}/conf && \ 428141aca1fSJohn Baldwin config -m ${KERNSRCDIR}/${TARGET}/conf/${kernel} 2> /dev/null | \ 42992f64fb9SWarner Losh grep -v WARNING: | cut -f 2 43092f64fb9SWarner Losh.if empty(TARGET_ARCH_${kernel}) 43192f64fb9SWarner Losh.error "Target architecture for ${TARGET}/conf/${kernel} unknown. config(8) likely too old." 43292f64fb9SWarner Losh.endif 4338e7c4a05SNathan Whitehornuniverse_kernconfs: universe_kernconf_${TARGET}_${kernel} 4348e7c4a05SNathan Whitehornuniverse_kernconf_${TARGET}_${kernel}: 43533367c7fSDag-Erling Smørgrav @(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \ 43633367c7fSDag-Erling Smørgrav ${MAKE} ${JFLAG} buildkernel \ 4373c55ed70SBjoern A. Zeeb TARGET=${TARGET} \ 4388e7c4a05SNathan Whitehorn TARGET_ARCH=${TARGET_ARCH_${kernel}} \ 439dd0f3923SRuslan Ermilov KERNCONF=${kernel} \ 4403c55ed70SBjoern A. Zeeb > _.${TARGET}.${kernel} 2>&1 || \ 4413c55ed70SBjoern A. Zeeb (echo "${TARGET} ${kernel} kernel failed," \ 4423c55ed70SBjoern A. Zeeb "check _.${TARGET}.${kernel} for details"| ${MAKEFAIL})) 443d18c9906SRuslan Ermilov.endfor 444d18c9906SRuslan Ermilovuniverse: universe_epilogue 445d18c9906SRuslan Ermilovuniverse_epilogue: 44677c1699fSPoul-Henning Kamp @echo "--------------------------------------------------------------" 4475ab77811SRuslan Ermilov @echo ">>> make universe completed on `LC_ALL=C date`" 4485ab77811SRuslan Ermilov @echo " (started ${STARTTIME})" 44977c1699fSPoul-Henning Kamp @echo "--------------------------------------------------------------" 4504bb9ca57SAlfred Perlstein.if defined(DOING_TINDERBOX) 4514bb9ca57SAlfred Perlstein @if [ -e ${FAILFILE} ] ; then \ 4524bb9ca57SAlfred Perlstein echo "Tinderbox failed:" ;\ 4534bb9ca57SAlfred Perlstein cat ${FAILFILE} ;\ 4544bb9ca57SAlfred Perlstein exit 1 ;\ 4554bb9ca57SAlfred Perlstein fi 4564bb9ca57SAlfred Perlstein.endif 457d18c9906SRuslan Ermilov.endif 4583c4ee57dSMarcel Moolenaar 4593c4ee57dSMarcel MoolenaarbuildLINT: 4603c4ee57dSMarcel Moolenaar ${MAKE} -C ${.CURDIR}/sys/${_TARGET}/conf LINT 461