1# 2# $FreeBSD$ 3# 4# Make command line options: 5# -DNO_CLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir 6# -DNO_CLEAN do not clean at all 7# -DDB_FROM_SRC use the user/group databases in src/etc instead of 8# the system database when installing. 9# -DNO_SHARE do not go into share subdir 10# -DKERNFAST define NO_KERNEL{CONFIG,CLEAN,OBJ} 11# -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel 12# -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel 13# -DNO_KERNELOBJ do not run ${MAKE} obj in ${MAKE} buildkernel 14# -DNO_PORTSUPDATE do not update ports in ${MAKE} update 15# -DNO_ROOT install without using root privilege 16# -DNO_DOCUPDATE do not update doc in ${MAKE} update 17# -DWITHOUT_CTF do not run the DTrace CTF conversion tools on built objects 18# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list 19# LOCAL_ITOOLS="list of tools" to add additional tools to the ITOOLS list 20# LOCAL_LIB_DIRS="list of dirs" to add additional dirs to libraries target 21# LOCAL_MTREE="list of mtree files" to process to allow local directories 22# to be created before files are installed 23# LOCAL_TOOL_DIRS="list of dirs" to add additional dirs to the build-tools 24# list 25# LOCAL_XTOOL_DIRS="list of dirs" to add additional dirs to the 26# cross-tools target 27# METALOG="path to metadata log" to write permission and ownership 28# when NO_ROOT is set. (default: ${DESTDIR}/METALOG) 29# TARGET="machine" to crossbuild world for a different machine type 30# TARGET_ARCH= may be required when a TARGET supports multiple endians 31# BUILDENV_SHELL= shell to launch for the buildenv target (def:${SHELL}) 32# WORLD_FLAGS= additional flags to pass to make(1) during buildworld 33# KERNEL_FLAGS= additional flags to pass to make(1) during buildkernel 34# SUBDIR_OVERRIDE="list of dirs" to build rather than everything. 35# All libraries and includes, and some build tools will still build. 36 37# 38# The intended user-driven targets are: 39# buildworld - rebuild *everything*, including glue to help do upgrades 40# installworld- install everything built by "buildworld" 41# checkworld - run test suite on installed world 42# doxygen - build API documentation of the kernel 43# update - convenient way to update your source tree (eg: svn/svnup) 44# 45# Standard targets (not defined here) are documented in the makefiles in 46# /usr/share/mk. These include: 47# obj depend all install clean cleandepend cleanobj 48 49.if !defined(TARGET) || !defined(TARGET_ARCH) 50.error "Both TARGET and TARGET_ARCH must be defined." 51.endif 52 53SRCDIR?= ${.CURDIR} 54LOCALBASE?= /usr/local 55 56# Cross toolchain changes must be in effect before bsd.compiler.mk 57# so that gets the right CC, and pass CROSS_TOOLCHAIN to submakes. 58.if defined(CROSS_TOOLCHAIN) 59.include "${LOCALBASE}/share/toolchains/${CROSS_TOOLCHAIN}.mk" 60CROSSENV+=CROSS_TOOLCHAIN="${CROSS_TOOLCHAIN}" 61.endif 62.if defined(CROSS_TOOLCHAIN_PREFIX) 63CROSS_COMPILER_PREFIX?=${CROSS_TOOLCHAIN_PREFIX} 64.endif 65 66XCOMPILERS= CC CXX CPP 67.for COMPILER in ${XCOMPILERS} 68.if defined(CROSS_COMPILER_PREFIX) 69X${COMPILER}?= ${CROSS_COMPILER_PREFIX}${${COMPILER}} 70.else 71X${COMPILER}?= ${${COMPILER}} 72.endif 73.endfor 74# If a full path to an external cross compiler is given, don't build 75# a cross compiler. 76.if ${XCC:N${CCACHE_BIN}:M/*} 77MK_CLANG_BOOTSTRAP= no 78MK_GCC_BOOTSTRAP= no 79.endif 80 81# Pull in compiler metadata from buildworld/toolchain if possible to avoid 82# running CC from bsd.compiler.mk. 83.if make(installworld) || make(install) || make(distributeworld) || \ 84 make(stageworld) 85.-include "${OBJTOP}/compiler-metadata.mk" 86.endif 87 88# Pull in COMPILER_TYPE and COMPILER_FREEBSD_VERSION early. 89.include <bsd.compiler.mk> 90.include "share/mk/src.opts.mk" 91 92# Check if there is a local compiler that can satisfy as an external compiler. 93# Which compiler is expected to be used? 94.if ${MK_CLANG_BOOTSTRAP} == "yes" 95WANT_COMPILER_TYPE= clang 96.elif ${MK_GCC_BOOTSTRAP} == "yes" 97WANT_COMPILER_TYPE= gcc 98.else 99WANT_COMPILER_TYPE= 100.endif 101.if !defined(WANT_COMPILER_FREEBSD_VERSION) 102.if ${WANT_COMPILER_TYPE} == "clang" 103WANT_COMPILER_FREEBSD_VERSION_FILE= lib/clang/freebsd_cc_version.h 104WANT_COMPILER_FREEBSD_VERSION!= \ 105 awk '$$2 == "FREEBSD_CC_VERSION" {printf("%d\n", $$3)}' \ 106 ${SRCDIR}/${WANT_COMPILER_FREEBSD_VERSION_FILE} || echo unknown 107WANT_COMPILER_VERSION_FILE= lib/clang/include/clang/Basic/Version.inc 108WANT_COMPILER_VERSION!= \ 109 awk '$$2 == "CLANG_VERSION" {split($$3, a, "."); print a[1] * 10000 + a[2] * 100 + a[3]}' \ 110 ${SRCDIR}/${WANT_COMPILER_VERSION_FILE} || echo unknown 111.elif ${WANT_COMPILER_TYPE} == "gcc" 112WANT_COMPILER_FREEBSD_VERSION_FILE= gnu/usr.bin/cc/cc_tools/freebsd-native.h 113WANT_COMPILER_FREEBSD_VERSION!= \ 114 awk '$$2 == "FBSD_CC_VER" {printf("%d\n", $$3)}' \ 115 ${SRCDIR}/${WANT_COMPILER_FREEBSD_VERSION_FILE} || echo unknown 116WANT_COMPILER_VERSION_FILE= contrib/gcc/BASE-VER 117WANT_COMPILER_VERSION!= \ 118 awk -F. '{print $$1 * 10000 + $$2 * 100 + $$3}' \ 119 ${SRCDIR}/${WANT_COMPILER_VERSION_FILE} || echo unknown 120.endif 121.export WANT_COMPILER_FREEBSD_VERSION WANT_COMPILER_TYPE WANT_COMPILER_VERSION 122.endif # !defined(WANT_COMPILER_FREEBSD_VERSION) 123# It needs to be the same revision as we would build for the bootstrap. 124# If the expected vs CC is different then we can't skip. 125# GCC cannot be used for cross-arch yet. For clang we pass -target later if 126# TARGET_ARCH!=MACHINE_ARCH. 127.if ${MK_SYSTEM_COMPILER} == "yes" && \ 128 (${MK_CLANG_BOOTSTRAP} == "yes" || ${MK_GCC_BOOTSTRAP} == "yes") && \ 129 !make(showconfig) && !make(xdev*) && \ 130 ${WANT_COMPILER_TYPE} == ${COMPILER_TYPE} && \ 131 (${COMPILER_TYPE} == "clang" || ${TARGET_ARCH} == ${MACHINE_ARCH}) && \ 132 ${COMPILER_VERSION} == ${WANT_COMPILER_VERSION} && \ 133 ${COMPILER_FREEBSD_VERSION} == ${WANT_COMPILER_FREEBSD_VERSION} 134# Everything matches, disable the bootstrap compiler. 135MK_CLANG_BOOTSTRAP= no 136MK_GCC_BOOTSTRAP= no 137USING_SYSTEM_COMPILER= yes 138.endif # ${WANT_COMPILER_TYPE} == ${COMPILER_TYPE} 139USING_SYSTEM_COMPILER?= no 140TEST_SYSTEM_COMPILER_VARS= \ 141 USING_SYSTEM_COMPILER MK_SYSTEM_COMPILER \ 142 MK_CROSS_COMPILER MK_CLANG_BOOTSTRAP MK_GCC_BOOTSTRAP \ 143 WANT_COMPILER_TYPE WANT_COMPILER_VERSION WANT_COMPILER_VERSION_FILE \ 144 WANT_COMPILER_FREEBSD_VERSION WANT_COMPILER_FREEBSD_VERSION_FILE \ 145 CC COMPILER_TYPE COMPILER_FEATURES COMPILER_VERSION \ 146 COMPILER_FREEBSD_VERSION \ 147 LINKER_TYPE LINKER_VERSION 148test-system-compiler: .PHONY 149.for v in ${TEST_SYSTEM_COMPILER_VARS} 150 ${_+_}@printf "%-35s= %s\n" "${v}" "${${v}}" 151.endfor 152.if ${USING_SYSTEM_COMPILER} == "yes" && \ 153 (make(buildworld) || make(buildkernel) || make(kernel-toolchain) || \ 154 make(toolchain) || make(_cross-tools)) 155.info SYSTEM_COMPILER: Determined that CC=${CC} matches the source tree. Not bootstrapping a cross-compiler. 156.endif 157 158# For installworld need to ensure that the looked-up compiler metadata is 159# passed along rather than trying to run cc from the restricted 160# STRICTTMPPATH. 161.if ${MK_CLANG_BOOTSTRAP} == "no" && ${MK_GCC_BOOTSTRAP} == "no" 162.if !defined(X_COMPILER_TYPE) 163CROSSENV+= COMPILER_VERSION=${COMPILER_VERSION} \ 164 COMPILER_TYPE=${COMPILER_TYPE} \ 165 COMPILER_FEATURES=${COMPILER_FEATURES} \ 166 COMPILER_FREEBSD_VERSION=${COMPILER_FREEBSD_VERSION} 167.else 168CROSSENV+= COMPILER_VERSION=${X_COMPILER_VERSION} \ 169 COMPILER_FEATURES=${X_COMPILER_FEATURES} \ 170 COMPILER_TYPE=${X_COMPILER_TYPE} \ 171 COMPILER_FREEBSD_VERSION=${X_COMPILER_FREEBSD_VERSION} 172.endif 173.endif 174# Store some compiler metadata for use in installworld where we don't 175# want to invoke CC at all. 176_COMPILER_METADATA_VARS= COMPILER_VERSION \ 177 COMPILER_TYPE \ 178 COMPILER_FEATURES \ 179 COMPILER_FREEBSD_VERSION \ 180 LINKER_VERSION \ 181 LINKER_TYPE 182compiler-metadata.mk: .PHONY .META 183 @: > ${.TARGET} 184 @echo ".info Using cached compiler metadata from build at $$(hostname) on $$(date)" \ 185 > ${.TARGET} 186.for v in ${_COMPILER_METADATA_VARS} 187 @echo "${v}=${${v}}" >> ${.TARGET} 188.endfor 189 @echo ".export ${_COMPILER_METADATA_VARS}" >> ${.TARGET} 190 191# Handle external binutils. 192.if defined(CROSS_TOOLCHAIN_PREFIX) 193CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX} 194.endif 195# If we do not have a bootstrap binutils (because the in-tree one does not 196# support the target architecture), provide a default cross-binutils prefix. 197# This allows riscv64 builds, for example, to automatically use the 198# riscv64-binutils port or package. 199.if !make(showconfig) 200.if !empty(BROKEN_OPTIONS:MBINUTILS_BOOTSTRAP) && \ 201 ${MK_LLD_BOOTSTRAP} == "no" && \ 202 !defined(CROSS_BINUTILS_PREFIX) 203CROSS_BINUTILS_PREFIX=/usr/local/${TARGET_ARCH}-freebsd/bin/ 204.if !exists(${CROSS_BINUTILS_PREFIX}) 205.error In-tree binutils does not support the ${TARGET_ARCH} architecture. Install the ${TARGET_ARCH}-binutils port or package or set CROSS_BINUTILS_PREFIX. 206.endif 207.endif 208.endif 209XBINUTILS= AS AR LD NM OBJCOPY RANLIB SIZE STRINGS 210.for BINUTIL in ${XBINUTILS} 211.if defined(CROSS_BINUTILS_PREFIX) && \ 212 exists(${CROSS_BINUTILS_PREFIX}${${BINUTIL}}) 213X${BINUTIL}?= ${CROSS_BINUTILS_PREFIX}${${BINUTIL}} 214.else 215X${BINUTIL}?= ${${BINUTIL}} 216.endif 217.endfor 218 219 220# We must do lib/ and libexec/ before bin/ in case of a mid-install error to 221# keep the users system reasonably usable. For static->dynamic root upgrades, 222# we don't want to install a dynamic binary without rtld and the needed 223# libraries. More commonly, for dynamic root, we don't want to install a 224# binary that requires a newer library version that hasn't been installed yet. 225# This ordering is not a guarantee though. The only guarantee of a working 226# system here would require fine-grained ordering of all components based 227# on their dependencies. 228.if !empty(SUBDIR_OVERRIDE) 229SUBDIR= ${SUBDIR_OVERRIDE} 230.else 231SUBDIR= lib libexec 232.if !defined(NO_ROOT) && (make(installworld) || make(install)) 233# Ensure libraries are installed before progressing. 234SUBDIR+=.WAIT 235.endif 236SUBDIR+=bin 237.if ${MK_CDDL} != "no" 238SUBDIR+=cddl 239.endif 240SUBDIR+=gnu include 241.if ${MK_KERBEROS} != "no" 242SUBDIR+=kerberos5 243.endif 244.if ${MK_RESCUE} != "no" 245SUBDIR+=rescue 246.endif 247SUBDIR+=sbin 248.if ${MK_CRYPT} != "no" 249SUBDIR+=secure 250.endif 251.if !defined(NO_SHARE) 252SUBDIR+=share 253.endif 254SUBDIR+=sys usr.bin usr.sbin 255.if ${MK_TESTS} != "no" 256SUBDIR+= tests 257.endif 258.if ${MK_OFED} != "no" 259SUBDIR+=contrib/ofed 260.endif 261 262# Local directories are last, since it is nice to at least get the base 263# system rebuilt before you do them. 264.for _DIR in ${LOCAL_DIRS} 265.if exists(${.CURDIR}/${_DIR}/Makefile) 266SUBDIR+= ${_DIR} 267.endif 268.endfor 269# Add LOCAL_LIB_DIRS, but only if they will not be picked up as a SUBDIR 270# of a LOCAL_DIRS directory. This allows LOCAL_DIRS=foo and 271# LOCAL_LIB_DIRS=foo/lib to behave as expected. 272.for _DIR in ${LOCAL_DIRS:M*/} ${LOCAL_DIRS:N*/:S|$|/|} 273_REDUNDANT_LIB_DIRS+= ${LOCAL_LIB_DIRS:M${_DIR}*} 274.endfor 275.for _DIR in ${LOCAL_LIB_DIRS} 276.if empty(_REDUNDANT_LIB_DIRS:M${_DIR}) && exists(${.CURDIR}/${_DIR}/Makefile) 277SUBDIR+= ${_DIR} 278.endif 279.endfor 280 281# We must do etc/ last as it hooks into building the man whatis file 282# by calling 'makedb' in share/man. This is only relevant for 283# install/distribute so they build the whatis file after every manpage is 284# installed. 285.if make(installworld) || make(install) 286SUBDIR+=.WAIT 287.endif 288SUBDIR+=etc 289 290.endif # !empty(SUBDIR_OVERRIDE) 291 292.if defined(NOCLEAN) 293.warning NOCLEAN option is deprecated. Use NO_CLEAN instead. 294NO_CLEAN= ${NOCLEAN} 295.endif 296.if defined(NO_CLEANDIR) 297CLEANDIR= clean cleandepend 298.else 299CLEANDIR= cleandir 300.endif 301 302.if defined(WORLDFAST) 303NO_CLEAN= t 304NO_OBJWALK= t 305.endif 306 307.if ${MK_META_MODE} == "yes" 308# If filemon is used then we can rely on the build being incremental-safe. 309# The .meta files will also track the build command and rebuild should 310# it change. 311.if empty(.MAKE.MODE:Mnofilemon) 312NO_CLEAN= t 313.endif 314.endif 315.if defined(NO_OBJWALK) || ${MK_AUTO_OBJ} == "yes" 316NO_OBJWALK= t 317NO_KERNELOBJ= t 318.endif 319.if !defined(NO_OBJWALK) 320_obj= obj 321.endif 322 323LOCAL_TOOL_DIRS?= 324PACKAGEDIR?= ${DESTDIR}/${DISTDIR} 325 326.if empty(SHELL:M*csh*) 327BUILDENV_SHELL?=${SHELL} 328.else 329BUILDENV_SHELL?=/bin/sh 330.endif 331 332.if !defined(SVN) || empty(SVN) 333. for _P in /usr/bin /usr/local/bin 334. for _S in svn svnlite 335. if exists(${_P}/${_S}) 336SVN= ${_P}/${_S} 337. endif 338. endfor 339. endfor 340.endif 341SVNFLAGS?= -r HEAD 342.if !defined(VCS_REVISION) && empty(VCS_REVISION) 343_VCS_REVISION?= $$(eval ${SVNVERSION_CMD} ${SRCDIR}) 344. if !empty(_VCS_REVISION) 345VCS_REVISION= $$(echo r${_VCS_REVISION}) 346. endif 347.endif 348 349.if !defined(OSRELDATE) 350.if exists(/usr/include/osreldate.h) 351OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \ 352 /usr/include/osreldate.h 353.else 354OSRELDATE= 0 355.endif 356.export OSRELDATE 357.endif 358 359# Set VERSION for CTFMERGE to use via the default CTFFLAGS=-L VERSION. 360.if !defined(_REVISION) 361_REVISION!= ${MAKE} -C ${SRCDIR}/release MK_AUTO_OBJ=no -V REVISION 362.export _REVISION 363.endif 364.if !defined(_BRANCH) 365_BRANCH!= ${MAKE} -C ${SRCDIR}/release MK_AUTO_OBJ=no -V BRANCH 366.export _BRANCH 367.endif 368.if !defined(SRCRELDATE) 369SRCRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \ 370 ${SRCDIR}/sys/sys/param.h 371.export SRCRELDATE 372.endif 373.if !defined(VERSION) 374VERSION= FreeBSD ${_REVISION}-${_BRANCH:C/-p[0-9]+$//} ${TARGET_ARCH} ${SRCRELDATE} 375.export VERSION 376.endif 377 378.if !defined(PKG_VERSION) 379.if ${_BRANCH:MSTABLE*} || ${_BRANCH:MCURRENT*} || ${_BRANCH:MALPHA*} 380TIMENOW= %Y%m%d%H%M%S 381EXTRA_REVISION= .s${TIMENOW:gmtime} 382.endif 383.if ${_BRANCH:M*-p*} 384EXTRA_REVISION= _${_BRANCH:C/.*-p([0-9]+$)/\1/} 385.endif 386PKG_VERSION= ${_REVISION}${EXTRA_REVISION} 387.endif 388 389KNOWN_ARCHES?= aarch64/arm64 \ 390 amd64 \ 391 arm \ 392 armeb/arm \ 393 armv6/arm \ 394 armv7/arm \ 395 i386 \ 396 mips \ 397 mipsel/mips \ 398 mips64el/mips \ 399 mipsn32el/mips \ 400 mips64/mips \ 401 mipsn32/mips \ 402 mipshf/mips \ 403 mipselhf/mips \ 404 mips64elhf/mips \ 405 mips64hf/mips \ 406 powerpc \ 407 powerpc64/powerpc \ 408 powerpcspe/powerpc \ 409 riscv64/riscv \ 410 riscv64sf/riscv \ 411 sparc64 412 413.if ${TARGET} == ${TARGET_ARCH} 414_t= ${TARGET} 415.else 416_t= ${TARGET_ARCH}/${TARGET} 417.endif 418.for _t in ${_t} 419.if empty(KNOWN_ARCHES:M${_t}) 420.error Unknown target ${TARGET_ARCH}:${TARGET}. 421.endif 422.endfor 423 424.if ${TARGET} == ${MACHINE} 425TARGET_CPUTYPE?=${CPUTYPE} 426.else 427TARGET_CPUTYPE?= 428.endif 429 430.if !empty(TARGET_CPUTYPE) 431_TARGET_CPUTYPE=${TARGET_CPUTYPE} 432.else 433_TARGET_CPUTYPE=dummy 434.endif 435_CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} -f /dev/null \ 436 -m ${.CURDIR}/share/mk MK_AUTO_OBJ=no -V CPUTYPE 437.if ${_CPUTYPE} != ${_TARGET_CPUTYPE} 438.error CPUTYPE global should be set with ?=. 439.endif 440.if make(buildworld) 441BUILD_ARCH!= uname -p 442.if ${MACHINE_ARCH} != ${BUILD_ARCH} 443.error To cross-build, set TARGET_ARCH. 444.endif 445.endif 446WORLDTMP?= ${OBJTOP}/tmp 447BPATH= ${CCACHE_WRAPPER_PATH_PFX}${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/bin 448XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin 449STRICTTMPPATH= ${BPATH}:${XPATH} 450TMPPATH= ${STRICTTMPPATH}:${PATH} 451 452# 453# Avoid running mktemp(1) unless actually needed. 454# It may not be functional, e.g., due to new ABI 455# when in the middle of installing over this system. 456# 457.if make(distributeworld) || make(installworld) || make(stageworld) 458INSTALLTMP!= /usr/bin/mktemp -d -u -t install 459.endif 460 461.if make(stagekernel) || make(distributekernel) 462TAGS+= kernel 463PACKAGE= kernel 464.endif 465 466# 467# Building a world goes through the following stages 468# 469# 1. legacy stage [BMAKE] 470# This stage is responsible for creating compatibility 471# shims that are needed by the bootstrap-tools, 472# build-tools and cross-tools stages. These are generally 473# APIs that tools from one of those three stages need to 474# build that aren't present on the host. 475# 1. bootstrap-tools stage [BMAKE] 476# This stage is responsible for creating programs that 477# are needed for backward compatibility reasons. They 478# are not built as cross-tools. 479# 2. build-tools stage [TMAKE] 480# This stage is responsible for creating the object 481# tree and building any tools that are needed during 482# the build process. Some programs are listed during 483# this phase because they build binaries to generate 484# files needed to build these programs. This stage also 485# builds the 'build-tools' target rather than 'all'. 486# 3. cross-tools stage [XMAKE] 487# This stage is responsible for creating any tools that 488# are needed for building the system. A cross-compiler is one 489# of them. This differs from build tools in two ways: 490# 1. the 'all' target is built rather than 'build-tools' 491# 2. these tools are installed into TMPPATH for stage 4. 492# 4. world stage [WMAKE] 493# This stage actually builds the world. 494# 5. install stage (optional) [IMAKE] 495# This stage installs a previously built world. 496# 497 498BOOTSTRAPPING?= 0 499# Keep these in sync -- see below for special case exception 500MINIMUM_SUPPORTED_OSREL?= 900044 501MINIMUM_SUPPORTED_REL?= 9.1 502 503# Common environment for world related stages 504CROSSENV+= \ 505 MACHINE_ARCH=${TARGET_ARCH} \ 506 MACHINE=${TARGET} \ 507 CPUTYPE=${TARGET_CPUTYPE} 508.if ${MK_META_MODE} != "no" 509# Don't rebuild build-tools targets during normal build. 510CROSSENV+= BUILD_TOOLS_META=.NOMETA 511.endif 512.if defined(TARGET_CFLAGS) 513CROSSENV+= ${TARGET_CFLAGS} 514.endif 515 516# bootstrap-tools stage 517BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \ 518 TOOLS_PREFIX=${WORLDTMP} \ 519 PATH=${BPATH}:${PATH} \ 520 WORLDTMP=${WORLDTMP} \ 521 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" 522# need to keep this in sync with targets/pseudo/bootstrap-tools/Makefile 523BSARGS= DESTDIR= \ 524 OBJTOP='${WORLDTMP}/obj-tools' \ 525 OBJROOT='$${OBJTOP}/' \ 526 BOOTSTRAPPING=${OSRELDATE} \ 527 BWPHASE=${.TARGET:C,^_,,} \ 528 SSP_CFLAGS= \ 529 MK_COVERAGE=no MK_HTML=no NO_LINT=yes MK_MAN=no \ 530 -DNO_PIC MK_PROFILE=no -DNO_SHARED \ 531 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \ 532 MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \ 533 MK_LLDB=no MK_TESTS=no \ 534 MK_INCLUDES=yes 535 536BMAKE= \ 537 ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ 538 ${BSARGS} 539 540# build-tools stage 541TMAKE= \ 542 ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ 543 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ 544 DESTDIR= \ 545 BOOTSTRAPPING=${OSRELDATE} \ 546 BWPHASE=${.TARGET:C,^_,,} \ 547 SSP_CFLAGS= \ 548 -DNO_LINT \ 549 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \ 550 MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \ 551 MK_COVERAGE=no \ 552 MK_LLDB=no MK_TESTS=no 553 554# cross-tools stage 555# TOOLS_PREFIX set in BMAKE 556XMAKE= ${BMAKE} \ 557 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ 558 MK_GDB=no MK_LLD_IS_LD=${MK_LLD_BOOTSTRAP} MK_TESTS=no 559 560# kernel-tools stage 561KTMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \ 562 PATH=${BPATH}:${PATH} \ 563 WORLDTMP=${WORLDTMP} 564KTMAKE= TOOLS_PREFIX=${WORLDTMP} \ 565 ${KTMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ 566 DESTDIR= \ 567 OBJTOP='${WORLDTMP}/obj-kernel-tools' \ 568 OBJROOT='$${OBJTOP}/' \ 569 BOOTSTRAPPING=${OSRELDATE} \ 570 SSP_CFLAGS= \ 571 MK_COVERAGE=no MK_HTML=no -DNO_LINT MK_MAN=no \ 572 -DNO_PIC MK_PROFILE=no -DNO_SHARED \ 573 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no 574 575# world stage 576WMAKEENV= ${CROSSENV} \ 577 INSTALL="sh ${.CURDIR}/tools/install.sh" \ 578 PATH=${TMPPATH} \ 579 SYSROOT=${WORLDTMP} 580 581# make hierarchy 582HMAKE= PATH=${TMPPATH} ${MAKE} LOCAL_MTREE=${LOCAL_MTREE:Q} 583.if defined(NO_ROOT) 584HMAKE+= PATH=${TMPPATH} METALOG=${METALOG} -DNO_ROOT 585.endif 586 587CROSSENV+= CC="${XCC} ${XCFLAGS}" CXX="${XCXX} ${XCXXFLAGS} ${XCFLAGS}" \ 588 CPP="${XCPP} ${XCFLAGS}" \ 589 AS="${XAS}" AR="${XAR}" LD="${XLD}" LLVM_LINK="${XLLVM_LINK}" \ 590 NM=${XNM} OBJCOPY="${XOBJCOPY}" \ 591 RANLIB=${XRANLIB} STRINGS=${XSTRINGS} \ 592 SIZE="${XSIZE}" 593 594.if defined(CROSS_BINUTILS_PREFIX) && exists(${CROSS_BINUTILS_PREFIX}) 595# In the case of xdev-build tools, CROSS_BINUTILS_PREFIX won't be a 596# directory, but the compiler will look in the right place for its 597# tools so we don't need to tell it where to look. 598BFLAGS+= -B${CROSS_BINUTILS_PREFIX} 599.endif 600 601 602# The internal bootstrap compiler has a default sysroot set by TOOLS_PREFIX 603# and target set by TARGET/TARGET_ARCH. However, there are several needs to 604# always pass an explicit --sysroot and -target. 605# - External compiler needs sysroot and target flags. 606# - External ld needs sysroot. 607# - To be clear about the use of a sysroot when using the internal compiler. 608# - Easier debugging. 609# - Allowing WITH_SYSTEM_COMPILER+WITH_META_MODE to work together due to 610# the flip-flopping build command when sometimes using external and 611# sometimes using internal. 612# - Allow using lld which has no support for default paths. 613.if !defined(CROSS_BINUTILS_PREFIX) || !exists(${CROSS_BINUTILS_PREFIX}) 614BFLAGS+= -B${WORLDTMP}/usr/bin 615.endif 616.if ${TARGET} == "arm" 617.if ${TARGET_ARCH:Marmv[67]*} != "" && ${TARGET_CPUTYPE:M*soft*} == "" 618TARGET_ABI= gnueabihf 619.else 620TARGET_ABI= gnueabi 621.endif 622.endif 623.if ${WANT_COMPILER_TYPE} == gcc || \ 624 (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc) 625# GCC requires -isystem and -L when using a cross-compiler. --sysroot 626# won't set header path and -L is used to ensure the base library path 627# is added before the port PREFIX library path. 628XCFLAGS+= -isystem ${WORLDTMP}/usr/include -L${WORLDTMP}/usr/lib 629# GCC requires -B to find /usr/lib/crti.o when using a cross-compiler 630# combined with --sysroot. 631XCFLAGS+= -B${WORLDTMP}/usr/lib 632# Force using libc++ for external GCC. 633.if ${X_COMPILER_TYPE} == gcc && ${X_COMPILER_VERSION} >= 40800 634XCXXFLAGS+= -isystem ${WORLDTMP}/usr/include/c++/v1 -std=c++11 \ 635 -nostdinc++ 636.endif 637.elif ${WANT_COMPILER_TYPE} == clang || \ 638 (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == clang) 639MACHINE_ABI?= unknown 640MACHINE_TRIPLE?=${MACHINE_ARCH:C/amd64/x86_64/}-${MACHINE_ABI}-freebsd12.0 641TARGET_ABI?= unknown 642TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd12.0 643XCFLAGS+= -target ${TARGET_TRIPLE} 644.endif 645XCFLAGS+= --sysroot=${WORLDTMP} 646 647.if !empty(BFLAGS) 648XCFLAGS+= ${BFLAGS} 649.endif 650 651.if ${MK_LIB32} != "no" && (${TARGET_ARCH} == "amd64" || \ 652 ${TARGET_ARCH} == "powerpc64" || ${TARGET_ARCH:Mmips64*} != "") 653LIBCOMPAT= 32 654.include "Makefile.libcompat" 655.elif ${MK_LIBSOFT} != "no" && ${TARGET_ARCH:Marmv[67]*} != "" 656LIBCOMPAT= SOFT 657.include "Makefile.libcompat" 658.endif 659 660# META_MODE normally ignores host file changes since every build updates 661# timestamps (see NO_META_IGNORE_HOST in sys.mk). There are known times 662# when the ABI breaks though that we want to force rebuilding WORLDTMP 663# to get updated host tools. 664.if ${MK_META_MODE} == "yes" && defined(NO_CLEAN) && \ 665 !defined(NO_META_IGNORE_HOST) && !defined(NO_META_IGNORE_HOST_HEADERS) && \ 666 !make(showconfig) 667# r318736 - ino64 major ABI breakage 668META_MODE_BAD_ABI_VERS+= 1200031 669 670.if !defined(OBJDIR_HOST_OSRELDATE) 671.if exists(${OBJTOP}/host-osreldate.h) 672OBJDIR_HOST_OSRELDATE!= \ 673 awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \ 674 ${OBJTOP}/host-osreldate.h 675.elif exists(${WORLDTMP}/usr/include/osreldate.h) 676OBJDIR_HOST_OSRELDATE= 0 677.endif 678.export OBJDIR_HOST_OSRELDATE 679.endif 680 681# Note that this logic is the opposite of normal BOOTSTRAP handling. We want 682# to compare the WORLDTMP's OSRELDATE to the host's OSRELDATE. If the WORLDTMP 683# is older than the ABI-breakage OSRELDATE of the HOST then we rebuild. 684.if defined(OBJDIR_HOST_OSRELDATE) 685.for _ver in ${META_MODE_BAD_ABI_VERS} 686.if ${OSRELDATE} >= ${_ver} && ${OBJDIR_HOST_OSRELDATE} < ${_ver} 687_meta_mode_need_rebuild= ${_ver} 688.endif 689.endfor 690.if defined(_meta_mode_need_rebuild) 691.info META_MODE: Rebuilding host tools due to ABI breakage in __FreeBSD_version ${_meta_mode_need_rebuild}. 692NO_META_IGNORE_HOST_HEADERS= 1 693.export NO_META_IGNORE_HOST_HEADERS 694.endif # defined(_meta_mode_need_rebuild) 695.endif # defined(OBJDIR_HOST_OSRELDATE) 696.endif # ${MK_META_MODE} == "yes" && defined(NO_CLEAN) ... 697# This is only used for META_MODE+filemon to track what the oldest 698# __FreeBSD_version is in WORLDTMP. This purposely does NOT have 699# a make dependency on /usr/include/osreldate.h as the file should 700# only be copied when it is missing or meta mode determines it has changed. 701# Since host files are normally ignored without NO_META_IGNORE_HOST 702# the file will never be updated unless that flag is specified. This 703# allows tracking the oldest osreldate to force rebuilds via 704# META_MODE_BADABI_REVS above. 705host-osreldate.h: # DO NOT ADD /usr/include/osreldate.h here 706 @cp -f /usr/include/osreldate.h ${.TARGET} 707 708WMAKE= ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ 709 BWPHASE=${.TARGET:C,^_,,} \ 710 DESTDIR=${WORLDTMP} 711 712IMAKEENV= ${CROSSENV} 713IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 \ 714 ${IMAKE_INSTALL} ${IMAKE_MTREE} 715.if empty(.MAKEFLAGS:M-n) 716IMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMP} \ 717 LD_LIBRARY_PATH=${INSTALLTMP} \ 718 PATH_LOCALE=${INSTALLTMP}/locale 719IMAKE+= __MAKE_SHELL=${INSTALLTMP}/sh 720.else 721IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP} 722.endif 723.if defined(DB_FROM_SRC) 724INSTALLFLAGS+= -N ${.CURDIR}/etc 725MTREEFLAGS+= -N ${.CURDIR}/etc 726.endif 727_INSTALL_DDIR= ${DESTDIR}/${DISTDIR} 728INSTALL_DDIR= ${_INSTALL_DDIR:S://:/:g:C:/$::} 729.if defined(NO_ROOT) 730METALOG?= ${DESTDIR}/${DISTDIR}/METALOG 731METALOG:= ${METALOG:C,//+,/,g} 732IMAKE+= -DNO_ROOT METALOG=${METALOG} 733INSTALLFLAGS+= -U -M ${METALOG} -D ${INSTALL_DDIR} 734MTREEFLAGS+= -W 735.endif 736.if defined(BUILD_PKGS) 737INSTALLFLAGS+= -h sha256 738.endif 739.if defined(DB_FROM_SRC) || defined(NO_ROOT) 740IMAKE_INSTALL= INSTALL="install ${INSTALLFLAGS}" 741IMAKE_MTREE= MTREE_CMD="mtree ${MTREEFLAGS}" 742.endif 743 744# kernel stage 745KMAKEENV= ${WMAKEENV:NSYSROOT=*} 746KMAKE= ${KMAKEENV} ${MAKE} ${.MAKEFLAGS} ${KERNEL_FLAGS} KERNEL=${INSTKERNNAME} 747 748# 749# buildworld 750# 751# Attempt to rebuild the entire system, with reasonable chance of 752# success, regardless of how old your existing system is. 753# 754_sanity_check: .PHONY .MAKE 755.if ${.CURDIR:C/[^,]//g} != "" 756# The m4 build of sendmail files doesn't like it if ',' is used 757# anywhere in the path of it's files. 758 @echo 759 @echo "*** Error: path to source tree contains a comma ','" 760 @echo 761 @false 762.elif ${.CURDIR:M*\:*} != "" 763# Using ':' leaks into PATH and breaks finding cross-tools. 764 @echo 765 @echo "*** Error: path to source tree contains a colon ':'" 766 @echo 767 @false 768.endif 769 770# Our current approach to dependency tracking cannot cope with certain source 771# tree changes, particularly with respect to removing source files and 772# replacing generated files. Handle these cases here in an ad-hoc fashion. 773_cleanobj_fast_depend_hack: .PHONY 774# Syscall stubs rewritten in C 775# Date SVN Rev Syscalls 776# 20160829 r305012 ptrace 777# 20170624 r320278 fstat fstatat fstatfs getdirentries getfsstat statfs 778.for f in fstat fstatat fstatfs getdirentries getfsstat ptrace statfs 779.if exists(${OBJTOP}/lib/libc/.depend.${f}.o) 780 @if egrep -qw '${f}\.[sS]' \ 781 ${OBJTOP}/lib/libc/.depend.${f}.o; then \ 782 echo Removing stale dependencies for ${f} syscall wrappers; \ 783 rm -f ${OBJTOP}/lib/libc/.depend.${f}.* \ 784 ${LIBCOMPAT:D${LIBCOMPAT_OBJTOP}/lib/libc/.depend.${f}.*}; \ 785 fi 786.endif 787.endfor 788# 20170607 remove stale dependencies for utimens* wrappers removed in r319663 789.for f in futimens utimensat 790.if exists(${OBJTOP}/lib/libc/.depend.${f}.o) 791 @if egrep -q '/${f}.c' \ 792 ${OBJTOP}/lib/libc/.depend.${f}.o; then \ 793 echo Removing stale dependencies for ${f} syscall wrappers; \ 794 rm -f ${OBJTOP}/lib/libc/.depend.${f}.* \ 795 ${LIBCOMPAT:D${LIBCOMPAT_OBJTOP}/lib/libc/.depend.${f}.*}; \ 796 fi 797.endif 798.endfor 799# 20170523 remove stale generated asm files for functions which are no longer 800# syscalls after r302092 (pipe) and r318736 (others) 801.for f in getdents lstat mknod pipe stat 802.if exists(${OBJTOP}/lib/libc/${f}.s) || \ 803 exists(${OBJTOP}/lib/libc/${f}.S) 804 @echo Removing stale generated ${f} syscall files 805 @rm -f ${OBJTOP}/lib/libc/${f}.* \ 806 ${OBJTOP}/lib/libc/.depend.${f}.* \ 807 ${LIBCOMPAT:D${LIBCOMPAT_OBJTOP}/lib/libc/${f}.*} \ 808 ${LIBCOMPAT:D${LIBCOMPAT_OBJTOP}/lib/libc/.depend.${f}.*} 809.endif 810.endfor 811 812_worldtmp: .PHONY 813 @echo 814 @echo "--------------------------------------------------------------" 815 @echo ">>> Rebuilding the temporary build tree" 816 @echo "--------------------------------------------------------------" 817.if !defined(NO_CLEAN) 818 rm -rf ${WORLDTMP} 819.else 820.if exists(${WORLDTMP}) 821 @echo ">>> Deleting stale files in build tree..." 822 ${_+_}cd ${.CURDIR}; ${WMAKE} -DBATCH_DELETE_OLD_FILES \ 823 delete-old delete-old-libs >/dev/null 824.endif 825 rm -rf ${WORLDTMP}/legacy/usr/include 826.if ${USING_SYSTEM_COMPILER} == "yes" 827.for cc in cc c++ 828 if [ -x ${WORLDTMP}/usr/bin/${cc} ]; then \ 829 inum=$$(stat -f %i ${WORLDTMP}/usr/bin/${cc}); \ 830 find ${WORLDTMP}/usr/bin -inum $${inum} -delete; \ 831 fi 832.endfor 833.endif # ${USING_SYSTEM_COMPILER} == "yes" 834.endif # !defined(NO_CLEAN) 835 @mkdir -p ${WORLDTMP} 836 @touch ${WORLDTMP}/${.TARGET} 837 838.for _dir in \ 839 lib lib/casper usr legacy/bin legacy/usr 840 mkdir -p ${WORLDTMP}/${_dir} 841.endfor 842 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 843 -p ${WORLDTMP}/legacy/usr >/dev/null 844 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 845 -p ${WORLDTMP}/legacy/usr/include >/dev/null 846 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 847 -p ${WORLDTMP}/usr >/dev/null 848 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 849 -p ${WORLDTMP}/usr/include >/dev/null 850 ln -sf ${.CURDIR}/sys ${WORLDTMP} 851.if ${MK_DEBUG_FILES} != "no" 852 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \ 853 -p ${WORLDTMP}/legacy/usr/lib >/dev/null 854 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \ 855 -p ${WORLDTMP}/usr/lib >/dev/null 856.endif 857.for _mtree in ${LOCAL_MTREE} 858 mtree -deU -f ${.CURDIR}/${_mtree} -p ${WORLDTMP} > /dev/null 859.endfor 860_legacy: 861 @echo 862 @echo "--------------------------------------------------------------" 863 @echo ">>> stage 1.1: legacy release compatibility shims" 864 @echo "--------------------------------------------------------------" 865 ${_+_}cd ${.CURDIR}; ${BMAKE} legacy 866_bootstrap-tools: 867 @echo 868 @echo "--------------------------------------------------------------" 869 @echo ">>> stage 1.2: bootstrap tools" 870 @echo "--------------------------------------------------------------" 871 ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools 872_cleanobj: 873.if !defined(NO_CLEAN) 874 @echo 875 @echo "--------------------------------------------------------------" 876 @echo ">>> stage 2.1: cleaning up the object tree" 877 @echo "--------------------------------------------------------------" 878 ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR} 879.if defined(LIBCOMPAT) 880 ${_+_}cd ${.CURDIR}; ${LIBCOMPATWMAKE} -f Makefile.inc1 ${CLEANDIR} 881.endif 882.else 883 ${_+_}cd ${.CURDIR}; ${WMAKE} _cleanobj_fast_depend_hack 884.endif # !defined(NO_CLEAN) 885_obj: 886 @echo 887 @echo "--------------------------------------------------------------" 888 @echo ">>> stage 2.2: rebuilding the object tree" 889 @echo "--------------------------------------------------------------" 890 ${_+_}cd ${.CURDIR}; ${WMAKE} obj 891_build-tools: 892 @echo 893 @echo "--------------------------------------------------------------" 894 @echo ">>> stage 2.3: build tools" 895 @echo "--------------------------------------------------------------" 896 ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools 897_cross-tools: 898 @echo 899 @echo "--------------------------------------------------------------" 900 @echo ">>> stage 3: cross tools" 901 @echo "--------------------------------------------------------------" 902 @rm -f ${OBJTOP}/compiler-metadata.mk 903 ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools 904 ${_+_}cd ${.CURDIR}; ${XMAKE} kernel-tools 905_build-metadata: 906 @echo 907 @echo "--------------------------------------------------------------" 908 @echo ">>> stage 3.1: recording build metadata" 909 @echo "--------------------------------------------------------------" 910 ${_+_}cd ${.CURDIR}; ${WMAKE} compiler-metadata.mk 911 ${_+_}cd ${.CURDIR}; ${WMAKE} host-osreldate.h 912_includes: 913 @echo 914 @echo "--------------------------------------------------------------" 915 @echo ">>> stage 4.1: building includes" 916 @echo "--------------------------------------------------------------" 917# Special handling for SUBDIR_OVERRIDE in buildworld as they most likely need 918# headers from default SUBDIR. Do SUBDIR_OVERRIDE includes last. 919 ${_+_}cd ${.CURDIR}; ${WMAKE} SUBDIR_OVERRIDE= SHARED=symlinks \ 920 MK_INCLUDES=yes includes 921.if !empty(SUBDIR_OVERRIDE) && make(buildworld) 922 ${_+_}cd ${.CURDIR}; ${WMAKE} MK_INCLUDES=yes SHARED=symlinks includes 923.endif 924_libraries: 925 @echo 926 @echo "--------------------------------------------------------------" 927 @echo ">>> stage 4.2: building libraries" 928 @echo "--------------------------------------------------------------" 929 ${_+_}cd ${.CURDIR}; \ 930 ${WMAKE} -DNO_FSCHG MK_HTML=no -DNO_LINT MK_MAN=no \ 931 MK_PROFILE=no MK_TESTS=no MK_TESTS_SUPPORT=${MK_TESTS} libraries 932everything: .PHONY 933 @echo 934 @echo "--------------------------------------------------------------" 935 @echo ">>> stage 4.3: building everything" 936 @echo "--------------------------------------------------------------" 937 ${_+_}cd ${.CURDIR}; _PARALLEL_SUBDIR_OK=1 ${WMAKE} all 938 939WMAKE_TGTS= 940.if !defined(WORLDFAST) 941WMAKE_TGTS+= _sanity_check _worldtmp _legacy 942.if empty(SUBDIR_OVERRIDE) 943WMAKE_TGTS+= _bootstrap-tools 944.endif 945WMAKE_TGTS+= _cleanobj 946.if !defined(NO_OBJWALK) 947WMAKE_TGTS+= _obj 948.endif 949WMAKE_TGTS+= _build-tools _cross-tools 950WMAKE_TGTS+= _build-metadata 951WMAKE_TGTS+= _includes 952.endif 953.if !defined(NO_LIBS) 954WMAKE_TGTS+= _libraries 955.endif 956WMAKE_TGTS+= everything 957.if defined(LIBCOMPAT) && empty(SUBDIR_OVERRIDE) 958WMAKE_TGTS+= build${libcompat} 959.endif 960 961buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue .PHONY 962.ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue 963 964buildworld_prologue: .PHONY 965 @echo "--------------------------------------------------------------" 966 @echo ">>> World build started on `LC_ALL=C date`" 967 @echo "--------------------------------------------------------------" 968 969buildworld_epilogue: .PHONY 970 @echo 971 @echo "--------------------------------------------------------------" 972 @echo ">>> World build completed on `LC_ALL=C date`" 973 @echo "--------------------------------------------------------------" 974 975# 976# We need to have this as a target because the indirection between Makefile 977# and Makefile.inc1 causes the correct PATH to be used, rather than a 978# modification of the current environment's PATH. In addition, we need 979# to quote multiword values. 980# 981buildenvvars: .PHONY 982 @echo ${WMAKEENV:Q} ${.MAKE.EXPORTED:@v@$v=\"${$v}\"@} 983 984.if ${.TARGETS:Mbuildenv} 985.if ${.MAKEFLAGS:M-j} 986.error The buildenv target is incompatible with -j 987.endif 988.endif 989BUILDENV_DIR?= ${.CURDIR} 990buildenv: .PHONY 991 @echo Entering world for ${TARGET_ARCH}:${TARGET} 992.if ${BUILDENV_SHELL:M*zsh*} 993 @echo For ZSH you must run: export CPUTYPE=${TARGET_CPUTYPE} 994.endif 995 @cd ${BUILDENV_DIR} && env ${WMAKEENV} BUILDENV=1 ${BUILDENV_SHELL} 996 997TOOLCHAIN_TGTS= ${WMAKE_TGTS:Neverything:Nbuild${libcompat}} 998toolchain: ${TOOLCHAIN_TGTS} .PHONY 999KERNEL_TOOLCHAIN_TGTS= ${TOOLCHAIN_TGTS:N_obj:N_cleanobj:N_includes:N_libraries} 1000.if make(kernel-toolchain) 1001.ORDER: ${KERNEL_TOOLCHAIN_TGTS} 1002.endif 1003kernel-toolchain: ${KERNEL_TOOLCHAIN_TGTS} .PHONY 1004 1005# 1006# installcheck 1007# 1008# Checks to be sure system is ready for installworld/installkernel. 1009# 1010installcheck: _installcheck_world _installcheck_kernel .PHONY 1011_installcheck_world: .PHONY 1012_installcheck_kernel: .PHONY 1013 1014# 1015# Require DESTDIR to be set if installing for a different architecture or 1016# using the user/group database in the source tree. 1017# 1018.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE} || \ 1019 defined(DB_FROM_SRC) 1020.if !make(distributeworld) 1021_installcheck_world: __installcheck_DESTDIR 1022_installcheck_kernel: __installcheck_DESTDIR 1023__installcheck_DESTDIR: .PHONY 1024.if !defined(DESTDIR) || empty(DESTDIR) 1025 @echo "ERROR: Please set DESTDIR!"; \ 1026 false 1027.endif 1028.endif 1029.endif 1030 1031.if !defined(DB_FROM_SRC) 1032# 1033# Check for missing UIDs/GIDs. 1034# 1035CHECK_UIDS= auditdistd 1036CHECK_GIDS= audit 1037.if ${MK_SENDMAIL} != "no" 1038CHECK_UIDS+= smmsp 1039CHECK_GIDS+= smmsp 1040.endif 1041.if ${MK_PF} != "no" 1042CHECK_UIDS+= proxy 1043CHECK_GIDS+= proxy authpf 1044.endif 1045.if ${MK_UNBOUND} != "no" 1046CHECK_UIDS+= unbound 1047CHECK_GIDS+= unbound 1048.endif 1049_installcheck_world: __installcheck_UGID 1050__installcheck_UGID: .PHONY 1051.for uid in ${CHECK_UIDS} 1052 @if ! `id -u ${uid} >/dev/null 2>&1`; then \ 1053 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \ 1054 false; \ 1055 fi 1056.endfor 1057.for gid in ${CHECK_GIDS} 1058 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \ 1059 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \ 1060 false; \ 1061 fi 1062.endfor 1063.endif 1064# 1065# If installing over the running system (DESTDIR is / or unset) and the install 1066# includes rescue, try running rescue from the objdir as a sanity check. If 1067# rescue is not functional (e.g., because it depends on a system call not 1068# supported by the currently running kernel), abort the installation. 1069# 1070.if !make(distributeworld) && ${MK_RESCUE} != "no" && \ 1071 (empty(DESTDIR) || ${DESTDIR} == "/") && empty(BYPASS_INSTALLCHECK_SH) 1072_installcheck_world: __installcheck_sh_check 1073__installcheck_sh_check: .PHONY 1074 @if [ "`${OBJTOP}/rescue/rescue/rescue sh -c 'echo OK'`" != \ 1075 OK ]; then \ 1076 echo "rescue/sh check failed, installation aborted" >&2; \ 1077 false; \ 1078 fi 1079.endif 1080 1081# 1082# Required install tools to be saved in a scratch dir for safety. 1083# 1084.if ${MK_ZONEINFO} != "no" 1085_zoneinfo= zic tzsetup 1086.endif 1087 1088ITOOLS= [ awk cap_mkdb cat chflags chmod chown cmp cp \ 1089 date echo egrep find grep id install ${_install-info} \ 1090 ln make mkdir mtree mv pwd_mkdb \ 1091 rm sed services_mkdb sh strip sysctl test true uname wc ${_zoneinfo} \ 1092 ${LOCAL_ITOOLS} 1093 1094# Needed for share/man 1095.if ${MK_MAN_UTILS} != "no" 1096ITOOLS+=makewhatis 1097.endif 1098 1099# 1100# distributeworld 1101# 1102# Distributes everything compiled by a `buildworld'. 1103# 1104# installworld 1105# 1106# Installs everything compiled by a 'buildworld'. 1107# 1108 1109# Non-base distributions produced by the base system 1110EXTRA_DISTRIBUTIONS= doc 1111.if defined(LIBCOMPAT) 1112EXTRA_DISTRIBUTIONS+= lib${libcompat} 1113.endif 1114.if ${MK_TESTS} != "no" 1115EXTRA_DISTRIBUTIONS+= tests 1116.endif 1117 1118DEBUG_DISTRIBUTIONS= 1119.if ${MK_DEBUG_FILES} != "no" 1120DEBUG_DISTRIBUTIONS+= base ${EXTRA_DISTRIBUTIONS:S,doc,,:S,tests,,} 1121.endif 1122 1123MTREE_MAGIC?= mtree 2.0 1124 1125distributeworld installworld stageworld: _installcheck_world .PHONY 1126 mkdir -p ${INSTALLTMP} 1127 progs=$$(for prog in ${ITOOLS}; do \ 1128 if progpath=`which $$prog`; then \ 1129 echo $$progpath; \ 1130 else \ 1131 echo "Required tool $$prog not found in PATH." >&2; \ 1132 exit 1; \ 1133 fi; \ 1134 done); \ 1135 libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | \ 1136 while read line; do \ 1137 set -- $$line; \ 1138 if [ "$$2 $$3" != "not found" ]; then \ 1139 echo $$2; \ 1140 else \ 1141 echo "Required library $$1 not found." >&2; \ 1142 exit 1; \ 1143 fi; \ 1144 done); \ 1145 cp $$libs $$progs ${INSTALLTMP} 1146 cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale 1147.if defined(NO_ROOT) 1148 -mkdir -p ${METALOG:H} 1149 echo "#${MTREE_MAGIC}" > ${METALOG} 1150.endif 1151.if make(distributeworld) 1152.for dist in ${EXTRA_DISTRIBUTIONS} 1153 -mkdir ${DESTDIR}/${DISTDIR}/${dist} 1154 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \ 1155 -p ${DESTDIR}/${DISTDIR}/${dist} >/dev/null 1156 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 1157 -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null 1158 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 1159 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/include >/dev/null 1160.if ${MK_COVERAGE} != "no" 1161 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.cov.dist \ 1162 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib >/dev/null 1163.endif 1164.if ${MK_DEBUG_FILES} != "no" 1165 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \ 1166 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib >/dev/null 1167.endif 1168.if defined(LIBCOMPAT) 1169 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ 1170 -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null 1171.if ${MK_DEBUG_FILES} != "no" 1172 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ 1173 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib/debug/usr >/dev/null 1174.endif 1175.endif 1176.if ${MK_TESTS} != "no" && ${dist} == "tests" 1177 -mkdir -p ${DESTDIR}/${DISTDIR}/${dist}${TESTSBASE} 1178 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \ 1179 -p ${DESTDIR}/${DISTDIR}/${dist}${TESTSBASE} >/dev/null 1180.if ${MK_DEBUG_FILES} != "no" 1181 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \ 1182 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib/debug/${TESTSBASE} >/dev/null 1183.endif 1184.endif 1185.if defined(NO_ROOT) 1186 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \ 1187 sed -e 's#^\./#./${dist}/#' >> ${METALOG} 1188 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.usr.dist | \ 1189 sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG} 1190 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.include.dist | \ 1191 sed -e 's#^\./#./${dist}/usr/include/#' >> ${METALOG} 1192.if defined(LIBCOMPAT) 1193 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist | \ 1194 sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG} 1195.endif 1196.endif 1197.endfor 1198 -mkdir ${DESTDIR}/${DISTDIR}/base 1199 ${_+_}cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \ 1200 METALOG=${METALOG} ${IMAKE_INSTALL} ${IMAKE_MTREE} \ 1201 DISTBASE=/base DESTDIR=${DESTDIR}/${DISTDIR}/base \ 1202 LOCAL_MTREE=${LOCAL_MTREE:Q} distrib-dirs 1203.endif 1204 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \ 1205 ${IMAKEENV} rm -rf ${INSTALLTMP} 1206.if make(distributeworld) 1207.for dist in ${EXTRA_DISTRIBUTIONS} 1208 find ${DESTDIR}/${DISTDIR}/${dist} -mindepth 1 -type d -empty -delete 1209.endfor 1210.if defined(NO_ROOT) 1211.for dist in base ${EXTRA_DISTRIBUTIONS} 1212 @# For each file that exists in this dist, print the corresponding 1213 @# line from the METALOG. This relies on the fact that 1214 @# a line containing only the filename will sort immediately before 1215 @# the relevant mtree line. 1216 cd ${DESTDIR}/${DISTDIR}; \ 1217 find ./${dist} | sort -u ${METALOG} - | \ 1218 awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \ 1219 ${DESTDIR}/${DISTDIR}/${dist}.meta 1220.endfor 1221.for dist in ${DEBUG_DISTRIBUTIONS} 1222 @# For each file that exists in this dist, print the corresponding 1223 @# line from the METALOG. This relies on the fact that 1224 @# a line containing only the filename will sort immediately before 1225 @# the relevant mtree line. 1226 cd ${DESTDIR}/${DISTDIR}; \ 1227 find ./${dist}/usr/lib/debug | sort -u ${METALOG} - | \ 1228 awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \ 1229 ${DESTDIR}/${DISTDIR}/${dist}.debug.meta 1230.endfor 1231.endif 1232.endif 1233 1234packageworld: .PHONY 1235.for dist in base ${EXTRA_DISTRIBUTIONS} 1236.if defined(NO_ROOT) 1237 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ 1238 tar cvf - --exclude usr/lib/debug \ 1239 @${DESTDIR}/${DISTDIR}/${dist}.meta | \ 1240 ${XZ_CMD} > ${PACKAGEDIR}/${dist}.txz 1241.else 1242 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ 1243 tar cvf - --exclude usr/lib/debug . | \ 1244 ${XZ_CMD} > ${PACKAGEDIR}/${dist}.txz 1245.endif 1246.endfor 1247 1248.for dist in ${DEBUG_DISTRIBUTIONS} 1249. if defined(NO_ROOT) 1250 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ 1251 tar cvf - @${DESTDIR}/${DISTDIR}/${dist}.debug.meta | \ 1252 ${XZ_CMD} > ${PACKAGEDIR}/${dist}-dbg.txz 1253. else 1254 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ 1255 tar cvLf - usr/lib/debug | \ 1256 ${XZ_CMD} > ${PACKAGEDIR}/${dist}-dbg.txz 1257. endif 1258.endfor 1259 1260# 1261# reinstall 1262# 1263# If you have a build server, you can NFS mount the source and obj directories 1264# and do a 'make reinstall' on the *client* to install new binaries from the 1265# most recent server build. 1266# 1267restage reinstall: .MAKE .PHONY 1268 @echo "--------------------------------------------------------------" 1269 @echo ">>> Making hierarchy" 1270 @echo "--------------------------------------------------------------" 1271 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 \ 1272 LOCAL_MTREE=${LOCAL_MTREE:Q} hierarchy 1273.if make(restage) 1274 @echo "--------------------------------------------------------------" 1275 @echo ">>> Making distribution" 1276 @echo "--------------------------------------------------------------" 1277 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 \ 1278 LOCAL_MTREE=${LOCAL_MTREE:Q} distribution 1279.endif 1280 @echo 1281 @echo "--------------------------------------------------------------" 1282 @echo ">>> Installing everything" 1283 @echo "--------------------------------------------------------------" 1284 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install 1285.if defined(LIBCOMPAT) 1286 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install${libcompat} 1287.endif 1288 1289redistribute: .MAKE .PHONY 1290 @echo "--------------------------------------------------------------" 1291 @echo ">>> Distributing everything" 1292 @echo "--------------------------------------------------------------" 1293 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute 1294.if defined(LIBCOMPAT) 1295 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute${libcompat} \ 1296 DISTRIBUTION=lib${libcompat} 1297.endif 1298 1299distrib-dirs distribution: .MAKE .PHONY 1300 ${_+_}cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \ 1301 ${IMAKE_INSTALL} ${IMAKE_MTREE} METALOG=${METALOG} ${.TARGET} 1302.if make(distribution) 1303 ${_+_}cd ${.CURDIR}; ${CROSSENV} PATH=${TMPPATH} \ 1304 ${MAKE} -f Makefile.inc1 ${IMAKE_INSTALL} \ 1305 METALOG=${METALOG} MK_TESTS=no installconfig 1306.endif 1307 1308# 1309# buildkernel and installkernel 1310# 1311# Which kernels to build and/or install is specified by setting 1312# KERNCONF. If not defined a GENERIC kernel is built/installed. 1313# Only the existing (depending TARGET) config files are used 1314# for building kernels and only the first of these is designated 1315# as the one being installed. 1316# 1317# Note that we have to use TARGET instead of TARGET_ARCH when 1318# we're in kernel-land. Since only TARGET_ARCH is (expected) to 1319# be set to cross-build, we have to make sure TARGET is set 1320# properly. 1321 1322.if defined(KERNFAST) 1323NO_KERNELCLEAN= t 1324NO_KERNELCONFIG= t 1325NO_KERNELOBJ= t 1326# Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah 1327.if !defined(KERNCONF) && ${KERNFAST} != "1" 1328KERNCONF=${KERNFAST} 1329.endif 1330.endif 1331.if ${TARGET_ARCH} == "powerpc64" 1332KERNCONF?= GENERIC64 1333.else 1334KERNCONF?= GENERIC 1335.endif 1336INSTKERNNAME?= kernel 1337 1338KERNSRCDIR?= ${.CURDIR}/sys 1339KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf 1340KRNLOBJDIR= ${OBJTOP}${KERNSRCDIR:C,^${.CURDIR},,} 1341KERNCONFDIR?= ${KRNLCONFDIR} 1342 1343BUILDKERNELS= 1344INSTALLKERNEL= 1345.if defined(NO_INSTALLKERNEL) 1346# All of the BUILDKERNELS loops start at index 1. 1347BUILDKERNELS+= dummy 1348.endif 1349.for _kernel in ${KERNCONF} 1350.if exists(${KERNCONFDIR}/${_kernel}) 1351BUILDKERNELS+= ${_kernel} 1352.if empty(INSTALLKERNEL) && !defined(NO_INSTALLKERNEL) 1353INSTALLKERNEL= ${_kernel} 1354.endif 1355.else 1356.if make(buildkernel) 1357.error Missing KERNCONF ${KERNCONFDIR}/${_kernel} 1358.endif 1359.endif 1360.endfor 1361 1362${WMAKE_TGTS:N_worldtmp:Nbuild${libcompat}} ${.ALLTARGETS:M_*:N_worldtmp}: .MAKE .PHONY 1363 1364# 1365# buildkernel 1366# 1367# Builds all kernels defined by BUILDKERNELS. 1368# 1369buildkernel: .MAKE .PHONY 1370.if empty(BUILDKERNELS:Ndummy) 1371 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \ 1372 false 1373.endif 1374 @echo 1375.for _kernel in ${BUILDKERNELS:Ndummy} 1376 @echo "--------------------------------------------------------------" 1377 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`" 1378 @echo "--------------------------------------------------------------" 1379 @echo "===> ${_kernel}" 1380 mkdir -p ${KRNLOBJDIR} 1381.if !defined(NO_KERNELCONFIG) 1382 @echo 1383 @echo "--------------------------------------------------------------" 1384 @echo ">>> stage 1: configuring the kernel" 1385 @echo "--------------------------------------------------------------" 1386 cd ${KRNLCONFDIR}; \ 1387 PATH=${TMPPATH} \ 1388 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \ 1389 -I '${KERNCONFDIR}' '${KERNCONFDIR}/${_kernel}' 1390.endif 1391.if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN) 1392 @echo 1393 @echo "--------------------------------------------------------------" 1394 @echo ">>> stage 2.1: cleaning up the object tree" 1395 @echo "--------------------------------------------------------------" 1396 ${_+_}cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR} 1397.endif 1398.if !defined(NO_KERNELOBJ) 1399 @echo 1400 @echo "--------------------------------------------------------------" 1401 @echo ">>> stage 2.2: rebuilding the object tree" 1402 @echo "--------------------------------------------------------------" 1403 ${_+_}cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj 1404.endif 1405 @echo 1406 @echo "--------------------------------------------------------------" 1407 @echo ">>> stage 2.3: build tools" 1408 @echo "--------------------------------------------------------------" 1409 ${_+_}cd ${.CURDIR}; ${KTMAKE} kernel-tools 1410 @echo 1411 @echo "--------------------------------------------------------------" 1412 @echo ">>> stage 3.1: building everything" 1413 @echo "--------------------------------------------------------------" 1414 ${_+_}cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ 1415 @echo "--------------------------------------------------------------" 1416 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`" 1417 @echo "--------------------------------------------------------------" 1418.endfor 1419 1420NO_INSTALLEXTRAKERNELS?= yes 1421 1422# 1423# installkernel, etc. 1424# 1425# Install the kernel defined by INSTALLKERNEL 1426# 1427installkernel installkernel.debug \ 1428reinstallkernel reinstallkernel.debug: _installcheck_kernel .PHONY 1429.if !defined(NO_INSTALLKERNEL) 1430.if empty(INSTALLKERNEL) 1431 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \ 1432 false 1433.endif 1434 @echo "--------------------------------------------------------------" 1435 @echo ">>> Installing kernel ${INSTALLKERNEL}" 1436 @echo "--------------------------------------------------------------" 1437 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ 1438 ${CROSSENV} PATH=${TMPPATH} \ 1439 ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//} 1440.endif 1441.if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes" 1442.for _kernel in ${BUILDKERNELS:[2..-1]} 1443 @echo "--------------------------------------------------------------" 1444 @echo ">>> Installing kernel ${_kernel}" 1445 @echo "--------------------------------------------------------------" 1446 cd ${KRNLOBJDIR}/${_kernel}; \ 1447 ${CROSSENV} PATH=${TMPPATH} \ 1448 ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME}.${_kernel} ${.TARGET:S/kernel//} 1449.endfor 1450.endif 1451 1452distributekernel distributekernel.debug: .PHONY 1453.if !defined(NO_INSTALLKERNEL) 1454.if empty(INSTALLKERNEL) 1455 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \ 1456 false 1457.endif 1458 mkdir -p ${DESTDIR}/${DISTDIR} 1459.if defined(NO_ROOT) 1460 @echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.premeta 1461.endif 1462 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ 1463 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.premeta/} \ 1464 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} KERNEL=${INSTKERNNAME} \ 1465 DESTDIR=${INSTALL_DDIR}/kernel \ 1466 ${.TARGET:S/distributekernel/install/} 1467.if defined(NO_ROOT) 1468 @sed -e 's|^./kernel|.|' ${DESTDIR}/${DISTDIR}/kernel.premeta > \ 1469 ${DESTDIR}/${DISTDIR}/kernel.meta 1470.endif 1471.endif 1472.if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes" 1473.for _kernel in ${BUILDKERNELS:[2..-1]} 1474.if defined(NO_ROOT) 1475 @echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta 1476.endif 1477 cd ${KRNLOBJDIR}/${_kernel}; \ 1478 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.${_kernel}.premeta/} \ 1479 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} \ 1480 KERNEL=${INSTKERNNAME}.${_kernel} \ 1481 DESTDIR=${INSTALL_DDIR}/kernel.${_kernel} \ 1482 ${.TARGET:S/distributekernel/install/} 1483.if defined(NO_ROOT) 1484 @sed -e "s|^./kernel.${_kernel}|.|" \ 1485 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta > \ 1486 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta 1487.endif 1488.endfor 1489.endif 1490 1491packagekernel: .PHONY 1492.if defined(NO_ROOT) 1493.if !defined(NO_INSTALLKERNEL) 1494 cd ${DESTDIR}/${DISTDIR}/kernel; \ 1495 tar cvf - --exclude '*.debug' \ 1496 @${DESTDIR}/${DISTDIR}/kernel.meta | \ 1497 ${XZ_CMD} > ${PACKAGEDIR}/kernel.txz 1498.endif 1499.if ${MK_DEBUG_FILES} != "no" 1500 cd ${DESTDIR}/${DISTDIR}/kernel; \ 1501 tar cvf - --include '*/*/*.debug' \ 1502 @${DESTDIR}/${DISTDIR}/kernel.meta | \ 1503 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel-dbg.txz 1504.endif 1505.if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes" 1506.for _kernel in ${BUILDKERNELS:[2..-1]} 1507 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ 1508 tar cvf - --exclude '*.debug' \ 1509 @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta | \ 1510 ${XZ_CMD} > ${PACKAGEDIR}/kernel.${_kernel}.txz 1511.if ${MK_DEBUG_FILES} != "no" 1512 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ 1513 tar cvf - --include '*/*/*.debug' \ 1514 @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta | \ 1515 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}-dbg.txz 1516.endif 1517.endfor 1518.endif 1519.else 1520.if !defined(NO_INSTALLKERNEL) 1521 cd ${DESTDIR}/${DISTDIR}/kernel; \ 1522 tar cvf - --exclude '*.debug' . | \ 1523 ${XZ_CMD} > ${PACKAGEDIR}/kernel.txz 1524.endif 1525.if ${MK_DEBUG_FILES} != "no" 1526 cd ${DESTDIR}/${DISTDIR}/kernel; \ 1527 tar cvf - --include '*/*/*.debug' $$(eval find .) | \ 1528 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel-dbg.txz 1529.endif 1530.if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes" 1531.for _kernel in ${BUILDKERNELS:[2..-1]} 1532 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ 1533 tar cvf - --exclude '*.debug' . | \ 1534 ${XZ_CMD} > ${PACKAGEDIR}/kernel.${_kernel}.txz 1535.if ${MK_DEBUG_FILES} != "no" 1536 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ 1537 tar cvf - --include '*/*/*.debug' $$(eval find .) | \ 1538 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}-dbg.txz 1539.endif 1540.endfor 1541.endif 1542.endif 1543 1544stagekernel: .PHONY 1545 ${_+_}${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} distributekernel 1546 1547PORTSDIR?= /usr/ports 1548WSTAGEDIR?= ${OBJTOP}/worldstage 1549KSTAGEDIR?= ${OBJTOP}/kernelstage 1550REPODIR?= ${OBJROOT}repo 1551PKGSIGNKEY?= # empty 1552 1553.ORDER: stage-packages create-packages 1554.ORDER: create-packages create-world-packages 1555.ORDER: create-packages create-kernel-packages 1556.ORDER: create-packages sign-packages 1557 1558_pkgbootstrap: .PHONY 1559.if !exists(${LOCALBASE}/sbin/pkg) 1560 @env ASSUME_ALWAYS_YES=YES pkg bootstrap 1561.endif 1562 1563packages: .PHONY 1564 ${_+_}${MAKE} -C ${.CURDIR} PKG_VERSION=${PKG_VERSION} real-packages 1565 1566package-pkg: .PHONY 1567 rm -rf /tmp/ports.${TARGET} || : 1568 env ${WMAKEENV:Q} SRCDIR=${.CURDIR} PORTSDIR=${PORTSDIR} REVISION=${_REVISION} \ 1569 PKG_CMD=${PKG_CMD} PKG_VERSION=${PKG_VERSION} REPODIR=${REPODIR} \ 1570 WSTAGEDIR=${WSTAGEDIR} \ 1571 sh ${.CURDIR}/release/scripts/make-pkg-package.sh 1572 1573real-packages: stage-packages create-packages sign-packages .PHONY 1574 1575stage-packages-world: .PHONY 1576 @mkdir -p ${WSTAGEDIR} 1577 ${_+_}@cd ${.CURDIR}; \ 1578 ${MAKE} DESTDIR=${WSTAGEDIR} -DNO_ROOT stageworld 1579 1580stage-packages-kernel: .PHONY 1581 @mkdir -p ${KSTAGEDIR} 1582 ${_+_}@cd ${.CURDIR}; \ 1583 ${MAKE} DESTDIR=${KSTAGEDIR} -DNO_ROOT stagekernel 1584 1585stage-packages: .PHONY stage-packages-world stage-packages-kernel 1586 1587_repodir: .PHONY 1588 @mkdir -p ${REPODIR} 1589 1590create-packages-world: _pkgbootstrap _repodir .PHONY 1591 ${_+_}@cd ${.CURDIR}; \ 1592 ${MAKE} -f Makefile.inc1 \ 1593 DESTDIR=${WSTAGEDIR} \ 1594 PKG_VERSION=${PKG_VERSION} create-world-packages 1595 1596create-packages-kernel: _pkgbootstrap _repodir .PHONY 1597 ${_+_}@cd ${.CURDIR}; \ 1598 ${MAKE} -f Makefile.inc1 \ 1599 DESTDIR=${KSTAGEDIR} \ 1600 PKG_VERSION=${PKG_VERSION} DISTDIR=kernel \ 1601 create-kernel-packages 1602 1603create-packages: .PHONY create-packages-world create-packages-kernel 1604 1605create-world-packages: _pkgbootstrap .PHONY 1606 @rm -f ${WSTAGEDIR}/*.plist 2>/dev/null || : 1607 @cd ${WSTAGEDIR} ; \ 1608 awk -f ${SRCDIR}/release/scripts/mtree-to-plist.awk \ 1609 ${WSTAGEDIR}/METALOG 1610 @for plist in ${WSTAGEDIR}/*.plist; do \ 1611 plist=$${plist##*/} ; \ 1612 pkgname=$${plist%.plist} ; \ 1613 echo "_PKGS+= $${pkgname}" ; \ 1614 done > ${WSTAGEDIR}/packages.mk 1615 ${_+_}@cd ${.CURDIR}; \ 1616 ${MAKE} -f Makefile.inc1 create-world-packages-jobs \ 1617 .MAKE.JOB.PREFIX= 1618 1619.if make(create-world-packages-jobs) 1620.include "${WSTAGEDIR}/packages.mk" 1621.endif 1622 1623create-world-packages-jobs: .PHONY 1624.for pkgname in ${_PKGS} 1625create-world-packages-jobs: create-world-package-${pkgname} 1626create-world-package-${pkgname}: .PHONY 1627 @sh ${SRCDIR}/release/packages/generate-ucl.sh -o ${pkgname} \ 1628 -s ${SRCDIR} -u ${WSTAGEDIR}/${pkgname}.ucl 1629 @awk -F\" ' \ 1630 /^name/ { printf("===> Creating %s-", $$2); next } \ 1631 /^version/ { print $$2; next } \ 1632 ' ${WSTAGEDIR}/${pkgname}.ucl 1633 @if [ "${pkgname}" == "runtime" ]; then \ 1634 sed -i '' -e "s/%VCS_REVISION%/${VCS_REVISION}/" ${WSTAGEDIR}/${pkgname}.ucl ; \ 1635 fi 1636 ${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh -o ALLOW_BASE_SHLIBS=yes \ 1637 create -M ${WSTAGEDIR}/${pkgname}.ucl \ 1638 -p ${WSTAGEDIR}/${pkgname}.plist \ 1639 -r ${WSTAGEDIR} \ 1640 -o ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION} 1641.endfor 1642 1643create-kernel-packages: .PHONY 1644_default_flavor= -default 1645.if exists(${KSTAGEDIR}/kernel.meta) 1646. if ${MK_DEBUG_FILES} != "no" 1647_debug=-debug 1648. endif 1649. for flavor in "" ${_debug} 1650create-kernel-packages: create-kernel-packages-flavor${flavor:C,^""$,${_default_flavor},} 1651create-kernel-packages-flavor${flavor:C,^""$,${_default_flavor},}: _pkgbootstrap .PHONY 1652 @cd ${KSTAGEDIR}/${DISTDIR} ; \ 1653 awk -f ${SRCDIR}/release/scripts/mtree-to-plist.awk \ 1654 -v kernel=yes -v _kernconf=${INSTALLKERNEL} \ 1655 ${KSTAGEDIR}/kernel.meta ; \ 1656 cap_arg=`cd ${SRCDIR}/etc ; ${MAKE} -VCAP_MKDB_ENDIAN` ; \ 1657 pwd_arg=`cd ${SRCDIR}/etc ; ${MAKE} -VPWD_MKDB_ENDIAN` ; \ 1658 sed -e "s/%VERSION%/${PKG_VERSION}/" \ 1659 -e "s/%PKGNAME%/kernel-${INSTALLKERNEL:tl}${flavor}/" \ 1660 -e "s/%COMMENT%/FreeBSD ${INSTALLKERNEL} kernel ${flavor}/" \ 1661 -e "s/%DESC%/FreeBSD ${INSTALLKERNEL} kernel ${flavor}/" \ 1662 -e "s/%CAP_MKDB_ENDIAN%/$${cap_arg}/g" \ 1663 -e "s/%PWD_MKDB_ENDIAN%/$${pwd_arg}/g" \ 1664 -e "s/ %VCS_REVISION%/${VCS_REVISION}/" \ 1665 ${SRCDIR}/release/packages/kernel.ucl \ 1666 > ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl ; \ 1667 awk -F\" ' \ 1668 /name/ { printf("===> Creating %s-", $$2); next } \ 1669 /version/ {print $$2; next } ' \ 1670 ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl ; \ 1671 ${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh -o ALLOW_BASE_SHLIBS=yes \ 1672 create -M ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl \ 1673 -p ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.plist \ 1674 -r ${KSTAGEDIR}/${DISTDIR} \ 1675 -o ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION} 1676. endfor 1677.endif 1678.if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes" 1679. for _kernel in ${BUILDKERNELS:[2..-1]} 1680. if exists(${KSTAGEDIR}/kernel.${_kernel}.meta) 1681. if ${MK_DEBUG_FILES} != "no" 1682_debug=-debug 1683. endif 1684. for flavor in "" ${_debug} 1685create-kernel-packages: create-kernel-packages-extra-flavor${flavor:C,^""$,${_default_flavor},}-${_kernel} 1686create-kernel-packages-extra-flavor${flavor:C,^""$,${_default_flavor},}-${_kernel}: _pkgbootstrap .PHONY 1687 @cd ${KSTAGEDIR}/kernel.${_kernel} ; \ 1688 awk -f ${SRCDIR}/release/scripts/mtree-to-plist.awk \ 1689 -v kernel=yes -v _kernconf=${_kernel} \ 1690 ${KSTAGEDIR}/kernel.${_kernel}.meta ; \ 1691 cap_arg=`cd ${SRCDIR}/etc ; ${MAKE} -VCAP_MKDB_ENDIAN` ; \ 1692 pwd_arg=`cd ${SRCDIR}/etc ; ${MAKE} -VPWD_MKDB_ENDIAN` ; \ 1693 sed -e "s/%VERSION%/${PKG_VERSION}/" \ 1694 -e "s/%PKGNAME%/kernel-${_kernel:tl}${flavor}/" \ 1695 -e "s/%COMMENT%/FreeBSD ${_kernel} kernel ${flavor}/" \ 1696 -e "s/%DESC%/FreeBSD ${_kernel} kernel ${flavor}/" \ 1697 -e "s/%CAP_MKDB_ENDIAN%/$${cap_arg}/g" \ 1698 -e "s/%PWD_MKDB_ENDIAN%/$${pwd_arg}/g" \ 1699 -e "s/ %VCS_REVISION%/${VCS_REVISION}/" \ 1700 ${SRCDIR}/release/packages/kernel.ucl \ 1701 > ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.ucl ; \ 1702 awk -F\" ' \ 1703 /name/ { printf("===> Creating %s-", $$2); next } \ 1704 /version/ {print $$2; next } ' \ 1705 ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.ucl ; \ 1706 ${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh -o ALLOW_BASE_SHLIBS=yes \ 1707 create -M ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.ucl \ 1708 -p ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.plist \ 1709 -r ${KSTAGEDIR}/kernel.${_kernel} \ 1710 -o ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION} 1711. endfor 1712. endif 1713. endfor 1714.endif 1715 1716sign-packages: _pkgbootstrap .PHONY 1717 @[ -L "${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/latest" ] && \ 1718 unlink ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/latest ; \ 1719 ${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh repo \ 1720 -o ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION} \ 1721 ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION} \ 1722 ${PKGSIGNKEY} ; \ 1723 cd ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI); \ 1724 ln -s ${PKG_VERSION} latest 1725 1726# 1727# 1728# checkworld 1729# 1730# Run test suite on installed world. 1731# 1732checkworld: .PHONY 1733 @if [ ! -x "${LOCALBASE}/bin/kyua" ]; then \ 1734 echo "You need kyua (devel/kyua) to run the test suite." | /usr/bin/fmt; \ 1735 exit 1; \ 1736 fi 1737 ${_+_}PATH="$$PATH:${LOCALBASE}/bin" kyua test -k ${TESTSBASE}/Kyuafile 1738 1739# 1740# 1741# doxygen 1742# 1743# Build the API documentation with doxygen 1744# 1745doxygen: .PHONY 1746 @if [ ! -x "${LOCALBASE}/bin/doxygen" ]; then \ 1747 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \ 1748 exit 1; \ 1749 fi 1750 ${_+_}cd ${.CURDIR}/tools/kerneldoc/subsys; ${MAKE} obj all 1751 1752# 1753# update 1754# 1755# Update the source tree(s), by running svn/svnup to update to the 1756# latest copy. 1757# 1758update: .PHONY 1759.if defined(SVN_UPDATE) 1760 @echo "--------------------------------------------------------------" 1761 @echo ">>> Updating ${.CURDIR} using Subversion" 1762 @echo "--------------------------------------------------------------" 1763 @(cd ${.CURDIR}; ${SVN} update ${SVNFLAGS}) 1764.endif 1765 1766# 1767# ------------------------------------------------------------------------ 1768# 1769# From here onwards are utility targets used by the 'make world' and 1770# related targets. If your 'world' breaks, you may like to try to fix 1771# the problem and manually run the following targets to attempt to 1772# complete the build. Beware, this is *not* guaranteed to work, you 1773# need to have a pretty good grip on the current state of the system 1774# to attempt to manually finish it. If in doubt, 'make world' again. 1775# 1776 1777# 1778# legacy: Build compatibility shims for the next three targets. This is a 1779# minimal set of tools and shims necessary to compensate for older systems 1780# which don't have the APIs required by the targets built in bootstrap-tools, 1781# build-tools or cross-tools. 1782# 1783 1784# ELF Tool Chain libraries are needed for ELF tools and dtrace tools. 1785# r296685 fix cross-endian objcopy 1786# r310724 fixed PR 215350, a crash in libdwarf with objects built by GCC 6.2. 1787.if ${BOOTSTRAPPING} < 1200020 1788_elftoolchain_libs= lib/libelf lib/libdwarf 1789.endif 1790 1791legacy: .PHONY 1792# Temporary special case for automatically detecting the clang compiler issue 1793# Note: 9.x didn't have FreeBSD_version bumps often enough, so you may need to 1794# set BOOTSTRAPPING to 0 if you're stable/9 tree post-dates r286035 but is before 1795# the version bump in r296219 (from July 29, 2015 -> Feb 29, 2016). 1796.if ${BOOTSTRAPPING} != 0 && \ 1797 ${WANT_COMPILER_TYPE} == "clang" && ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} < 30601 1798.if ${BOOTSTRAPPING} > 10000000 && ${BOOTSTRAPPING} < 1002501 1799 @echo "ERROR: Source upgrades from stable/10 prior to r286033 are not supported."; false 1800.elif ${BOOTSTRAPPING} > 9000000 && ${BOOTSTRAPPING} < 903509 1801 @echo "ERROR: Source upgrades from stable/9 prior to r286035 are not supported."; false 1802.endif 1803.endif 1804.if ${BOOTSTRAPPING} < ${MINIMUM_SUPPORTED_OSREL} && ${BOOTSTRAPPING} != 0 1805 @echo "ERROR: Source upgrades from versions prior to ${MINIMUM_SUPPORTED_REL} are not supported."; \ 1806 false 1807.endif 1808 1809.for _tool in tools/build ${_elftoolchain_libs} 1810 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,all,install)"; \ 1811 cd ${.CURDIR}/${_tool}; \ 1812 if [ -z "${NO_OBJWALK}" ]; then ${MAKE} DIRPRFX=${_tool}/ obj; fi; \ 1813 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${WORLDTMP}/legacy includes; \ 1814 ${MAKE} DIRPRFX=${_tool}/ MK_INCLUDES=no all; \ 1815 ${MAKE} DIRPRFX=${_tool}/ MK_INCLUDES=no \ 1816 DESTDIR=${WORLDTMP}/legacy install 1817.endfor 1818 1819# 1820# bootstrap-tools: Build tools needed for compatibility. These are binaries that 1821# are built to build other binaries in the system. However, the focus of these 1822# binaries is usually quite narrow. Bootstrap tools use the host's compiler and 1823# libraries, augmented by -legacy. 1824# 1825_bt= _bootstrap-tools 1826 1827.if ${MK_GAMES} != "no" 1828_strfile= usr.bin/fortune/strfile 1829.endif 1830 1831.if ${MK_GCC} != "no" && ${MK_CXX} != "no" 1832_gperf= gnu/usr.bin/gperf 1833.endif 1834 1835.if ${MK_VT} != "no" 1836_vtfontcvt= usr.bin/vtfontcvt 1837.endif 1838 1839.if ${BOOTSTRAPPING} < 1000033 1840_m4= usr.bin/m4 1841_lex= usr.bin/lex 1842 1843${_bt}-usr.bin/m4: ${_bt}-lib/libopenbsd 1844${_bt}-usr.bin/lex: ${_bt}-usr.bin/m4 1845.endif 1846 1847# r245440 mtree -N support added 1848# r313404 requires sha384.h for libnetbsd, added to libmd in r292782 1849.if ${BOOTSTRAPPING} < 1100093 1850_nmtree= lib/libmd \ 1851 lib/libnetbsd \ 1852 usr.sbin/nmtree 1853 1854${_bt}-lib/libnetbsd: ${_bt}-lib/libmd 1855${_bt}-usr.sbin/nmtree: ${_bt}-lib/libnetbsd 1856.endif 1857 1858# r246097: log addition login.conf.db, passwd, pwd.db, and spwd.db with cat -l 1859.if ${BOOTSTRAPPING} < 1000027 1860_cat= bin/cat 1861.endif 1862 1863# r277259 crunchide: Correct 64-bit section header offset 1864# r281674 crunchide: always include both 32- and 64-bit ELF support 1865.if ${BOOTSTRAPPING} < 1100078 1866_crunchide= usr.sbin/crunch/crunchide 1867.endif 1868 1869# r285986 crunchen: use STRIPBIN rather than STRIP 1870# 1100113: Support MK_AUTO_OBJ 1871# 1200006: META_MODE fixes 1872.if ${BOOTSTRAPPING} < 1100078 || \ 1873 (${MK_AUTO_OBJ} == "yes" && ${BOOTSTRAPPING} < 1100114) || \ 1874 (${MK_META_MODE} == "yes" && ${BOOTSTRAPPING} < 1200006) 1875_crunchgen= usr.sbin/crunch/crunchgen 1876.endif 1877 1878# r296926 -P keymap search path, MFC to stable/10 in r298297 1879.if ${BOOTSTRAPPING} < 1003501 || \ 1880 (${BOOTSTRAPPING} >= 1100000 && ${BOOTSTRAPPING} < 1100103) 1881_kbdcontrol= usr.sbin/kbdcontrol 1882.endif 1883 1884_yacc= lib/liby \ 1885 usr.bin/yacc 1886 1887${_bt}-usr.bin/yacc: ${_bt}-lib/liby 1888 1889.if ${MK_BSNMP} != "no" 1890_gensnmptree= usr.sbin/bsnmpd/gensnmptree 1891.endif 1892 1893# We need to build tblgen when we're building clang or lld, either as 1894# bootstrap tools, or as the part of the normal build. 1895.if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_CLANG} != "no" || \ 1896 ${MK_LLD_BOOTSTRAP} != "no" || ${MK_LLD} != "no" 1897_clang_tblgen= \ 1898 lib/clang/libllvmminimal \ 1899 usr.bin/clang/llvm-tblgen \ 1900 usr.bin/clang/clang-tblgen 1901 1902${_bt}-usr.bin/clang/clang-tblgen: ${_bt}-lib/clang/libllvmminimal 1903${_bt}-usr.bin/clang/llvm-tblgen: ${_bt}-lib/clang/libllvmminimal 1904.endif 1905 1906# Default to building the GPL DTC, but build the BSDL one if users explicitly 1907# request it. 1908_dtc= usr.bin/dtc 1909.if ${MK_GPL_DTC} != "no" 1910_dtc= gnu/usr.bin/dtc 1911.endif 1912 1913.if ${MK_KERBEROS} != "no" 1914_kerberos5_bootstrap_tools= \ 1915 kerberos5/tools/make-roken \ 1916 kerberos5/lib/libroken \ 1917 kerberos5/lib/libvers \ 1918 kerberos5/tools/asn1_compile \ 1919 kerberos5/tools/slc \ 1920 usr.bin/compile_et 1921 1922.ORDER: ${_kerberos5_bootstrap_tools:C/^/${_bt}-/g} 1923.endif 1924 1925${_bt}-usr.bin/mandoc: ${_bt}-lib/libopenbsd 1926 1927bootstrap-tools: .PHONY 1928 1929# Please document (add comment) why something is in 'bootstrap-tools'. 1930# Try to bound the building of the bootstrap-tool to just the 1931# FreeBSD versions that need the tool built at this stage of the build. 1932.for _tool in \ 1933 ${_clang_tblgen} \ 1934 ${_kerberos5_bootstrap_tools} \ 1935 ${_strfile} \ 1936 ${_gperf} \ 1937 ${_dtc} \ 1938 ${_cat} \ 1939 ${_kbdcontrol} \ 1940 usr.bin/lorder \ 1941 lib/libopenbsd \ 1942 usr.bin/mandoc \ 1943 usr.bin/rpcgen \ 1944 ${_yacc} \ 1945 ${_m4} \ 1946 ${_lex} \ 1947 usr.bin/xinstall \ 1948 ${_gensnmptree} \ 1949 usr.sbin/config \ 1950 ${_crunchide} \ 1951 ${_crunchgen} \ 1952 ${_nmtree} \ 1953 ${_vtfontcvt} \ 1954 usr.bin/localedef 1955${_bt}-${_tool}: .PHONY .MAKE 1956 ${_+_}@${ECHODIR} "===> ${_tool} (obj,all,install)"; \ 1957 cd ${.CURDIR}/${_tool}; \ 1958 if [ -z "${NO_OBJWALK}" ]; then ${MAKE} DIRPRFX=${_tool}/ obj; fi; \ 1959 ${MAKE} DIRPRFX=${_tool}/ all; \ 1960 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${WORLDTMP}/legacy install 1961 1962bootstrap-tools: ${_bt}-${_tool} 1963.endfor 1964 1965# 1966# build-tools: Build special purpose build tools 1967# 1968.if !defined(NO_SHARE) 1969_share= share/syscons/scrnmaps 1970.endif 1971 1972.if ${MK_GCC} != "no" 1973_gcc_tools= gnu/usr.bin/cc/cc_tools 1974.endif 1975 1976.if ${MK_RESCUE} != "no" 1977# rescue includes programs that have build-tools targets 1978_rescue=rescue/rescue 1979.endif 1980 1981.if ${MK_TCSH} != "no" 1982_tcsh=bin/csh 1983.endif 1984 1985# kernel-toolchain skips _cleanobj, so handle cleaning up previous 1986# build-tools directories if needed. 1987.if !defined(NO_CLEAN) && make(kernel-toolchain) 1988_bt_clean= ${CLEANDIR} 1989.endif 1990 1991.for _tool in \ 1992 ${_tcsh} \ 1993 bin/sh \ 1994 ${LOCAL_TOOL_DIRS} \ 1995 lib/ncurses/ncurses \ 1996 lib/ncurses/ncursesw \ 1997 ${_rescue} \ 1998 ${_share} \ 1999 usr.bin/awk \ 2000 lib/libmagic \ 2001 usr.bin/mkesdb_static \ 2002 usr.bin/mkcsmapper_static \ 2003 usr.bin/vi/catalog \ 2004 ${_gcc_tools} 2005build-tools_${_tool}: .PHONY 2006 ${_+_}@${ECHODIR} "===> ${_tool} (${_bt_clean:D${_bt_clean},}obj,build-tools)"; \ 2007 cd ${.CURDIR}/${_tool}; \ 2008 if [ -n "${_bt_clean}" ]; then ${MAKE} DIRPRFX=${_tool}/ ${_bt_clean}; fi; \ 2009 if [ -z "${NO_OBJWALK}" ]; then ${MAKE} DIRPRFX=${_tool}/ obj; fi; \ 2010 ${MAKE} DIRPRFX=${_tool}/ build-tools 2011build-tools: build-tools_${_tool} 2012.endfor 2013 2014# 2015# kernel-tools: Build kernel-building tools 2016# 2017kernel-tools: .PHONY 2018 mkdir -p ${WORLDTMP}/usr 2019 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 2020 -p ${WORLDTMP}/usr >/dev/null 2021 2022# 2023# cross-tools: All the tools needed to build the rest of the system after 2024# we get done with the earlier stages. It is the last set of tools needed 2025# to begin building the target binaries. 2026# 2027.if ${TARGET_ARCH} != ${MACHINE_ARCH} 2028.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386" 2029_btxld= usr.sbin/btxld 2030.endif 2031.endif 2032 2033# Rebuild ctfconvert and ctfmerge to avoid difficult-to-diagnose failures 2034# resulting from missing bug fixes or ELF Toolchain updates. 2035.if ${MK_CDDL} != "no" 2036_dtrace_tools= cddl/lib/libctf cddl/usr.bin/ctfconvert \ 2037 cddl/usr.bin/ctfmerge 2038.endif 2039 2040# If we're given an XAS, don't build binutils. 2041.if ${XAS:M/*} == "" 2042.if ${MK_BINUTILS_BOOTSTRAP} != "no" 2043_binutils= gnu/usr.bin/binutils 2044.endif 2045.if ${MK_ELFTOOLCHAIN_BOOTSTRAP} != "no" 2046_elftctools= lib/libelftc \ 2047 lib/libpe \ 2048 usr.bin/elfcopy \ 2049 usr.bin/nm \ 2050 usr.bin/size \ 2051 usr.bin/strings 2052# These are not required by the build, but can be useful for developers who 2053# cross-build on a FreeBSD 10 host: 2054_elftctools+= usr.bin/addr2line 2055.endif 2056.elif ${TARGET_ARCH} != ${MACHINE_ARCH} && ${MK_ELFTOOLCHAIN_BOOTSTRAP} != "no" 2057# If cross-building with an external binutils we still need to build strip for 2058# the target (for at least crunchide). 2059_elftctools= lib/libelftc \ 2060 lib/libpe \ 2061 usr.bin/elfcopy 2062.endif 2063 2064.if ${MK_CLANG_BOOTSTRAP} != "no" 2065_clang= usr.bin/clang 2066.endif 2067.if ${MK_LLD_BOOTSTRAP} != "no" 2068_lld= usr.bin/clang/lld 2069.endif 2070.if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_LLD_BOOTSTRAP} != "no" 2071_clang_libs= lib/clang 2072.endif 2073.if ${MK_GCC_BOOTSTRAP} != "no" 2074_gcc= gnu/usr.bin/cc 2075.endif 2076.if ${MK_USB} != "no" 2077_usb_tools= sys/boot/usb/tools 2078.endif 2079 2080cross-tools: .MAKE .PHONY 2081.for _tool in \ 2082 ${LOCAL_XTOOL_DIRS} \ 2083 ${_clang_libs} \ 2084 ${_clang} \ 2085 ${_lld} \ 2086 ${_binutils} \ 2087 ${_elftctools} \ 2088 ${_dtrace_tools} \ 2089 ${_gcc} \ 2090 ${_btxld} \ 2091 ${_usb_tools} 2092 ${_+_}@${ECHODIR} "===> ${_tool} (obj,all,install)"; \ 2093 cd ${.CURDIR}/${_tool}; \ 2094 if [ -z "${NO_OBJWALK}" ]; then ${MAKE} DIRPRFX=${_tool}/ obj; fi; \ 2095 ${MAKE} DIRPRFX=${_tool}/ all; \ 2096 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${WORLDTMP} install 2097.endfor 2098 2099# 2100# native-xtools is the current target for qemu-user cross builds of ports 2101# via poudriere and the imgact_binmisc kernel module. 2102# This target merely builds a toolchan/sysroot, then builds the tools it wants 2103# with the options it wants in a special MAKEOBJDIRPREFIX, using the toolchain 2104# already built. It then installs the static tools to NXBDESTDIR for Poudriere 2105# to pickup. 2106# 2107NXBOBJROOT= ${OBJROOT}${MACHINE}.${MACHINE_ARCH}/nxb/ 2108NXBOBJTOP= ${NXBOBJROOT}${TARGET}.${TARGET_ARCH} 2109NXTP?= /nxb-bin 2110.if ${NXTP:N/*} 2111.error NXTP variable should be an absolute path 2112.endif 2113NXBDESTDIR?= ${DESTDIR}${NXTP} 2114 2115# This is the list of tools to be built/installed as static and where 2116# appropriate to build for the given TARGET.TARGET_ARCH. 2117NXBDIRS+= \ 2118 bin/cat \ 2119 bin/chmod \ 2120 bin/cp \ 2121 ${_tcsh} \ 2122 bin/echo \ 2123 bin/expr \ 2124 bin/hostname \ 2125 bin/ln \ 2126 bin/ls \ 2127 bin/mkdir \ 2128 bin/mv \ 2129 bin/ps \ 2130 bin/realpath \ 2131 bin/rm \ 2132 bin/rmdir \ 2133 bin/sh \ 2134 bin/sleep \ 2135 sbin/md5 \ 2136 sbin/sysctl \ 2137 usr.bin/addr2line \ 2138 usr.bin/ar \ 2139 usr.bin/awk \ 2140 usr.bin/basename \ 2141 usr.bin/bmake \ 2142 usr.bin/bzip2 \ 2143 usr.bin/cmp \ 2144 usr.bin/diff \ 2145 usr.bin/dirname \ 2146 usr.bin/elfcopy \ 2147 usr.bin/env \ 2148 usr.bin/fetch \ 2149 usr.bin/find \ 2150 usr.bin/grep \ 2151 usr.bin/gzip \ 2152 usr.bin/id \ 2153 usr.bin/lex \ 2154 usr.bin/limits \ 2155 usr.bin/lorder \ 2156 usr.bin/mandoc \ 2157 usr.bin/mktemp \ 2158 usr.bin/mt \ 2159 usr.bin/nm \ 2160 usr.bin/patch \ 2161 usr.bin/readelf \ 2162 usr.bin/sed \ 2163 usr.bin/size \ 2164 usr.bin/sort \ 2165 usr.bin/strings \ 2166 usr.bin/tar \ 2167 usr.bin/touch \ 2168 usr.bin/tr \ 2169 usr.bin/true \ 2170 usr.bin/uniq \ 2171 usr.bin/unzip \ 2172 usr.bin/xargs \ 2173 usr.bin/xinstall \ 2174 usr.bin/xz \ 2175 usr.bin/yacc \ 2176 usr.sbin/chown 2177 2178.if ${MK_CLANG} != "no" 2179NXBDIRS+= lib/clang 2180SUBDIR_DEPEND_usr.bin/clang= lib/clang 2181NXBDIRS+= usr.bin/clang 2182.elif ${MK_GCC} != "no" 2183NXBDIRS+= gnu/usr.bin/cc 2184.endif 2185.if ${MK_BINUTILS} != "no" 2186NXBDIRS+= gnu/usr.bin/binutils 2187.endif 2188 2189NXBMAKEARGS+= \ 2190 OBJTOP=${NXBOBJTOP:Q} \ 2191 OBJROOT=${NXBOBJROOT:Q} \ 2192 -DNO_SHARED \ 2193 -DNO_CPU_CFLAGS \ 2194 -DNO_PIC \ 2195 SSP_CFLAGS= \ 2196 MK_CLANG_EXTRAS=no \ 2197 MK_CLANG_FULL=no \ 2198 MK_CTF=no \ 2199 MK_DEBUG_FILES=no \ 2200 MK_GDB=no \ 2201 MK_HTML=no \ 2202 MK_LLDB=no \ 2203 MK_MAN=no \ 2204 MK_MAN_UTILS=yes \ 2205 MK_OFED=no \ 2206 MK_OPENSSH=no \ 2207 MK_PROFILE=no \ 2208 MK_SENDMAIL=no \ 2209 MK_SVNLITE=no \ 2210 MK_TESTS=no \ 2211 MK_WARNS=no \ 2212 MK_ZFS=no 2213 2214 2215# For 'toolchain' we want to produce native binaries that themselves generate 2216# native binaries. 2217NXBTMAKE= ${NXBMAKEENV} ${MAKE} ${NXBMAKEARGS:N-DNO_PIC:N-DNO_SHARED} \ 2218 TARGET=${MACHINE} TARGET_ARCH=${MACHINE_ARCH} 2219# For 'everything' we want to produce native binaries (hence -target to 2220# be MACHINE) that themselves generate TARGET.TARGET_ARCH binaries. 2221# TARGET/TARGET_ARCH are still passed along from user. 2222NXBMAKE= ${NXBMAKEENV} ${MAKE} ${NXBMAKEARGS} \ 2223 TARGET_TRIPLE=${MACHINE_TRIPLE:Q} 2224native-xtools: .PHONY 2225 # Build the bootstrap/host/cross tools that produce native binaries 2226 ${_+_}cd ${.CURDIR}; ${NXBTMAKE} kernel-toolchain 2227 # Populate includes/libraries sysroot that produce native binaries. 2228 # This is split out from 'toolchain' above mostly so that target LLVM 2229 # libraries have a proper LLVM_DEFAULT_TARGET_TRIPLE without 2230 # polluting the cross-compiler build. The LLVM/GCC libs are skipped 2231 # here to avoid the problem but are kept in 'toolchain' so that 2232 # needed build tools are built. 2233 ${_+_}cd ${.CURDIR}; ${NXBTMAKE} _includes MK_CLANG=no MK_GCC=no 2234 ${_+_}cd ${.CURDIR}; ${NXBTMAKE} _libraries MK_CLANG=no MK_GCC=no 2235.if !defined(NO_OBJWALK) 2236 ${_+_}cd ${.CURDIR}; ${NXBMAKE} SUBDIR_OVERRIDE="${NXBDIRS:M*}" _obj 2237.endif 2238 ${_+_}cd ${.CURDIR}; ${NXBMAKE} SUBDIR_OVERRIDE="${NXBDIRS:M*}" \ 2239 everything 2240 @echo ">> native-xtools done. Use 'make native-xtools-install' to install to a given DESTDIR" 2241 2242native-xtools-install: .PHONY 2243 mkdir -p ${NXBDESTDIR}/bin ${NXBDESTDIR}/sbin ${NXBDESTDIR}/usr 2244 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 2245 -p ${NXBDESTDIR}/usr >/dev/null 2246 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 2247 -p ${NXBDESTDIR}/usr/include >/dev/null 2248 ${_+_}cd ${.CURDIR}; ${NXBMAKE} -f Makefile.inc1 \ 2249 DESTDIR=${NXBDESTDIR} \ 2250 SUBDIR_OVERRIDE="${NXBDIRS:M*}" \ 2251 -DNO_ROOT \ 2252 install 2253 2254# 2255# hierarchy - ensure that all the needed directories are present 2256# 2257hierarchy hier: .MAKE .PHONY 2258 ${_+_}cd ${.CURDIR}/etc; ${HMAKE} distrib-dirs 2259 2260# 2261# libraries - build all libraries, and install them under ${DESTDIR}. 2262# 2263# The list of libraries with dependents (${_prebuild_libs}) and their 2264# interdependencies (__L) are built automatically by the 2265# ${.CURDIR}/tools/make_libdeps.sh script. 2266# 2267libraries: .MAKE .PHONY 2268 ${_+_}cd ${.CURDIR}; \ 2269 ${MAKE} -f Makefile.inc1 _prereq_libs; \ 2270 ${MAKE} -f Makefile.inc1 _startup_libs; \ 2271 ${MAKE} -f Makefile.inc1 _prebuild_libs; \ 2272 ${MAKE} -f Makefile.inc1 _generic_libs 2273 2274# 2275# static libgcc.a prerequisite for shared libc 2276# 2277_prereq_libs= lib/libcompiler_rt 2278.if ${MK_SSP} != "no" 2279_prereq_libs+= gnu/lib/libssp/libssp_nonshared 2280.endif 2281 2282# 2283# The coverage libraries must be built for the target prior to ${_startup_libs} 2284# for world to have runtime coverage instrumentation. 2285# 2286.if ${MK_COVERAGE} != "no" 2287_prereq_libs+= lib/libclang_rt/profile 2288.endif 2289 2290# These dependencies are not automatically generated: 2291# 2292# gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before 2293# all shared libraries for ELF. 2294# 2295_startup_libs= gnu/lib/csu 2296_startup_libs+= lib/csu 2297_startup_libs+= lib/libcompiler_rt 2298_startup_libs+= lib/libc 2299_startup_libs+= lib/libc_nonshared 2300.if ${MK_LIBCPLUSPLUS} != "no" 2301_startup_libs+= lib/libcxxrt 2302.endif 2303 2304.if ${MK_LLVM_LIBUNWIND} != "no" 2305_prereq_libs+= lib/libgcc_eh lib/libgcc_s 2306_startup_libs+= lib/libgcc_eh lib/libgcc_s 2307 2308lib/libgcc_s__L: lib/libc__L 2309lib/libgcc_s__L: lib/libc_nonshared__L 2310.if ${MK_LIBCPLUSPLUS} != "no" 2311lib/libcxxrt__L: lib/libgcc_s__L 2312.endif 2313 2314.else # MK_LLVM_LIBUNWIND == no 2315 2316_prereq_libs+= gnu/lib/libgcc 2317_startup_libs+= gnu/lib/libgcc 2318 2319gnu/lib/libgcc__L: lib/libc__L 2320gnu/lib/libgcc__L: lib/libc_nonshared__L 2321.if ${MK_LIBCPLUSPLUS} != "no" 2322lib/libcxxrt__L: gnu/lib/libgcc__L 2323.endif 2324.endif 2325 2326_prebuild_libs= ${_kerberos5_lib_libasn1} \ 2327 ${_kerberos5_lib_libhdb} \ 2328 ${_kerberos5_lib_libheimbase} \ 2329 ${_kerberos5_lib_libheimntlm} \ 2330 ${_libsqlite3} \ 2331 ${_kerberos5_lib_libheimipcc} \ 2332 ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \ 2333 ${_kerberos5_lib_libroken} \ 2334 ${_kerberos5_lib_libwind} \ 2335 lib/libbz2 ${_libcom_err} lib/libcrypt \ 2336 lib/libelf lib/libexpat \ 2337 lib/libfigpar \ 2338 ${_lib_libgssapi} \ 2339 lib/libkiconv lib/libkvm lib/liblzma lib/libmd lib/libnv \ 2340 ${_lib_casper} \ 2341 lib/ncurses/ncurses lib/ncurses/ncursesw \ 2342 lib/libopie lib/libpam/libpam ${_lib_libthr} \ 2343 ${_lib_libradius} lib/libsbuf lib/libtacplus \ 2344 lib/libgeom \ 2345 ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \ 2346 ${_cddl_lib_libuutil} \ 2347 ${_cddl_lib_libavl} \ 2348 ${_cddl_lib_libzfs_core} \ 2349 ${_cddl_lib_libctf} \ 2350 lib/libutil lib/libpjdlog ${_lib_libypclnt} lib/libz lib/msun \ 2351 ${_secure_lib_libcrypto} ${_lib_libldns} \ 2352 ${_secure_lib_libssh} ${_secure_lib_libssl} 2353 2354.if ${MK_GNUCXX} != "no" 2355_prebuild_libs+= gnu/lib/libstdc++ gnu/lib/libsupc++ 2356gnu/lib/libstdc++__L: lib/msun__L 2357gnu/lib/libsupc++__L: gnu/lib/libstdc++__L 2358.endif 2359 2360.if ${MK_DIALOG} != "no" 2361_prebuild_libs+= gnu/lib/libdialog 2362gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncursesw__L 2363.endif 2364 2365.if ${MK_LIBCPLUSPLUS} != "no" 2366_prebuild_libs+= lib/libc++ 2367.endif 2368 2369lib/libgeom__L: lib/libexpat__L 2370lib/libkvm__L: lib/libelf__L 2371 2372.if ${MK_LIBTHR} != "no" 2373_lib_libthr= lib/libthr 2374.endif 2375 2376.if ${MK_RADIUS_SUPPORT} != "no" 2377_lib_libradius= lib/libradius 2378.endif 2379 2380.if ${MK_OFED} != "no" 2381_ofed_lib= contrib/ofed/usr.lib 2382_prebuild_libs+= contrib/ofed/usr.lib/libosmcomp 2383_prebuild_libs+= contrib/ofed/usr.lib/libopensm 2384_prebuild_libs+= contrib/ofed/usr.lib/libibcommon 2385_prebuild_libs+= contrib/ofed/usr.lib/libibverbs 2386_prebuild_libs+= contrib/ofed/usr.lib/libibumad 2387 2388contrib/ofed/usr.lib/libopensm__L: lib/libthr__L 2389contrib/ofed/usr.lib/libosmcomp__L: lib/libthr__L 2390contrib/ofed/usr.lib/libibumad__L: contrib/ofed/usr.lib/libibcommon__L 2391.endif 2392 2393.if ${MK_CASPER} != "no" 2394_lib_casper= lib/libcasper 2395.endif 2396 2397lib/libpjdlog__L: lib/libutil__L 2398lib/libcasper__L: lib/libnv__L 2399lib/liblzma__L: lib/libthr__L 2400 2401_generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib} 2402.for _DIR in ${LOCAL_LIB_DIRS} 2403.if exists(${.CURDIR}/${_DIR}/Makefile) && empty(_generic_libs:M${_DIR}) 2404_generic_libs+= ${_DIR} 2405.endif 2406.endfor 2407 2408lib/libopie__L lib/libtacplus__L: lib/libmd__L 2409 2410.if ${MK_CDDL} != "no" 2411_cddl_lib_libumem= cddl/lib/libumem 2412_cddl_lib_libnvpair= cddl/lib/libnvpair 2413_cddl_lib_libavl= cddl/lib/libavl 2414_cddl_lib_libuutil= cddl/lib/libuutil 2415.if ${MK_ZFS} != "no" 2416_cddl_lib_libzfs_core= cddl/lib/libzfs_core 2417cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L 2418.endif 2419_cddl_lib_libctf= cddl/lib/libctf 2420_cddl_lib= cddl/lib 2421cddl/lib/libctf__L: lib/libz__L 2422.endif 2423# cddl/lib/libdtrace requires lib/libproc and lib/librtld_db; it's only built 2424# on select architectures though (see cddl/lib/Makefile) 2425.if ${MACHINE_CPUARCH} != "sparc64" 2426_prebuild_libs+= lib/libprocstat lib/libproc lib/librtld_db 2427lib/libprocstat__L: lib/libelf__L lib/libkvm__L lib/libutil__L 2428lib/libproc__L: lib/libprocstat__L 2429lib/librtld_db__L: lib/libprocstat__L 2430.endif 2431 2432.if ${MK_CRYPT} != "no" 2433.if ${MK_OPENSSL} != "no" 2434_secure_lib_libcrypto= secure/lib/libcrypto 2435_secure_lib_libssl= secure/lib/libssl 2436lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L 2437.if ${MK_LDNS} != "no" 2438_lib_libldns= lib/libldns 2439lib/libldns__L: secure/lib/libcrypto__L 2440.endif 2441.if ${MK_OPENSSH} != "no" 2442_secure_lib_libssh= secure/lib/libssh 2443secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L 2444.if ${MK_LDNS} != "no" 2445secure/lib/libssh__L: lib/libldns__L 2446.endif 2447.if ${MK_GSSAPI} != "no" && ${MK_KERBEROS_SUPPORT} != "no" 2448secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \ 2449 kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \ 2450 lib/libmd__L kerberos5/lib/libroken__L 2451.endif 2452.endif 2453.endif 2454_secure_lib= secure/lib 2455.endif 2456 2457.if ${MK_KERBEROS} != "no" 2458kerberos5/lib/libasn1__L: lib/libcom_err__L kerberos5/lib/libroken__L 2459kerberos5/lib/libhdb__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ 2460 kerberos5/lib/libkrb5__L kerberos5/lib/libroken__L \ 2461 kerberos5/lib/libwind__L lib/libsqlite3__L 2462kerberos5/lib/libheimntlm__L: secure/lib/libcrypto__L kerberos5/lib/libkrb5__L \ 2463 kerberos5/lib/libroken__L lib/libcom_err__L 2464kerberos5/lib/libhx509__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ 2465 secure/lib/libcrypto__L kerberos5/lib/libroken__L kerberos5/lib/libwind__L 2466kerberos5/lib/libkrb5__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ 2467 lib/libcrypt__L secure/lib/libcrypto__L kerberos5/lib/libhx509__L \ 2468 kerberos5/lib/libroken__L kerberos5/lib/libwind__L \ 2469 kerberos5/lib/libheimbase__L kerberos5/lib/libheimipcc__L 2470kerberos5/lib/libroken__L: lib/libcrypt__L 2471kerberos5/lib/libwind__L: kerberos5/lib/libroken__L lib/libcom_err__L 2472kerberos5/lib/libheimbase__L: lib/libthr__L 2473kerberos5/lib/libheimipcc__L: kerberos5/lib/libroken__L kerberos5/lib/libheimbase__L lib/libthr__L 2474.endif 2475 2476lib/libsqlite3__L: lib/libthr__L 2477 2478.if ${MK_GSSAPI} != "no" 2479_lib_libgssapi= lib/libgssapi 2480.endif 2481 2482.if ${MK_KERBEROS} != "no" 2483_kerberos5_lib= kerberos5/lib 2484_kerberos5_lib_libasn1= kerberos5/lib/libasn1 2485_kerberos5_lib_libhdb= kerberos5/lib/libhdb 2486_kerberos5_lib_libheimbase= kerberos5/lib/libheimbase 2487_kerberos5_lib_libkrb5= kerberos5/lib/libkrb5 2488_kerberos5_lib_libhx509= kerberos5/lib/libhx509 2489_kerberos5_lib_libroken= kerberos5/lib/libroken 2490_kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm 2491_libsqlite3= lib/libsqlite3 2492_kerberos5_lib_libheimipcc= kerberos5/lib/libheimipcc 2493_kerberos5_lib_libwind= kerberos5/lib/libwind 2494_libcom_err= lib/libcom_err 2495.endif 2496 2497.if ${MK_NIS} != "no" 2498_lib_libypclnt= lib/libypclnt 2499.endif 2500 2501.if ${MK_OPENSSL} == "no" 2502lib/libradius__L: lib/libmd__L 2503.endif 2504 2505lib/libproc__L: \ 2506 ${_cddl_lib_libctf:D${_cddl_lib_libctf}__L} lib/libelf__L lib/librtld_db__L lib/libutil__L 2507.if ${MK_CXX} != "no" 2508.if ${MK_LIBCPLUSPLUS} != "no" 2509lib/libproc__L: lib/libcxxrt__L 2510.else # This implies MK_GNUCXX != "no"; see lib/libproc 2511lib/libproc__L: gnu/lib/libsupc++__L 2512.endif 2513.endif 2514 2515.for _lib in ${_prereq_libs} 2516${_lib}__PL: .PHONY .MAKE 2517.if exists(${.CURDIR}/${_lib}) 2518 ${_+_}@${ECHODIR} "===> ${_lib} (obj,all,install)"; \ 2519 cd ${.CURDIR}/${_lib}; \ 2520 if [ -z "${NO_OBJWALK}" ]; then ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj; fi; \ 2521 ${MAKE} MK_TESTS=no MK_PROFILE=no -DNO_PIC \ 2522 DIRPRFX=${_lib}/ all; \ 2523 ${MAKE} MK_COVERAGE=no MK_TESTS=no MK_PROFILE=no -DNO_PIC \ 2524 DIRPRFX=${_lib}/ install 2525.endif 2526.endfor 2527 2528.for _lib in ${_startup_libs} ${_prebuild_libs} ${_generic_libs} 2529${_lib}__L: .PHONY .MAKE 2530.if exists(${.CURDIR}/${_lib}) 2531 ${_+_}@${ECHODIR} "===> ${_lib} (obj,all,install)"; \ 2532 cd ${.CURDIR}/${_lib}; \ 2533 if [ -z "${NO_OBJWALK}" ]; then ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj; fi; \ 2534 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ all; \ 2535 ${MAKE} MK_COVERAGE=no MK_TESTS=no DIRPRFX=${_lib}/ install 2536.endif 2537.endfor 2538 2539_prereq_libs: ${_prereq_libs:S/$/__PL/} 2540_startup_libs: ${_startup_libs:S/$/__L/} 2541_prebuild_libs: ${_prebuild_libs:S/$/__L/} 2542_generic_libs: ${_generic_libs:S/$/__L/} 2543 2544# Enable SUBDIR_PARALLEL when not calling 'make all', unless called from 2545# 'everything' with _PARALLEL_SUBDIR_OK set. This is because it is unlikely 2546# that running 'make all' from the top-level, especially with a SUBDIR_OVERRIDE 2547# or LOCAL_DIRS set, will have a reliable build if SUBDIRs are built in 2548# parallel. This is safe for the world stage of buildworld though since it has 2549# already built libraries in a proper order and installed includes into 2550# WORLDTMP. Special handling is done for SUBDIR ordering for 'install*' to 2551# avoid trashing a system if it crashes mid-install. 2552.if !make(all) || defined(_PARALLEL_SUBDIR_OK) 2553SUBDIR_PARALLEL= 2554.endif 2555 2556.include <bsd.subdir.mk> 2557 2558.if make(check-old) || make(check-old-dirs) || \ 2559 make(check-old-files) || make(check-old-libs) || \ 2560 make(delete-old) || make(delete-old-dirs) || \ 2561 make(delete-old-files) || make(delete-old-libs) 2562 2563# 2564# check for / delete old files section 2565# 2566 2567.include "ObsoleteFiles.inc" 2568 2569OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \ 2570else you can not start such an application. Consult UPDATING for more \ 2571information regarding how to cope with the removal/revision bump of a \ 2572specific library." 2573 2574.if !defined(BATCH_DELETE_OLD_FILES) 2575RM_I=-i 2576.else 2577RM_I=-v 2578.endif 2579 2580delete-old-files: .PHONY 2581 @echo ">>> Removing old files (only deletes safe to delete libs)" 2582# Ask for every old file if the user really wants to remove it. 2583# It's annoying, but better safe than sorry. 2584# NB: We cannot pass the list of OLD_FILES as a parameter because the 2585# argument list will get too long. Using .for/.endfor make "loops" will make 2586# the Makefile parser segfault. 2587 @exec 3<&0; \ 2588 cd ${.CURDIR}; \ 2589 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 2590 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \ 2591 while read file; do \ 2592 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 2593 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \ 2594 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \ 2595 fi; \ 2596 for ext in debug symbols; do \ 2597 if ! [ -e "${DESTDIR}/$${file}" ] && [ -f \ 2598 "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \ 2599 rm ${RM_I} "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" \ 2600 <&3; \ 2601 fi; \ 2602 done; \ 2603 done 2604# Remove catpages without corresponding manpages. 2605 @exec 3<&0; \ 2606 find ${DESTDIR}/usr/share/man/cat* ! -type d 2>/dev/null | \ 2607 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \ 2608 while read catpage; do \ 2609 read manpage; \ 2610 if [ ! -e "$${manpage}" ]; then \ 2611 rm ${RM_I} $${catpage} <&3; \ 2612 fi; \ 2613 done 2614 @echo ">>> Old files removed" 2615 2616check-old-files: .PHONY 2617 @echo ">>> Checking for old files" 2618 @cd ${.CURDIR}; \ 2619 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 2620 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \ 2621 while read file; do \ 2622 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 2623 echo "${DESTDIR}/$${file}"; \ 2624 fi; \ 2625 for ext in debug symbols; do \ 2626 if [ -f "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \ 2627 echo "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}"; \ 2628 fi; \ 2629 done; \ 2630 done 2631# Check for catpages without corresponding manpages. 2632 @find ${DESTDIR}/usr/share/man/cat* ! -type d 2>/dev/null | \ 2633 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \ 2634 while read catpage; do \ 2635 read manpage; \ 2636 if [ ! -e "$${manpage}" ]; then \ 2637 echo $${catpage}; \ 2638 fi; \ 2639 done 2640 2641delete-old-libs: .PHONY 2642 @echo ">>> Removing old libraries" 2643 @echo "${OLD_LIBS_MESSAGE}" | fmt 2644 @exec 3<&0; \ 2645 cd ${.CURDIR}; \ 2646 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 2647 -V OLD_LIBS | xargs -n1 | \ 2648 while read file; do \ 2649 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 2650 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \ 2651 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \ 2652 fi; \ 2653 for ext in debug symbols; do \ 2654 if ! [ -e "${DESTDIR}/$${file}" ] && [ -f \ 2655 "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \ 2656 rm ${RM_I} "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" \ 2657 <&3; \ 2658 fi; \ 2659 done; \ 2660 done 2661 @echo ">>> Old libraries removed" 2662 2663check-old-libs: .PHONY 2664 @echo ">>> Checking for old libraries" 2665 @cd ${.CURDIR}; \ 2666 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 2667 -V OLD_LIBS | xargs -n1 | \ 2668 while read file; do \ 2669 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 2670 echo "${DESTDIR}/$${file}"; \ 2671 fi; \ 2672 for ext in debug symbols; do \ 2673 if [ -f "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \ 2674 echo "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}"; \ 2675 fi; \ 2676 done; \ 2677 done 2678 2679delete-old-dirs: .PHONY 2680 @echo ">>> Removing old directories" 2681 @cd ${.CURDIR}; \ 2682 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 2683 -V OLD_DIRS | xargs -n1 | sort -r | \ 2684 while read dir; do \ 2685 if [ -d "${DESTDIR}/$${dir}" ]; then \ 2686 rmdir -v "${DESTDIR}/$${dir}" || true; \ 2687 elif [ -L "${DESTDIR}/$${dir}" ]; then \ 2688 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \ 2689 fi; \ 2690 if [ -d "${DESTDIR}${DEBUGDIR}/$${dir}" ]; then \ 2691 rmdir -v "${DESTDIR}${DEBUGDIR}/$${dir}" || true; \ 2692 elif [ -L "${DESTDIR}${DEBUGDIR}/$${dir}" ]; then \ 2693 echo "${DESTDIR}${DEBUGDIR}/$${dir} is a link, please remove everything manually."; \ 2694 fi; \ 2695 done 2696 @echo ">>> Old directories removed" 2697 2698check-old-dirs: .PHONY 2699 @echo ">>> Checking for old directories" 2700 @cd ${.CURDIR}; \ 2701 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 2702 -V OLD_DIRS | xargs -n1 | \ 2703 while read dir; do \ 2704 if [ -d "${DESTDIR}/$${dir}" ]; then \ 2705 echo "${DESTDIR}/$${dir}"; \ 2706 elif [ -L "${DESTDIR}/$${dir}" ]; then \ 2707 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \ 2708 fi; \ 2709 if [ -d "${DESTDIR}${DEBUGDIR}/$${dir}" ]; then \ 2710 echo "${DESTDIR}${DEBUGDIR}/$${dir}"; \ 2711 elif [ -L "${DESTDIR}${DEBUGDIR}/$${dir}" ]; then \ 2712 echo "${DESTDIR}${DEBUGDIR}/$${dir} is a link, please remove everything manually."; \ 2713 fi; \ 2714 done 2715 2716delete-old: delete-old-files delete-old-dirs .PHONY 2717 @echo "To remove old libraries run '${MAKE_CMD} delete-old-libs'." 2718 2719check-old: check-old-files check-old-libs check-old-dirs .PHONY 2720 @echo "To remove old files and directories run '${MAKE_CMD} delete-old'." 2721 @echo "To remove old libraries run '${MAKE_CMD} delete-old-libs'." 2722 2723.endif 2724 2725# 2726# showconfig - show build configuration. 2727# 2728showconfig: .PHONY 2729 @(${MAKE} -n -f ${.CURDIR}/sys/conf/kern.opts.mk -V dummy -dg1 UPDATE_DEPENDFILE=no NO_OBJ=yes; \ 2730 ${MAKE} -n -f ${.CURDIR}/share/mk/src.opts.mk -V dummy -dg1 UPDATE_DEPENDFILE=no NO_OBJ=yes) 2>&1 | grep ^MK_ | sort -u 2731 2732.if !empty(KRNLOBJDIR) && !empty(KERNCONF) 2733DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/ 2734 2735.if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE) 2736.if exists(${KERNCONFDIR}/${KERNCONF}) 2737FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \ 2738 '${KERNCONFDIR}/${KERNCONF}' ; echo 2739.endif 2740.endif 2741 2742.endif 2743 2744.if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH}) 2745DTBOUTPUTPATH= ${.CURDIR} 2746.endif 2747 2748# 2749# Build 'standalone' Device Tree Blob 2750# 2751builddtb: .PHONY 2752 @PATH=${TMPPATH} MACHINE=${TARGET} \ 2753 ${.CURDIR}/sys/tools/fdt/make_dtb.sh ${.CURDIR}/sys \ 2754 "${FDT_DTS_FILE}" ${DTBOUTPUTPATH} 2755 2756############### 2757 2758# cleanworld 2759# In the following, the first 'rm' in a series will usually remove all 2760# files and directories. If it does not, then there are probably some 2761# files with file flags set, so this unsets them and tries the 'rm' a 2762# second time. There are situations where this target will be cleaning 2763# some directories via more than one method, but that duplication is 2764# needed to correctly handle all the possible situations. Removing all 2765# files without file flags set in the first 'rm' instance saves time, 2766# because 'chflags' will need to operate on fewer files afterwards. 2767# 2768# It is expected that BW_CANONICALOBJDIR == the CANONICALOBJDIR as would be 2769# created by bsd.obj.mk, except that we don't want to .include that file 2770# in this makefile. We don't do a cleandir walk if MK_AUTO_OBJ is yes 2771# since it is not possible for files to land in the wrong place. 2772# 2773.if make(cleanworld) 2774BW_CANONICALOBJDIR:=${OBJTOP}/ 2775.elif make(cleanuniverse) 2776BW_CANONICALOBJDIR:=${OBJROOT} 2777.if ${MK_UNIFIED_OBJDIR} == "no" 2778.error ${.TARGETS} only supported with WITH_UNIFIED_OBJDIR enabled. 2779.endif 2780.endif 2781cleanworld cleanuniverse: .PHONY 2782.if !empty(BW_CANONICALOBJDIR) && exists(${BW_CANONICALOBJDIR}) 2783 -rm -rf ${BW_CANONICALOBJDIR}* 2784 -chflags -R 0 ${BW_CANONICALOBJDIR} 2785 rm -rf ${BW_CANONICALOBJDIR}* 2786.endif 2787.if make(cleanworld) && ${MK_AUTO_OBJ} == "no" 2788.if ${.CURDIR} == ${.OBJDIR} || ${.CURDIR}/obj == ${.OBJDIR} 2789 # To be safe in this case, fall back to a 'make cleandir' 2790 ${_+_}@cd ${.CURDIR}; ${MAKE} cleandir 2791.endif 2792.endif 2793 2794.if ${TARGET} == ${MACHINE} && ${TARGET_ARCH} == ${MACHINE_ARCH} 2795XDEV_CPUTYPE?=${CPUTYPE} 2796.else 2797XDEV_CPUTYPE?=${TARGET_CPUTYPE} 2798.endif 2799 2800NOFUN= MK_COVERAGE=no -DNO_FSCHG MK_HTML=no -DNO_LINT \ 2801 MK_MAN=no MK_NLS=no MK_PROFILE=no \ 2802 MK_KERBEROS=no MK_RESCUE=no MK_TESTS=no MK_WARNS=no \ 2803 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ 2804 CPUTYPE=${XDEV_CPUTYPE} 2805 2806XDDIR=${TARGET_ARCH}-freebsd 2807XDTP?=/usr/${XDDIR} 2808.if ${XDTP:N/*} 2809.error XDTP variable should be an absolute path 2810.endif 2811 2812CDBOBJROOT= ${OBJROOT}${MACHINE}.${MACHINE_ARCH}/xdev/ 2813CDBOBJTOP= ${CDBOBJROOT}${XDDIR} 2814CDBENV= \ 2815 INSTALL="sh ${.CURDIR}/tools/install.sh" 2816CDENV= ${CDBENV} \ 2817 TOOLS_PREFIX=${XDTP} 2818CDMAKEARGS= \ 2819 OBJTOP=${CDBOBJTOP:Q} \ 2820 OBJROOT=${CDBOBJROOT:Q} 2821CD2MAKEARGS= ${CDMAKEARGS} 2822 2823.if ${WANT_COMPILER_TYPE} == gcc || \ 2824 (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc) 2825# GCC requires -isystem and -L when using a cross-compiler. --sysroot 2826# won't set header path and -L is used to ensure the base library path 2827# is added before the port PREFIX library path. 2828CD2CFLAGS+= -isystem ${XDDESTDIR}/usr/include -L${XDDESTDIR}/usr/lib 2829# GCC requires -B to find /usr/lib/crti.o when using a cross-compiler 2830# combined with --sysroot. 2831CD2CFLAGS+= -B${XDDESTDIR}/usr/lib 2832# Force using libc++ for external GCC. 2833.if ${X_COMPILER_TYPE} == gcc && ${X_COMPILER_VERSION} >= 40800 2834CD2CXXFLAGS+= -isystem ${XDDESTDIR}/usr/include/c++/v1 -std=c++11 \ 2835 -nostdinc++ 2836.endif 2837.endif 2838CD2CFLAGS+= --sysroot=${XDDESTDIR}/ 2839CD2ENV=${CDENV} CC="${CC} ${CD2CFLAGS}" CXX="${CXX} ${CD2CXXFLAGS} ${CD2CFLAGS}" \ 2840 CPP="${CPP} ${CD2CFLAGS}" \ 2841 MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH} 2842 2843CDTMP= ${OBJTOP}/${XDDIR}/tmp 2844CDMAKE=${CDENV} PATH=${CDTMP}/usr/bin:${PATH} ${MAKE} ${CDMAKEARGS} ${NOFUN} 2845CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDDESTDIR}/usr/bin:${PATH} \ 2846 ${MAKE} ${CD2MAKEARGS} ${NOFUN} 2847.if ${MK_META_MODE} != "no" 2848# Don't rebuild build-tools targets during normal build. 2849CD2MAKE+= BUILD_TOOLS_META=.NOMETA 2850.endif 2851XDDESTDIR=${DESTDIR}${XDTP} 2852 2853.ORDER: xdev-build xdev-install xdev-links 2854xdev: xdev-build xdev-install .PHONY 2855 2856.ORDER: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools 2857xdev-build: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools .PHONY 2858 2859_xb-worldtmp: .PHONY 2860 mkdir -p ${CDTMP}/usr 2861 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 2862 -p ${CDTMP}/usr >/dev/null 2863 2864_xb-bootstrap-tools: .PHONY 2865.for _tool in \ 2866 ${_clang_tblgen} \ 2867 ${_gperf} \ 2868 ${_yacc} 2869 ${_+_}@${ECHODIR} "===> ${_tool} (obj,all,install)"; \ 2870 cd ${.CURDIR}/${_tool}; \ 2871 if [ -z "${NO_OBJWALK}" ]; then ${CDMAKE} DIRPRFX=${_tool}/ obj; fi; \ 2872 ${CDMAKE} DIRPRFX=${_tool}/ all; \ 2873 ${CDMAKE} DIRPRFX=${_tool}/ DESTDIR=${CDTMP} install 2874.endfor 2875 2876_xb-build-tools: .PHONY 2877 ${_+_}@cd ${.CURDIR}; \ 2878 ${CDBENV} ${MAKE} ${CDMAKEARGS} -f Makefile.inc1 ${NOFUN} build-tools 2879 2880XDEVDIRS= \ 2881 ${_clang_libs} \ 2882 ${_lld} \ 2883 ${_binutils} \ 2884 ${_elftctools} \ 2885 usr.bin/ar \ 2886 ${_clang} \ 2887 ${_gcc} 2888 2889_xb-cross-tools: .PHONY 2890.for _tool in ${XDEVDIRS} 2891 ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,all)"; \ 2892 cd ${.CURDIR}/${_tool}; \ 2893 if [ -z "${NO_OBJWALK}" ]; then ${CDMAKE} DIRPRFX=${_tool}/ obj; fi; \ 2894 ${CDMAKE} DIRPRFX=${_tool}/ all 2895.endfor 2896 2897_xi-mtree: .PHONY 2898 ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}" 2899 mkdir -p ${XDDESTDIR} 2900 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \ 2901 -p ${XDDESTDIR} >/dev/null 2902 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 2903 -p ${XDDESTDIR}/usr >/dev/null 2904 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 2905 -p ${XDDESTDIR}/usr/include >/dev/null 2906.if defined(LIBCOMPAT) 2907 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ 2908 -p ${XDDESTDIR}/usr >/dev/null 2909.endif 2910.if ${MK_TESTS} != "no" 2911 mkdir -p ${XDDESTDIR}${TESTSBASE} 2912 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \ 2913 -p ${XDDESTDIR}${TESTSBASE} >/dev/null 2914.endif 2915 2916.ORDER: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries 2917xdev-install: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries .PHONY 2918 2919_xi-cross-tools: .PHONY 2920 @echo "_xi-cross-tools" 2921.for _tool in ${XDEVDIRS} 2922 ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \ 2923 cd ${.CURDIR}/${_tool}; \ 2924 ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR} 2925.endfor 2926 2927_xi-includes: .PHONY 2928.if !defined(NO_OBJWALK) 2929 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 _obj \ 2930 DESTDIR=${XDDESTDIR} 2931.endif 2932 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 includes \ 2933 DESTDIR=${XDDESTDIR} 2934 2935_xi-libraries: .PHONY 2936 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \ 2937 DESTDIR=${XDDESTDIR} 2938 2939xdev-links: .PHONY 2940 ${_+_}cd ${XDDESTDIR}/usr/bin; \ 2941 mkdir -p ../../../../usr/bin; \ 2942 for i in *; do \ 2943 ln -sf ../../${XDTP}/usr/bin/$$i \ 2944 ../../../../usr/bin/${XDDIR}-$$i; \ 2945 ln -sf ../../${XDTP}/usr/bin/$$i \ 2946 ../../../../usr/bin/${XDDIR}${_REVISION}-$$i; \ 2947 done 2948