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