3# 4# The user-driven targets are: 5# 6# universe - *Really* build *everything* (buildworld and 7# all kernels on all architectures). 8# tinderbox - Same as universe, but presents a list of failed build 9# targets and exits with an error if there were any. 10# buildworld - Rebuild *everything*, including glue to help do 11# upgrades. 12# installworld - Install everything built by "buildworld". 13# world - buildworld + installworld, no kernel. 14# buildkernel - Rebuild the kernel and the kernel-modules. 15# installkernel - Install the kernel and the kernel-modules. 16# installkernel.debug 17# reinstallkernel - Reinstall the kernel and the kernel-modules. 18# reinstallkernel.debug 19# kernel - buildkernel + installkernel. 20# kernel-toolchain - Builds the subset of world necessary to build a kernel 21# doxygen - Build API documentation of the kernel, needs doxygen. 22# update - Convenient way to update your source tree (cvs). 23# check-old - List obsolete directories/files/libraries. 24# check-old-dirs - List obsolete directories. 25# check-old-files - List obsolete files. 26# check-old-libs - List obsolete libraries. 27# delete-old - Delete obsolete directories/files/libraries. 28# delete-old-dirs - Delete obsolete directories. 29# delete-old-files - Delete obsolete files. 30# delete-old-libs - Delete obsolete libraries. 31# targets - Print a list of supported TARGET/TARGET_ARCH pairs 32# for world and kernel targets. 33# toolchains - Build a toolchain for all world and kernel targets. 34# 35# This makefile is simple by design. The FreeBSD make automatically reads 36# the /usr/share/mk/sys.mk unless the -m argument is specified on the 37# command line. By keeping this makefile simple, it doesn't matter too 38# much how different the installed mk files are from those in the source 39# tree. This makefile executes a child make process, forcing it to use 40# the mk files from the source tree which are supposed to DTRT. 41# 42# Most of the user-driven targets (as listed above) are implemented in 43# Makefile.inc1. The exceptions are universe, tinderbox and targets. 44# 45# If you want to build your system from source be sure that /usr/obj has 46# at least 1GB of diskspace available. A complete 'universe' build requires 47# about 15GB of space. 48# 49# For individuals wanting to build from the sources currently on their 50# system, the simple instructions are: 51# 52# 1. `cd /usr/src' (or to the directory containing your source tree). 53# 2. Define `HISTORICAL_MAKE_WORLD' variable (see README). 54# 3. `make world' 55# 56# For individuals wanting to upgrade their sources (even if only a 57# delta of a few days): 58# 59# 1. `cd /usr/src' (or to the directory containing your source tree). 60# 2. `make buildworld' 61# 3. `make buildkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC). 62# 4. `make installkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC). 63# [steps 3. & 4. can be combined by using the "kernel" target] 64# 5. `reboot' (in single user mode: boot -s from the loader prompt). 65# 6. `mergemaster -p' 66# 7. `make installworld' 67# 8. `make delete-old' 68# 9. `mergemaster' (you may wish to use -U or -ai). 69# 10. `reboot' 70# 11. `make delete-old-libs' (in case no 3rd party program uses them anymore) 71# 72# See src/UPDATING `COMMON ITEMS' for more complete information. 73# 74# If TARGET=machine (e.g. ia64, sparc64, ...) is specified you can 75# cross build world for other machine types using the buildworld target, 76# and once the world is built you can cross build a kernel using the 77# buildkernel target. 78# 79# Define the user-driven targets. These are listed here in alphabetical 80# order, but that's not important. 81# 82# Targets that begin with underscore are internal targets intended for 83# developer convenience only. They are intentionally not documented and 84# completely subject to change without notice. 85# 86# For more information, see the build(7) manual page. 87# 88TGTS= all all-man buildenv buildenvvars buildkernel buildworld \ 89 check-old check-old-dirs check-old-files check-old-libs \ 90 checkdpadd clean cleandepend cleandir \ 91 delete-old delete-old-dirs delete-old-files delete-old-libs \
| 3# 4# The user-driven targets are: 5# 6# universe - *Really* build *everything* (buildworld and 7# all kernels on all architectures). 8# tinderbox - Same as universe, but presents a list of failed build 9# targets and exits with an error if there were any. 10# buildworld - Rebuild *everything*, including glue to help do 11# upgrades. 12# installworld - Install everything built by "buildworld". 13# world - buildworld + installworld, no kernel. 14# buildkernel - Rebuild the kernel and the kernel-modules. 15# installkernel - Install the kernel and the kernel-modules. 16# installkernel.debug 17# reinstallkernel - Reinstall the kernel and the kernel-modules. 18# reinstallkernel.debug 19# kernel - buildkernel + installkernel. 20# kernel-toolchain - Builds the subset of world necessary to build a kernel 21# doxygen - Build API documentation of the kernel, needs doxygen. 22# update - Convenient way to update your source tree (cvs). 23# check-old - List obsolete directories/files/libraries. 24# check-old-dirs - List obsolete directories. 25# check-old-files - List obsolete files. 26# check-old-libs - List obsolete libraries. 27# delete-old - Delete obsolete directories/files/libraries. 28# delete-old-dirs - Delete obsolete directories. 29# delete-old-files - Delete obsolete files. 30# delete-old-libs - Delete obsolete libraries. 31# targets - Print a list of supported TARGET/TARGET_ARCH pairs 32# for world and kernel targets. 33# toolchains - Build a toolchain for all world and kernel targets. 34# 35# This makefile is simple by design. The FreeBSD make automatically reads 36# the /usr/share/mk/sys.mk unless the -m argument is specified on the 37# command line. By keeping this makefile simple, it doesn't matter too 38# much how different the installed mk files are from those in the source 39# tree. This makefile executes a child make process, forcing it to use 40# the mk files from the source tree which are supposed to DTRT. 41# 42# Most of the user-driven targets (as listed above) are implemented in 43# Makefile.inc1. The exceptions are universe, tinderbox and targets. 44# 45# If you want to build your system from source be sure that /usr/obj has 46# at least 1GB of diskspace available. A complete 'universe' build requires 47# about 15GB of space. 48# 49# For individuals wanting to build from the sources currently on their 50# system, the simple instructions are: 51# 52# 1. `cd /usr/src' (or to the directory containing your source tree). 53# 2. Define `HISTORICAL_MAKE_WORLD' variable (see README). 54# 3. `make world' 55# 56# For individuals wanting to upgrade their sources (even if only a 57# delta of a few days): 58# 59# 1. `cd /usr/src' (or to the directory containing your source tree). 60# 2. `make buildworld' 61# 3. `make buildkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC). 62# 4. `make installkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC). 63# [steps 3. & 4. can be combined by using the "kernel" target] 64# 5. `reboot' (in single user mode: boot -s from the loader prompt). 65# 6. `mergemaster -p' 66# 7. `make installworld' 67# 8. `make delete-old' 68# 9. `mergemaster' (you may wish to use -U or -ai). 69# 10. `reboot' 70# 11. `make delete-old-libs' (in case no 3rd party program uses them anymore) 71# 72# See src/UPDATING `COMMON ITEMS' for more complete information. 73# 74# If TARGET=machine (e.g. ia64, sparc64, ...) is specified you can 75# cross build world for other machine types using the buildworld target, 76# and once the world is built you can cross build a kernel using the 77# buildkernel target. 78# 79# Define the user-driven targets. These are listed here in alphabetical 80# order, but that's not important. 81# 82# Targets that begin with underscore are internal targets intended for 83# developer convenience only. They are intentionally not documented and 84# completely subject to change without notice. 85# 86# For more information, see the build(7) manual page. 87# 88TGTS= all all-man buildenv buildenvvars buildkernel buildworld \ 89 check-old check-old-dirs check-old-files check-old-libs \ 90 checkdpadd clean cleandepend cleandir \ 91 delete-old delete-old-dirs delete-old-files delete-old-libs \
|
95 installworld kernel-toolchain libraries lint maninstall \ 96 obj objlink regress rerelease showconfig tags toolchain update \ 97 _worldtmp _legacy _bootstrap-tools _cleanobj _obj \ 98 _build-tools _cross-tools _includes _libraries _depend \ 99 build32 builddtb distribute32 install32 xdev xdev-build xdev-install \ 100 101TGTS+= ${SUBDIR_TARGETS} 102 103BITGTS= files includes 104BITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/} 105TGTS+= ${BITGTS} 106 107.ORDER: buildworld installworld 108.ORDER: buildworld distributeworld 109.ORDER: buildworld buildkernel 110.ORDER: buildkernel installkernel 111.ORDER: buildkernel installkernel.debug 112.ORDER: buildkernel reinstallkernel 113.ORDER: buildkernel reinstallkernel.debug 114 115PATH= /sbin:/bin:/usr/sbin:/usr/bin 116MAKEOBJDIRPREFIX?= /usr/obj 117_MAKEOBJDIRPREFIX!= /usr/bin/env -i PATH=${PATH} ${MAKE} \ 118 ${.MAKEFLAGS:MMAKEOBJDIRPREFIX=*} __MAKE_CONF=${__MAKE_CONF} \ 119 -f /dev/null -V MAKEOBJDIRPREFIX dummy 120.if !empty(_MAKEOBJDIRPREFIX) 121.error MAKEOBJDIRPREFIX can only be set in environment, not as a global\ 122 (in make.conf(5)) or command-line variable. 123.endif 124MAKEPATH= ${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE} 125BINMAKE= \ 126 `if [ -x ${MAKEPATH}/make ]; then echo ${MAKEPATH}/make; else echo ${MAKE}; fi` \ 127 -m ${.CURDIR}/share/mk 128_MAKE= PATH=${PATH} ${BINMAKE} -f Makefile.inc1 TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH} 129 130# Guess machine architecture from machine type, and vice versa. 131.if !defined(TARGET_ARCH) && defined(TARGET) 132_TARGET_ARCH= ${TARGET:S/pc98/i386/:S/sun4v/sparc64/:S/mips/mipsel/} 133.elif !defined(TARGET) && defined(TARGET_ARCH) && \ 134 ${TARGET_ARCH} != ${MACHINE_ARCH} 135_TARGET= ${TARGET_ARCH:C/mips.*e[lb]/mips/:C/armeb/arm/} 136.endif 137# Legacy names, for a transition period mips:mips -> mipsel:mips 138.if defined(TARGET) && defined(TARGET_ARCH) && \ 139 ${TARGET_ARCH} == "mips" && ${TARGET} == "mips" 140.warning "TARGET_ARCH of mips is deprecated in favor of mipsel or mipseb" 141.if defined(TARGET_BIG_ENDIAN) 142_TARGET_ARCH=mipseb 143.else 144_TARGET_ARCH=mipsel 145.endif 146.endif 147# arm with TARGET_BIG_ENDIAN -> armeb 148.if defined(TARGET_ARCH) && ${TARGET_ARCH} == "arm" && defined(TARGET_BIG_ENDIAN) 149.warning "TARGET_ARCH of arm with TARGET_BIG_ENDIAN is deprecated. use armeb" 150_TARGET_ARCH=armeb 151.endif 152.if defined(TARGET) && !defined(_TARGET) 153_TARGET=${TARGET} 154.endif 155.if defined(TARGET_ARCH) && !defined(_TARGET_ARCH) 156_TARGET_ARCH=${TARGET_ARCH} 157.endif 158# Otherwise, default to current machine type and architecture. 159_TARGET?= ${MACHINE} 160_TARGET_ARCH?= ${MACHINE_ARCH} 161 162# 163# Make sure we have an up-to-date make(1). Only world and buildworld 164# should do this as those are the initial targets used for upgrades. 165# The user can define ALWAYS_CHECK_MAKE to have this check performed 166# for all targets. 167# 168.if defined(ALWAYS_CHECK_MAKE) 169${TGTS}: upgrade_checks 170.else 171buildworld: upgrade_checks 172.endif 173 174# 175# This 'cleanworld' target is not included in TGTS, because it is not a 176# recursive target. All of the work for it is done right here. It is 177# expected that BW_CANONICALOBJDIR == the CANONICALOBJDIR as would be 178# created by bsd.obj.mk, except that we don't want to .include that file 179# in this makefile. 180# 181# In the following, the first 'rm' in a series will usually remove all 182# files and directories. If it does not, then there are probably some 183# files with chflags set, so this unsets them and tries the 'rm' a 184# second time. There are situations where this target will be cleaning 185# some directories via more than one method, but that duplication is 186# needed to correctly handle all the possible situations. 187# 188BW_CANONICALOBJDIR:=${MAKEOBJDIRPREFIX}${.CURDIR} 189cleanworld: 190.if ${.CURDIR} == ${.OBJDIR} || ${.CURDIR}/obj == ${.OBJDIR} 191.if exists(${BW_CANONICALOBJDIR}/) 192 -rm -rf ${BW_CANONICALOBJDIR}/* 193 -chflags -R 0 ${BW_CANONICALOBJDIR} 194 rm -rf ${BW_CANONICALOBJDIR}/* 195.endif 196 # To be safe in this case, fall back to a 'make cleandir' 197 ${_+_}@cd ${.CURDIR}; ${_MAKE} cleandir 198.else 199 -rm -rf ${.OBJDIR}/* 200 -chflags -R 0 ${.OBJDIR} 201 rm -rf ${.OBJDIR}/* 202.endif 203 204# 205# Handle the user-driven targets, using the source relative mk files. 206# 207 208${TGTS}: 209 ${_+_}@cd ${.CURDIR}; ${_MAKE} ${.TARGET} 210 211# Set a reasonable default 212.MAIN: all 213 214STARTTIME!= LC_ALL=C date 215CHECK_TIME!= find ${.CURDIR}/sys/sys/param.h -mtime -0 216.if !empty(CHECK_TIME) 217.error check your date/time: ${STARTTIME} 218.endif 219 220.if defined(HISTORICAL_MAKE_WORLD) || defined(DESTDIR) 221# 222# world 223# 224# Attempt to rebuild and reinstall everything. This target is not to be 225# used for upgrading an existing FreeBSD system, because the kernel is 226# not included. One can argue that this target doesn't build everything 227# then. 228# 229world: upgrade_checks 230 @echo "--------------------------------------------------------------" 231 @echo ">>> make world started on ${STARTTIME}" 232 @echo "--------------------------------------------------------------" 233.if target(pre-world) 234 @echo 235 @echo "--------------------------------------------------------------" 236 @echo ">>> Making 'pre-world' target" 237 @echo "--------------------------------------------------------------" 238 ${_+_}@cd ${.CURDIR}; ${_MAKE} pre-world 239.endif 240 ${_+_}@cd ${.CURDIR}; ${_MAKE} buildworld 241 ${_+_}@cd ${.CURDIR}; ${_MAKE} -B installworld 242.if target(post-world) 243 @echo 244 @echo "--------------------------------------------------------------" 245 @echo ">>> Making 'post-world' target" 246 @echo "--------------------------------------------------------------" 247 ${_+_}@cd ${.CURDIR}; ${_MAKE} post-world 248.endif 249 @echo 250 @echo "--------------------------------------------------------------" 251 @echo ">>> make world completed on `LC_ALL=C date`" 252 @echo " (started ${STARTTIME})" 253 @echo "--------------------------------------------------------------" 254.else 255world: 256 @echo "WARNING: make world will overwrite your existing FreeBSD" 257 @echo "installation without also building and installing a new" 258 @echo "kernel. This can be dangerous. Please read the handbook," 259 @echo "'Rebuilding world', for how to upgrade your system." 260 @echo "Define DESTDIR to where you want to install FreeBSD," 261 @echo "including /, to override this warning and proceed as usual." 262 @echo "" 263 @echo "Bailing out now..." 264 @false 265.endif 266 267# 268# kernel 269# 270# Short hand for `make buildkernel installkernel' 271# 272kernel: buildkernel installkernel 273 274# 275# Perform a few tests to determine if the installed tools are adequate 276# for building the world. 277# 278upgrade_checks: 279 @if ! (cd ${.CURDIR}/tools/build/make_check && \ 280 PATH=${PATH} ${BINMAKE} obj >/dev/null 2>&1 && \ 281 PATH=${PATH} ${BINMAKE} >/dev/null 2>&1); \ 282 then \ 283 (cd ${.CURDIR} && ${MAKE} make); \ 284 fi 285 286# 287# Upgrade make(1) to the current version using the installed 288# headers, libraries and tools. Also, allow the location of 289# the system bsdmake-like utility to be overridden. 290# 291MMAKEENV= MAKEOBJDIRPREFIX=${MAKEPATH} \ 292 DESTDIR= \ 293 INSTALL="sh ${.CURDIR}/tools/install.sh" 294MMAKE= ${MMAKEENV} ${MAKE} \ 295 -D_UPGRADING \ 296 -DNOMAN -DNO_MAN -DNOSHARED -DNO_SHARED \ 297 -DNO_CPU_CFLAGS -DNO_WERROR 298 299make: .PHONY 300 @echo 301 @echo "--------------------------------------------------------------" 302 @echo ">>> Building an up-to-date make(1)" 303 @echo "--------------------------------------------------------------" 304 ${_+_}@cd ${.CURDIR}/usr.bin/make; \ 305 ${MMAKE} obj && \ 306 ${MMAKE} depend && \ 307 ${MMAKE} all && \ 308 ${MMAKE} install DESTDIR=${MAKEPATH} BINDIR= 309 310tinderbox: 311 @cd ${.CURDIR} && ${MAKE} DOING_TINDERBOX=YES universe 312 313toolchains: 314 @cd ${.CURDIR} && ${MAKE} UNIVERSE_TARGET=toolchain universe 315 316# 317# universe 318# 319# Attempt to rebuild *everything* for all supported architectures, 320# with a reasonable chance of success, regardless of how old your 321# existing system is. 322# 323.if make(universe) || make(universe_kernels) || make(tinderbox) || make(targets) 324TARGETS?=amd64 arm i386 ia64 mips pc98 powerpc sparc64 sun4v 325TARGET_ARCHES_arm?= arm armeb 326TARGET_ARCHES_mips?= mipsel mipseb mips64el mips64eb 327TARGET_ARCHES_powerpc?= powerpc powerpc64 328TARGET_ARCHES_pc98?= i386 329TARGET_ARCHES_sun4v?= sparc64 330.for target in ${TARGETS} 331TARGET_ARCHES_${target}?= ${target} 332.endfor 333 334.if defined(UNIVERSE_TARGET) 335MAKE_JUST_WORLDS= YES 336.else 337UNIVERSE_TARGET?= buildworld 338.endif 339KERNSRCDIR?= ${.CURDIR}/sys 340 341targets: 342 @echo "Supported TARGET/TARGET_ARCH pairs for world and kernel targets" 343.for target in ${TARGETS} 344.for target_arch in ${TARGET_ARCHES_${target}} 345 @echo " ${target}/${target_arch}" 346.endfor 347.endfor 348 349.if defined(DOING_TINDERBOX) 350FAILFILE=${.CURDIR}/_.tinderbox.failed 351MAKEFAIL=tee -a ${FAILFILE} 352.else 353MAKEFAIL=cat 354.endif 355 356universe: universe_prologue 357universe_prologue: 358 @echo "--------------------------------------------------------------" 359 @echo ">>> make universe started on ${STARTTIME}" 360 @echo "--------------------------------------------------------------" 361.if defined(DOING_TINDERBOX) 362 @rm -f ${FAILFILE} 363.endif 364.for target in ${TARGETS} 365universe: universe_${target} 366.ORDER: universe_prologue universe_${target} universe_epilogue 367universe_${target}: universe_${target}_prologue 368universe_${target}_prologue: 369 @echo ">> ${target} started on `LC_ALL=C date`" 370.if !defined(MAKE_JUST_KERNELS) 371.for target_arch in ${TARGET_ARCHES_${target}} 372universe_${target}: universe_${target}_${target_arch} 373universe_${target}_${target_arch}: universe_${target}_prologue 374 @echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} started on `LC_ALL=C date`" 375 @(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \ 376 ${MAKE} ${JFLAG} ${UNIVERSE_TARGET} \ 377 TARGET=${target} \ 378 TARGET_ARCH=${target_arch} \ 379 > _.${target}.${target_arch}.${UNIVERSE_TARGET} 2>&1 || \ 380 (echo "${target}.${target_arch} ${UNIVERSE_TARGET} failed," \ 381 "check _.${target}.${target_arch}.${UNIVERSE_TARGET} for details" | \ 382 ${MAKEFAIL})) 383 @echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} completed on `LC_ALL=C date`" 384.endfor 385.endif 386.if !defined(MAKE_JUST_WORLDS) 387.if exists(${KERNSRCDIR}/${target}/conf/NOTES) 388 @(cd ${KERNSRCDIR}/${target}/conf && env __MAKE_CONF=/dev/null \ 389 ${MAKE} LINT > ${.CURDIR}/_.${target}.makeLINT 2>&1 || \ 390 (echo "${target} 'make LINT' failed," \ 391 "check _.${target}.makeLINT for details"| ${MAKEFAIL})) 392.endif 393 @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} TARGET=${target} \ 394 universe_kernels 395.endif 396 @echo ">> ${target} completed on `LC_ALL=C date`" 397.endfor 398universe_kernels: universe_kernconfs 399.if !defined(TARGET) 400TARGET!= uname -m 401.endif 402KERNCONFS!= cd ${KERNSRCDIR}/${TARGET}/conf && \ 403 find [A-Z0-9]*[A-Z0-9] -type f -maxdepth 0 \ 404 ! -name DEFAULTS ! -name NOTES 405universe_kernconfs: 406.for kernel in ${KERNCONFS} 407TARGET_ARCH_${kernel}!= cd ${KERNSRCDIR}/${TARGET}/conf && \ 408 config -m ${KERNSRCDIR}/${TARGET}/conf/${kernel} 2> /dev/null | \ 409 grep -v WARNING: | cut -f 2 410.if empty(TARGET_ARCH_${kernel}) 411.error "Target architecture for ${TARGET}/conf/${kernel} unknown. config(8) likely too old." 412.endif 413universe_kernconfs: universe_kernconf_${TARGET}_${kernel} 414universe_kernconf_${TARGET}_${kernel}: 415 @(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \ 416 ${MAKE} ${JFLAG} buildkernel \ 417 TARGET=${TARGET} \ 418 TARGET_ARCH=${TARGET_ARCH_${kernel}} \ 419 KERNCONF=${kernel} \ 420 > _.${TARGET}.${kernel} 2>&1 || \ 421 (echo "${TARGET} ${kernel} kernel failed," \ 422 "check _.${TARGET}.${kernel} for details"| ${MAKEFAIL})) 423.endfor 424universe: universe_epilogue 425universe_epilogue: 426 @echo "--------------------------------------------------------------" 427 @echo ">>> make universe completed on `LC_ALL=C date`" 428 @echo " (started ${STARTTIME})" 429 @echo "--------------------------------------------------------------" 430.if defined(DOING_TINDERBOX) 431 @if [ -e ${FAILFILE} ] ; then \ 432 echo "Tinderbox failed:" ;\ 433 cat ${FAILFILE} ;\ 434 exit 1 ;\ 435 fi 436.endif 437.endif
| 97 installworld kernel-toolchain libraries lint maninstall \ 98 obj objlink regress rerelease showconfig tags toolchain update \ 99 _worldtmp _legacy _bootstrap-tools _cleanobj _obj \ 100 _build-tools _cross-tools _includes _libraries _depend \ 101 build32 builddtb distribute32 install32 xdev xdev-build xdev-install \ 102 103TGTS+= ${SUBDIR_TARGETS} 104 105BITGTS= files includes 106BITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/} 107TGTS+= ${BITGTS} 108 109.ORDER: buildworld installworld 110.ORDER: buildworld distributeworld 111.ORDER: buildworld buildkernel 112.ORDER: buildkernel installkernel 113.ORDER: buildkernel installkernel.debug 114.ORDER: buildkernel reinstallkernel 115.ORDER: buildkernel reinstallkernel.debug 116 117PATH= /sbin:/bin:/usr/sbin:/usr/bin 118MAKEOBJDIRPREFIX?= /usr/obj 119_MAKEOBJDIRPREFIX!= /usr/bin/env -i PATH=${PATH} ${MAKE} \ 120 ${.MAKEFLAGS:MMAKEOBJDIRPREFIX=*} __MAKE_CONF=${__MAKE_CONF} \ 121 -f /dev/null -V MAKEOBJDIRPREFIX dummy 122.if !empty(_MAKEOBJDIRPREFIX) 123.error MAKEOBJDIRPREFIX can only be set in environment, not as a global\ 124 (in make.conf(5)) or command-line variable. 125.endif 126MAKEPATH= ${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE} 127BINMAKE= \ 128 `if [ -x ${MAKEPATH}/make ]; then echo ${MAKEPATH}/make; else echo ${MAKE}; fi` \ 129 -m ${.CURDIR}/share/mk 130_MAKE= PATH=${PATH} ${BINMAKE} -f Makefile.inc1 TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH} 131 132# Guess machine architecture from machine type, and vice versa. 133.if !defined(TARGET_ARCH) && defined(TARGET) 134_TARGET_ARCH= ${TARGET:S/pc98/i386/:S/sun4v/sparc64/:S/mips/mipsel/} 135.elif !defined(TARGET) && defined(TARGET_ARCH) && \ 136 ${TARGET_ARCH} != ${MACHINE_ARCH} 137_TARGET= ${TARGET_ARCH:C/mips.*e[lb]/mips/:C/armeb/arm/} 138.endif 139# Legacy names, for a transition period mips:mips -> mipsel:mips 140.if defined(TARGET) && defined(TARGET_ARCH) && \ 141 ${TARGET_ARCH} == "mips" && ${TARGET} == "mips" 142.warning "TARGET_ARCH of mips is deprecated in favor of mipsel or mipseb" 143.if defined(TARGET_BIG_ENDIAN) 144_TARGET_ARCH=mipseb 145.else 146_TARGET_ARCH=mipsel 147.endif 148.endif 149# arm with TARGET_BIG_ENDIAN -> armeb 150.if defined(TARGET_ARCH) && ${TARGET_ARCH} == "arm" && defined(TARGET_BIG_ENDIAN) 151.warning "TARGET_ARCH of arm with TARGET_BIG_ENDIAN is deprecated. use armeb" 152_TARGET_ARCH=armeb 153.endif 154.if defined(TARGET) && !defined(_TARGET) 155_TARGET=${TARGET} 156.endif 157.if defined(TARGET_ARCH) && !defined(_TARGET_ARCH) 158_TARGET_ARCH=${TARGET_ARCH} 159.endif 160# Otherwise, default to current machine type and architecture. 161_TARGET?= ${MACHINE} 162_TARGET_ARCH?= ${MACHINE_ARCH} 163 164# 165# Make sure we have an up-to-date make(1). Only world and buildworld 166# should do this as those are the initial targets used for upgrades. 167# The user can define ALWAYS_CHECK_MAKE to have this check performed 168# for all targets. 169# 170.if defined(ALWAYS_CHECK_MAKE) 171${TGTS}: upgrade_checks 172.else 173buildworld: upgrade_checks 174.endif 175 176# 177# This 'cleanworld' target is not included in TGTS, because it is not a 178# recursive target. All of the work for it is done right here. It is 179# expected that BW_CANONICALOBJDIR == the CANONICALOBJDIR as would be 180# created by bsd.obj.mk, except that we don't want to .include that file 181# in this makefile. 182# 183# In the following, the first 'rm' in a series will usually remove all 184# files and directories. If it does not, then there are probably some 185# files with chflags set, so this unsets them and tries the 'rm' a 186# second time. There are situations where this target will be cleaning 187# some directories via more than one method, but that duplication is 188# needed to correctly handle all the possible situations. 189# 190BW_CANONICALOBJDIR:=${MAKEOBJDIRPREFIX}${.CURDIR} 191cleanworld: 192.if ${.CURDIR} == ${.OBJDIR} || ${.CURDIR}/obj == ${.OBJDIR} 193.if exists(${BW_CANONICALOBJDIR}/) 194 -rm -rf ${BW_CANONICALOBJDIR}/* 195 -chflags -R 0 ${BW_CANONICALOBJDIR} 196 rm -rf ${BW_CANONICALOBJDIR}/* 197.endif 198 # To be safe in this case, fall back to a 'make cleandir' 199 ${_+_}@cd ${.CURDIR}; ${_MAKE} cleandir 200.else 201 -rm -rf ${.OBJDIR}/* 202 -chflags -R 0 ${.OBJDIR} 203 rm -rf ${.OBJDIR}/* 204.endif 205 206# 207# Handle the user-driven targets, using the source relative mk files. 208# 209 210${TGTS}: 211 ${_+_}@cd ${.CURDIR}; ${_MAKE} ${.TARGET} 212 213# Set a reasonable default 214.MAIN: all 215 216STARTTIME!= LC_ALL=C date 217CHECK_TIME!= find ${.CURDIR}/sys/sys/param.h -mtime -0 218.if !empty(CHECK_TIME) 219.error check your date/time: ${STARTTIME} 220.endif 221 222.if defined(HISTORICAL_MAKE_WORLD) || defined(DESTDIR) 223# 224# world 225# 226# Attempt to rebuild and reinstall everything. This target is not to be 227# used for upgrading an existing FreeBSD system, because the kernel is 228# not included. One can argue that this target doesn't build everything 229# then. 230# 231world: upgrade_checks 232 @echo "--------------------------------------------------------------" 233 @echo ">>> make world started on ${STARTTIME}" 234 @echo "--------------------------------------------------------------" 235.if target(pre-world) 236 @echo 237 @echo "--------------------------------------------------------------" 238 @echo ">>> Making 'pre-world' target" 239 @echo "--------------------------------------------------------------" 240 ${_+_}@cd ${.CURDIR}; ${_MAKE} pre-world 241.endif 242 ${_+_}@cd ${.CURDIR}; ${_MAKE} buildworld 243 ${_+_}@cd ${.CURDIR}; ${_MAKE} -B installworld 244.if target(post-world) 245 @echo 246 @echo "--------------------------------------------------------------" 247 @echo ">>> Making 'post-world' target" 248 @echo "--------------------------------------------------------------" 249 ${_+_}@cd ${.CURDIR}; ${_MAKE} post-world 250.endif 251 @echo 252 @echo "--------------------------------------------------------------" 253 @echo ">>> make world completed on `LC_ALL=C date`" 254 @echo " (started ${STARTTIME})" 255 @echo "--------------------------------------------------------------" 256.else 257world: 258 @echo "WARNING: make world will overwrite your existing FreeBSD" 259 @echo "installation without also building and installing a new" 260 @echo "kernel. This can be dangerous. Please read the handbook," 261 @echo "'Rebuilding world', for how to upgrade your system." 262 @echo "Define DESTDIR to where you want to install FreeBSD," 263 @echo "including /, to override this warning and proceed as usual." 264 @echo "" 265 @echo "Bailing out now..." 266 @false 267.endif 268 269# 270# kernel 271# 272# Short hand for `make buildkernel installkernel' 273# 274kernel: buildkernel installkernel 275 276# 277# Perform a few tests to determine if the installed tools are adequate 278# for building the world. 279# 280upgrade_checks: 281 @if ! (cd ${.CURDIR}/tools/build/make_check && \ 282 PATH=${PATH} ${BINMAKE} obj >/dev/null 2>&1 && \ 283 PATH=${PATH} ${BINMAKE} >/dev/null 2>&1); \ 284 then \ 285 (cd ${.CURDIR} && ${MAKE} make); \ 286 fi 287 288# 289# Upgrade make(1) to the current version using the installed 290# headers, libraries and tools. Also, allow the location of 291# the system bsdmake-like utility to be overridden. 292# 293MMAKEENV= MAKEOBJDIRPREFIX=${MAKEPATH} \ 294 DESTDIR= \ 295 INSTALL="sh ${.CURDIR}/tools/install.sh" 296MMAKE= ${MMAKEENV} ${MAKE} \ 297 -D_UPGRADING \ 298 -DNOMAN -DNO_MAN -DNOSHARED -DNO_SHARED \ 299 -DNO_CPU_CFLAGS -DNO_WERROR 300 301make: .PHONY 302 @echo 303 @echo "--------------------------------------------------------------" 304 @echo ">>> Building an up-to-date make(1)" 305 @echo "--------------------------------------------------------------" 306 ${_+_}@cd ${.CURDIR}/usr.bin/make; \ 307 ${MMAKE} obj && \ 308 ${MMAKE} depend && \ 309 ${MMAKE} all && \ 310 ${MMAKE} install DESTDIR=${MAKEPATH} BINDIR= 311 312tinderbox: 313 @cd ${.CURDIR} && ${MAKE} DOING_TINDERBOX=YES universe 314 315toolchains: 316 @cd ${.CURDIR} && ${MAKE} UNIVERSE_TARGET=toolchain universe 317 318# 319# universe 320# 321# Attempt to rebuild *everything* for all supported architectures, 322# with a reasonable chance of success, regardless of how old your 323# existing system is. 324# 325.if make(universe) || make(universe_kernels) || make(tinderbox) || make(targets) 326TARGETS?=amd64 arm i386 ia64 mips pc98 powerpc sparc64 sun4v 327TARGET_ARCHES_arm?= arm armeb 328TARGET_ARCHES_mips?= mipsel mipseb mips64el mips64eb 329TARGET_ARCHES_powerpc?= powerpc powerpc64 330TARGET_ARCHES_pc98?= i386 331TARGET_ARCHES_sun4v?= sparc64 332.for target in ${TARGETS} 333TARGET_ARCHES_${target}?= ${target} 334.endfor 335 336.if defined(UNIVERSE_TARGET) 337MAKE_JUST_WORLDS= YES 338.else 339UNIVERSE_TARGET?= buildworld 340.endif 341KERNSRCDIR?= ${.CURDIR}/sys 342 343targets: 344 @echo "Supported TARGET/TARGET_ARCH pairs for world and kernel targets" 345.for target in ${TARGETS} 346.for target_arch in ${TARGET_ARCHES_${target}} 347 @echo " ${target}/${target_arch}" 348.endfor 349.endfor 350 351.if defined(DOING_TINDERBOX) 352FAILFILE=${.CURDIR}/_.tinderbox.failed 353MAKEFAIL=tee -a ${FAILFILE} 354.else 355MAKEFAIL=cat 356.endif 357 358universe: universe_prologue 359universe_prologue: 360 @echo "--------------------------------------------------------------" 361 @echo ">>> make universe started on ${STARTTIME}" 362 @echo "--------------------------------------------------------------" 363.if defined(DOING_TINDERBOX) 364 @rm -f ${FAILFILE} 365.endif 366.for target in ${TARGETS} 367universe: universe_${target} 368.ORDER: universe_prologue universe_${target} universe_epilogue 369universe_${target}: universe_${target}_prologue 370universe_${target}_prologue: 371 @echo ">> ${target} started on `LC_ALL=C date`" 372.if !defined(MAKE_JUST_KERNELS) 373.for target_arch in ${TARGET_ARCHES_${target}} 374universe_${target}: universe_${target}_${target_arch} 375universe_${target}_${target_arch}: universe_${target}_prologue 376 @echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} started on `LC_ALL=C date`" 377 @(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \ 378 ${MAKE} ${JFLAG} ${UNIVERSE_TARGET} \ 379 TARGET=${target} \ 380 TARGET_ARCH=${target_arch} \ 381 > _.${target}.${target_arch}.${UNIVERSE_TARGET} 2>&1 || \ 382 (echo "${target}.${target_arch} ${UNIVERSE_TARGET} failed," \ 383 "check _.${target}.${target_arch}.${UNIVERSE_TARGET} for details" | \ 384 ${MAKEFAIL})) 385 @echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} completed on `LC_ALL=C date`" 386.endfor 387.endif 388.if !defined(MAKE_JUST_WORLDS) 389.if exists(${KERNSRCDIR}/${target}/conf/NOTES) 390 @(cd ${KERNSRCDIR}/${target}/conf && env __MAKE_CONF=/dev/null \ 391 ${MAKE} LINT > ${.CURDIR}/_.${target}.makeLINT 2>&1 || \ 392 (echo "${target} 'make LINT' failed," \ 393 "check _.${target}.makeLINT for details"| ${MAKEFAIL})) 394.endif 395 @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} TARGET=${target} \ 396 universe_kernels 397.endif 398 @echo ">> ${target} completed on `LC_ALL=C date`" 399.endfor 400universe_kernels: universe_kernconfs 401.if !defined(TARGET) 402TARGET!= uname -m 403.endif 404KERNCONFS!= cd ${KERNSRCDIR}/${TARGET}/conf && \ 405 find [A-Z0-9]*[A-Z0-9] -type f -maxdepth 0 \ 406 ! -name DEFAULTS ! -name NOTES 407universe_kernconfs: 408.for kernel in ${KERNCONFS} 409TARGET_ARCH_${kernel}!= cd ${KERNSRCDIR}/${TARGET}/conf && \ 410 config -m ${KERNSRCDIR}/${TARGET}/conf/${kernel} 2> /dev/null | \ 411 grep -v WARNING: | cut -f 2 412.if empty(TARGET_ARCH_${kernel}) 413.error "Target architecture for ${TARGET}/conf/${kernel} unknown. config(8) likely too old." 414.endif 415universe_kernconfs: universe_kernconf_${TARGET}_${kernel} 416universe_kernconf_${TARGET}_${kernel}: 417 @(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \ 418 ${MAKE} ${JFLAG} buildkernel \ 419 TARGET=${TARGET} \ 420 TARGET_ARCH=${TARGET_ARCH_${kernel}} \ 421 KERNCONF=${kernel} \ 422 > _.${TARGET}.${kernel} 2>&1 || \ 423 (echo "${TARGET} ${kernel} kernel failed," \ 424 "check _.${TARGET}.${kernel} for details"| ${MAKEFAIL})) 425.endfor 426universe: universe_epilogue 427universe_epilogue: 428 @echo "--------------------------------------------------------------" 429 @echo ">>> make universe completed on `LC_ALL=C date`" 430 @echo " (started ${STARTTIME})" 431 @echo "--------------------------------------------------------------" 432.if defined(DOING_TINDERBOX) 433 @if [ -e ${FAILFILE} ] ; then \ 434 echo "Tinderbox failed:" ;\ 435 cat ${FAILFILE} ;\ 436 exit 1 ;\ 437 fi 438.endif 439.endif
|