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