1# 2# 3# Make command line options: 4# -DNO_CLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir 5# -DNO_CLEAN do not clean at all (enabled by default) 6# -DDB_FROM_SRC use the user/group databases in src/etc instead of 7# the system database when installing. 8# -DNO_SHARE do not go into share subdir 9# -DKERNFAST define NO_KERNEL{CONFIG,CLEAN,OBJ} 10# -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel 11# -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel 12# -DNO_KERNELOBJ do not run ${MAKE} obj in ${MAKE} buildkernel 13# -DNO_ROOT install without using root privilege 14# -DWITHOUT_CTF do not run the DTrace CTF conversion tools on built objects 15# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list 16# LOCAL_ITOOLS="list of tools" to add additional tools to the ITOOLS list 17# LOCAL_LIB_DIRS="list of dirs" to add additional dirs to libraries target 18# LOCAL_MTREE="list of mtree files" to process to allow local directories 19# to be created before files are installed 20# LOCAL_LEGACY_DIRS="list of dirs" to add additional dirs to the legacy 21# target 22# LOCAL_BSTOOL_DIRS="list of dirs" to add additional dirs to the 23# bootstrap-tools target 24# LOCAL_TOOL_DIRS="list of dirs" to add additional dirs to the build-tools 25# target 26# LOCAL_XTOOL_DIRS="list of dirs" to add additional dirs to the 27# cross-tools target 28# METALOG="path to metadata log" to write permission and ownership 29# when NO_ROOT is set. (default: ${DESTDIR}/${DISTDIR}/METALOG, 30# check /etc/make.conf for DISTDIR) 31# TARGET="machine" to crossbuild world for a different machine type 32# TARGET_ARCH= may be required when a TARGET supports multiple endians 33# BUILDENV_SHELL= shell to launch for the buildenv target (def:${SHELL}) 34# WORLD_FLAGS= additional flags to pass to make(1) during buildworld 35# KERNEL_FLAGS= additional flags to pass to make(1) during buildkernel 36# SUBDIR_OVERRIDE="list of dirs" to build rather than everything. 37# All libraries and includes, and some build tools will still build. 38 39# 40# The intended user-driven targets are: 41# buildworld - rebuild *everything*, including glue to help do upgrades 42# installworld- install everything built by "buildworld" 43# checkworld - run test suite on installed world 44# doxygen - build API documentation of the kernel 45# 46# Standard targets (not defined here) are documented in the makefiles in 47# /usr/share/mk. These include: 48# obj depend all install clean cleandepend cleanobj 49 50.if !defined(TARGET) || !defined(TARGET_ARCH) 51.error Both TARGET and TARGET_ARCH must be defined. 52.endif 53 54.if make(showconfig) || make(test-system-*) 55_MKSHOWCONFIG= t 56.endif 57 58SRCDIR?= ${.CURDIR} 59LOCALBASE?= /usr/local 60TIME_ENV ?= time env 61 62.include "share/mk/src.tools.mk" 63 64# Cross toolchain changes must be in effect before bsd.compiler.mk 65# so that gets the right CC, and pass CROSS_TOOLCHAIN to submakes. 66.if defined(CROSS_TOOLCHAIN) 67.if exists(${LOCALBASE}/share/toolchains/${CROSS_TOOLCHAIN}.mk) 68.include "${LOCALBASE}/share/toolchains/${CROSS_TOOLCHAIN}.mk" 69.elif exists(${CROSS_TOOLCHAIN}) 70.include "${CROSS_TOOLCHAIN}" 71.else 72.error CROSS_TOOLCHAIN ${CROSS_TOOLCHAIN} not found 73.endif 74CROSSENV+=CROSS_TOOLCHAIN="${CROSS_TOOLCHAIN}" 75.elif defined(UNIVERSE_TOOLCHAIN) 76UNIVERSE_TOOLCHAIN_PATH?=${HOST_OBJTOP}/tmp/usr/bin 77XCC?="${UNIVERSE_TOOLCHAIN_PATH}/cc" 78XCXX?="${UNIVERSE_TOOLCHAIN_PATH}/c++" 79XCPP?="${UNIVERSE_TOOLCHAIN_PATH}/cpp" 80XLD?="${UNIVERSE_TOOLCHAIN_PATH}/ld" 81.endif 82.if defined(CROSS_TOOLCHAIN_PREFIX) 83CROSS_COMPILER_PREFIX?=${CROSS_TOOLCHAIN_PREFIX} 84.endif 85 86XCOMPILERS= CC CXX CPP 87.for COMPILER in ${XCOMPILERS} 88.if defined(CROSS_COMPILER_PREFIX) 89X${COMPILER}?= ${CROSS_COMPILER_PREFIX}${${COMPILER}} 90.else 91X${COMPILER}?= ${${COMPILER}} 92.endif 93.endfor 94# If a full path to an external cross compiler is given, don't build 95# a cross compiler. 96.if ${XCC:N${CCACHE_BIN}:M/*} 97MK_CLANG_BOOTSTRAP= no 98# Make sure sub-makes see the option as disabled so the hack in bsd.sys.mk to 99# work around incompatible headers in Clang's resource directory is enabled. 100.MAKEOVERRIDES+= MK_CLANG_BOOTSTRAP 101.endif 102 103# Pull in compiler metadata from buildworld/toolchain if possible to avoid 104# running CC from bsd.compiler.mk. 105.if make(installworld) || make(install) || make(distributeworld) || \ 106 make(stageworld) 107.-include "${OBJTOP}/toolchain-metadata.mk" 108.if !defined(_LOADED_TOOLCHAIN_METADATA) 109.error A build is required first. You may have the wrong MAKEOBJDIRPREFIX set. 110.endif 111.endif 112 113# Pull in COMPILER_TYPE and COMPILER_FREEBSD_VERSION early. Pull it from the 114# tree to be friendlier to foreign OS builds. It's safe to do so unconditionally 115# here since we will always have the right make, unlike in src/Makefile 116# Don't include bsd.linker.mk yet until XBINUTILS is handled (after src.opts.mk) 117_NO_INCLUDE_LINKERMK= t 118# We also want the X_COMPILER* variables if we are using an external toolchain. 119_WANT_TOOLCHAIN_CROSS_VARS= t 120.include "share/mk/bsd.compiler.mk" 121.undef _NO_INCLUDE_LINKERMK 122.undef _WANT_TOOLCHAIN_CROSS_VARS 123# src.opts.mk depends on COMPILER_FEATURES 124.include "share/mk/src.opts.mk" 125 126.if ${TARGET} == ${MACHINE} 127TARGET_CPUTYPE?=${CPUTYPE} 128.else 129TARGET_CPUTYPE?= 130.endif 131.if !empty(TARGET_CPUTYPE) 132_TARGET_CPUTYPE=${TARGET_CPUTYPE} 133.else 134_TARGET_CPUTYPE=dummy 135.endif 136.if ${TARGET} == "arm" 137.if ${TARGET_CPUTYPE:M*soft*} == "" 138TARGET_TRIPLE_ABI= gnueabihf 139.else 140TARGET_TRIPLE_ABI= gnueabi 141.endif 142.endif 143MACHINE_TRIPLE_ABI?= unknown 144MACHINE_TRIPLE?=${MACHINE_ARCH:S/amd64/x86_64/}-${MACHINE_TRIPLE_ABI}-freebsd${OS_REVISION} 145TARGET_TRIPLE_ABI?= unknown 146TARGET_TRIPLE?= ${TARGET_ARCH:S/amd64/x86_64/}-${TARGET_TRIPLE_ABI}-freebsd${OS_REVISION} 147KNOWN_ARCHES?= aarch64/arm64 \ 148 amd64 \ 149 armv7/arm \ 150 i386 \ 151 powerpc \ 152 powerpc64/powerpc \ 153 powerpc64le/powerpc \ 154 riscv64/riscv 155 156.if ${TARGET} == ${TARGET_ARCH} 157_t= ${TARGET} 158.else 159_t= ${TARGET_ARCH}/${TARGET} 160.endif 161.for _t in ${_t} 162.if empty(KNOWN_ARCHES:M${_t}) 163.error Unknown target ${TARGET_ARCH}:${TARGET}. 164.endif 165.endfor 166 167.if ${TARGET_ARCH} == "amd64" 168LIBCOMPAT_INCLUDE_DIRS+= i386 169.elif ${TARGET_ARCH} == "aarch64" 170LIBCOMPAT_INCLUDE_DIRS+= arm 171.endif 172 173.if !defined(_MKSHOWCONFIG) 174.if ((defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == "gcc") || \ 175 (!defined(X_COMPILER_TYPE) && ${COMPILER_TYPE} == "gcc")) 176.if ${TARGET} == "arm" 177_GCC_BROKEN="https://reviews.freebsd.org/D36754" 178.endif 179.if ${TARGET_ARCH} == "powerpc" 180_GCC_BROKEN=Missing atomic builtins in libc++. 181.endif 182.if ${TARGET_ARCH:Mpowerpc64*} 183_GCC_BROKEN=libsys.so.7.full has a LOAD segment with RWX permissions. 184.endif 185.if defined(_GCC_BROKEN) 186.warning Target ${TARGET} is broken with GCC: ${_GCC_BROKEN} 187.if defined(TRY_GCC_BROKEN) 188.warning Trying build anyway. 189.else 190.error Avoiding broken build. Define TRY_GCC_BROKEN to try anyway. 191.endif 192.endif 193.endif 194.endif 195 196.if ${.MAKE.OS} != "FreeBSD" 197CROSSBUILD_HOST=${.MAKE.OS} # Unset for native FreeBSD builds 198.if ${.MAKE.OS} != "Linux" && ${.MAKE.OS} != "Darwin" 199.warning Unsupported crossbuild system: ${.MAKE.OS}. Build will probably fail! 200.endif 201.endif 202# We need to force NO_ROOT/DB_FROM_SRC builds when building on other operating 203# systems since the BSD.foo.dist specs contain users and groups that do not 204# exist by default on a Linux/MacOS system. The distribute* and package* 205# targets used for install media legacy distribution sets also always use and 206# require NO_ROOT mode. 207.if defined(CROSSBUILD_HOST) || make(distributeworld) || make(packageworld) || \ 208 make(distributekernel) || make(packagekernel) 209NO_ROOT:= 1 210DB_FROM_SRC:= 1 211.export NO_ROOT 212.endif 213 214# If all targets are disabled for system llvm then don't expect it to work 215# for cross-builds. 216.if !defined(TOOLS_PREFIX) && ${MK_LLVM_TARGET_ALL} == "no" && \ 217 ${MACHINE} != ${TARGET} && ${MACHINE_ARCH} != ${TARGET_ARCH} && \ 218 !make(showconfig) 219MK_SYSTEM_COMPILER= no 220MK_SYSTEM_LINKER= no 221.endif 222 223# Handle external binutils. 224.if defined(CROSS_TOOLCHAIN_PREFIX) 225CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX} 226.endif 227XBINUTILS= AS AR ELFCTL LD NM OBJCOPY RANLIB SIZE STRINGS STRIPBIN 228.for BINUTIL in ${XBINUTILS} 229.if defined(CROSS_BINUTILS_PREFIX) && \ 230 exists(${CROSS_BINUTILS_PREFIX}/${${BINUTIL}}) 231X${BINUTIL}?= ${CROSS_BINUTILS_PREFIX:C,/*$,,}/${${BINUTIL}} 232.else 233X${BINUTIL}?= ${${BINUTIL}} 234.endif 235.endfor 236 237# If a full path to an external linker is given, don't build lld. 238.if ${XLD:M/*} 239MK_LLD_BOOTSTRAP= no 240.endif 241 242# We also want the X_LINKER* variables if we are using an external toolchain. 243_WANT_TOOLCHAIN_CROSS_VARS= t 244.include "share/mk/bsd.linker.mk" 245.undef _WANT_TOOLCHAIN_CROSS_VARS 246 247# Begin WITH_SYSTEM_COMPILER / WITH_SYSTEM_LD 248 249# WITH_SYSTEM_COMPILER - Pull in needed values and make a decision. 250 251# Check if there is a local compiler that can satisfy as an external compiler. 252# Which compiler is expected to be used? 253.if ${MK_CLANG_BOOTSTRAP} == "yes" 254WANT_COMPILER_TYPE= clang 255.else 256WANT_COMPILER_TYPE= 257.endif 258 259.if !defined(WANT_COMPILER_FREEBSD_VERSION) && !make(showconfig) && \ 260 !make(test-system-linker) 261.if ${WANT_COMPILER_TYPE} == "clang" 262WANT_COMPILER_FREEBSD_VERSION_FILE= lib/clang/freebsd_cc_version.h 263WANT_COMPILER_FREEBSD_VERSION!= \ 264 awk '$$2 == "FREEBSD_CC_VERSION" {printf("%d\n", $$3)}' \ 265 ${SRCDIR}/${WANT_COMPILER_FREEBSD_VERSION_FILE} || echo unknown 266WANT_COMPILER_VERSION_FILE= lib/clang/include/clang/Basic/Version.inc 267WANT_COMPILER_VERSION!= \ 268 awk '$$2 == "CLANG_VERSION" {split($$3, a, "."); print a[1] * 10000 + a[2] * 100 + a[3]}' \ 269 ${SRCDIR}/${WANT_COMPILER_VERSION_FILE} || echo unknown 270.endif 271.export WANT_COMPILER_FREEBSD_VERSION WANT_COMPILER_VERSION 272.endif # !defined(WANT_COMPILER_FREEBSD_VERSION) 273 274# It needs to be the same revision as we would build for the bootstrap. 275# If the expected vs CC is different then we can't skip. 276# GCC cannot be used for cross-arch yet. For clang we pass -target later if 277# TARGET_ARCH!=MACHINE_ARCH. 278.if ${MK_SYSTEM_COMPILER} == "yes" && \ 279 defined(WANT_COMPILER_FREEBSD_VERSION) && \ 280 ${MK_CLANG_BOOTSTRAP} == "yes" && \ 281 !make(xdev*) && \ 282 ${X_COMPILER_TYPE} == ${WANT_COMPILER_TYPE} && \ 283 (${X_COMPILER_TYPE} == "clang" || ${TARGET_ARCH} == ${MACHINE_ARCH}) && \ 284 ${X_COMPILER_VERSION} == ${WANT_COMPILER_VERSION} && \ 285 ${X_COMPILER_FREEBSD_VERSION} == ${WANT_COMPILER_FREEBSD_VERSION} 286# Everything matches, disable the bootstrap compiler. 287MK_CLANG_BOOTSTRAP= no 288USING_SYSTEM_COMPILER= yes 289.endif # ${WANT_COMPILER_TYPE} == ${COMPILER_TYPE} 290 291# WITH_SYSTEM_LD - Pull in needed values and make a decision. 292 293# Check if there is a local linker that can satisfy as an external linker. 294# Which linker is expected to be used? 295.if ${MK_LLD_BOOTSTRAP} == "yes" 296WANT_LINKER_TYPE= lld 297.else 298WANT_LINKER_TYPE= 299.endif 300 301.if !defined(WANT_LINKER_FREEBSD_VERSION) && !make(showconfig) && \ 302 !make(test-system-compiler) 303.if ${WANT_LINKER_TYPE} == "lld" 304WANT_LINKER_FREEBSD_VERSION_FILE= lib/clang/include/lld/Common/Version.inc 305WANT_LINKER_FREEBSD_VERSION!= \ 306 awk '$$2 == "LLD_FREEBSD_VERSION" {print $$3}' \ 307 ${SRCDIR}/${WANT_LINKER_FREEBSD_VERSION_FILE} || echo unknown 308WANT_LINKER_VERSION_FILE= lib/clang/include/lld/Common/Version.inc 309WANT_LINKER_VERSION!= \ 310 awk '$$2 == "LLD_VERSION_STRING" {gsub("\"", "", $$3); split($$3, a, "."); print a[1] * 10000 + a[2] * 100 + a[3]}' \ 311 ${SRCDIR}/${WANT_LINKER_VERSION_FILE} || echo unknown 312.else 313WANT_LINKER_FREEBSD_VERSION_FILE= 314WANT_LINKER_FREEBSD_VERSION= 315.endif 316.export WANT_LINKER_FREEBSD_VERSION WANT_LINKER_VERSION 317.endif # !defined(WANT_LINKER_FREEBSD_VERSION) 318 319.if ${MK_SYSTEM_LINKER} == "yes" && \ 320 defined(WANT_LINKER_FREEBSD_VERSION) && \ 321 (${MK_LLD_BOOTSTRAP} == "yes") && \ 322 !make(xdev*) && \ 323 ${X_LINKER_TYPE} == ${WANT_LINKER_TYPE} && \ 324 ${X_LINKER_VERSION} == ${WANT_LINKER_VERSION} && \ 325 ${X_LINKER_FREEBSD_VERSION} == ${WANT_LINKER_FREEBSD_VERSION} 326# Everything matches, disable the bootstrap linker. 327MK_LLD_BOOTSTRAP= no 328USING_SYSTEM_LINKER= yes 329.endif # ${WANT_LINKER_TYPE} == ${LINKER_TYPE} 330 331# WITH_SYSTEM_COMPILER / WITH_SYSTEM_LINKER - Handle defaults and debug. 332USING_SYSTEM_COMPILER?= no 333USING_SYSTEM_LINKER?= no 334 335TEST_SYSTEM_COMPILER_VARS= \ 336 USING_SYSTEM_COMPILER MK_SYSTEM_COMPILER \ 337 MK_CROSS_COMPILER MK_CLANG_BOOTSTRAP \ 338 WANT_COMPILER_TYPE WANT_COMPILER_VERSION WANT_COMPILER_VERSION_FILE \ 339 WANT_COMPILER_FREEBSD_VERSION WANT_COMPILER_FREEBSD_VERSION_FILE \ 340 CC COMPILER_TYPE COMPILER_FEATURES COMPILER_VERSION \ 341 COMPILER_FREEBSD_VERSION \ 342 XCC X_COMPILER_TYPE X_COMPILER_FEATURES X_COMPILER_VERSION \ 343 X_COMPILER_FREEBSD_VERSION 344TEST_SYSTEM_LINKER_VARS= \ 345 USING_SYSTEM_LINKER MK_SYSTEM_LINKER \ 346 MK_LLD_BOOTSTRAP \ 347 WANT_LINKER_TYPE WANT_LINKER_VERSION WANT_LINKER_VERSION_FILE \ 348 WANT_LINKER_FREEBSD_VERSION WANT_LINKER_FREEBSD_VERSION_FILE \ 349 LD LINKER_TYPE LINKER_FEATURES LINKER_VERSION \ 350 LINKER_FREEBSD_VERSION \ 351 XLD X_LINKER_TYPE X_LINKER_FEATURES X_LINKER_VERSION \ 352 X_LINKER_FREEBSD_VERSION 353 354.for _t in compiler linker 355test-system-${_t}: .PHONY 356.for v in ${TEST_SYSTEM_${_t:tu}_VARS} 357 ${_+_}@printf "%-35s= %s\n" "${v}" "${${v}}" 358.endfor 359.endfor 360.if (make(buildworld) || make(buildkernel) || make(kernel-toolchain) || \ 361 make(toolchain) || make(_cross-tools)) 362.if ${USING_SYSTEM_COMPILER} == "yes" 363.info SYSTEM_COMPILER: Determined that CC=${CC} matches the source tree. Not bootstrapping a cross-compiler. 364.elif ${MK_CLANG_BOOTSTRAP} == "yes" 365.info SYSTEM_COMPILER: libclang will be built for bootstrapping a cross-compiler. 366.endif 367.if ${USING_SYSTEM_LINKER} == "yes" 368.info SYSTEM_LINKER: Determined that LD=${LD} matches the source tree. Not bootstrapping a cross-linker. 369.elif ${MK_LLD_BOOTSTRAP} == "yes" 370.info SYSTEM_LINKER: libclang will be built for bootstrapping a cross-linker. 371.endif 372.endif 373 374# End WITH_SYSTEM_COMPILER / WITH_SYSTEM_LD 375 376# Store some compiler metadata for use in installworld where we don't 377# want to invoke CC at all. 378_TOOLCHAIN_METADATA_VARS= COMPILER_VERSION \ 379 COMPILER_TYPE \ 380 COMPILER_FEATURES \ 381 COMPILER_FREEBSD_VERSION \ 382 COMPILER_RESOURCE_DIR \ 383 LINKER_VERSION \ 384 LINKER_FEATURES \ 385 LINKER_TYPE \ 386 LINKER_FREEBSD_VERSION 387toolchain-metadata.mk: .PHONY .META 388 @: > ${.TARGET} 389 @echo ".info Using cached toolchain metadata from build at $$(hostname) on $$(date)" \ 390 > ${.TARGET} 391 @echo "_LOADED_TOOLCHAIN_METADATA=t" >> ${.TARGET} 392.for v in ${_TOOLCHAIN_METADATA_VARS} 393 @echo "${v}=${${v}}" >> ${.TARGET} 394 @echo "X_${v}=${X_${v}}" >> ${.TARGET} 395.endfor 396 @echo ".export ${_TOOLCHAIN_METADATA_VARS}" >> ${.TARGET} 397 @echo ".export ${_TOOLCHAIN_METADATA_VARS:C,^,X_,}" >> ${.TARGET} 398 399 400# We must do lib/ and libexec/ before bin/ in case of a mid-install error to 401# keep the users system reasonably usable. For static->dynamic root upgrades, 402# we don't want to install a dynamic binary without rtld and the needed 403# libraries. More commonly, for dynamic root, we don't want to install a 404# binary that requires a newer library version that hasn't been installed yet. 405# This ordering is not a guarantee though. The only guarantee of a working 406# system here would require fine-grained ordering of all components based 407# on their dependencies. 408.if !empty(SUBDIR_OVERRIDE) 409SUBDIR= ${SUBDIR_OVERRIDE} 410.else 411SUBDIR= lib libexec 412# Add LOCAL_LIB_DIRS, but only if they will not be picked up as a SUBDIR 413# of a LOCAL_DIRS directory. This allows LOCAL_DIRS=foo and 414# LOCAL_LIB_DIRS=foo/lib to behave as expected. 415.for _DIR in ${LOCAL_DIRS:M*/} ${LOCAL_DIRS:N*/:S|$|/|} 416_REDUNDANT_LIB_DIRS+= ${LOCAL_LIB_DIRS:M${_DIR}*} 417.endfor 418.for _DIR in ${LOCAL_LIB_DIRS} 419.if ${_DIR} == ".WAIT" || (empty(_REDUNDANT_LIB_DIRS:M${_DIR}) && exists(${.CURDIR}/${_DIR}/Makefile)) 420SUBDIR+= ${_DIR} 421.endif 422.endfor 423.if !defined(NO_ROOT) && (make(installworld) || make(install)) 424# Ensure libraries are installed before progressing. 425SUBDIR+=.WAIT 426.endif 427SUBDIR+=bin 428.if ${MK_CDDL} != "no" 429SUBDIR+=cddl 430.endif 431SUBDIR+=gnu include 432.if ${MK_KERBEROS} != "no" 433.if ${MK_MITKRB5} != "no" 434SUBDIR+=krb5 435.else 436SUBDIR+=kerberos5 437.endif 438.endif 439.if ${MK_RESCUE} != "no" 440SUBDIR+=rescue 441.endif 442SUBDIR+=sbin 443.if ${MK_CRYPT} != "no" 444SUBDIR+=secure 445.endif 446.if !defined(NO_SHARE) 447SUBDIR+=share 448.endif 449.if ${MK_BOOT} != "no" 450SUBDIR+=stand 451.endif 452SUBDIR+=sys usr.bin usr.sbin 453.if ${MK_TESTS} != "no" 454SUBDIR+= tests 455.endif 456 457# Local directories are built in parallel with the base system directories. 458# Users may insert a .WAIT directive at the beginning or elsewhere within 459# the LOCAL_DIRS and LOCAL_LIB_DIRS lists as needed. 460.for _DIR in ${LOCAL_DIRS} 461.if ${_DIR} == ".WAIT" || exists(${.CURDIR}/${_DIR}/Makefile) 462SUBDIR+= ${_DIR} 463.endif 464.endfor 465 466# We must do etc/ last as it hooks into building the man whatis file 467# by calling 'makedb' in share/man. This is only relevant for 468# install/distribute so they build the whatis file after every manpage is 469# installed. 470.if make(installworld) || make(install) || make(distributeworld) || make(distribute) 471SUBDIR+=.WAIT 472.endif 473SUBDIR+=etc 474 475.endif # !empty(SUBDIR_OVERRIDE) 476 477.if defined(NOCLEAN) 478.warning The src.conf WITHOUT_CLEAN option can now be used instead of NOCLEAN. 479MK_CLEAN:= no 480.endif 481.if defined(NO_CLEAN) 482.info The src.conf WITHOUT_CLEAN option can now be used instead of NO_CLEAN. 483MK_CLEAN:= no 484.endif 485.if defined(NO_CLEANDIR) 486CLEANDIR= clean cleandepend 487.else 488CLEANDIR= cleandir 489.endif 490 491.if defined(WORLDFAST) 492MK_CLEAN:= no 493NO_OBJWALK= t 494.endif 495 496.if ${MK_META_MODE} == "yes" 497# If filemon is used then we can rely on the build being incremental-safe. 498# The .meta files will also track the build command and rebuild should 499# it change. 500.if empty(.MAKE.MODE:Mnofilemon) 501MK_CLEAN:= no 502.endif 503.endif 504.if defined(NO_OBJWALK) || ${MK_AUTO_OBJ} == "yes" 505NO_OBJWALK= t 506NO_KERNELOBJ= t 507.endif 508.if !defined(NO_OBJWALK) 509_obj= obj 510.endif 511 512LOCAL_TOOL_DIRS?= 513PACKAGEDIR?= ${DESTDIR}/${DISTDIR} 514 515.if empty(SHELL:M*csh*) 516BUILDENV_SHELL?=${SHELL} 517.else 518BUILDENV_SHELL?=/bin/sh 519.endif 520 521.if !defined(_MKSHOWCONFIG) 522 523.if !defined(GIT_CMD) || empty(GIT_CMD) 524. for _P in /usr/bin /usr/local/bin 525. if exists(${_P}/git) 526GIT_CMD= ${_P}/git 527. endif 528. endfor 529.export GIT_CMD 530.endif 531 532.if !defined(OSRELDATE) 533.if exists(/usr/include/osreldate.h) 534OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \ 535 /usr/include/osreldate.h 536.else 537OSRELDATE= 0 538.endif 539.export OSRELDATE 540.endif 541 542# Set VERSION for CTFMERGE to use via the default CTFFLAGS=-L VERSION. 543.for _V in BRANCH REVISION TYPE 544.if !defined(_${_V}) 545_${_V}!= eval $$(awk '/^${_V}=/{print}' ${SRCTOP}/sys/conf/newvers.sh); echo $$${_V} 546.export _${_V} 547.endif 548.endfor 549.if !defined(SRCRELDATE) 550SRCRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \ 551 ${SRCDIR}/sys/sys/param.h 552.export SRCRELDATE 553.endif 554.if !defined(VERSION) 555VERSION= FreeBSD ${_REVISION}-${_BRANCH:C/-p[0-9]+$//} ${TARGET_ARCH} ${SRCRELDATE} 556.export VERSION 557.endif 558MAJOR_REVISION= ${_REVISION:R} 559 560_PKG_REVISION= ${_REVISION} 561_STRTIMENOW= %Y%m%d%H%M%S 562_TIMENOW= ${_STRTIMENOW:gmtime} 563BRANCH_EXT= 564.if ${_BRANCH:MCURRENT*} || ${_BRANCH:MSTABLE*} || ${_BRANCH:MPRERELEASE*} 565_PKG_REVISION:= ${MAJOR_REVISION} 566BRANCH_EXT= ${MAJOR_REVISION}.snap 567EXTRA_REVISION= .snap${_TIMENOW} 568.elif ${_BRANCH:MALPHA*} 569BRANCH_EXT= alpha 570EXTRA_REVISION= .a${_BRANCH:C/ALPHA([0-9]+).*/\1/}.${_TIMENOW} 571.elif ${_BRANCH:MBETA*} 572BRANCH_EXT= beta 573EXTRA_REVISION= .b${_BRANCH:C/BETA([0-9]+).*/\1/}.${_TIMENOW} 574.elif ${_BRANCH:MRC*} 575BRANCH_EXT= rc 576EXTRA_REVISION= .rc${_BRANCH:C/RC([0-9]+).*/\1/}.${_TIMENOW} 577.elif ${_BRANCH:M*-p*} 578EXTRA_REVISION= p${_BRANCH:C/.*-p([0-9]+$)/\1/} 579.endif 580.if !defined(PKG_VERSION) 581PKG_VERSION:= ${_PKG_REVISION}${EXTRA_REVISION:C/[[:space:]]//g} 582.endif 583 584.endif # !defined(_MKSHOWCONFIG) 585 586PKG_NAME_PREFIX?= FreeBSD 587PKG_MAINTAINER?= re@FreeBSD.org 588PKG_WWW?= https://www.FreeBSD.org 589PKG_WORKERS_COUNT?= 1 590 591.if make(*package*) 592.export PKG_NAME_PREFIX 593.export PKG_MAINTAINER 594.export PKG_WWW 595 596.if !defined(PKG_TIMESTAMP) 597.if !empty(GIT_CMD) && exists(${GIT_CMD}) && exists(${SRCDIR}/.git) 598SOURCE_DATE_EPOCH!= ${GIT_CMD} -C ${SRCDIR} show -s --format=%ct HEAD 599.else 600TIMEEPOCHNOW= %s 601SOURCE_DATE_EPOCH= ${TIMEEPOCHNOW:gmtime} 602.endif 603.else 604SOURCE_DATE_EPOCH= ${PKG_TIMESTAMP} 605.endif 606.endif 607 608.if !defined(_MKSHOWCONFIG) 609_CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} -f /dev/null \ 610 -m ${.CURDIR}/share/mk MK_AUTO_OBJ=no -V CPUTYPE 611.if ${_CPUTYPE} != ${_TARGET_CPUTYPE} 612.error CPUTYPE global should be set with ?=. 613.endif 614.endif 615.if make(buildworld) 616BUILD_ARCH!= uname -p 617# On some Linux systems uname -p returns "unknown" so skip this check there. 618# This check only exists to tell people to use TARGET_ARCH instead of 619# MACHINE_ARCH so skipping it when crossbuilding on non-FreeBSD should be fine. 620.if ${MACHINE_ARCH} != ${BUILD_ARCH} && ${.MAKE.OS} == "FreeBSD" 621.error To cross-build, set TARGET_ARCH. 622.endif 623.endif 624WORLDTMP?= ${OBJTOP}/tmp 625BPATH= ${CCACHE_WRAPPER_PATH_PFX}${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/bin:${WORLDTMP}/legacy/usr/libexec 626XPATH= ${WORLDTMP}/bin:${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin 627 628# When building we want to find the cross tools before the host tools in ${BPATH}. 629# We also need to add UNIVERSE_TOOLCHAIN_PATH so that we can find the shared 630# toolchain files (clang, lld, etc.) during make universe/tinderbox 631STRICTTMPPATH= ${XPATH}:${BPATH} 632.if defined(UNIVERSE_TOOLCHAIN_PATH) 633STRICTTMPPATH:=${STRICTTMPPATH}:${UNIVERSE_TOOLCHAIN_PATH} 634.endif 635# We should not be using tools from /usr/bin accidentally since this could cause 636# the build to break on other systems that don't have that tool. For now we 637# still allow using the old behaviour (inheriting $PATH) if 638# BUILD_WITH_STRICT_TMPPATH is set to 0 but this will eventually be removed. 639 640# Currently strict $PATH can cause build failures. Once the remaining issues 641# have been resolved it will be turned on by default. 642BUILD_WITH_STRICT_TMPPATH?=0 643.if defined(CROSSBUILD_HOST) 644# When building on non-FreeBSD we can't rely on the tools in /usr/bin being compatible 645# with what FreeBSD expects. Therefore we only use tools from STRICTTMPPATH 646# during the world build stage. We build most tools during the bootstrap-tools 647# phase but symlink host tools that are known to work instead of building them 648BUILD_WITH_STRICT_TMPPATH:=1 649.endif 650.if ${BUILD_WITH_STRICT_TMPPATH} != 0 651TMPPATH= ${STRICTTMPPATH} 652.else 653TMPPATH= ${STRICTTMPPATH}:${PATH} 654.endif 655 656# 657# Avoid running mktemp(1) unless actually needed. 658# It may not be functional, e.g., due to new ABI 659# when in the middle of installing over this system. 660# 661.if make(distributeworld) || make(installworld) || make(stageworld) 662.if ${BUILD_WITH_STRICT_TMPPATH} != 0 663MKTEMP=${WORLDTMP}/legacy/usr/bin/mktemp 664.if !exists(${MKTEMP}) 665.error mktemp binary doesn't exist in expected location: ${MKTEMP} 666.endif 667.else 668MKTEMP=mktemp 669.endif 670INSTALLTMP!= ${MKTEMP} -d -u -t install 671 672.if ${.MAKE.OS} == "FreeBSD" 673# When building on FreeBSD we always copy the host tools instead of linking 674# into INSTALLTMP to avoid issues with incompatible libraries (see r364030). 675# Note: we could create links if we don't intend to update the current machine. 676INSTALLTMP_COPY_HOST_TOOL=cp 677.else 678# However, this is not necessary on Linux/macOS. Additionally, copying the host 679# tools to another directory with cp results in AMFI Launch Constraint 680# Violations on macOS Ventura as part of its System Integrity Protection. 681INSTALLTMP_COPY_HOST_TOOL=ln -s 682.endif 683.endif 684 685.if make(stagekernel) || make(distributekernel) 686TAGS+= kernel 687PACKAGE= kernel 688.endif 689 690# 691# Building a world goes through the following stages 692# 693# 1. legacy stage [BMAKE] 694# This stage is responsible for creating compatibility 695# shims that are needed by the bootstrap-tools, 696# build-tools and cross-tools stages. These are generally 697# APIs that tools from one of those three stages need to 698# build that aren't present on the host. 699# 1. bootstrap-tools stage [BMAKE] 700# This stage is responsible for creating programs that 701# are needed for backward compatibility reasons. They 702# are not built as cross-tools. 703# 2. build-tools stage [TMAKE] 704# This stage is responsible for creating the object 705# tree and building any tools that are needed during 706# the build process. Some programs are listed during 707# this phase because they build binaries to generate 708# files needed to build these programs. This stage also 709# builds the 'build-tools' target rather than 'all'. 710# 3. cross-tools stage [XMAKE] 711# This stage is responsible for creating any tools that 712# are needed for building the system. A cross-compiler is one 713# of them. This differs from build tools in two ways: 714# 1. the 'all' target is built rather than 'build-tools' 715# 2. these tools are installed into TMPPATH for stage 4. 716# 4. world stage [WMAKE] 717# This stage actually builds the world. 718# 5. install stage (optional) [IMAKE] 719# This stage installs a previously built world. 720# 721 722BOOTSTRAPPING?= 0 723# Keep these in sync 724MINIMUM_SUPPORTED_OSREL?= 1104001 725MINIMUM_SUPPORTED_REL?= 11.4 726 727# Common environment for world related stages 728CROSSENV+= \ 729 MACHINE_ARCH=${TARGET_ARCH} \ 730 MACHINE=${TARGET} \ 731 CPUTYPE=${TARGET_CPUTYPE} 732.if ${MK_META_MODE} != "no" 733# Don't rebuild build-tools targets during normal build. 734CROSSENV+= BUILD_TOOLS_META=.NOMETA 735.endif 736.if defined(TARGET_CFLAGS) 737CROSSENV+= ${TARGET_CFLAGS} 738.endif 739.if (${TARGET} != ${MACHINE} && !defined(WITH_LOCAL_MODULES)) || \ 740 defined(WITHOUT_LOCAL_MODULES) 741CROSSENV+= LOCAL_MODULES= 742.endif 743 744BOOTSTRAPPING_OSRELDATE?=${OSRELDATE} 745 746# bootstrap-tools stage 747BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \ 748 TOOLS_PREFIX=${TOOLS_PREFIX_UNDEF:U${WORLDTMP}} \ 749 PATH=${BPATH:Q}:${PATH:Q} \ 750 WORLDTMP=${WORLDTMP} \ 751 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" 752# need to keep this in sync with targets/pseudo/bootstrap-tools/Makefile 753BSARGS= DESTDIR= \ 754 OBJTOP='${WORLDTMP}/obj-tools' \ 755 OBJROOT='$${OBJTOP}/' \ 756 UNIVERSE_TOOLCHAIN_PATH=${UNIVERSE_TOOLCHAIN_PATH} \ 757 MAKEOBJDIRPREFIX= \ 758 BOOTSTRAPPING=${BOOTSTRAPPING_OSRELDATE} \ 759 BWPHASE=${.TARGET:C,^_,,} \ 760 -DNO_CPU_CFLAGS \ 761 -DNO_PIC \ 762 -DNO_SHARED \ 763 MK_ASAN=no \ 764 MK_CTF=no \ 765 MK_CLANG_EXTRAS=no \ 766 MK_CLANG_FORMAT=no \ 767 MK_CLANG_FULL=no \ 768 MK_HTML=no \ 769 MK_MAN=no \ 770 MK_RETPOLINE=no \ 771 MK_SSP=no \ 772 MK_TESTS=no \ 773 MK_UBSAN=no \ 774 MK_WERROR=no \ 775 MK_INCLUDES=yes \ 776 MK_MAN_UTILS=yes 777 778BMAKE= \ 779 ${TIME_ENV} ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ 780 ${BSARGS} 781.if empty(.MAKEOVERRIDES:MMK_LLVM_TARGET_ALL) 782BMAKE+= MK_LLVM_TARGET_ALL=no 783.endif 784 785# build-tools stage 786TMAKE= \ 787 ${TIME_ENV} ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ 788 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ 789 DESTDIR= \ 790 BOOTSTRAPPING=${BOOTSTRAPPING_OSRELDATE} \ 791 BWPHASE=${.TARGET:C,^_,,} \ 792 -DNO_CPU_CFLAGS \ 793 MK_ASAN=no \ 794 MK_CTF=no \ 795 MK_CLANG_EXTRAS=no \ 796 MK_CLANG_FORMAT=no \ 797 MK_CLANG_FULL=no \ 798 MK_LLDB=no \ 799 MK_RETPOLINE=no \ 800 MK_SSP=no \ 801 MK_TESTS=no \ 802 MK_UBSAN=no \ 803 MK_WERROR=no 804 805# cross-tools stage 806# TOOLS_PREFIX set in BMAKE 807XMAKE= ${BMAKE} \ 808 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ 809 MK_CLANG=${MK_CLANG_BOOTSTRAP} \ 810 MK_LLDB=no \ 811 MK_LLVM_BINUTILS=no \ 812 MK_TESTS=no 813 814# kernel-tools stage 815KTMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \ 816 PATH=${BPATH:Q}:${PATH:Q} \ 817 WORLDTMP=${WORLDTMP} \ 818 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" 819 820KTMAKE= ${TIME_ENV} \ 821 TOOLS_PREFIX=${TOOLS_PREFIX_UNDEF:U${WORLDTMP}} \ 822 ${KTMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ 823 DESTDIR= \ 824 OBJTOP='${WORLDTMP}/obj-kernel-tools' \ 825 OBJROOT='$${OBJTOP}/' \ 826 UNIVERSE_TOOLCHAIN_PATH=${UNIVERSE_TOOLCHAIN_PATH} \ 827 MAKEOBJDIRPREFIX= \ 828 BOOTSTRAPPING=${BOOTSTRAPPING_OSRELDATE} \ 829 -DNO_CPU_CFLAGS \ 830 -DNO_PIC \ 831 -DNO_SHARED \ 832 MK_CTF=no \ 833 MK_HTML=no \ 834 MK_MAN=no \ 835 MK_SSP=no \ 836 MK_RETPOLINE=no \ 837 MK_WERROR=no 838 839# world stage 840WMAKEENV= ${CROSSENV} \ 841 INSTALL="${INSTALL_CMD} -U" \ 842 PATH=${TMPPATH:Q} \ 843 SYSROOT=${WORLDTMP} 844 845# make hierarchy 846HMAKE= PATH=${TMPPATH:Q} ${MAKE} LOCAL_MTREE=${LOCAL_MTREE:Q} 847.if defined(NO_ROOT) 848HMAKE+= PATH=${TMPPATH:Q} METALOG=${METALOG} -DNO_ROOT 849.endif 850 851CROSSENV+= CC="${XCC} ${XCFLAGS}" CXX="${XCXX} ${XCXXFLAGS} ${XCFLAGS}" \ 852 CPP="${XCPP} ${XCFLAGS}" \ 853 AS="${XAS}" AR="${XAR}" ELFCTL="${XELFCTL}" LD="${XLD}" \ 854 LLVM_LINK="${XLLVM_LINK}" NM=${XNM} OBJCOPY="${XOBJCOPY}" \ 855 RANLIB=${XRANLIB} STRINGS=${XSTRINGS} \ 856 SIZE="${XSIZE}" STRIPBIN="${XSTRIPBIN}" 857 858.if defined(CROSS_BINUTILS_PREFIX) && exists(${CROSS_BINUTILS_PREFIX}) 859# In the case of xdev-build tools, CROSS_BINUTILS_PREFIX won't be a 860# directory, but the compiler will look in the right place for its 861# tools so we don't need to tell it where to look. 862BFLAGS+= -B${CROSS_BINUTILS_PREFIX} 863.endif 864 865 866# The internal bootstrap compiler has a default sysroot set by TOOLS_PREFIX 867# and target set by TARGET/TARGET_ARCH. However, there are several needs to 868# always pass an explicit --sysroot and -target. 869# - External compiler needs sysroot and target flags. 870# - External ld needs sysroot. 871# - To be clear about the use of a sysroot when using the internal compiler. 872# - Easier debugging. 873# - Allowing WITH_SYSTEM_COMPILER+WITH_META_MODE to work together due to 874# the flip-flopping build command when sometimes using external and 875# sometimes using internal. 876# - Allow using lld which has no support for default paths. 877.if !defined(CROSS_BINUTILS_PREFIX) || !exists(${CROSS_BINUTILS_PREFIX}) 878BFLAGS+= -B${WORLDTMP}/usr/bin 879.endif 880.if ${WANT_COMPILER_TYPE} == gcc || \ 881 (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc) 882.elif ${WANT_COMPILER_TYPE} == clang || \ 883 (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == clang) 884XCFLAGS+= -target ${TARGET_TRIPLE} 885.endif 886XCFLAGS+= --sysroot=${WORLDTMP} 887 888.if !empty(BFLAGS) 889XCFLAGS+= ${BFLAGS} 890.endif 891 892.include "share/mk/bsd.compat.pre.mk" 893.for LIBCOMPAT in ${_ALL_LIBCOMPATS} 894.if ${MK_LIB${LIBCOMPAT}} == "yes" 895_LIBCOMPATS+= ${LIBCOMPAT} 896.endif 897.endfor 898.include "Makefile.libcompat" 899 900# META_MODE normally ignores host file changes since every build updates 901# timestamps (see NO_META_IGNORE_HOST in sys.mk). There are known times 902# when the ABI breaks though that we want to force rebuilding WORLDTMP 903# to get updated host tools. 904.if ${MK_META_MODE} == "yes" && ${MK_CLEAN} == "no" && \ 905 !defined(NO_META_IGNORE_HOST) && !defined(NO_META_IGNORE_HOST_HEADERS) && \ 906 !defined(_MKSHOWCONFIG) 907# r318736 - ino64 major ABI breakage 908META_MODE_BAD_ABI_VERS+= 1200031 909 910.if !defined(OBJDIR_HOST_OSRELDATE) 911.if exists(${OBJTOP}/host-osreldate.h) 912OBJDIR_HOST_OSRELDATE!= \ 913 awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \ 914 ${OBJTOP}/host-osreldate.h 915.elif exists(${WORLDTMP}/usr/include/osreldate.h) 916OBJDIR_HOST_OSRELDATE= 0 917.endif 918.export OBJDIR_HOST_OSRELDATE 919.endif 920 921# Note that this logic is the opposite of normal BOOTSTRAP handling. We want 922# to compare the WORLDTMP's OSRELDATE to the host's OSRELDATE. If the WORLDTMP 923# is older than the ABI-breakage OSRELDATE of the HOST then we rebuild. 924.if defined(OBJDIR_HOST_OSRELDATE) 925.for _ver in ${META_MODE_BAD_ABI_VERS} 926.if ${OSRELDATE} >= ${_ver} && ${OBJDIR_HOST_OSRELDATE} < ${_ver} 927_meta_mode_need_rebuild= ${_ver} 928.endif 929.endfor 930.if defined(_meta_mode_need_rebuild) 931.info META_MODE: Rebuilding host tools due to ABI breakage in __FreeBSD_version ${_meta_mode_need_rebuild}. 932NO_META_IGNORE_HOST_HEADERS= 1 933.export NO_META_IGNORE_HOST_HEADERS 934.endif # defined(_meta_mode_need_rebuild) 935.endif # defined(OBJDIR_HOST_OSRELDATE) 936.endif # ${MK_META_MODE} == "yes" && ${MK_CLEAN} == "no" ... 937# This is only used for META_MODE+filemon to track what the oldest 938# __FreeBSD_version is in WORLDTMP. This purposely does NOT have 939# a make dependency on /usr/include/osreldate.h as the file should 940# only be copied when it is missing or meta mode determines it has changed. 941# Since host files are normally ignored without NO_META_IGNORE_HOST 942# the file will never be updated unless that flag is specified. This 943# allows tracking the oldest osreldate to force rebuilds via 944# META_MODE_BADABI_REVS above. 945host-osreldate.h: # DO NOT ADD /usr/include/osreldate.h here 946.if !defined(CROSSBUILD_HOST) 947 @cp -f /usr/include/osreldate.h ${.TARGET} 948.else 949 @echo "#ifndef __FreeBSD_version" > ${.TARGET} 950 @echo "#define __FreeBSD_version ${OSRELDATE}" >> ${.TARGET} 951 @echo "#endif" >> ${.TARGET} 952.endif 953 954WMAKE= ${TIME_ENV} ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ 955 BWPHASE=${.TARGET:C,^_,,} \ 956 DESTDIR=${WORLDTMP} 957 958IMAKEENV= ${CROSSENV} 959IMAKE= ${TIME_ENV} ${IMAKEENV} ${MAKE} -f Makefile.inc1 \ 960 ${IMAKE_INSTALL} ${IMAKE_MTREE} 961.if empty(.MAKEFLAGS:M-n) 962IMAKEENV+= PATH=${STRICTTMPPATH:Q}:${INSTALLTMP:Q} \ 963 LD_LIBRARY_PATH=${INSTALLTMP:Q} \ 964 PATH_LOCALE=${INSTALLTMP}/locale 965IMAKE+= __MAKE_SHELL=${INSTALLTMP}/sh 966.else 967IMAKEENV+= PATH=${TMPPATH:Q}:${INSTALLTMP:Q} 968.endif 969 970# When generating install media, do not allow user and group information from 971# the build host to affect the contents of the distribution. 972.if make(distributeworld) || make(distrib-dirs) || make(distribution) || \ 973 make(stageworld) 974DB_FROM_SRC= yes 975.endif 976 977.if defined(DB_FROM_SRC) 978INSTALLFLAGS+= -N ${.CURDIR}/etc 979MTREEFLAGS+= -N ${.CURDIR}/etc 980.endif 981_INSTALL_DDIR= ${DESTDIR}/${DISTDIR} 982INSTALL_DDIR= ${_INSTALL_DDIR:S://:/:g:C:/$::} 983.if defined(NO_ROOT) 984METALOG?= ${DESTDIR}/${DISTDIR}/METALOG 985METALOG:= ${METALOG:C,//+,/,g} 986IMAKE+= -DNO_ROOT METALOG=${METALOG} 987METALOG_INSTALLFLAGS= -U -M ${METALOG} -D ${INSTALL_DDIR} 988INSTALLFLAGS+= ${METALOG_INSTALLFLAGS} 989CERTCTLFLAGS= ${METALOG_INSTALLFLAGS} 990MTREEFLAGS+= -W 991.endif 992.if defined(BUILD_PKGS) 993INSTALLFLAGS+= -h sha256 994.endif 995.if defined(DB_FROM_SRC) || defined(NO_ROOT) 996IMAKE_INSTALL= INSTALL="${INSTALL_CMD} ${INSTALLFLAGS}" 997IMAKE_MTREE= MTREE_CMD="${MTREE_CMD} ${MTREEFLAGS}" 998.endif 999 1000.if make(distributeworld) || make(packageworld) || make(distributekernel) || \ 1001 make(packagekernel) 1002.if ${DISTDIR:U/} == / 1003.error DISTDIR must be set for make distribute* and make package*, and may not be the root directory. 1004.endif 1005.if !defined(NO_ROOT) || !defined(METALOG) 1006.error NO_ROOT and METALOG must be set for make distribute* and make package*. 1007.endif 1008.endif 1009 1010.if make(distributeworld) 1011CERTCTLDESTDIR= ${DESTDIR}/${DISTDIR} 1012CERTCTLFLAGS+= -d /base 1013.else 1014CERTCTLDESTDIR= ${DESTDIR} 1015.endif 1016CERTCTLFLAGS+= -D "${CERTCTLDESTDIR}" 1017 1018DESTDIR_MTREEFLAGS= -deU 1019# When creating worldtmp we don't need to set the directories as owned by root 1020# so we also pass -W 1021WORLDTMP_MTREEFLAGS= -deUW 1022.if defined(NO_ROOT) 1023# When building with -DNO_ROOT we shouldn't be changing the directories 1024# that are created by mtree to be owned by root/wheel. 1025DESTDIR_MTREEFLAGS+= -W 1026.endif 1027.if defined(DB_FROM_SRC) 1028DISTR_MTREEFLAGS= -N ${.CURDIR}/etc 1029.endif 1030DISTR_MTREECMD= ${MTREE_CMD} 1031.if ${BUILD_WITH_STRICT_TMPPATH} != 0 1032DISTR_MTREECMD= ${WORLDTMP}/legacy/usr/sbin/mtree 1033.endif 1034DISTR_MTREE= ${DISTR_MTREECMD} ${DISTR_MTREEFLAGS} 1035WORLDTMP_MTREE= ${DISTR_MTREECMD} ${WORLDTMP_MTREEFLAGS} 1036DESTDIR_MTREE= ${DISTR_MTREECMD} ${DESTDIR_MTREEFLAGS} 1037 1038METALOG_SORT_CMD= env -i LC_COLLATE=C sort 1039 1040# kernel stage 1041KMAKEENV= ${WMAKEENV} 1042KMAKE= ${TIME_ENV} ${KMAKEENV} ${MAKE} ${.MAKEFLAGS} ${KERNEL_FLAGS} KERNEL=${INSTKERNNAME} 1043 1044# 1045# buildworld 1046# 1047# Attempt to rebuild the entire system, with reasonable chance of 1048# success, regardless of how old your existing system is. 1049# 1050_sanity_check: .PHONY .MAKE 1051.if ${.CURDIR:C/[^,]//g} != "" 1052# The m4 build of sendmail files doesn't like it if ',' is used 1053# anywhere in the path of it's files. 1054 @echo 1055 @echo "*** Error: path to source tree contains a comma ','" 1056 @echo 1057 @false 1058.elif ${.CURDIR:M*\:*} != "" 1059# Using ':' leaks into PATH and breaks finding cross-tools. 1060 @echo 1061 @echo "*** Error: path to source tree contains a colon ':'" 1062 @echo 1063 @false 1064.endif 1065 1066# Our current approach to dependency tracking cannot cope with certain source 1067# tree changes, particularly with respect to removing source files and 1068# replacing generated files. Handle these cases here in an ad-hoc fashion. 1069_cleanobj_fast_depend_hack: .PHONY 1070.if ${MK_DEPEND_CLEANUP} != "no" 1071 @echo ">>> Deleting stale dependencies..."; 1072 MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH} \ 1073 ALL_libcompats=${_ALL_libcompats:Q} MAKE=${MAKE} \ 1074 sh ${.CURDIR}/tools/build/depend-cleanup.sh ${OBJTOP} ${SRCTOP} 1075.endif 1076 1077_cleanworldtmp: .PHONY 1078.if ${MK_CLEAN} == "yes" 1079 @echo 1080 @echo "--------------------------------------------------------------" 1081 @echo ">>> Cleaning up the temporary build tree" 1082 @echo "--------------------------------------------------------------" 1083 rm -rf ${WORLDTMP} 1084.else 1085# Note: for delete-old we need to set $PATH to also include the host $PATH 1086# since otherwise a partial build with missing symlinks in ${WORLDTMP}/legacy/ 1087# will fail to run due to missing binaries. $WMAKE sets PATH to only ${TMPPATH} 1088# so we remove that assignment from $WMAKE and prepend the new $PATH 1089 ${_+_}@if [ -e "${WORLDTMP}" ]; then \ 1090 echo ">>> Deleting stale files in build tree..."; \ 1091 cd ${.CURDIR}; env PATH=${TMPPATH:Q}:${PATH:Q} ${WMAKE:NPATH=*} \ 1092 _NO_INCLUDE_COMPILERMK=t -DBATCH_DELETE_OLD_FILES delete-old \ 1093 delete-old-libs >/dev/null; \ 1094 fi 1095 rm -rf ${WORLDTMP}/legacy/usr/include 1096.if ${USING_SYSTEM_COMPILER} == "yes" 1097.for cc in cc c++ 1098 if [ -x ${WORLDTMP}/usr/bin/${cc} ]; then \ 1099 inum=$$(ls -i ${WORLDTMP}/usr/bin/${cc}); \ 1100 find ${WORLDTMP}/usr/bin -inum $${inum%% *} -delete; \ 1101 fi 1102.endfor 1103.endif # ${USING_SYSTEM_COMPILER} == "yes" 1104.if ${USING_SYSTEM_LINKER} == "yes" 1105 @rm -f ${WORLDTMP}/usr/bin/ld ${WORLDTMP}/usr/bin/ld.lld 1106.endif # ${USING_SYSTEM_LINKER} == "yes" 1107.endif # ${MK_CLEAN} == "yes" 1108_worldtmp: .PHONY 1109 @echo 1110 @echo "--------------------------------------------------------------" 1111 @echo ">>> Rebuilding the temporary build tree" 1112 @echo "--------------------------------------------------------------" 1113 @mkdir -p ${WORLDTMP} 1114 @touch ${WORLDTMP}/${.TARGET} 1115# We can't use mtree to create the worldtmp directories since it may not be 1116# available on the target system (this happens e.g. when building on non-FreeBSD) 1117 ${_+_}cd ${.CURDIR}/tools/build; \ 1118 ${MAKE} DIRPRFX=tools/build/ DESTDIR=${WORLDTMP}/legacy installdirs 1119# In order to build without inheriting $PATH we need to add symlinks to the host 1120# tools in $WORLDTMP for the tools that we don't build during bootstrap-tools 1121 ${_+_}cd ${.CURDIR}/tools/build; \ 1122 ${MAKE} DIRPRFX=tools/build/ DESTDIR=${WORLDTMP}/legacy host-symlinks 1123 1124_legacy: 1125 @echo 1126 @echo "--------------------------------------------------------------" 1127 @echo ">>> stage 1.1: legacy release compatibility shims" 1128 @echo "--------------------------------------------------------------" 1129 ${_+_}cd ${.CURDIR}; ${BMAKE} legacy 1130_bootstrap-tools: 1131 @echo 1132 @echo "--------------------------------------------------------------" 1133 @echo ">>> stage 1.2: bootstrap tools" 1134 @echo "--------------------------------------------------------------" 1135.if ${MK_CLEAN} != "yes" 1136 ${_+_}cd ${.CURDIR}; ${BMAKE} _NO_INCLUDE_COMPILERMK=t _cleanobj_fast_depend_hack 1137.endif 1138 ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools 1139 mkdir -p ${WORLDTMP}/usr ${WORLDTMP}/lib/geom ${WORLDTMP}/bin 1140 ${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 1141 -p ${WORLDTMP}/usr >/dev/null 1142 ${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 1143 -p ${WORLDTMP}/usr/include >/dev/null 1144.for d in ${LIBCOMPAT_INCLUDE_DIRS} 1145 mkdir -p ${WORLDTMP}/usr/include/${d} 1146.endfor 1147 ln -sf ${.CURDIR}/sys ${WORLDTMP} 1148.if ${MK_DEBUG_FILES} != "no" 1149 ${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.debug.dist \ 1150 -p ${WORLDTMP}/usr/lib >/dev/null 1151.endif 1152.for _mtree in ${LOCAL_MTREE} 1153 ${WORLDTMP_MTREE} -f ${.CURDIR}/${_mtree} -p ${WORLDTMP} > /dev/null 1154.endfor 1155_cleanobj: 1156.if ${MK_CLEAN} == "yes" 1157 @echo 1158 @echo "--------------------------------------------------------------" 1159 @echo ">>> stage 2.1: cleaning up the object tree" 1160 @echo "--------------------------------------------------------------" 1161 # Avoid including bsd.compiler.mk in clean and obj with _NO_INCLUDE_COMPILERMK 1162 # since the restricted $PATH might not contain a valid cc binary 1163 ${_+_}cd ${.CURDIR}; ${WMAKE} _NO_INCLUDE_COMPILERMK=t ${CLEANDIR} 1164.for LIBCOMPAT in ${_LIBCOMPATS} 1165 ${_+_}cd ${.CURDIR}; ${LIB${LIBCOMPAT}WMAKE} _NO_INCLUDE_COMPILERMK=t -f Makefile.inc1 ${CLEANDIR} 1166.endfor 1167.else 1168 ${_+_}cd ${.CURDIR}; env CLEANMK="_NO_INCLUDE_COMPILERMK=t ${CLEANDIR}" \ 1169 ${WMAKE} _cleanobj_fast_depend_hack 1170.endif # ${MK_CLEAN} == "yes" 1171_obj: 1172 @echo 1173 @echo "--------------------------------------------------------------" 1174 @echo ">>> stage 2.2: rebuilding the object tree" 1175 @echo "--------------------------------------------------------------" 1176 ${_+_}cd ${.CURDIR}; ${WMAKE} _NO_INCLUDE_COMPILERMK=t obj 1177_build-tools: 1178 @echo 1179 @echo "--------------------------------------------------------------" 1180 @echo ">>> stage 2.3: build tools" 1181 @echo "--------------------------------------------------------------" 1182 ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools 1183_cross-tools: 1184 @echo 1185 @echo "--------------------------------------------------------------" 1186 @echo ">>> stage 3: cross tools" 1187 @echo "--------------------------------------------------------------" 1188 @rm -f ${OBJTOP}/toolchain-metadata.mk 1189 ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools 1190 ${_+_}cd ${.CURDIR}; ${XMAKE} kernel-tools 1191_build-metadata: 1192 @echo 1193 @echo "--------------------------------------------------------------" 1194 @echo ">>> stage 3.1: recording build metadata" 1195 @echo "--------------------------------------------------------------" 1196 ${_+_}cd ${.CURDIR}; ${WMAKE} toolchain-metadata.mk 1197 ${_+_}cd ${.CURDIR}; ${WMAKE} host-osreldate.h 1198_includes: 1199 @echo 1200 @echo "--------------------------------------------------------------" 1201 @echo ">>> stage 4.1: building includes" 1202 @echo "--------------------------------------------------------------" 1203# Special handling for SUBDIR_OVERRIDE in buildworld as they most likely need 1204# headers from default SUBDIR. Do SUBDIR_OVERRIDE includes last. 1205 ${_+_}cd ${.CURDIR}; ${WMAKE} SUBDIR_OVERRIDE= SHARED=symlinks \ 1206 MK_INCLUDES=yes includes 1207.if !empty(SUBDIR_OVERRIDE) && make(buildworld) 1208 ${_+_}cd ${.CURDIR}; ${WMAKE} MK_INCLUDES=yes SHARED=symlinks includes 1209.endif 1210 ${_+_}cd ${.CURDIR}; ${WMAKE} test-includes 1211_libraries: 1212 @echo 1213 @echo "--------------------------------------------------------------" 1214 @echo ">>> stage 4.2: building libraries" 1215 @echo "--------------------------------------------------------------" 1216 ${_+_}cd ${.CURDIR}; \ 1217 ${WMAKE} -DNO_FSCHG MK_HTML=no MK_MAN=no \ 1218 MK_TESTS=no MK_TESTS_SUPPORT=${MK_TESTS_SUPPORT} \ 1219 libraries 1220everything: .PHONY 1221 @echo 1222 @echo "--------------------------------------------------------------" 1223 @echo ">>> stage 4.4: building everything" 1224 @echo "--------------------------------------------------------------" 1225 ${_+_}cd ${.CURDIR}; _PARALLEL_SUBDIR_OK=1 ${WMAKE} all 1226 1227WMAKE_TGTS= 1228.if !defined(WORLDFAST) 1229WMAKE_TGTS+= _sanity_check _cleanworldtmp _worldtmp _legacy 1230.if empty(SUBDIR_OVERRIDE) 1231WMAKE_TGTS+= _bootstrap-tools 1232.endif 1233WMAKE_TGTS+= _cleanobj 1234.if !defined(NO_OBJWALK) 1235WMAKE_TGTS+= _obj 1236.endif 1237WMAKE_TGTS+= _build-tools _cross-tools 1238WMAKE_TGTS+= _build-metadata 1239WMAKE_TGTS+= _includes 1240.endif 1241.if !defined(NO_LIBS) 1242WMAKE_TGTS+= _libraries 1243.endif 1244.if empty(SUBDIR_OVERRIDE) 1245.for libcompat in ${libcompats} 1246WMAKE_TGTS+= build${libcompat} 1247.endfor 1248.endif 1249WMAKE_TGTS+= everything 1250 1251# record buildworld / install time in seconds 1252.if make(buildworld) 1253_BUILDWORLD_START!= date '+%s' 1254.export _BUILDWORLD_START 1255.endif 1256.if make(reinstall) || make(restage) 1257_INSTALLWORLD_START!= date '+%s' 1258.export _INSTALLWORLD_START 1259.endif 1260.if make(*installkernel*) 1261_INSTALLKERNEL_START!= date '+%s' 1262.export _INSTALLKERNEL_START 1263.endif 1264 1265buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue .PHONY 1266.ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue 1267 1268_ncpu_cmd=sysctl -n hw.ncpu 2>/dev/null || nproc 2>/dev/null || echo unknown 1269 1270buildworld_prologue: .PHONY 1271 @echo "--------------------------------------------------------------" 1272 @echo ">>> World build started on `LC_ALL=C date`" 1273 @echo "--------------------------------------------------------------" 1274 1275buildworld_epilogue: .PHONY 1276 @echo 1277 @echo "--------------------------------------------------------------" 1278 @echo ">>> World build completed on `LC_ALL=C date`" 1279 @seconds=$$(($$(date '+%s') - ${_BUILDWORLD_START})); \ 1280 echo ">>> World built in $$seconds seconds, ncpu: $$(${_ncpu_cmd})${.MAKE.JOBS:S/^/, make -j/}" 1281 @echo "--------------------------------------------------------------" 1282 1283# 1284# We need to have this as a target because the indirection between Makefile 1285# and Makefile.inc1 causes the correct PATH to be used, rather than a 1286# modification of the current environment's PATH. In addition, we need 1287# to quote multiword values. 1288# 1289buildenvvars: .PHONY 1290 @echo ${WMAKEENV:Q} ${.MAKE.EXPORTED:@v@$v=\"${$v}\"@} 1291 1292.if ${.TARGETS:Mbuildenv} 1293.if ${.MAKEFLAGS:M-j} 1294.error The buildenv target is incompatible with -j 1295.endif 1296.endif 1297BUILDENV_DIR?= ${.CURDIR} 1298# 1299# Note: make will report any errors the shell reports. This can 1300# be odd if the last command in an interactive shell generates an 1301# error or is terminated by SIGINT. These reported errors look bad, 1302# but are harmless. Allowing them also allows BUILDENV_SHELL to 1303# be a complex command whose status will be returned to the caller. 1304# Some scripts in tools rely on this behavior to report build errors. 1305# 1306buildenv: .PHONY 1307 @echo Entering world for ${TARGET_ARCH}:${TARGET} 1308.if ${BUILDENV_SHELL:M*zsh*} 1309 @echo For ZSH you must run: export CPUTYPE=${TARGET_CPUTYPE} 1310.endif 1311 @cd ${BUILDENV_DIR} && env ${WMAKEENV} \ 1312 INSTALL="${INSTALL_CMD} ${INSTALLFLAGS}" \ 1313 MTREE_CMD="${MTREE_CMD} ${MTREEFLAGS}" BUILDENV=1 ${BUILDENV_SHELL} 1314 1315TOOLCHAIN_TGTS= ${WMAKE_TGTS:Neverything:${libcompats:@v@Nbuild${v}@:ts:}} 1316toolchain: ${TOOLCHAIN_TGTS} .PHONY 1317KERNEL_TOOLCHAIN_TGTS= ${TOOLCHAIN_TGTS:N_obj:N_cleanobj:N_includes:N_libraries} 1318.if make(kernel-toolchain) 1319.ORDER: ${KERNEL_TOOLCHAIN_TGTS} 1320.endif 1321kernel-toolchain: ${KERNEL_TOOLCHAIN_TGTS} .PHONY 1322 1323# 1324# installcheck 1325# 1326# Checks to be sure system is ready for installworld/installkernel. 1327# 1328installcheck: _installcheck_world _installcheck_kernel .PHONY 1329_installcheck_world: .PHONY 1330 @echo "--------------------------------------------------------------" 1331 @echo ">>> Install check world started on `LC_ALL=C date`" 1332 @echo "--------------------------------------------------------------" 1333_installcheck_kernel: .PHONY 1334 @echo "--------------------------------------------------------------" 1335 @echo ">>> Install check kernel started on `LC_ALL=C date`" 1336 @echo "--------------------------------------------------------------" 1337 1338# 1339# Require DESTDIR to be set if installing for a different architecture or 1340# using the user/group database in the source tree. 1341# 1342.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE} || \ 1343 defined(DB_FROM_SRC) 1344.if !make(distributeworld) 1345_installcheck_world: __installcheck_DESTDIR 1346_installcheck_kernel: __installcheck_DESTDIR 1347__installcheck_DESTDIR: .PHONY 1348.if !defined(DESTDIR) || empty(DESTDIR) 1349 @echo "ERROR: Please set DESTDIR!"; \ 1350 false 1351.endif 1352.endif 1353.endif 1354 1355.if !defined(DB_FROM_SRC) 1356# 1357# Check for missing UIDs/GIDs. 1358# 1359CHECK_UIDS= auditdistd 1360CHECK_GIDS= audit 1361CHECK_UIDS+= ntpd 1362CHECK_GIDS+= ntpd 1363CHECK_UIDS+= proxy 1364CHECK_GIDS+= proxy authpf 1365CHECK_UIDS+= smmsp 1366CHECK_GIDS+= smmsp 1367CHECK_UIDS+= unbound 1368CHECK_GIDS+= unbound 1369_installcheck_world: __installcheck_UGID 1370__installcheck_UGID: .PHONY 1371.for uid in ${CHECK_UIDS} 1372 @if ! `id -u ${uid} >/dev/null 2>&1`; then \ 1373 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \ 1374 false; \ 1375 fi 1376.endfor 1377.for gid in ${CHECK_GIDS} 1378 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \ 1379 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \ 1380 false; \ 1381 fi 1382.endfor 1383.endif 1384# 1385# If installing over the running system (DESTDIR is / or unset) and the install 1386# includes rescue, try running rescue from the objdir as a sanity check. If 1387# rescue is not functional (e.g., because it depends on a system call not 1388# supported by the currently running kernel), abort the installation. 1389# 1390.if !make(distributeworld) && ${MK_RESCUE} != "no" && \ 1391 (empty(DESTDIR) || ${DESTDIR} == "/") && empty(BYPASS_INSTALLCHECK_SH) 1392_installcheck_world: __installcheck_sh_check 1393__installcheck_sh_check: .PHONY 1394 @if [ "`${OBJTOP}/rescue/rescue/rescue sh -c 'echo OK'`" != \ 1395 OK ]; then \ 1396 echo "rescue/sh check failed, installation aborted" >&2; \ 1397 false; \ 1398 fi 1399.endif 1400 1401# 1402# Required install tools to be saved in a scratch dir for safety. 1403# 1404.if !defined(CROSSBUILD_HOST) 1405_sysctl=sysctl 1406.endif 1407 1408ITOOLS= [ awk cap_mkdb cat chflags chmod chown cmp cp \ 1409 date echo egrep find grep id install \ 1410 ln make mkdir mtree mv pwd_mkdb \ 1411 rm sed services_mkdb sh sort strip ${_sysctl} test time true uname wc 1412 1413.if ${MK_ZONEINFO} != "no" 1414ITOOLS+=tzsetup 1415.endif 1416 1417# Needed for share/man 1418.if ${MK_MAN_UTILS} != "no" 1419ITOOLS+=makewhatis 1420.endif 1421 1422ITOOLS+=${LOCAL_ITOOLS} 1423 1424# 1425# distributeworld 1426# 1427# Distributes everything compiled by a `buildworld'. 1428# 1429# installworld 1430# 1431# Installs everything compiled by a 'buildworld'. 1432# 1433 1434# Non-base distributions produced by the base system 1435EXTRA_DISTRIBUTIONS= 1436.for libcompat in ${libcompats} 1437EXTRA_DISTRIBUTIONS+= lib${libcompat} 1438.endfor 1439.if ${MK_TESTS} != "no" 1440EXTRA_DISTRIBUTIONS+= tests 1441.endif 1442 1443DEBUG_DISTRIBUTIONS= 1444.if ${MK_DEBUG_FILES} != "no" 1445DEBUG_DISTRIBUTIONS+= base ${EXTRA_DISTRIBUTIONS:S,tests,,} 1446.endif 1447 1448MTREE_MAGIC?= mtree 2.0 1449 1450distributeworld installworld stageworld: _installcheck_world .PHONY 1451 mkdir -p ${INSTALLTMP} 1452 progs=$$(for prog in ${ITOOLS}; do \ 1453 if progpath=`env PATH=${TMPPATH:Q} which $$prog`; then \ 1454 echo $$progpath; \ 1455 else \ 1456 echo "Required tool $$prog not found in PATH ("${TMPPATH:Q}")." >&2; \ 1457 exit 1; \ 1458 fi; \ 1459 done); \ 1460 if [ -z "${CROSSBUILD_HOST}" ] ; then \ 1461 libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | grep -Ev '\[.*]' | \ 1462 while read line; do \ 1463 set -- $$line; \ 1464 if [ "$$2 $$3" != "not found" ]; then \ 1465 echo $$2; \ 1466 else \ 1467 echo "Required library $$1 not found." >&2; \ 1468 exit 1; \ 1469 fi; \ 1470 done); \ 1471 fi; \ 1472 ${INSTALLTMP_COPY_HOST_TOOL} $$libs $$progs ${INSTALLTMP} 1473 cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale 1474.if defined(NO_ROOT) 1475 -mkdir -p ${METALOG:H} 1476 echo "#${MTREE_MAGIC}" > ${METALOG} 1477.endif 1478.if make(distributeworld) 1479.for dist in ${EXTRA_DISTRIBUTIONS} 1480 -mkdir ${DESTDIR}/${DISTDIR}/${dist} 1481 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.root.dist \ 1482 -p ${DESTDIR}/${DISTDIR}/${dist} >/dev/null 1483 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 1484 -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null 1485 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 1486 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/include >/dev/null 1487.for d in ${LIBCOMPAT_INCLUDE_DIRS} 1488 -mkdir ${DESTDIR}/${DISTDIR}/${dist}/usr/include/${d} 1489.endfor 1490.if ${MK_DEBUG_FILES} != "no" 1491 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.debug.dist \ 1492 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib >/dev/null 1493.endif 1494.for libcompat in ${libcompats} 1495 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ 1496 -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null 1497.if ${MK_DEBUG_FILES} != "no" 1498 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ 1499 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib/debug/usr >/dev/null 1500.endif 1501.endfor 1502.if ${MK_TESTS} != "no" && ${dist} == "tests" 1503 -mkdir -p ${DESTDIR}/${DISTDIR}/${dist}${TESTSBASE} 1504 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.tests.dist \ 1505 -p ${DESTDIR}/${DISTDIR}/${dist}${TESTSBASE} >/dev/null 1506.if ${MK_DEBUG_FILES} != "no" 1507 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.tests.dist \ 1508 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib/debug${TESTSBASE} >/dev/null 1509.endif 1510.endif 1511 ${IMAKEENV} ${DISTR_MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \ 1512 sed -e 's#^\./#./${dist}/#' >> ${METALOG} 1513 ${IMAKEENV} ${DISTR_MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.usr.dist | \ 1514 sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG} 1515 ${IMAKEENV} ${DISTR_MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.include.dist | \ 1516 sed -e 's#^\./#./${dist}/usr/include/#' >> ${METALOG} 1517.for d in ${LIBCOMPAT_INCLUDE_DIRS} 1518 echo "./${dist}/usr/include/${d} type=dir uname=root gname=wheel mode=0755" >> ${METALOG} 1519.endfor 1520.for libcompat in ${libcompats} 1521 ${IMAKEENV} ${DISTR_MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist | \ 1522 sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG} 1523.endfor 1524.endfor 1525 -mkdir ${DESTDIR}/${DISTDIR}/base 1526 ${_+_}cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH:Q} ${MAKE} \ 1527 METALOG=${METALOG} ${IMAKE_INSTALL} ${IMAKE_MTREE} \ 1528 DISTBASE=/base DESTDIR=${INSTALL_DDIR}/base \ 1529 LOCAL_MTREE=${LOCAL_MTREE:Q} distrib-dirs 1530 ${INSTALL_SYMLINK} ${INSTALLFLAGS} usr/src/sys ${INSTALL_DDIR}/base/sys 1531.endif # make(distributeworld) 1532 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \ 1533 ${IMAKEENV} rm -rf ${INSTALLTMP} 1534.if !make(packageworld) && ${MK_CAROOT} != "no" && ${MK_OPENSSL} != "no" 1535 PATH=${TMPPATH:Q}:${PATH:Q} \ 1536 LOCALBASE=${LOCALBASE:Q} \ 1537 certctl ${CERTCTLFLAGS} rehash 1538.endif 1539.if make(distributeworld) 1540.for dist in ${EXTRA_DISTRIBUTIONS} 1541 find ${DESTDIR}/${DISTDIR}/${dist} -mindepth 1 -type d -empty -delete 1542.endfor 1543.for dist in base ${EXTRA_DISTRIBUTIONS} 1544.for path suffix in "" .meta /usr/lib/debug .debug.meta 1545 @# For each file that exists in this dist, print the corresponding 1546 @# line from the METALOG. This relies on the fact that 1547 @# a line containing only the filename will sort immediately before 1548 @# the relevant mtree line. 1549 cd ${DESTDIR}/${DISTDIR}; \ 1550 find ./${dist}${path} | ${METALOG_SORT_CMD} -u ${METALOG} - | \ 1551 awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}/, "."); print } }' > \ 1552 ${DESTDIR}/${DISTDIR}/${dist}${suffix} 1553.endfor 1554.endfor 1555.endif # make(distributeworld) 1556 1557packageworld: .PHONY 1558.for dist in base ${EXTRA_DISTRIBUTIONS} 1559 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ 1560 ${TAR_CMD} cvf - --exclude usr/lib/debug \ 1561 @${DESTDIR}/${DISTDIR}/${dist}.meta | \ 1562 ${XZ_CMD} > ${PACKAGEDIR}/${dist}.txz 1563.endfor 1564 1565.for dist in ${DEBUG_DISTRIBUTIONS} 1566 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ 1567 ${TAR_CMD} cvf - @${DESTDIR}/${DISTDIR}/${dist}.debug.meta | \ 1568 ${XZ_CMD} > ${PACKAGEDIR}/${dist}-dbg.txz 1569.endfor 1570 1571makeman: .PHONY 1572 ${_+_}cd ${.CURDIR}/tools/build/options; sh makeman > \ 1573 ${.CURDIR}/share/man/man5/src.conf.5 1574 1575# Ensure no regressions in self-includeability of sys/*.h and net*/*.h 1576test-includes: .PHONY 1577 ${_+_}cd ${.CURDIR}/tools/build/test-includes; \ 1578 ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} obj; \ 1579 ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} DESTDIR=${WORLDTMP} test-includes 1580 1581# We can't assume here that ${TMPPATH} will include ${PATH} or /usr/libexec 1582# because we may be building with a STRICTTMPPATH, so we explicitly include 1583# /usr/libexec here for flua. ${TMPPATH} still usefully includes anything else 1584# we may need to function. 1585_sysent_PATH= ${TMPPATH}:/usr/libexec 1586_sysent_dirs= sys/kern 1587_sysent_dirs+= sys/compat/freebsd32 1588_sysent_dirs+= sys/amd64/linux \ 1589 sys/amd64/linux32 \ 1590 sys/arm64/linux \ 1591 sys/i386/linux \ 1592 sys/tools/syscalls/examples/cpp 1593 1594sysent: .PHONY 1595.for _dir in ${_sysent_dirs} 1596sysent-${_dir}: .PHONY 1597 @echo "${MAKE} -C ${.CURDIR}/${_dir} sysent" 1598 ${_+_}@env PATH=${_sysent_PATH:Q} ${MAKE} -C ${.CURDIR}/${_dir} sysent 1599 1600sysent: sysent-${_dir} 1601.endfor 1602 1603# 1604# reinstall 1605# 1606# If you have a build server, you can NFS mount the source and obj directories 1607# and do a 'make reinstall' on the *client* to install new binaries from the 1608# most recent server build. 1609# 1610restage reinstall: .MAKE .PHONY 1611 @echo "--------------------------------------------------------------" 1612 @echo ">>> Making hierarchy" 1613 @echo "--------------------------------------------------------------" 1614 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 \ 1615 LOCAL_MTREE=${LOCAL_MTREE:Q} hierarchy 1616.if make(restage) 1617 @echo "--------------------------------------------------------------" 1618 @echo ">>> Making distribution" 1619 @echo "--------------------------------------------------------------" 1620 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 \ 1621 LOCAL_MTREE=${LOCAL_MTREE:Q} distribution 1622.endif 1623 @echo 1624 @echo "--------------------------------------------------------------" 1625 @echo ">>> Installing everything started on `LC_ALL=C date`" 1626 @echo "--------------------------------------------------------------" 1627 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install 1628.for libcompat in ${libcompats} 1629 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install${libcompat} 1630.endfor 1631 @echo "--------------------------------------------------------------" 1632 @echo ">>> Installing everything completed on `LC_ALL=C date`" 1633 @seconds=$$(($$(date '+%s') - ${_INSTALLWORLD_START})); \ 1634 echo ">>> Install world completed in $$seconds seconds, ncpu: $$(${_ncpu_cmd})${.MAKE.JOBS:S/^/, make -j/}" 1635 @echo "--------------------------------------------------------------" 1636 1637redistribute: .MAKE .PHONY 1638 @echo "--------------------------------------------------------------" 1639 @echo ">>> Distributing everything" 1640 @echo "--------------------------------------------------------------" 1641 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute 1642.for libcompat in ${libcompats} 1643 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute${libcompat} \ 1644 DISTRIBUTION=lib${libcompat} 1645.endfor 1646 1647distrib-dirs distribution: .MAKE .PHONY 1648 ${_+_}cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH:Q} ${MAKE} \ 1649 ${IMAKE_INSTALL} ${IMAKE_MTREE} METALOG=${METALOG} ${.TARGET} 1650.if make(distribution) 1651 ${_+_}cd ${.CURDIR}; ${CROSSENV} PATH=${TMPPATH:Q} \ 1652 ${MAKE} -f Makefile.inc1 ${IMAKE_INSTALL} \ 1653 METALOG=${METALOG} MK_TESTS=no \ 1654 MK_TESTS_SUPPORT=${MK_TESTS_SUPPORT} installconfig 1655.endif 1656 1657# 1658# buildetc and installetc 1659# 1660buildetc: .MAKE .PHONY 1661 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 _worldtmp 1662 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 _legacy 1663 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 _bootstrap-tools \ 1664 MK_CROSS_COMPILER=no MK_TOOLCHAIN=no 1665 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 _obj 1666 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 buildconfig 1667 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 everything \ 1668 SUBDIR_OVERRIDE=etc 1669 1670installetc: .MAKE .PHONY 1671 @echo "--------------------------------------------------------------" 1672 @echo ">>> Making hierarchy" 1673 @echo "--------------------------------------------------------------" 1674 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distrib-dirs 1675 @echo "--------------------------------------------------------------" 1676 @echo ">>> Making distribution" 1677 @echo "--------------------------------------------------------------" 1678 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribution 1679 1680# 1681# buildkernel and installkernel 1682# 1683# Which kernels to build and/or install is specified by setting 1684# KERNCONF. If not defined a GENERIC kernel is built/installed. 1685# Only the existing (depending TARGET) config files are used 1686# for building kernels and only the first of these is designated 1687# as the one being installed. 1688# 1689# Note that we have to use TARGET instead of TARGET_ARCH when 1690# we're in kernel-land. Since only TARGET_ARCH is (expected) to 1691# be set to cross-build, we have to make sure TARGET is set 1692# properly. 1693 1694.if defined(KERNFAST) 1695NO_KERNELCLEAN= t 1696NO_KERNELCONFIG= t 1697NO_KERNELOBJ= t 1698# Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah 1699.if !defined(KERNCONF) && ${KERNFAST} != "1" 1700KERNCONF=${KERNFAST} 1701.endif 1702.endif 1703GENERIC_KERNCONF_SUFX_powerpc64= 64 1704GENERIC_KERNCONF_SUFX_powerpc64le= 64LE 1705GENERIC_KERNCONF?= ${GENERIC_KERNCONF_${TARGET_ARCH}:UGENERIC${GENERIC_KERNCONF_SUFX_${TARGET_ARCH}}} 1706INSTKERNNAME?= kernel 1707 1708KERNSRCDIR?= ${.CURDIR}/sys 1709KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf 1710KRNLOBJDIR= ${OBJTOP}${KERNSRCDIR:C,^${.CURDIR},,} 1711KERNCONFDIR?= ${KRNLCONFDIR} 1712 1713.for _k in ${GENERIC_KERNCONF} MINIMAL${GENERIC_KERNCONF_SUFX_${TARGET_ARCH}} ${GENERIC_KERNCONF}-MMCCAM 1714.if exists(${KERNCONFDIR}/${_k}) 1715PKG_KERNCONF+= ${_k} 1716.for _dbg in NODEBUG DEBUG 1717.if exists(${KERNCONFDIR}/${_k}-${_dbg}) 1718PKG_KERNCONF+= ${_k}-${_dbg} 1719.endif 1720.endfor 1721.endif 1722.endfor 1723 1724.if defined(PACKAGE_BUILDING) 1725KERNCONF?= ${PKG_KERNCONF} 1726.else 1727KERNCONF?= ${GENERIC_KERNCONF} 1728.endif 1729 1730BUILDKERNELS= 1731INSTALLKERNEL= 1732.for _kernel in ${KERNCONF} 1733.if !defined(_MKSHOWCONFIG) && exists(${KERNCONFDIR}/${_kernel}) 1734BUILDKERNELS+= ${_kernel} 1735.if empty(INSTALLKERNEL) && !defined(NO_INSTALLKERNEL) 1736INSTALLKERNEL= ${_kernel} 1737.endif 1738.else 1739.if make(buildkernel) 1740.error Missing KERNCONF ${KERNCONFDIR}/${_kernel} 1741.endif 1742.endif 1743.endfor 1744 1745_cleankernobj_fast_depend_hack: .PHONY 1746# 20191009 r353340 removal of opensolaris_atomic.S (also r353381) 1747.if ${MACHINE} != i386 1748.for f in opensolaris_atomic 1749.for m in opensolaris zfs 1750 @if [ -e "${KRNLOBJDIR}/${KERNCONF}/modules${SRCTOP}/sys/modules/${m}/.depend.${f}.o" ] && \ 1751 grep -q ${f}.S "${KRNLOBJDIR}/${KERNCONF}/modules${SRCTOP}/sys/modules/${m}/.depend.${f}.o"; then \ 1752 echo "Removing stale dependencies for opensolaris_atomic"; \ 1753 rm -f ${KRNLOBJDIR}/${KERNCONF}/modules${SRCTOP}/sys/modules/${m}/.depend.${f}.*; \ 1754 fi 1755.endfor 1756.endfor 1757.endif 1758 1759${WMAKE_TGTS:N_cleanworldtmp:N_worldtmp:${libcompats:@v@Nbuild${v}@:ts:}}: .MAKE .PHONY 1760${.ALLTARGETS:M_*:N_cleanworldtmp:N_worldtmp}: .MAKE .PHONY 1761 1762# record kernel(s) build time in seconds 1763.if make(buildkernel) 1764_BUILDKERNEL_START!= date '+%s' 1765.endif 1766 1767# 1768# buildkernel 1769# 1770# Builds all kernels defined by BUILDKERNELS. 1771# 1772buildkernel: .MAKE .PHONY 1773.if empty(BUILDKERNELS) 1774 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \ 1775 false 1776.endif 1777 @echo 1778.for _kernel in ${BUILDKERNELS} 1779 @echo "--------------------------------------------------------------" 1780 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`" 1781 @echo "--------------------------------------------------------------" 1782 @echo "===> ${_kernel}" 1783 mkdir -p ${KRNLOBJDIR} 1784.if !defined(NO_KERNELCONFIG) 1785 @echo 1786 @echo "--------------------------------------------------------------" 1787 @echo ">>> stage 1: configuring the kernel" 1788 @echo "--------------------------------------------------------------" 1789 cd ${KRNLCONFDIR}; \ 1790 PATH=${TMPPATH:Q} \ 1791 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \ 1792 -I '${KERNCONFDIR}' -I '${KRNLCONFDIR}' \ 1793 '${KERNCONFDIR}/${_kernel}' 1794.endif 1795.if ${MK_CLEAN} == "yes" && !defined(NO_KERNELCLEAN) 1796 @echo 1797 @echo "--------------------------------------------------------------" 1798 @echo ">>> stage 2.1: cleaning up the object tree" 1799 @echo "--------------------------------------------------------------" 1800 ${_+_}cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR} 1801.else 1802 ${_+_}cd ${.CURDIR}; ${WMAKE} _cleankernobj_fast_depend_hack 1803.endif 1804.if !defined(NO_KERNELOBJ) 1805 @echo 1806 @echo "--------------------------------------------------------------" 1807 @echo ">>> stage 2.2: rebuilding the object tree" 1808 @echo "--------------------------------------------------------------" 1809 ${_+_}cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj 1810.endif 1811 @echo 1812 @echo "--------------------------------------------------------------" 1813 @echo ">>> stage 2.3: build tools" 1814 @echo "--------------------------------------------------------------" 1815 ${_+_}cd ${.CURDIR}; ${KTMAKE} kernel-tools 1816 @echo 1817 @echo "--------------------------------------------------------------" 1818 @echo ">>> stage 3.1: building everything" 1819 @echo "--------------------------------------------------------------" 1820 ${_+_}cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ 1821 @echo "--------------------------------------------------------------" 1822 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`" 1823 @echo "--------------------------------------------------------------" 1824 1825.endfor 1826 @seconds=$$(($$(date '+%s') - ${_BUILDKERNEL_START})); \ 1827 echo ">>> Kernel(s) ${BUILDKERNELS} built in $$seconds seconds, ncpu: $$(${_ncpu_cmd})${.MAKE.JOBS:S/^/, make -j/}" 1828 @echo "--------------------------------------------------------------" 1829 1830.if !make(packages) && !make(update-packages) 1831NO_INSTALLEXTRAKERNELS?= yes 1832.else 1833# packages/update-packages installs kernels to a staging directory then builds 1834# packages from the result to be installed, typically to other systems. It is 1835# less surprising for these targets to honor KERNCONF if multiple kernels are 1836# specified. 1837NO_INSTALLEXTRAKERNELS?= no 1838.endif 1839 1840.if ${NO_INSTALLEXTRAKERNELS} != "yes" 1841.if defined(NO_INSTALLKERNEL) 1842INSTALLEXTRAKERNELS= ${BUILDKERNELS} 1843.elif ${BUILDKERNELS:[#]} > 1 1844# First kernel is installed separately by INSTALLKERNEL, typically to 1845# /boot/kernel, rather than to a config-suffixed directory. 1846INSTALLEXTRAKERNELS= ${BUILDKERNELS:[2..-1]} 1847.else 1848INSTALLEXTRAKERNELS= 1849.endif 1850.endif 1851 1852# 1853# Don't allow installworld or installkernel on a pkgbase system. This avoids 1854# accidentally updating a pkgbase system with install{world,kernel}, causing 1855# the installed system to become out of date with the package database. 1856# 1857# Skip the check if DESTDIR is defined on the assumption the user knows what 1858# they're doing. This means the check can be disabled for the running system 1859# using DESTDIR=/. 1860# 1861# People who want to disable this check permanently may set two variables in 1862# /etc/make.conf, ALLOW_PKGBASE_INSTALLKERNEL and ALLOW_PKGBASE_INSTALLWORLD, 1863# to disable these checks. That doesn't stop this from breaking your system, 1864# it just stops make from warning about it. 1865# 1866.if !make(distributeworld) && !defined(DESTDIR) 1867 1868. if !defined(ALLOW_PKGBASE_INSTALLKERNEL) && exists(${LOCALBASE}/sbin/pkg-static) 1869# For installkernel, we check if this specific kernel was installed by pkg. 1870# This means people can continue to use installkernel for non-packaged 1871# kernels, which is useful for development. 1872 1873_installcheck_kernel: __installcheck_kernel_pkgbase 1874__installcheck_kernel_pkgbase: .PHONY 1875. for _kernel in ${NO_INSTALLKERNEL:D:U${INSTKERNNAME}} \ 1876 ${INSTALLEXTRAKERNELS:S/^/${INSTKERNNAME}./} 1877 @if ${LOCALBASE}/sbin/pkg-static which /boot/${_kernel}/kernel \ 1878 >/dev/null 2>&1; then \ 1879 echo >&2 "ERROR: The kernel at /boot/${_kernel} was installed from packages." ; \ 1880 echo >&2 " A packaged kernel should never be updated using installkernel;" ; \ 1881 echo >&2 " this will cause the package database to become out of sync with" ; \ 1882 echo >&2 " the live system state. Either uninstall the packaged kernel," ; \ 1883 echo >&2 " or install this kernel to a different path using INSTKERNNAME." ; \ 1884 echo >&2 "" ; \ 1885 echo >&2 " If you understand the risks and wish to proceed anyway, you may" ; \ 1886 echo >&2 " set ALLOW_PKGBASE_INSTALLKERNEL=yes to override this safety check." ; \ 1887 echo >&2 " After doing so, you should not use the pkg(8) utility until you" ; \ 1888 echo >&2 " have resolved the inconsistency between the installed system and" ; \ 1889 echo >&2 " the package database." ; \ 1890 false; \ 1891 fi 1892. endfor 1893. endif # !defined(ALLOW_PKGBASE_INSTALLKERNEL) && exists(pkg-static) 1894 1895. if !defined(ALLOW_PKGBASE_INSTALLWORLD) && exists(${LOCALBASE}/sbin/pkg-static) 1896_installcheck_world: __installcheck_world_pkgbase 1897__installcheck_world_pkgbase: .PHONY 1898 @if ${LOCALBASE}/sbin/pkg-static info -e ${PKG_NAME_PREFIX}-runtime; then \ 1899 echo >&2 "ERROR: This target should never be used on a system installed from packages;" ; \ 1900 echo >&2 " doing so will cause the package database to become out of sync with" ; \ 1901 echo >&2 " the live system state." ; \ 1902 echo >&2 "" ; \ 1903 echo >&2 " If you understand the risks and wish to proceed anyway, you may" ; \ 1904 echo >&2 " set ALLOW_PKGBASE_INSTALLWORLD=yes to override this safety check." ; \ 1905 echo >&2 " After doing so, you should not use the pkg(8) utility until you" ; \ 1906 echo >&2 " have resolved the inconsistency between the installed system and" ; \ 1907 echo >&2 " the package database." ; \ 1908 false; \ 1909 fi 1910. endif # !defined(ALLOW_PKGBASE_INSTALLWORLD) && exists(pkg-static) 1911.endif # !make(distributeworld) && !defined(DESTDIR) 1912 1913# 1914# installkernel, etc. 1915# 1916# Install the kernel defined by INSTALLKERNEL 1917# 1918installkernel installkernel.debug \ 1919reinstallkernel reinstallkernel.debug: _installcheck_kernel .PHONY 1920.if !defined(NO_INSTALLKERNEL) 1921.if empty(INSTALLKERNEL) 1922 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \ 1923 false 1924.endif 1925 @echo "--------------------------------------------------------------" 1926 @echo ">>> Installing kernel ${INSTALLKERNEL} on $$(LC_ALL=C date)" 1927 @echo "--------------------------------------------------------------" 1928 ${_+_}cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ 1929 ${CROSSENV} PATH=${TMPPATH:Q} \ 1930 ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME} METALOG=${METALOG} \ 1931 ${.TARGET:S/kernel//} 1932 @echo "--------------------------------------------------------------" 1933 @echo ">>> Installing kernel ${INSTALLKERNEL} completed on $$(LC_ALL=C date)" 1934 @echo "--------------------------------------------------------------" 1935 @seconds=$$(($$(date '+%s') - ${_INSTALLKERNEL_START})); \ 1936 echo ">>> Install kernel(s) ${INSTALLKERNEL} completed in $$seconds seconds, ncpu: $$(${_ncpu_cmd})${.MAKE.JOBS:S/^/, make -j/}" 1937 @echo "--------------------------------------------------------------" 1938.endif 1939.if !empty(INSTALLEXTRAKERNELS) 1940.for _kernel in ${INSTALLEXTRAKERNELS} 1941 @echo "--------------------------------------------------------------" 1942 @echo ">>> Installing kernel ${_kernel} $$(LC_ALL=C date)" 1943 @echo "--------------------------------------------------------------" 1944 ${_+_}cd ${KRNLOBJDIR}/${_kernel}; \ 1945 ${CROSSENV} PATH=${TMPPATH:Q} \ 1946 ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME}.${_kernel} METALOG=${METALOG} \ 1947 ${.TARGET:S/kernel//} 1948 @echo "--------------------------------------------------------------" 1949 @echo ">>> Installing kernel ${_kernel} completed on $$(LC_ALL=C date)" 1950 @echo "--------------------------------------------------------------" 1951.endfor 1952 @seconds=$$(($$(date '+%s') - ${_INSTALLKERNEL_START})); \ 1953 echo ">>> Install kernel(s) ${BUILDKERNELS} completed in $$seconds seconds, ncpu: $$(${_ncpu_cmd})${.MAKE.JOBS:S/^/, make -j/}" 1954 @echo "--------------------------------------------------------------" 1955.endif 1956 1957distributekernel distributekernel.debug: .PHONY 1958.if !defined(NO_INSTALLKERNEL) 1959.if empty(INSTALLKERNEL) 1960 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \ 1961 false 1962.endif 1963 mkdir -p ${DESTDIR}/${DISTDIR} 1964 rm -f ${DESTDIR}/${DISTDIR}/kernel.premeta 1965 ${_+_}cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ 1966 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.premeta/} \ 1967 ${IMAKE_MTREE} PATH=${TMPPATH:Q} ${MAKE} KERNEL=${INSTKERNNAME} \ 1968 DISTBASE=/kernel DESTDIR=${INSTALL_DDIR}/kernel \ 1969 METALOG=${METALOG:S/METALOG/kernel.premeta/} \ 1970 ${.TARGET:S/distributekernel/install/} 1971.if defined(NO_ROOT) 1972 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.meta 1973 sed -e 's|^./kernel|.|' ${DESTDIR}/${DISTDIR}/kernel.premeta | \ 1974 ${METALOG_SORT_CMD} >> ${DESTDIR}/${DISTDIR}/kernel.meta 1975.endif 1976.endif 1977.if !empty(INSTALLEXTRAKERNELS) 1978.for _kernel in ${INSTALLEXTRAKERNELS} 1979 rm -f ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta 1980 ${_+_}cd ${KRNLOBJDIR}/${_kernel}; \ 1981 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.${_kernel}.premeta/} \ 1982 ${IMAKE_MTREE} PATH=${TMPPATH:Q} ${MAKE} \ 1983 KERNEL=${INSTKERNNAME}.${_kernel} \ 1984 DISTBASE=/kernel.${_kernel} DESTDIR=${INSTALL_DDIR}/kernel.${_kernel} \ 1985 METALOG=${METALOG:S/METALOG/kernel.${_kernel}.premeta/} \ 1986 ${.TARGET:S/distributekernel/install/} 1987.if defined(NO_ROOT) 1988 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta 1989 sed -e "s|^./kernel.${_kernel}|.|" \ 1990 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta | \ 1991 ${METALOG_SORT_CMD} >> ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta 1992.endif 1993.endfor 1994.endif 1995 1996packagekernel: .PHONY 1997.if !defined(NO_INSTALLKERNEL) 1998 cd ${DESTDIR}/${DISTDIR}/kernel; \ 1999 ${TAR_CMD} cvf - --exclude '*.debug' \ 2000 @${DESTDIR}/${DISTDIR}/kernel.meta | \ 2001 ${XZ_CMD} > ${PACKAGEDIR}/kernel.txz 2002.endif 2003.if ${MK_DEBUG_FILES} != "no" 2004 cd ${DESTDIR}/${DISTDIR}/kernel; \ 2005 ${TAR_CMD} cvf - --include '*/*/*.debug' \ 2006 @${DESTDIR}/${DISTDIR}/kernel.meta | \ 2007 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel-dbg.txz 2008.endif 2009.if !empty(INSTALLEXTRAKERNELS) 2010.for _kernel in ${INSTALLEXTRAKERNELS} 2011 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ 2012 ${TAR_CMD} cvf - --exclude '*.debug' \ 2013 @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta | \ 2014 ${XZ_CMD} > ${PACKAGEDIR}/kernel.${_kernel}.txz 2015.if ${MK_DEBUG_FILES} != "no" 2016 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ 2017 ${TAR_CMD} cvf - --include '*/*/*.debug' \ 2018 @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta | \ 2019 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}-dbg.txz 2020.endif 2021.endfor 2022.endif 2023 2024stagekernel: .PHONY 2025 ${_+_}${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} DISTDIR=. distributekernel 2026 2027PORTSDIR?= /usr/ports 2028WSTAGEDIR?= ${OBJTOP}/worldstage 2029KSTAGEDIR?= ${OBJTOP}/kernelstage 2030SSTAGEDIR?= ${OBJTOP}/sourcestage 2031REPODIR?= ${OBJROOT}repo 2032PKG_FORMAT?= tzst 2033PKG_LEVEL?= -1 2034PKG_CLEVEL?= ${"${PKG_FORMAT:Mtar}" != "":?:-l ${PKG_LEVEL}} 2035PKG_CTHREADS?= 0 2036PKG_REPO_SIGNING_KEY?= # empty 2037PKG_OUTPUT_DIR?= ${PKG_VERSION} 2038PKG_ABI_FILE?= ${WSTAGEDIR}/usr/bin/uname 2039.if make(create-*-packages*) || make(real-update-packages) || make(real-sign-packages) 2040PKG_ABI!= ${PKG_CMD} -o ABI_FILE=${PKG_ABI_FILE} config ABI 2041.endif 2042 2043.ORDER: stage-packages create-packages 2044.ORDER: create-packages create-world-packages 2045.ORDER: create-packages create-source-packages 2046.ORDER: create-packages create-kernel-packages 2047.ORDER: create-packages sign-packages 2048 2049_pkgbootstrap: .PHONY 2050.if make(*package*) && !exists(${LOCALBASE}/sbin/pkg) 2051.if defined(BOOTSTRAP_PKG_FROM_PORTS) 2052 env - UNAME_r=${UNAME_r} PATH=$$PATH \ 2053 make -C ${PORTSDIR}/ports-mgmt/pkg \ 2054 I_DONT_CARE_IF_MY_BUILDS_TARGET_THE_WRONG_RELEASE=1 \ 2055 BATCH=1 WRKDIRPREFIX=/tmp/ports DISTDIR=/tmp/distfiles \ 2056 all install clean 2057.else 2058 @env ASSUME_ALWAYS_YES=YES pkg bootstrap 2059.endif 2060.endif 2061 2062PKG_BIN_VERSION!=${PKG_CMD} --version </dev/null 2>/dev/null |\ 2063 awk -F. '/^[0-9.]+(-.*)?$$/ {print $$1 * 10000 + $$2 * 100 + $$3}' 2064PKG_EXT= pkg 2065 2066.if !defined(PKG_VERSION_FROM) && make(real-update-packages) && \ 2067 exists(${PKG_ABI_FILE}) && exists(${REPODIR}/${PKG_ABI}/latest) 2068PKG_VERSION_FROM!=/usr/bin/readlink ${REPODIR}/${PKG_ABI}/latest 2069PKG_VERSION_FROM_DIR= ${REPODIR}/${PKG_ABI}/${PKG_VERSION_FROM} 2070# Determine the name of the branch base on the version 2071# X.bY => beta 2072# X.aY => alpha 2073# X.rcY => rc 2074# X.snap => snap 2075# all others mean release 2076# 2077# This will be used when comparing to the branch that we are building 2078# to decide if we keep old packages or new packages when only their 2079# version differs 2080BRANCH_EXT_FROM= 2081.if ${PKG_VERSION_FROM:M*.snap*} 2082BRANCH_EXT_FROM= ${PKG_VERSION_FROM:C/.snap.*$//}.snap 2083.elif ${PKG_VERSION_FROM:M*.b*} 2084BRANCH_EXT_FROM= beta 2085.elif ${PKG_VERSION_FROM:M*.rc*} 2086BRANCH_EXT_FROM= rc 2087.elif ${PKG_VERSION_FROM:M*.a*} 2088BRANCH_EXT_FROM= alpha 2089.endif 2090.endif 2091 2092PKGMAKEARGS+= PKG_VERSION=${PKG_VERSION} \ 2093 NO_INSTALLEXTRAKERNELS=${NO_INSTALLEXTRAKERNELS} 2094 2095packages: .PHONY 2096 ${_+_}${MAKE} -C ${.CURDIR} ${PKGMAKEARGS} real-packages 2097 2098update-packages: .PHONY 2099 ${_+_}${MAKE} -C ${.CURDIR} ${PKGMAKEARGS} real-update-packages 2100 2101package-pkg: _pkgbootstrap _repodir .PHONY 2102.if defined(INCLUDE_PKG_IN_PKGBASE_REPO) 2103.if exists(${PORTSDIR}) 2104 rm -rf /tmp/ports.${TARGET} || : 2105 env ${WMAKEENV} SRCDIR=${.CURDIR} PORTSDIR=${PORTSDIR} REVISION=${_REVISION} \ 2106 PKG_CMD=${PKG_CMD} PKG_VERSION=${PKG_VERSION} REPODIR=${REPODIR} \ 2107 WSTAGEDIR=${WSTAGEDIR} \ 2108 OSVERSION="${SRCRELDATE}" LOCALBASE=${LOCALBASE} \ 2109 sh ${.CURDIR}/release/scripts/make-pkg-package.sh 2110.endif 2111.endif 2112 2113real-packages: stage-packages create-packages sign-packages .PHONY 2114 2115real-update-packages: stage-packages .PHONY 2116 ${_+_}${MAKE} -C ${.CURDIR} PKG_VERSION=${PKG_VERSION} create-packages 2117.if defined(PKG_VERSION_FROM_DIR) 2118 @echo "==> Checking for new packages (comparing ${PKG_VERSION} to ${PKG_VERSION_FROM})" 2119 @for pkg in ${PKG_VERSION_FROM_DIR}/${PKG_NAME_PREFIX}-*; do \ 2120 pkgname=$$(pkg query -F $${pkg} '%n' | sed 's/${PKG_NAME_PREFIX}-\(.*\)/\1/') ; \ 2121 newpkgname=${PKG_NAME_PREFIX}-$${pkgname}-${PKG_VERSION}.${PKG_EXT} ; \ 2122 oldsum=$$(pkg query -F $${pkg} '%X') ; \ 2123 if [ ! -f ${REPODIR}/${PKG_ABI}/${PKG_VERSION}/$${newpkgname} ]; then \ 2124 continue; \ 2125 fi ; \ 2126 newsum=$$(pkg query -F ${REPODIR}/${PKG_ABI}/${PKG_VERSION}/$${newpkgname} '%X') ; \ 2127 if [ "${BRANCH_EXT_FROM}" = "${BRANCH_EXT}" -a "$${oldsum}" = "$${newsum}" ]; then \ 2128 echo "==> Keeping old ${PKG_NAME_PREFIX}-$${pkgname}-${PKG_VERSION_FROM}.${PKG_EXT}" ; \ 2129 rm ${REPODIR}/${PKG_ABI}/${PKG_VERSION}/$${newpkgname} ; \ 2130 cp $${pkg} ${REPODIR}/${PKG_ABI}/${PKG_VERSION} ; \ 2131 else \ 2132 echo "==> New package $${newpkgname}" ; \ 2133 fi ; \ 2134 done 2135.else 2136 @echo "==> Bootstrapping repository, not checking for new packages" 2137.endif 2138 ${_+_}${MAKE} -C ${.CURDIR} -f Makefile.inc1 PKG_VERSION=${PKG_VERSION} sign-packages 2139 2140stage-packages-world: .PHONY 2141 @mkdir -p ${WSTAGEDIR} 2142 ${_+_}@cd ${.CURDIR}; \ 2143 ${MAKE} DESTDIR=${WSTAGEDIR} -DNO_ROOT stageworld 2144 2145stage-packages-kernel: .PHONY 2146 @mkdir -p ${KSTAGEDIR} 2147 ${_+_}@cd ${.CURDIR}; \ 2148 ${MAKE} DESTDIR=${KSTAGEDIR} -DNO_ROOT stagekernel 2149 2150stage-packages-source: .PHONY 2151 @mkdir -p ${SSTAGEDIR}; 2152 2153stage-packages: .PHONY stage-packages-world stage-packages-kernel stage-packages-source 2154 2155_repodir: .PHONY 2156 @mkdir -p ${REPODIR} 2157 2158create-packages-world: _pkgbootstrap _repodir .PHONY 2159 ${_+_}@cd ${.CURDIR}; \ 2160 ${MAKE} -f Makefile.inc1 \ 2161 DESTDIR=${WSTAGEDIR} \ 2162 PKG_VERSION=${PKG_VERSION} create-world-packages 2163 2164.ORDER: create-packages-world create-packages-sets 2165.ORDER: create-packages-kernel create-packages-sets 2166.ORDER: create-packages-source create-packages-sets 2167create-packages-sets: _pkgbootstrap _repodir .PHONY 2168 ${_+_}@cd ${.CURDIR}; \ 2169 ${MAKE} -f Makefile.inc1 \ 2170 DESTDIR=${WSTAGEDIR} \ 2171 PKG_VERSION=${PKG_VERSION} create-sets-packages 2172 2173create-packages-kernel: _pkgbootstrap _repodir .PHONY 2174 ${_+_}@cd ${.CURDIR}; \ 2175 ${MAKE} -f Makefile.inc1 \ 2176 DESTDIR=${KSTAGEDIR} \ 2177 PKG_VERSION=${PKG_VERSION} DISTDIR=kernel \ 2178 SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \ 2179 create-kernel-packages 2180 2181create-packages-kernel-repo: .PHONY create-packages-kernel sign-packages 2182 2183create-packages-world-repo: .PHONY create-packages-world sign-packages 2184 2185create-packages-sets-repo: .PHONY create-packages-sets sign-packages 2186 2187create-packages-source: _pkgbootstrap _repodir .PHONY 2188 ${_+_}@cd ${.CURDIR}; \ 2189 ${MAKE} -f Makefile.inc1 \ 2190 DESTDIR=${SSTAGEDIR} \ 2191 PKG_VERSION=${PKG_VERSION} \ 2192 SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \ 2193 create-source-packages 2194 2195create-packages: .PHONY create-packages-world create-packages-kernel create-packages-source package-pkg create-packages-sets 2196 2197create-source-src-package: _pkgbootstrap .PHONY 2198 rm -f ${SSTAGEDIR}/src.plist 2>/dev/null || : 2199.if !empty(GIT_CMD) && exists(${GIT_CMD}) && exists(${SRCDIR}/.git) 2200 @cd ${SRCDIR}; \ 2201 ( echo "@override_prefix /usr/src" ; \ 2202 ${GIT_CMD} ls-files --recurse-submodules ":!:sys/" ) \ 2203 > ${SSTAGEDIR}/src.plist 2204 ${SRCDIR}/release/packages/generate-ucl.lua \ 2205 PKGNAME "src" \ 2206 PKGGENNAME "src" \ 2207 VERSION "${PKG_VERSION}" \ 2208 PKG_NAME_PREFIX "${PKG_NAME_PREFIX}" \ 2209 PKG_MAINTAINER "${PKG_MAINTAINER}" \ 2210 PKG_WWW "${PKG_WWW}" \ 2211 UCLFILES "${SRCDIR}/release/packages/ucl" \ 2212 ${SRCDIR}/release/packages/template.ucl \ 2213 ${SSTAGEDIR}/src.ucl 2214 ${PKG_CMD} -o ABI=${PKG_ABI} \ 2215 -o OSVERSION="${SRCRELDATE}" \ 2216 create -f ${PKG_FORMAT} ${PKG_CLEVEL} -T${PKG_CTHREADS} \ 2217 -M ${SSTAGEDIR}/src.ucl \ 2218 -p ${SSTAGEDIR}/src.plist \ 2219 -r ${SRCDIR} \ 2220 -o ${REPODIR}/${PKG_ABI}/${PKG_OUTPUT_DIR} 2221.endif 2222 2223create-source-src-sys-package: _pkgbootstrap .PHONY 2224 rm -f ${SSTAGEDIR}/src-sys.plist 2>/dev/null || : 2225.if !empty(GIT_CMD) && exists(${GIT_CMD}) && exists(${SRCDIR}/.git) 2226 @cd ${SRCDIR}; \ 2227 ( echo "@override_prefix /usr/src" ; \ 2228 ${GIT_CMD} ls-files --recurse-submodules "sys/" ) \ 2229 > ${SSTAGEDIR}/src-sys.plist 2230 ${SRCDIR}/release/packages/generate-ucl.lua \ 2231 PKGNAME "src-sys" \ 2232 PKGGENNAME "src-sys" \ 2233 VERSION "${PKG_VERSION}" \ 2234 PKG_NAME_PREFIX "${PKG_NAME_PREFIX}" \ 2235 PKG_MAINTAINER "${PKG_MAINTAINER}" \ 2236 PKG_WWW "${PKG_WWW}" \ 2237 UCLFILES "${SRCDIR}/release/packages/ucl" \ 2238 ${SRCDIR}/release/packages/template.ucl \ 2239 ${SSTAGEDIR}/src-sys.ucl 2240 ${PKG_CMD} -o ABI=${PKG_ABI} \ 2241 -o OSVERSION="${SRCRELDATE}" \ 2242 create -f ${PKG_FORMAT} ${PKG_CLEVEL} -T${PKG_CTHREADS} \ 2243 -M ${SSTAGEDIR}/src-sys.ucl \ 2244 -p ${SSTAGEDIR}/src-sys.plist \ 2245 -r ${SRCDIR} \ 2246 -o ${REPODIR}/${PKG_ABI}/${PKG_OUTPUT_DIR} 2247.endif 2248 2249create-source-packages: .PHONY _pkgbootstrap create-source-src-package create-source-src-sys-package 2250 2251create-world-packages: _pkgbootstrap .PHONY 2252 @rm -f ${WSTAGEDIR}/*.plist 2>/dev/null || : 2253 @cd ${WSTAGEDIR} ; \ 2254 ${METALOG_SORT_CMD} ${WSTAGEDIR}/${DISTDIR}/METALOG | \ 2255 awk -f ${SRCDIR}/release/scripts/mtree-to-plist.awk 2256 @for plist in ${WSTAGEDIR}/*.plist; do \ 2257 plist=$${plist##*/} ; \ 2258 pkgname=$${plist%.plist} ; \ 2259 echo "_PKGS+= $${pkgname}" ; \ 2260 done > ${WSTAGEDIR}/packages.mk 2261 ${_+_}@cd ${.CURDIR}; \ 2262 ${MAKE} -f Makefile.inc1 create-world-packages-jobs \ 2263 SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \ 2264 .MAKE.JOB.PREFIX= 2265 2266.if make(create-world-packages-jobs) 2267.include "${WSTAGEDIR}/packages.mk" 2268.endif 2269 2270create-world-packages-jobs: .PHONY 2271.for pkgname in ${_PKGS} 2272create-world-packages-jobs: create-world-package-${pkgname} 2273create-world-package-${pkgname}: .PHONY 2274 @sh ${SRCDIR}/release/packages/generate-ucl.sh -o ${pkgname} \ 2275 -s ${SRCDIR} -u ${WSTAGEDIR}/${pkgname}.ucl 2276 @if [ "$$(grep -vc '^@dir' ${WSTAGEDIR}/${pkgname}.plist)" -gt 0 ]; then \ 2277 awk -F\" ' \ 2278 /^name/ { printf("===> Creating %s-", $$2); next } \ 2279 /^version/ { print $$2; next } \ 2280 ' ${WSTAGEDIR}/${pkgname}.ucl && \ 2281 ${PKG_CMD} -o ABI=${PKG_ABI} -o ALLOW_BASE_SHLIBS=yes \ 2282 -o OSVERSION="${SRCRELDATE}" \ 2283 create -f ${PKG_FORMAT} ${PKG_CLEVEL} -T${PKG_CTHREADS} \ 2284 -M ${WSTAGEDIR}/${pkgname}.ucl \ 2285 -p ${WSTAGEDIR}/${pkgname}.plist \ 2286 -r ${WSTAGEDIR} \ 2287 -o ${REPODIR}/${PKG_ABI}/${PKG_OUTPUT_DIR}; \ 2288 else \ 2289 awk -F\" ' \ 2290 /^name/ { printf("===> Skipping %s-", $$2); next } \ 2291 /^version/ { print $$2; next } \ 2292 ' ${WSTAGEDIR}/${pkgname}.ucl; \ 2293 fi 2294.endfor 2295 2296create-sets-packages-jobs: .PHONY create-sets-packages 2297create-sets-packages: .PHONY 2298 @echo "==> Creating set metapackages." 2299 sh "${SRCDIR}/release/packages/create-sets.sh" "${SRCDIR}" \ 2300 "${WSTAGEDIR}" "${REPODIR}/${PKG_ABI}/${PKG_OUTPUT_DIR}" \ 2301 VERSION "${PKG_VERSION}" \ 2302 PKG_NAME_PREFIX "${PKG_NAME_PREFIX}" \ 2303 PKG_MAINTAINER "${PKG_MAINTAINER}" \ 2304 PKG_WWW "${PKG_WWW}" 2305 @for manifest in ${WSTAGEDIR}/set-*.ucl; do \ 2306 echo "--> Processing manifest: $$manifest"; \ 2307 ${PKG_CMD} -o ABI=${PKG_ABI} -o OSVERSION="${SRCRELDATE}" \ 2308 create -f ${PKG_FORMAT} ${PKG_CLEVEL} -T${PKG_CTHREADS} \ 2309 -M $$manifest \ 2310 -o "${REPODIR}/${PKG_ABI}/${PKG_OUTPUT_DIR}" \ 2311 || exit 1; \ 2312 done 2313 2314_default_flavor= -default 2315.if make(*package*) && exists(${KSTAGEDIR}/kernel.meta) 2316. if ${MK_DEBUG_FILES} != "no" 2317_debug=-dbg 2318. endif 2319 2320create-dtb-package: .PHONY 2321 @if [ -f ${KSTAGEDIR}/${DISTDIR}/dtb.plist ]; then \ 2322 ${SRCDIR}/release/packages/generate-ucl.lua \ 2323 PKGNAME "dtb" \ 2324 PKGGENNAME "dtb" \ 2325 VERSION "${PKG_VERSION}" \ 2326 PKG_NAME_PREFIX "${PKG_NAME_PREFIX}" \ 2327 PKG_MAINTAINER "${PKG_MAINTAINER}" \ 2328 PKG_WWW "${PKG_WWW}" \ 2329 UCLFILES "${SRCDIR}/release/packages/ucl" \ 2330 ${SRCDIR}/release/packages/template.ucl \ 2331 ${KSTAGEDIR}/${DISTDIR}/dtb.ucl ; \ 2332 awk -F\" ' \ 2333 /name/ { printf("===> Creating %s-", $$2); next } \ 2334 /version/ {print $$2; next } ' \ 2335 ${KSTAGEDIR}/${DISTDIR}/dtb.ucl ; \ 2336 ${PKG_CMD} -o ABI=${PKG_ABI} -o ALLOW_BASE_SHLIBS=yes \ 2337 -o OSVERSION="${SRCRELDATE}" \ 2338 create -f ${PKG_FORMAT} ${PKG_CLEVEL} -T${PKG_CTHREADS} \ 2339 -M ${KSTAGEDIR}/${DISTDIR}/dtb.ucl \ 2340 -p ${KSTAGEDIR}/${DISTDIR}/dtb.plist \ 2341 -r ${KSTAGEDIR}/${DISTDIR} \ 2342 -o ${REPODIR}/${PKG_ABI}/${PKG_OUTPUT_DIR} ; \ 2343 fi 2344 2345create-kernel-packages: .PHONY create-kernel-flavored-packages create-dtb-package 2346create-kernel-flavored-packages: .PHONY 2347.ORDER: create-kernel-flavored-packages create-dtb-package 2348 2349. for flavor in "" ${_debug} 2350create-kernel-flavored-packages: create-kernel-packages-flavor${flavor:C,^""$,${_default_flavor},} 2351create-kernel-packages-flavor${flavor:C,^""$,${_default_flavor},}: _pkgbootstrap .PHONY 2352 @cd ${KSTAGEDIR}/${DISTDIR} ; \ 2353 ${METALOG_SORT_CMD} ${KSTAGEDIR}/kernel.meta | \ 2354 awk -f ${SRCDIR}/release/scripts/mtree-to-plist.awk \ 2355 -v kernel=yes -v _kernconf=${INSTALLKERNEL} ; \ 2356 ${SRCDIR}/release/packages/generate-ucl.lua \ 2357 PKGNAME "kernel-${INSTALLKERNEL:tl}${flavor}" \ 2358 PKGGENNAME "kernel" \ 2359 VERSION "${PKG_VERSION}" \ 2360 KERNELDIR "kernel" \ 2361 KERNEL_NAME "${INSTALLKERNEL}" \ 2362 KERNEL_FLAVOR "${flavor}" \ 2363 PKG_NAME_PREFIX "${PKG_NAME_PREFIX}" \ 2364 PKG_MAINTAINER "${PKG_MAINTAINER}" \ 2365 PKG_WWW "${PKG_WWW}" \ 2366 UCLFILES "${SRCDIR}/release/packages/ucl" \ 2367 ${SRCDIR}/release/packages/template.ucl \ 2368 ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl ; \ 2369 awk -F\" ' \ 2370 /name/ { printf("===> Creating %s-", $$2); next } \ 2371 /version/ {print $$2; next } ' \ 2372 ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl ; \ 2373 ${PKG_CMD} -o ABI=${PKG_ABI} -o ALLOW_BASE_SHLIBS=yes \ 2374 -o OSVERSION="${SRCRELDATE}" \ 2375 create -f ${PKG_FORMAT} ${PKG_CLEVEL} -T${PKG_CTHREADS} \ 2376 -M ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl \ 2377 -p ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.plist \ 2378 -r ${KSTAGEDIR}/${DISTDIR} \ 2379 -o ${REPODIR}/${PKG_ABI}/${PKG_OUTPUT_DIR} 2380. endfor 2381.else 2382create-kernel-packages: .PHONY 2383 2384.endif 2385.if !empty(INSTALLEXTRAKERNELS) 2386.for _kernel in ${INSTALLEXTRAKERNELS} 2387. if exists(${KSTAGEDIR}/kernel.${_kernel}.meta) 2388. if ${MK_DEBUG_FILES} != "no" 2389_debug=-dbg 2390. endif 2391. for flavor in "" ${_debug} 2392create-kernel-packages: create-kernel-packages-extra-flavor${flavor:C,^""$,${_default_flavor},}-${_kernel} 2393create-kernel-packages-extra-flavor${flavor:C,^""$,${_default_flavor},}-${_kernel}: _pkgbootstrap .PHONY 2394 @cd ${KSTAGEDIR}/kernel.${_kernel} ; \ 2395 ${METALOG_SORT_CMD} ${KSTAGEDIR}/kernel.${_kernel}.meta | \ 2396 awk -f ${SRCDIR}/release/scripts/mtree-to-plist.awk \ 2397 -v kernel=yes -v _kernconf=${_kernel} ; \ 2398 ${SRCDIR}/release/packages/generate-ucl.lua \ 2399 PKGNAME "kernel-${_kernel:tl}${flavor}" \ 2400 PKGGENNAME "kernel" \ 2401 FORCEINCLUDE "kernel${flavor}" \ 2402 VERSION "${PKG_VERSION}" \ 2403 KERNEL_NAME "${_kernel:tl}" \ 2404 KERNEL_FLAVOR "${flavor}" \ 2405 KERNELDIR "kernel.${_kernel}" \ 2406 PKG_NAME_PREFIX "${PKG_NAME_PREFIX}" \ 2407 PKG_MAINTAINER "${PKG_MAINTAINER}" \ 2408 PKG_WWW "${PKG_WWW}" \ 2409 UCLFILES "${SRCDIR}/release/packages/ucl" \ 2410 ${SRCDIR}/release/packages/template.ucl \ 2411 ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.ucl ; \ 2412 awk -F\" ' \ 2413 /name/ { printf("===> Creating %s-", $$2); next } \ 2414 /version/ {print $$2; next } ' \ 2415 ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.ucl ; \ 2416 ${PKG_CMD} -o ABI=${PKG_ABI} -o ALLOW_BASE_SHLIBS=yes \ 2417 -o OSVERSION="${SRCRELDATE}" \ 2418 create -f ${PKG_FORMAT} ${PKG_CLEVEL} -T${PKG_CTHREADS} \ 2419 -M ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.ucl \ 2420 -p ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.plist \ 2421 -r ${KSTAGEDIR}/kernel.${_kernel} \ 2422 -o ${REPODIR}/${PKG_ABI}/${PKG_OUTPUT_DIR} 2423. endfor 2424. endif 2425. endfor 2426.endif 2427 2428sign-packages: .PHONY 2429 ${_+_}@cd ${.CURDIR}; \ 2430 ${MAKE} -f Makefile.inc1 \ 2431 PKG_VERSION=${PKG_VERSION} \ 2432 SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \ 2433 real-sign-packages 2434 2435real-sign-packages: _pkgbootstrap .PHONY 2436 printf "version = 2;\n" > ${WSTAGEDIR}/meta 2437 @${PKG_CMD} -o ABI=${PKG_ABI} -o OSVERSION="${SRCRELDATE}" \ 2438 -o WORKERS_COUNT=${PKG_WORKERS_COUNT} repo \ 2439 -m ${WSTAGEDIR}/meta \ 2440 -o ${REPODIR}/${PKG_ABI}/${PKG_VERSION} \ 2441 ${REPODIR}/${PKG_ABI}/${PKG_VERSION} \ 2442 ${PKG_REPO_SIGNING_KEY} ; \ 2443 cd ${REPODIR}/${PKG_ABI}; \ 2444 ln -hfs ${PKG_OUTPUT_DIR} latest 2445 2446# 2447# 2448# checkworld 2449# 2450# Run test suite on installed world. 2451# 2452checkworld: .PHONY 2453 @if [ ! -x "${LOCALBASE}/bin/kyua" ] && [ ! -x "/usr/bin/kyua" ]; then \ 2454 echo "You need kyua (devel/kyua) to run the test suite." | /usr/bin/fmt; \ 2455 exit 1; \ 2456 fi 2457 ${_+_}PATH="$$PATH:${LOCALBASE}/bin" kyua test -k ${TESTSBASE}/Kyuafile 2458 2459# 2460# 2461# doxygen 2462# 2463# Build the API documentation with doxygen 2464# 2465doxygen: .PHONY 2466 @if [ ! -x "${LOCALBASE}/bin/doxygen" ]; then \ 2467 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \ 2468 exit 1; \ 2469 fi 2470 @if [ ! -x "${LOCALBASE}/bin/tex" ]; then \ 2471 echo "You need TeX (print/texlive-full) to generate the API documentation of the kernel." | /usr/bin/fmt; \ 2472 exit 1; \ 2473 fi 2474 @if [ ! -x "${LOCALBASE}/bin/dot" ]; then \ 2475 echo "You need graphviz (graphics/graphviz) to generate the API documentation of the kernel." | /usr/bin/fmt; \ 2476 exit 1; \ 2477 fi 2478 ${_+_}cd ${.CURDIR}/tools/kerneldoc/subsys; ${MAKE} obj all 2479 2480# 2481# ------------------------------------------------------------------------ 2482# 2483# From here onwards are utility targets used by the 'make world' and 2484# related targets. If your 'world' breaks, you may like to try to fix 2485# the problem and manually run the following targets to attempt to 2486# complete the build. Beware, this is *not* guaranteed to work, you 2487# need to have a pretty good grip on the current state of the system 2488# to attempt to manually finish it. If in doubt, 'make world' again. 2489# 2490 2491# 2492# legacy: Build compatibility shims for the next three targets. This is a 2493# minimal set of tools and shims necessary to compensate for older systems 2494# which don't have the APIs required by the targets built in bootstrap-tools, 2495# build-tools or cross-tools. 2496# 2497legacy: .PHONY 2498.if ${BOOTSTRAPPING} < ${MINIMUM_SUPPORTED_OSREL} && ${BOOTSTRAPPING} != 0 2499 @echo "ERROR: Source upgrades from versions prior to ${MINIMUM_SUPPORTED_REL} are not supported."; \ 2500 false 2501.endif 2502 2503.for _tool in \ 2504 tools/build \ 2505 ${LOCAL_LEGACY_DIRS} 2506 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,all,install)"; \ 2507 cd ${.CURDIR}/${_tool}; \ 2508 if [ -z "${NO_OBJWALK}" ]; then ${MAKE} DIRPRFX=${_tool}/ obj; fi; \ 2509 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${WORLDTMP}/legacy includes; \ 2510 ${MAKE} DIRPRFX=${_tool}/ MK_INCLUDES=no all; \ 2511 ${MAKE} DIRPRFX=${_tool}/ MK_INCLUDES=no \ 2512 DESTDIR=${WORLDTMP}/legacy install 2513.endfor 2514 2515# 2516# bootstrap-tools: Build tools needed for compatibility. These are binaries that 2517# are built to build other binaries in the system. However, the focus of these 2518# binaries is usually quite narrow. Bootstrap tools use the host's compiler and 2519# libraries, augmented by -legacy, in addition to the libraries built during 2520# bootstrap-tools. 2521# 2522_bt= _bootstrap-tools 2523 2524# We want to run the build with only ${WORLDTMP} in $PATH to ensure we don't 2525# accidentally run tools that are incompatible but happen to be in $PATH. 2526# This is especially important when building on Linux/MacOS where many of the 2527# programs used during the build accept different flags or generate different 2528# output. On those platforms we only symlink the tools known to be compatible 2529# (e.g. basic utilities such as mkdir) into ${WORLDTMP} and build all others 2530# from the FreeBSD sources during the bootstrap-tools stage. 2531# We want to build without the user's $PATH starting in the bootstrap-tools 2532# phase so the tools used in that phase (ln, cp, etc) must have already been 2533# linked to $WORLDTMP. The tools are listed in the _host_tools_to_symlink 2534# variable in tools/build/Makefile and are linked during the legacy phase. 2535# Since they could be Linux or MacOS binaries, too we must only use flags that 2536# are portable across operating systems. 2537 2538# If BOOTSTRAP_ALL_TOOLS is set we will build all the required tools from the 2539# current source tree. Otherwise we create a symlink to the version found in 2540# $PATH during the bootstrap-tools stage. 2541# When building on non-FreeBSD systems we can't assume that the host binaries 2542# accept compatible flags or produce compatible output. Therefore we force 2543# BOOTSTRAP_ALL_TOOLS and just build the FreeBSD version of the binary. 2544.if defined(CROSSBUILD_HOST) 2545BOOTSTRAP_ALL_TOOLS:= 1 2546.endif 2547.if defined(BOOTSTRAP_ALL_TOOLS) 2548# BOOTSTRAPPING will be set on the command line so we can't override it here. 2549# Instead set BOOTSTRAPPING_OSRELDATE so that the value 0 is set ${BSARGS} 2550BOOTSTRAPPING_OSRELDATE:= 0 2551.endif 2552 2553.if ${MK_GAMES} != "no" 2554_strfile= usr.bin/fortune/strfile 2555.endif 2556 2557# vtfontcvt is used to build font files for loader and to generate 2558# C source for loader built in font (8x16.c). 2559_vtfontcvt= usr.bin/vtfontcvt 2560 2561# zic is used to compile timezone data 2562.if ${MK_ZONEINFO} != "no" 2563_zic= usr.sbin/zic 2564.endif 2565 2566# If we are not building the bootstrap because BOOTSTRAPPING is sufficient 2567# we symlink the host version to $WORLDTMP instead. By doing this we can also 2568# detect when a bootstrap tool is being used without the required MK_FOO. 2569# If you add a new bootstrap tool where we could also use the host version, 2570# please ensure that you also add a .else case where you add the tool to the 2571# _bootstrap_tools_links variable. 2572.if ${BOOTSTRAPPING} < 1000033 2573# Note: lex needs m4 to build but m4 also depends on lex (which needs m4 to 2574# generate any files). To fix this cyclic dependency we can build a bootstrap 2575# version of m4 (with pre-generated files) then use that to build the real m4. 2576# We can't simply use the host m4 since e.g. the macOS version does not accept 2577# the flags that are passed by lex. 2578# For lex we also use the pre-gerated files since we would otherwise need to 2579# build awk and sed first (which need lex to build) 2580# TODO: add a _bootstrap_lex and then build the real lex afterwards 2581_lex= usr.bin/lex 2582_m4= tools/build/bootstrap-m4 usr.bin/m4 2583${_bt}-tools/build/bootstrap-m4: ${_bt}-usr.bin/lex ${_bt}-lib/libopenbsd ${_bt}-usr.bin/yacc 2584${_bt}-usr.bin/m4: ${_bt}-lib/libopenbsd ${_bt}-usr.bin/yacc ${_bt}-usr.bin/lex ${_bt}-tools/build/bootstrap-m4 2585_bt_m4_depend=${_bt}-usr.bin/m4 2586_bt_lex_depend=${_bt}-usr.bin/lex ${_bt_m4_depend} 2587.else 2588_bootstrap_tools_links+=m4 lex 2589.endif 2590 2591# ELF Tool Chain libraries are needed for ELF tools and dtrace tools. 2592# r296685 fix cross-endian objcopy 2593# r310724 fixed PR 215350, a crash in libdwarf with objects built by GCC 6.2. 2594# r334881 added libdwarf constants used by ctfconvert. 2595# r338478 fixed a crash in objcopy for mips64el objects 2596# r339083 libelf: correct mips64el test to use ELF header 2597# r348347 Add missing powerpc64 relocation support to libdwarf 2598.if ${BOOTSTRAPPING} < 1300030 2599_elftoolchain_libs= lib/libelf lib/libdwarf lib/libzstd 2600${_bt}-lib/libelf: ${_bt_m4_depend} 2601${_bt}-lib/libdwarf: ${_bt_m4_depend} 2602_bt_libelf_depend=${_bt}-lib/libelf 2603.endif 2604 2605_libkldelf= lib/libkldelf 2606${_bt}-lib/libkldelf: ${_bt_libelf_depend} 2607_bt_libkldelf_depend=${_bt}-lib/libkldelf 2608 2609_kldxref= usr.sbin/kldxref 2610${_bt}-usr.sbin/kldxref: ${_bt_libelf_depend} ${_bt_libkldelf_depend} 2611 2612# flua is required to regenerate syscall files. It first appeared during the 2613# 13.0-CURRENT cycle, thus needs to be built on -older releases and stable 2614# branches. 2615.if ${BOOTSTRAPPING} < 1300059 2616${_bt}-libexec/flua: ${_bt}-lib/liblua 2617_flua= lib/liblua libexec/flua 2618.if ${BOOTSTRAPPING} == 0 2619_flua+= lib/libmd lib/libucl lib/libyaml 2620${_bt}-libexec/flua: ${_bt}-lib/libmd ${_bt}-lib/libucl ${_bt}-lib/libyaml 2621.endif # BOOTSTRAPPING == 0 2622.endif 2623 2624# r245440 mtree -N support added 2625# r313404 requires sha384.h for libnetbsd, added to libmd in r292782 2626.if ${BOOTSTRAPPING} < 1100093 2627_libnetbsd= lib/libnetbsd 2628_nmtree= lib/libmd \ 2629 usr.sbin/nmtree 2630 2631${_bt}-lib/libnetbsd: ${_bt}-lib/libmd 2632${_bt}-usr.sbin/nmtree: ${_bt}-lib/libnetbsd 2633.else 2634_bootstrap_tools_links+=mtree 2635.endif 2636 2637# r246097: log addition login.conf.db, passwd, pwd.db, and spwd.db with cat -l 2638.if ${BOOTSTRAPPING} < 1000027 2639_cat= bin/cat 2640.else 2641_bootstrap_tools_links+=cat 2642.endif 2643 2644# r277259 crunchide: Correct 64-bit section header offset 2645# r281674 crunchide: always include both 32- and 64-bit ELF support 2646.if ${BOOTSTRAPPING} < 1100078 2647_crunchide= usr.sbin/crunch/crunchide 2648.else 2649_bootstrap_tools_links+=crunchide 2650.endif 2651 2652# 1400052, 1300526, 1203507: Removed -dc from linker invocation 2653.if ${BOOTSTRAPPING} < 1203507 || \ 2654 (${BOOTSTRAPPING} > 1300000 && ${BOOTSTRAPPING} < 1300526) || \ 2655 (${BOOTSTRAPPING} > 1400000 && ${BOOTSTRAPPING} < 1400052) 2656_crunchgen= usr.sbin/crunch/crunchgen 2657.else 2658_bootstrap_tools_links+=crunchgen 2659.endif 2660 2661# The ATKBD_DFLT_KEYMAP, UKBD_DFLT_KEYMAP and KBDMUX_DFLT_KEYMAP kernel options 2662# require kbdcontrol. Note that, even on FreeBSD, the host will lack kbdcontrol 2663# if built with WITHOUT_LEGACY_CONSOLE. 2664.if defined(BOOTSTRAP_ALL_TOOLS) || !exists(/usr/sbin/kbdcontrol) 2665_kbdcontrol= usr.sbin/kbdcontrol 2666.else 2667_bootstrap_tools_links+=kbdcontrol 2668.endif 2669 2670.if ${MK_DISK_IMAGE_TOOLS_BOOTSTRAP} != "no" 2671_etdump= usr.bin/etdump 2672_makefs= usr.sbin/makefs 2673 2674_libnetbsd= lib/libnetbsd 2675${_bt}-usr.sbin/makefs: ${_bt}-lib/libnetbsd 2676 2677.if defined(BOOTSTRAP_ALL_TOOLS) 2678_libsbuf= lib/libsbuf 2679${_bt}-usr.sbin/makefs: ${_bt}-lib/libsbuf 2680.endif 2681.endif 2682 2683# 1300102: VHDX support 2684.if ${BOOTSTRAPPING} < 1201520 || \ 2685 (${BOOTSTRAPPING} > 1300000 && ${BOOTSTRAPPING} < 1300102) || \ 2686 ${MK_DISK_IMAGE_TOOLS_BOOTSTRAP} != "no" 2687_mkimg= usr.bin/mkimg 2688.else 2689_bootstrap_tools_links+=mkimg 2690.endif 2691 2692_yacc= usr.bin/yacc 2693 2694.if ${MK_BSNMP} != "no" 2695_gensnmptree= usr.sbin/bsnmpd/gensnmptree 2696.endif 2697 2698 2699# We need to build tblgen when we're building clang or lld, either as 2700# bootstrap tools, or as the part of the normal build. 2701# llvm-tblgen is also needed for various llvm binutils (e.g. objcopy). 2702.if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_CLANG} != "no" || \ 2703 ${MK_LLD_BOOTSTRAP} != "no" || ${MK_LLD} != "no" || \ 2704 ${MK_LLDB} != "no" || ${MK_LLVM_BINUTILS} != "no" 2705_clang_tblgen= \ 2706 lib/clang/libllvmminimal \ 2707 usr.bin/clang/llvm-min-tblgen \ 2708 usr.bin/clang/llvm-tblgen 2709.if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_CLANG} != "no" || \ 2710 ${MK_LLDB} != "no" 2711_clang_tblgen+= lib/clang/libclangminimal 2712_clang_tblgen+= usr.bin/clang/clang-tblgen 2713.endif 2714.if ${MK_LLDB} != "no" 2715_clang_tblgen+= usr.bin/clang/lldb-tblgen 2716.endif 2717${_bt}-usr.bin/clang/clang-tblgen: ${_bt}-lib/clang/libllvmminimal 2718${_bt}-usr.bin/clang/lldb-tblgen: ${_bt}-lib/clang/libllvmminimal 2719${_bt}-usr.bin/clang/llvm-min-tblgen: ${_bt}-lib/clang/libllvmminimal 2720${_bt}-usr.bin/clang/llvm-tblgen: ${_bt}-lib/clang/libllvmminimal 2721${_bt}-usr.bin/clang/llvm-tblgen: ${_bt}-usr.bin/clang/llvm-min-tblgen 2722.endif 2723 2724# C.UTF-8 is always built in share/ctypes and we need localedef for that. 2725_localedef= usr.bin/localedef 2726${_bt}-usr.bin/localedef: ${_bt}-usr.bin/yacc ${_bt_lex_depend} 2727 2728.if ${MK_ICONV} != "no" 2729_mkesdb= usr.bin/mkesdb 2730_mkcsmapper= usr.bin/mkcsmapper 2731${_bt}-usr.bin/mkesdb: ${_bt}-usr.bin/yacc ${_bt_lex_depend} 2732${_bt}-usr.bin/mkcsmapper: ${_bt}-usr.bin/yacc ${_bt_lex_depend} 2733.endif 2734 2735.if ${MK_KERBEROS} != "no" 2736.if ${MK_MITKRB5} != "no" 2737_kerberos5_bootstrap_tools= \ 2738 krb5/util/build-tools \ 2739 krb5/util/compile_et \ 2740 krb5/util/support \ 2741 krb5/util/et \ 2742 krb5/util/ss \ 2743 krb5/util/profile \ 2744 krb5/util/verto 2745# krb5/include \ 2746# krb5/lib/crypto \ 2747# krb5/lib/krb5 \ 2748# krb5/lib/gssapi 2749.else 2750_kerberos5_bootstrap_tools= \ 2751 kerberos5/tools/make-roken \ 2752 kerberos5/lib/libroken \ 2753 kerberos5/lib/libvers \ 2754 kerberos5/tools/asn1_compile \ 2755 kerberos5/tools/slc \ 2756 usr.bin/compile_et 2757 2758.endif 2759.ORDER: ${_kerberos5_bootstrap_tools:C/^/${_bt}-/g} 2760.for _tool in ${_kerberos5_bootstrap_tools} 2761${_bt}-${_tool}: ${_bt}-usr.bin/yacc ${_bt_lex_depend} 2762.endfor 2763.endif 2764 2765${_bt}-usr.bin/mandoc: ${_bt}-lib/libopenbsd 2766 2767# The tools listed in _basic_bootstrap_tools will generally not be 2768# bootstrapped unless BOOTSTRAP_ALL_TOOL is set. However, when building on a 2769# Linux or MacOS host the host versions are incompatible so we need to build 2770# them from the source tree. Usually the link name will be the same as the subdir, 2771# but some directories such as grep or test install multiple binaries. In that 2772# case we use the _basic_bootstrap_tools_multilink variable which is a list of 2773# subdirectory and comma-separated list of files. 2774_basic_bootstrap_tools_multilink=usr.bin/grep grep,egrep,fgrep 2775_basic_bootstrap_tools_multilink+=bin/test test,[ 2776# bootstrap tools needed by buildworld: 2777_basic_bootstrap_tools+=usr.bin/cut bin/expr usr.bin/gencat usr.bin/join \ 2778 usr.bin/mktemp bin/realpath bin/rmdir usr.bin/sed usr.bin/sort \ 2779 usr.bin/truncate usr.bin/tsort 2780# Some build scripts use nawk instead of awk (this happens at least in 2781# cddl/contrib/opensolaris/lib/libdtrace/common/mknames.sh) so we need both awk 2782# and nawk in ${WORLDTMP}/legacy/bin. 2783_basic_bootstrap_tools_multilink+=usr.bin/awk awk,nawk 2784# file2c is required for building usr.sbin/config: 2785_basic_bootstrap_tools+=usr.bin/file2c 2786# uuencode/uudecode required for share/tabset 2787_basic_bootstrap_tools_multilink+=usr.bin/bintrans uuencode,uudecode 2788# xargs is required by mkioctls 2789_basic_bootstrap_tools+=usr.bin/xargs 2790# cap_mkdb is required for share/termcap: 2791_basic_bootstrap_tools+=usr.bin/cap_mkdb 2792# services_mkdb/pwd_mkdb are required for installworld: 2793_basic_bootstrap_tools+=usr.sbin/services_mkdb usr.sbin/pwd_mkdb 2794# ldd is required for installcheck (TODO: just always use /usr/bin/ldd instead?) 2795.if !defined(CROSSBUILD_HOST) 2796# ldd is only needed for updating the running system so we don't need to 2797# bootstrap ldd on non-FreeBSD systems 2798_basic_bootstrap_tools+=usr.bin/ldd 2799.endif 2800# sysctl/chflags are required for installkernel: 2801.if !defined(CROSSBUILD_HOST) 2802_basic_bootstrap_tools+=bin/chflags 2803# Note: sysctl does not bootstrap on FreeBSD < 13 anymore, but that doesn't 2804# matter since we don't need any of the new features for the build. 2805_bootstrap_tools_links+=sysctl 2806.else 2807# When building on non-FreeBSD, install a fake chflags instead since the 2808# version from the source tree cannot work. We also don't need sysctl since we 2809# are install with -DNO_ROOT. 2810_other_bootstrap_tools+=tools/build/cross-build/fake_chflags 2811.endif 2812# mkfifo is used by sys/conf/newvers.sh 2813_basic_bootstrap_tools+=usr.bin/mkfifo 2814# jot is needed for the mkimg tests 2815_basic_bootstrap_tools+=usr.bin/jot 2816 2817.if defined(BOOTSTRAP_ALL_TOOLS) 2818# sha256 and sha512 are used by release/ (and possibly others) 2819_basic_bootstrap_tools+=sbin/md5 2820.endif 2821 2822# tzsetup is needed as an install tool 2823.if ${MK_ZONEINFO} != "no" 2824_basic_bootstrap_tools+=usr.sbin/tzsetup 2825.endif 2826 2827# certctl is needed as an install tool. libcrypto is rather heavy, so we'll 2828# build that alongside it only for platforms that don't expose headers for 2829# OpenSSL, like macOS, or when building on releases with OpenSSL 1.x. 2830.if ${MK_CAROOT} != "no" && ${MK_OPENSSL} != "no" 2831.if ${.MAKE.OS} == "Darwin" || \ 2832 (${.MAKE.OS} == "FreeBSD" && ${BOOTSTRAPPING} < 1400000) 2833_bootstrap_libcrypto=secure/lib/libcrypto 2834${_bt}-usr.sbin/certctl: ${_bt}-secure/lib/libcrypto 2835.endif 2836_certctl=usr.sbin/certctl 2837.endif 2838 2839.if defined(BOOTSTRAP_ALL_TOOLS) 2840_other_bootstrap_tools+=${_basic_bootstrap_tools} 2841.for _subdir _links in ${_basic_bootstrap_tools_multilink} 2842_other_bootstrap_tools+=${_subdir} 2843.endfor 2844${_bt}-usr.bin/awk: ${_bt_lex_depend} ${_bt}-usr.bin/yacc 2845${_bt}-bin/expr: ${_bt_lex_depend} ${_bt}-usr.bin/yacc 2846# If we are bootstrapping file2c, we have to build it before config: 2847${_bt}-usr.sbin/config: ${_bt}-usr.bin/file2c ${_bt_lex_depend} 2848# Note: no symlink to make/bmake in the !BOOTSTRAP_ALL_TOOLS case here since 2849# the links to make/bmake make links will have already have been created in the 2850# `make legacy` step. Not adding a link to make is important on non-FreeBSD 2851# since "make" will usually point to GNU make there. 2852_other_bootstrap_tools+=usr.bin/bmake 2853 2854# Avoid dependency on host bz2 headers: 2855_other_bootstrap_tools+=lib/libbz2 2856${_bt}-usr.bin/grep: ${_bt}-lib/libbz2 2857 2858# libdwarf depends on libz 2859_other_bootstrap_tools+=lib/libz 2860${_bt}-lib/libdwarf: ${_bt}-lib/libz 2861 2862# libroken depends on libcrypt 2863_other_bootstrap_tools+=lib/libcrypt 2864${_bt}-lib/libroken: ${_bt}-lib/libcrypt 2865.else 2866# All tools in _basic_bootstrap_tools have the same name as the subdirectory 2867# so we can use :T to get the name of the symlinks that we need to create. 2868_bootstrap_tools_links+=${_basic_bootstrap_tools:T} 2869.for _subdir _links in ${_basic_bootstrap_tools_multilink} 2870_bootstrap_tools_links+=${_links:S/,/ /g} 2871.endfor 2872.endif # defined(BOOTSTRAP_ALL_TOOLS) 2873 2874# Link the tools that we need for building but don't need to bootstrap because 2875# the host version is known to be compatible into ${WORLDTMP}/legacy 2876# We do this before building any of the bootstrap tools in case they depend on 2877# the presence of any of the links (e.g. as m4/lex/awk) 2878${_bt}-links: .PHONY 2879 2880.for _tool in ${_bootstrap_tools_links} 2881${_bt}-link-${_tool}: .PHONY 2882 @rm -f "${WORLDTMP}/legacy/bin/${_tool}"; \ 2883 source_path=`which ${_tool} || true`; \ 2884 if [ ! -e "$${source_path}" ] ; then \ 2885 echo "Cannot find host tool '${_tool}'"; false; \ 2886 fi; \ 2887 install -p "$${source_path}" "${WORLDTMP}/legacy/bin/${_tool}" 2888${_bt}-links: ${_bt}-link-${_tool} 2889.endfor 2890 2891bootstrap-tools: ${_bt}-links .PHONY 2892 2893# Please document (add comment) why something is in 'bootstrap-tools'. 2894# Try to bound the building of the bootstrap-tool to just the 2895# FreeBSD versions that need the tool built at this stage of the build. 2896.for _tool in \ 2897 ${_clang_tblgen} \ 2898 ${_kerberos5_bootstrap_tools} \ 2899 ${_strfile} \ 2900 usr.bin/dtc \ 2901 ${_cat} \ 2902 ${_bootstrap_libcrypto} \ 2903 ${_certctl} \ 2904 ${_kbdcontrol} \ 2905 ${_elftoolchain_libs} \ 2906 ${_libkldelf} \ 2907 ${_kldxref} \ 2908 lib/libopenbsd \ 2909 usr.bin/mandoc \ 2910 usr.bin/rpcgen \ 2911 ${_yacc} \ 2912 ${_m4} \ 2913 ${_lex} \ 2914 ${_other_bootstrap_tools} \ 2915 usr.bin/xinstall \ 2916 ${_gensnmptree} \ 2917 usr.sbin/config \ 2918 ${_flua} \ 2919 ${_crunchide} \ 2920 ${_crunchgen} \ 2921 ${_etdump} \ 2922 ${_libnetbsd} \ 2923 ${_libsbuf} \ 2924 ${_makefs} \ 2925 ${_mkimg} \ 2926 ${_nmtree} \ 2927 ${_vtfontcvt} \ 2928 ${_localedef} \ 2929 ${_mkcsmapper} \ 2930 ${_mkesdb} \ 2931 ${_zic} \ 2932 ${LOCAL_BSTOOL_DIRS} 2933# We don't enforce any particular uniqueness of targets in the above list; it 2934# may be the case that different bootstrap tools may have shared dependencies 2935# at different BOOTSTRAPPING points, so we don't object to them using their own 2936# conditionals and duplicating them into their ${_foo} variable to ease future 2937# maintenance if we purge some entries. These target names are purposefully 2938# unique and this is the only place that should be generating commands for them, 2939# but the target may have been defined earlier to express dependencies -- thus, 2940# we specifically want commands() here. 2941.if !commands(${_bt}-${_tool}) 2942${_bt}-${_tool}: ${_bt}-links .PHONY .MAKE 2943 ${_+_}@${ECHODIR} "===> ${_tool} (obj,all,install)"; \ 2944 cd ${.CURDIR}/${_tool}; \ 2945 if [ -z "${NO_OBJWALK}" ]; then ${MAKE} DIRPRFX=${_tool}/ obj; fi; \ 2946 if [ "${_tool}" = "usr.bin/lex" ]; then \ 2947 ${MAKE} DIRPRFX=${_tool}/ bootstrap; \ 2948 fi; \ 2949 ${MAKE} DIRPRFX=${_tool}/ all; \ 2950 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${WORLDTMP}/legacy install 2951bootstrap-tools: ${_bt}-${_tool} 2952.endif 2953.endfor 2954.if target(${_bt}-lib/libmd) 2955# If we are bootstrapping libmd (e.g. when building on macOS/Linux) add the 2956# necessary dependencies: 2957${_bt}-usr.bin/sort: ${_bt}-lib/libmd 2958${_bt}-usr.bin/xinstall: ${_bt}-lib/libmd 2959${_bt}-sbin/md5: ${_bt}-lib/libmd 2960.endif 2961 2962 2963# 2964# build-tools: Build special purpose build tools 2965# 2966.if !defined(NO_SHARE) && ${MK_SYSCONS} != "no" 2967_share= share/syscons/scrnmaps 2968.endif 2969 2970.if ${MK_RESCUE} != "no" 2971# rescue includes programs that have build-tools targets 2972_rescue=rescue/rescue 2973.endif 2974 2975.if ${MK_TCSH} != "no" 2976_tcsh=bin/csh 2977.endif 2978.if ${MK_FILE} != "no" 2979_libmagic=lib/libmagic 2980.endif 2981 2982.if ${MK_PMC} != "no" 2983_jevents=lib/libpmc/pmu-events 2984.endif 2985 2986# kernel-toolchain skips _cleanobj, so handle cleaning up previous 2987# build-tools directories if needed. 2988.if ${MK_CLEAN} == "yes" && make(kernel-toolchain) 2989_bt_clean= ${CLEANDIR} 2990.endif 2991 2992.for _tool in \ 2993 ${_tcsh} \ 2994 bin/sh \ 2995 ${LOCAL_TOOL_DIRS} \ 2996 ${_jevents} \ 2997 lib/ncurses/tinfo \ 2998 ${_rescue} \ 2999 ${_share} \ 3000 usr.bin/awk \ 3001 ${_libmagic} \ 3002 usr.bin/vi/catalog 3003build-tools_${_tool}: .PHONY 3004 ${_+_}@${ECHODIR} "===> ${_tool} (${_bt_clean:D${_bt_clean},}obj,build-tools)"; \ 3005 cd ${.CURDIR}/${_tool}; \ 3006 if [ -n "${_bt_clean}" ]; then ${MAKE} DIRPRFX=${_tool}/ ${_bt_clean}; fi; \ 3007 if [ -z "${NO_OBJWALK}" ]; then ${MAKE} DIRPRFX=${_tool}/ obj; fi; \ 3008 ${MAKE} DIRPRFX=${_tool}/ build-tools 3009build-tools: build-tools_${_tool} 3010.endfor 3011 3012# 3013# kernel-tools: Build kernel-building tools 3014# 3015kernel-tools: .PHONY 3016 mkdir -p ${WORLDTMP}/usr 3017 ${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 3018 -p ${WORLDTMP}/usr >/dev/null 3019 3020# 3021# cross-tools: All the tools needed to build the rest of the system after 3022# we get done with the earlier stages. It is the last set of tools needed 3023# to begin building the target binaries. 3024# 3025.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${BUILD_WITH_STRICT_TMPPATH} != 0 3026.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386" 3027_btxld= usr.sbin/btxld 3028.endif 3029.endif 3030 3031# Rebuild ctfconvert and ctfmerge to avoid difficult-to-diagnose failures 3032# resulting from missing bug fixes or ELF Toolchain updates. 3033.if ${MK_CDDL} != "no" 3034_dtrace_tools= cddl/lib/libctf cddl/lib/libspl cddl/usr.bin/ctfconvert \ 3035 cddl/usr.bin/ctfmerge 3036.endif 3037 3038.if ${MK_ELFTOOLCHAIN_BOOTSTRAP} != "no" 3039# Some bespoke tools from or based on ELF Tool Chain. elfcopy is included 3040# because llvm-objcopy is currently not capable of translating ELF to PE32+, 3041# which is required for EFI boot programs. 3042_elftctools= lib/libelftc \ 3043 lib/libpe \ 3044 usr.bin/elfcopy \ 3045 usr.bin/elfctl \ 3046 usr.bin/elfdump 3047# If we're given an XNM we don't need to build standard binary utilities. 3048.if ${XNM:M/*} == "" 3049_elftctools+= usr.bin/nm \ 3050 usr.bin/size \ 3051 usr.bin/strings 3052# These are not required by the build, but can be useful for developers who 3053# cross-build on a FreeBSD 10 host: 3054_elftctools+= usr.bin/addr2line 3055.endif 3056.endif 3057 3058.if ${MK_CLANG_BOOTSTRAP} != "no" 3059_clang= usr.bin/clang/clang 3060.endif 3061.if ${MK_LLD_BOOTSTRAP} != "no" 3062_lld= usr.bin/clang/lld 3063.endif 3064.if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_LLD_BOOTSTRAP} != "no" 3065_clang_libs= lib/clang 3066.endif 3067.if ${MK_USB} != "no" 3068_usb_tools= stand/usb/tools 3069.endif 3070 3071.if ${BUILD_WITH_STRICT_TMPPATH} != 0 || defined(BOOTSTRAP_ALL_TOOLS) 3072_ar=usr.bin/ar 3073.endif 3074 3075cross-tools: .MAKE .PHONY 3076.for _tool in \ 3077 ${LOCAL_XTOOL_DIRS} \ 3078 ${_ar} \ 3079 ${_clang_libs} \ 3080 ${_clang} \ 3081 ${_lld} \ 3082 ${_elftctools} \ 3083 ${_dtrace_tools} \ 3084 ${_btxld} \ 3085 ${_usb_tools} 3086 ${_+_}@${ECHODIR} "===> ${_tool} (obj,all,install)"; \ 3087 cd ${.CURDIR}/${_tool}; \ 3088 if [ -z "${NO_OBJWALK}" ]; then ${MAKE} DIRPRFX=${_tool}/ obj; fi; \ 3089 ${MAKE} DIRPRFX=${_tool}/ all; \ 3090 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${WORLDTMP} install 3091.endfor 3092 3093# 3094# native-xtools is the current target for qemu-user cross builds of ports 3095# via poudriere and the imgact_binmisc kernel module. 3096# This target merely builds a toolchan/sysroot, then builds the tools it wants 3097# with the options it wants in a special MAKEOBJDIRPREFIX, using the toolchain 3098# already built. It then installs the static tools to NXBDESTDIR for Poudriere 3099# to pickup. 3100# 3101NXBOBJROOT= ${OBJROOT}${MACHINE}.${MACHINE_ARCH}/nxb/ 3102NXBOBJTOP= ${NXBOBJROOT}${NXB_TARGET}.${NXB_TARGET_ARCH} 3103NXTP?= /nxb-bin 3104.if ${NXTP:N/*} 3105.error NXTP variable should be an absolute path 3106.endif 3107NXBDESTDIR?= ${DESTDIR}${NXTP} 3108 3109# This is the list of tools to be built/installed as static and where 3110# appropriate to build for the given TARGET.TARGET_ARCH. 3111NXBDIRS+= \ 3112 bin/cat \ 3113 bin/chmod \ 3114 bin/cp \ 3115 ${_tcsh} \ 3116 bin/echo \ 3117 bin/expr \ 3118 bin/hostname \ 3119 bin/ln \ 3120 bin/ls \ 3121 bin/mkdir \ 3122 bin/mv \ 3123 bin/ps \ 3124 bin/realpath \ 3125 bin/rm \ 3126 bin/rmdir \ 3127 bin/sh \ 3128 bin/sleep \ 3129 sbin/md5 \ 3130 sbin/sysctl \ 3131 usr.bin/addr2line \ 3132 usr.bin/ar \ 3133 usr.bin/awk \ 3134 usr.bin/basename \ 3135 usr.bin/bmake \ 3136 usr.bin/bzip2 \ 3137 usr.bin/cmp \ 3138 usr.bin/diff \ 3139 usr.bin/dirname \ 3140 usr.bin/elfcopy \ 3141 usr.bin/env \ 3142 usr.bin/fetch \ 3143 usr.bin/find \ 3144 usr.bin/grep \ 3145 usr.bin/gzip \ 3146 usr.bin/head \ 3147 usr.bin/id \ 3148 usr.bin/lex \ 3149 usr.bin/limits \ 3150 usr.bin/mandoc \ 3151 usr.bin/mktemp \ 3152 usr.bin/mt \ 3153 usr.bin/nm \ 3154 usr.bin/patch \ 3155 usr.bin/readelf \ 3156 usr.bin/sed \ 3157 usr.bin/size \ 3158 usr.bin/sort \ 3159 usr.bin/strings \ 3160 usr.bin/tar \ 3161 usr.bin/touch \ 3162 usr.bin/tr \ 3163 usr.bin/true \ 3164 usr.bin/uniq \ 3165 usr.bin/unzip \ 3166 usr.bin/wc \ 3167 usr.bin/xargs \ 3168 usr.bin/xinstall \ 3169 usr.bin/xz \ 3170 usr.bin/yacc \ 3171 usr.sbin/chown 3172 3173SUBDIR_DEPEND_usr.bin/clang= lib/clang 3174.if ${MK_CLANG} != "no" 3175NXBDIRS+= lib/clang 3176NXBDIRS+= usr.bin/clang 3177.endif 3178# XXX: native-xtools passes along ${NXBDIRS} in SUBDIR_OVERRIDE that needs 3179# to be evaluated after NXBDIRS is set. 3180.if make(install) && !empty(SUBDIR_OVERRIDE) 3181SUBDIR= ${SUBDIR_OVERRIDE} 3182.endif 3183 3184NXBMAKEARGS+= \ 3185 OBJTOP=${NXBOBJTOP:Q} \ 3186 OBJROOT=${NXBOBJROOT:Q} \ 3187 -DNO_SHARED \ 3188 -DNO_CPU_CFLAGS \ 3189 -DNO_PIC \ 3190 MK_CASPER=no \ 3191 MK_CLANG_EXTRAS=no \ 3192 MK_CLANG_FORMAT=no \ 3193 MK_CLANG_FULL=no \ 3194 MK_CTF=no \ 3195 MK_DEBUG_FILES=no \ 3196 MK_HTML=no \ 3197 MK_LLDB=no \ 3198 MK_LLVM_LINK_STATIC_LIBRARIES=yes \ 3199 MK_MAN=no \ 3200 MK_MAN_UTILS=yes \ 3201 MK_OFED=no \ 3202 MK_OPENSSH=no \ 3203 MK_RETPOLINE=no \ 3204 MK_SENDMAIL=no \ 3205 MK_SSP=no \ 3206 MK_TESTS=no \ 3207 MK_WERROR=no \ 3208 MK_ZFS=no 3209 3210NXBMAKEENV+= \ 3211 MAKEOBJDIRPREFIX= 3212 3213# This should match all of the knobs in lib/Makefile that it takes to avoid 3214# descending into lib/clang! 3215NXBTNOTOOLS= MK_CLANG=no MK_LLD=no MK_LLDB=no MK_LLVM_BINUTILS=no 3216 3217.if make(native-xtools*) && \ 3218 (!defined(NXB_TARGET) || !defined(NXB_TARGET_ARCH)) 3219.error Missing NXB_TARGET / NXB_TARGET_ARCH 3220.endif 3221# For 'toolchain' we want to produce native binaries that themselves generate 3222# native binaries. 3223NXBTMAKE= ${NXBMAKEENV} ${MAKE} ${NXBMAKEARGS:N-DNO_PIC:N-DNO_SHARED} \ 3224 TARGET=${MACHINE} TARGET_ARCH=${MACHINE_ARCH} 3225# For 'everything' we want to produce native binaries (hence -target to 3226# be MACHINE) that themselves generate TARGET.TARGET_ARCH binaries. 3227# TARGET/TARGET_ARCH are still passed along from user. 3228# 3229# Use the toolchain we create as an external toolchain. 3230.if ${USING_SYSTEM_COMPILER} == "yes" || ${XCC:N${CCACHE_BIN}:M/*} 3231NXBMAKE+= XCC="${XCC}" \ 3232 XCXX="${XCXX}" \ 3233 XCPP="${XCPP}" 3234.else 3235NXBMAKE+= XCC="${NXBOBJTOP}/tmp/usr/bin/cc" \ 3236 XCXX="${NXBOBJTOP}/tmp/usr/bin/c++" \ 3237 XCPP="${NXBOBJTOP}/tmp/usr/bin/cpp" 3238.endif 3239NXBMAKE+= ${NXBMAKEENV} ${MAKE} -f Makefile.inc1 ${NXBMAKEARGS} \ 3240 MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH} \ 3241 TARGET=${NXB_TARGET} TARGET_ARCH=${NXB_TARGET_ARCH} \ 3242 TARGET_TRIPLE=${MACHINE_TRIPLE:Q} 3243# NXBDIRS is improperly based on MACHINE rather than NXB_TARGET. Need to 3244# invoke a sub-make to reevaluate MK_CLANG, etc, for NXBDIRS. 3245NXBMAKE+= SUBDIR_OVERRIDE='$${NXBDIRS:M*}' 3246# Need to avoid the -isystem logic when using clang as an external toolchain 3247# even if the TARGET being built for wants GCC. 3248NXBMAKE+= WANT_COMPILER_TYPE='$${X_COMPILER_TYPE}' 3249native-xtools: .PHONY 3250 ${_+_}cd ${.CURDIR}; ${NXBTMAKE} _cleanobj 3251 # Build the bootstrap/host/cross tools that produce native binaries 3252 ${_+_}cd ${.CURDIR}; ${NXBTMAKE} kernel-toolchain 3253 # Populate includes/libraries sysroot that produce native binaries. 3254 # This is split out from 'toolchain' above mostly so that target LLVM 3255 # libraries have a proper LLVM_DEFAULT_TARGET_TRIPLE without 3256 # polluting the cross-compiler build. The LLVM libs are skipped 3257 # here to avoid the problem but are kept in 'toolchain' so that 3258 # needed build tools are built. 3259 ${_+_}cd ${.CURDIR}; ${NXBTMAKE} _includes ${NXBTNOTOOLS} 3260 ${_+_}cd ${.CURDIR}; ${NXBTMAKE} _libraries ${NXBTNOTOOLS} 3261.if !defined(NO_OBJWALK) 3262 ${_+_}cd ${.CURDIR}; ${NXBMAKE} _obj 3263.endif 3264 ${_+_}cd ${.CURDIR}; ${NXBMAKE} everything 3265 @echo ">> native-xtools done. Use 'make native-xtools-install' to install to a given DESTDIR" 3266 3267native-xtools-install: .PHONY 3268 mkdir -p ${NXBDESTDIR}/bin ${NXBDESTDIR}/sbin ${NXBDESTDIR}/usr 3269 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 3270 -p ${NXBDESTDIR}/usr >/dev/null 3271 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 3272 -p ${NXBDESTDIR}/usr/include >/dev/null 3273.for d in ${LIBCOMPAT_INCLUDE_DIRS} 3274 mkdir -p ${NXBDESTDIR}/usr/include/${d} 3275.endfor 3276 ${_+_}cd ${.CURDIR}; ${NXBMAKE} \ 3277 DESTDIR=${NXBDESTDIR} \ 3278 -DNO_ROOT \ 3279 install 3280 3281# 3282# hierarchy - ensure that all the needed directories are present 3283# 3284hierarchy hier: .MAKE .PHONY 3285 ${_+_}cd ${.CURDIR}/etc; ${HMAKE} distrib-dirs 3286 3287# 3288# libraries - build all libraries, and install them under ${DESTDIR}. 3289# 3290# The list of libraries with dependents (${_prebuild_libs}) and their 3291# interdependencies (__L) are built automatically by the 3292# ${.CURDIR}/tools/make_libdeps.sh script. 3293# 3294libraries: .MAKE .PHONY 3295 ${_+_}cd ${.CURDIR}; \ 3296 ${MAKE} -f Makefile.inc1 _prereq_libs; \ 3297 ${MAKE} -f Makefile.inc1 _startup_libs; \ 3298 ${MAKE} -f Makefile.inc1 _prebuild_libs -DLIBCRYPTO_WITHOUT_SUBDIRS; \ 3299 ${MAKE} -f Makefile.inc1 _generic_libs 3300 3301# 3302# static libgcc.a prerequisite for shared libc 3303# 3304_prereq_libs= lib/libcompiler_rt 3305.if ${MK_SSP} != "no" 3306_prereq_libs+= lib/libssp_nonshared 3307.endif 3308.if ${MK_ASAN} != "no" 3309_prereq_libs+= lib/libclang_rt/asan 3310_prereq_libs+= lib/libclang_rt/asan-preinit 3311_prereq_libs+= lib/libclang_rt/asan_cxx 3312_prereq_libs+= lib/libclang_rt/asan_static 3313.endif 3314.if ${MK_UBSAN} != "no" 3315_prereq_libs+= lib/libclang_rt/ubsan_minimal 3316_prereq_libs+= lib/libclang_rt/ubsan_standalone 3317_prereq_libs+= lib/libclang_rt/ubsan_standalone_cxx 3318.endif 3319 3320# These dependencies are not automatically generated: 3321# 3322# lib/csu and lib/libc must be built before 3323# all shared libraries for ELF. 3324# 3325_startup_libs= lib/csu 3326_startup_libs+= lib/libc 3327_startup_libs+= lib/libc_nonshared 3328_startup_libs+= lib/libcxxrt 3329_startup_libs+= lib/libsys 3330 3331_prereq_libs+= lib/libgcc_eh lib/libgcc_s 3332_startup_libs+= lib/libgcc_eh lib/libgcc_s 3333 3334lib/libc__L: lib/libsys__L 3335lib/libgcc_s__L: lib/libc__L 3336lib/libgcc_s__L: lib/libc_nonshared__L 3337lib/libcxxrt__L: lib/libgcc_s__L 3338lib/libcrypt__L: lib/libmd__L 3339 3340_prebuild_libs= ${_kerberos5_lib_libasn1} \ 3341 ${_kerberos5_lib_libhdb} \ 3342 ${_kerberos5_lib_libheimbase} \ 3343 ${_kerberos5_lib_libheimntlm} \ 3344 ${_libsqlite3} \ 3345 ${_kerberos5_lib_libheimipcc} \ 3346 ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \ 3347 ${_kerberos5_lib_libroken} \ 3348 ${_kerberos5_lib_libwind} \ 3349 ${_krb5_util_et} \ 3350 ${_krb5_util_profile} \ 3351 lib/libbz2 ${_libcom_err} lib/libcrypt \ 3352 lib/libc++ \ 3353 lib/libelf lib/libexpat \ 3354 lib/libfigpar \ 3355 ${_lib_libgssapi} \ 3356 lib/libjail \ 3357 lib/libkiconv lib/libkldelf lib/libkvm \ 3358 lib/liblzma lib/libmd lib/libnv \ 3359 lib/libzstd \ 3360 ${_lib_casper} \ 3361 lib/ncurses/tinfo \ 3362 lib/ncurses/ncurses \ 3363 lib/libedit \ 3364 ${_krb5_util_ss} \ 3365 ${_krb5_util_support} \ 3366 ${_krb5_util_verto} \ 3367 ${_krb5_lib_krb5} \ 3368 ${_krb5_lib_crypto} \ 3369 ${_krb5_lib_gssapikrb5} \ 3370 ${_krb5_lib_gssrpc} \ 3371 ${_krb5_lib_kdb5} \ 3372 ${_krb5_lib_krad} \ 3373 ${_krb5_lib_kadm5srvmit} \ 3374 ${_krb5_lib_kadm5clntmit} \ 3375 lib/libpam/libpam lib/libthr \ 3376 ${_lib_libradius} lib/libsbuf lib/libtacplus \ 3377 lib/libgeom \ 3378 ${_lib_librt} \ 3379 ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \ 3380 ${_cddl_lib_libavl} \ 3381 ${_cddl_lib_libicp} \ 3382 ${_cddl_lib_libicp_rescue} \ 3383 ${_cddl_lib_libspl} \ 3384 ${_cddl_lib_libzfs_core} ${_cddl_lib_libzfs} \ 3385 ${_cddl_lib_libzutil} \ 3386 ${_cddl_lib_libctf} ${_cddl_lib_libzfsbootenv} \ 3387 lib/libufs \ 3388 lib/libutil lib/libpjdlog ${_lib_libypclnt} lib/libz lib/msun \ 3389 lib/libxo \ 3390 ${_secure_lib_libcrypto} ${_secure_lib_libssl} \ 3391 ${_lib_libldns} ${_secure_lib_libssh} 3392 3393.if ${MK_DIALOG} != "no" 3394_prebuild_libs+= gnu/lib/libdialog 3395gnu/lib/libdialog__L: lib/msun__L lib/ncurses/tinfo__L lib/ncurses/ncurses__L 3396.endif 3397 3398.if ${MK_GOOGLETEST} != "no" 3399_prebuild_libs+= lib/libregex 3400.endif 3401 3402lib/libgeom__L: lib/libexpat__L lib/libsbuf__L 3403lib/libkldelf__L: lib/libelf__L 3404lib/libkvm__L: lib/libelf__L 3405 3406.if ${MK_RADIUS_SUPPORT} != "no" 3407_lib_libradius= lib/libradius 3408.endif 3409 3410lib/ncurses/ncurses__L: lib/ncurses/tinfo__L 3411 3412lib/libedit__L: lib/ncurses/ncurses__L 3413 3414.if ${MK_OFED} != "no" 3415_prebuild_libs+= \ 3416 lib/ofed/libibverbs \ 3417 lib/ofed/libibmad \ 3418 lib/ofed/libibumad \ 3419 lib/ofed/complib \ 3420 lib/ofed/libbnxtre \ 3421 lib/ofed/libmlx5 3422 3423lib/ofed/libibmad__L: lib/ofed/libibumad__L 3424lib/ofed/complib__L: lib/libthr__L 3425lib/ofed/libbnxtre__L: lib/ofed/libibverbs__L lib/libthr__L 3426lib/ofed/libmlx5__L: lib/ofed/libibverbs__L lib/libthr__L 3427.endif 3428 3429.if ${MK_CASPER} != "no" 3430_lib_casper= lib/libcasper 3431.endif 3432 3433lib/libpjdlog__L: lib/libutil__L 3434lib/libcasper__L: lib/libnv__L 3435lib/liblzma__L: lib/libmd__L lib/libthr__L 3436lib/libzstd__L: lib/libthr__L 3437lib/librt__L: lib/libthr__L 3438 3439_generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} 3440.if ${MK_IPFILTER} != "no" 3441_generic_libs+= sbin/ipf/libipf 3442.endif 3443.for _DIR in ${LOCAL_LIB_DIRS} 3444.if ${_DIR} == ".WAIT" || (empty(_generic_libs:M${_DIR}) && exists(${.CURDIR}/${_DIR}/Makefile)) 3445_generic_libs+= ${_DIR} 3446.endif 3447.endfor 3448 3449lib/libtacplus__L: lib/libmd__L lib/libpam/libpam__L 3450lib/libxo__L: lib/libutil__L 3451 3452.if ${MK_CDDL} != "no" 3453_cddl_lib_libumem= cddl/lib/libumem 3454_cddl_lib_libnvpair= cddl/lib/libnvpair 3455_cddl_lib_libavl= cddl/lib/libavl 3456_cddl_lib_libspl= cddl/lib/libspl 3457 3458cddl/lib/libavl__L: cddl/lib/libspl__L 3459cddl/lib/libnvpair__L: cddl/lib/libspl__L 3460 3461.if ${MK_ZFS} != "no" 3462_lib_librt= lib/librt 3463_cddl_lib_libicp= cddl/lib/libicp 3464_cddl_lib_libicp_rescue= cddl/lib/libicp_rescue 3465_cddl_lib_libzutil= cddl/lib/libzutil 3466_cddl_lib_libzfs_core= cddl/lib/libzfs_core 3467_cddl_lib_libzfs= cddl/lib/libzfs 3468_cddl_lib_libzfsbootenv= cddl/lib/libzfsbootenv 3469 3470cddl/lib/libzutil__L: cddl/lib/libavl__L lib/libgeom__L lib/msun__L 3471 3472cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L cddl/lib/libspl__L cddl/lib/libzutil__L 3473 3474cddl/lib/libzfs__L: cddl/lib/libzfs_core__L lib/msun__L lib/libutil__L lib/librt__L 3475cddl/lib/libzfs__L: lib/libthr__L lib/libmd__L lib/libz__L cddl/lib/libumem__L 3476cddl/lib/libzfs__L: cddl/lib/libavl__L lib/libgeom__L 3477cddl/lib/libzfs__L: cddl/lib/libnvpair__L cddl/lib/libzutil__L 3478cddl/lib/libzfs__L: secure/lib/libcrypto__L 3479 3480cddl/lib/libzfsbootenv__L: cddl/lib/libzfs__L 3481lib/libbe__L: cddl/lib/libzfs__L cddl/lib/libzfsbootenv__L 3482.endif 3483_cddl_lib_libctf= cddl/lib/libctf 3484_cddl_lib= cddl/lib 3485cddl/lib/libctf__L: lib/libz__L cddl/lib/libspl__L 3486cddl/lib/libdtrace__L: lib/libxo__L 3487.endif 3488# cddl/lib/libdtrace requires lib/libproc and lib/librtld_db 3489_prebuild_libs+= lib/libprocstat lib/libproc lib/librtld_db 3490lib/libprocstat__L: lib/libelf__L lib/libkvm__L lib/libutil__L 3491lib/libproc__L: lib/libprocstat__L 3492lib/librtld_db__L: lib/libprocstat__L 3493 3494.if ${MK_CRYPT} != "no" 3495.if ${MK_OPENSSL} != "no" 3496_secure_lib_libcrypto= secure/lib/libcrypto 3497_secure_lib_libssl= secure/lib/libssl 3498lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L 3499secure/lib/libcrypto__L: lib/libthr__L 3500.if ${MK_LDNS} != "no" 3501_lib_libldns= lib/libldns 3502lib/libldns__L: secure/lib/libssl__L 3503.endif 3504.if ${MK_OPENSSH} != "no" 3505_secure_lib_libssh= secure/lib/libssh 3506secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L 3507.if ${MK_LDNS} != "no" 3508secure/lib/libssh__L: lib/libldns__L 3509.endif 3510 3511.if ${MK_KERBEROS_SUPPORT} != "no" 3512.if ${MK_MITKRB5} != "no" 3513secure/lib/libssh__L: krb5/lib/gssapi__L krb5/lib/krb5__L \ 3514 krb5/lib/crypto__L krb5/util/et__L lib/libmd__L krb5/util/support__L 3515.else 3516secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \ 3517 kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \ 3518 lib/libmd__L kerberos5/lib/libroken__L 3519.endif 3520.endif 3521.endif 3522.endif 3523_secure_lib= secure/lib 3524.endif 3525 3526.if ${MK_KERBEROS} != "no" 3527.if ${MK_MITKRB5} != "no" 3528krb5/util/et__L: krb5/util/support__L 3529krb5/util/profile__L: krb5/util/et__L krb5/util/support__L 3530krb5/lib/crypto__L: krb5/util/et__L krb5/util/support__L \ 3531 secure/lib/libcrypto__L 3532krb5/lib/gssapi__L: krb5/lib/krb5__L krb5/lib/crypto__L krb5/util/et__L \ 3533 krb5/util/support__L 3534krb5/lib/kadm5clnt__L: krb5/util/profile__L krb5/lib/rpc__L \ 3535 krb5/lib/gssapi__L krb5/lib/krb5__L krb5/lib/crypto__L \ 3536 krb5/util/support__L krb5/util/et__L 3537krb5/lib/kadm5srv__L: krb5/util/profile__L krb5/lib/rpc__L \ 3538 krb5/lib/gssapi__L krb5/lib/kdb__L krb5/lib/krb5 krb5/lib/crypto__L \ 3539 krb5/util/support__L krb5/util/et__L 3540krb5/lib/kdb__L: krb5/util/profile__L krb5/lib/rpc__L krb5/lib/krb5__L \ 3541 krb5/lib/crypto__L krb5/util/et__L krb5/util/support__L krb5/lib/gssapi__L 3542krb5/lib/krad__L: krb5/lib/krb5__L krb5/lib/crypto__L krb5/util/et__L \ 3543 krb5/util/support__L krb5/util/verto__L 3544krb5/lib/krb5__L: krb5/util/profile__L krb5/lib/crypto__L krb5/util/et__L \ 3545 krb5/util/support__L 3546krb5/lib/rpc__L: krb5/lib/gssapi__L krb5/lib/krb5__L krb5/lib/crypto__L \ 3547 krb5/util/et__L krb5/util/support__L 3548.else 3549kerberos5/lib/libasn1__L: lib/libcom_err__L kerberos5/lib/libroken__L 3550kerberos5/lib/libhdb__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ 3551 kerberos5/lib/libkrb5__L kerberos5/lib/libroken__L \ 3552 kerberos5/lib/libwind__L lib/libsqlite3__L 3553kerberos5/lib/libheimntlm__L: secure/lib/libcrypto__L kerberos5/lib/libkrb5__L \ 3554 kerberos5/lib/libroken__L lib/libcom_err__L 3555kerberos5/lib/libhx509__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ 3556 secure/lib/libcrypto__L kerberos5/lib/libroken__L kerberos5/lib/libwind__L 3557kerberos5/lib/libkrb5__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ 3558 lib/libcrypt__L secure/lib/libcrypto__L kerberos5/lib/libhx509__L \ 3559 kerberos5/lib/libroken__L kerberos5/lib/libwind__L \ 3560 kerberos5/lib/libheimbase__L kerberos5/lib/libheimipcc__L 3561kerberos5/lib/libroken__L: lib/libcrypt__L 3562kerberos5/lib/libwind__L: kerberos5/lib/libroken__L lib/libcom_err__L 3563kerberos5/lib/libheimbase__L: lib/libthr__L 3564kerberos5/lib/libheimipcc__L: kerberos5/lib/libroken__L kerberos5/lib/libheimbase__L lib/libthr__L 3565.endif 3566.endif 3567 3568lib/libsqlite3__L: lib/libthr__L 3569 3570.if ${MK_KERBEROS} != "no" && ${MK_MITKRB5} == "no" 3571_lib_libgssapi= lib/libgssapi 3572.endif 3573 3574.if ${MK_KERBEROS} != "no" 3575.if ${MK_MITKRB5} != "no" 3576_krb5_util= krb5/util 3577_krb5_util_build_tools= krb5/util/build-tools 3578_krb5_util_compileet= krb5/util/compile_et 3579_krb5_util_et= krb5/util/et 3580_krb5_util_profile= krb5/util/profile 3581_krb5_util_ss= krb5/util/ss 3582_krb5_util_support= krb5/util/support 3583_krb5_util_verto= krb5/util/verto 3584_krb5_lib= krb5/lib 3585_krb5_lib_krb5= krb5/lib/krb5 3586_krb5_lib_kdb5= krb5/lib/kdb 3587_krb5_lib_crypto= krb5/lib/crypto 3588_krb5_lib_gssapikrb5= krb5/lib/gssapi 3589_krb5_lib_gssrpc= krb5/lib/rpc 3590_krb5_lib_apputils= krb5/lib/apputils 3591_krb5_lib_kadm5clntmit= krb5/lib/kadm5clnt 3592_krb5_lib_kadm5srvmit= krb5/lib/kadm5srv 3593_krb5_lib_kadm_common= krb5/lib/kadm_common 3594_krb5_lib_kproputil= krb5/lib/kprop_util 3595_krb5_lib_krad= krb5/lib/krad 3596.else 3597_kerberos5_lib= kerberos5/lib 3598_kerberos5_lib_libasn1= kerberos5/lib/libasn1 3599_kerberos5_lib_libhdb= kerberos5/lib/libhdb 3600_kerberos5_lib_libheimbase= kerberos5/lib/libheimbase 3601_kerberos5_lib_libkrb5= kerberos5/lib/libkrb5 3602_kerberos5_lib_libhx509= kerberos5/lib/libhx509 3603_kerberos5_lib_libroken= kerberos5/lib/libroken 3604_kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm 3605_libsqlite3= lib/libsqlite3 3606_kerberos5_lib_libheimipcc= kerberos5/lib/libheimipcc 3607_kerberos5_lib_libwind= kerberos5/lib/libwind 3608_libcom_err= lib/libcom_err 3609.endif 3610.endif 3611 3612.if ${MK_NIS} != "no" 3613_lib_libypclnt= lib/libypclnt 3614.endif 3615 3616.if ${MK_OPENSSL} == "no" 3617lib/libradius__L: lib/libmd__L 3618.endif 3619 3620lib/libproc__L: \ 3621 ${_cddl_lib_libctf:D${_cddl_lib_libctf}__L} \ 3622 lib/libelf__L lib/librtld_db__L lib/libutil__L lib/libcxxrt__L 3623 3624.for _lib in ${_prereq_libs} 3625${_lib}__PL: .PHONY .MAKE 3626.if !defined(_MKSHOWCONFIG) && exists(${.CURDIR}/${_lib}) 3627 ${_+_}@${ECHODIR} "===> ${_lib} (obj,all,install)"; \ 3628 cd ${.CURDIR}/${_lib}; \ 3629 if [ -z "${NO_OBJWALK}" ]; then ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj; fi; \ 3630 ${MAKE} MK_TESTS=no -DNO_PIC \ 3631 DIRPRFX=${_lib}/ all; \ 3632 ${MAKE} MK_TESTS=no -DNO_PIC \ 3633 DIRPRFX=${_lib}/ install 3634.endif 3635.endfor 3636 3637.for _lib in ${_startup_libs} ${_prebuild_libs} ${_generic_libs} 3638${_lib}__L: .PHONY .MAKE 3639.if !defined(_MKSHOWCONFIG) && exists(${.CURDIR}/${_lib}) 3640 ${_+_}@${ECHODIR} "===> ${_lib} (obj,all,install)"; \ 3641 cd ${.CURDIR}/${_lib}; \ 3642 if [ -z "${NO_OBJWALK}" ]; then ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj; fi; \ 3643 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ all; \ 3644 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ install 3645.endif 3646.endfor 3647 3648_prereq_libs: ${_prereq_libs:S/$/__PL/} 3649_startup_libs: ${_startup_libs:S/$/__L/} 3650_prebuild_libs: ${_prebuild_libs:S/$/__L/} 3651_generic_libs: ${_generic_libs:S/$/__L/} 3652 3653# Enable SUBDIR_PARALLEL when not calling 'make all', unless called from 3654# 'everything' with _PARALLEL_SUBDIR_OK set. This is because it is unlikely 3655# that running 'make all' from the top-level, especially with a SUBDIR_OVERRIDE 3656# or LOCAL_DIRS set, will have a reliable build if SUBDIRs are built in 3657# parallel. This is safe for the world stage of buildworld though since it has 3658# already built libraries in a proper order and installed includes into 3659# WORLDTMP. Special handling is done for SUBDIR ordering for 'install*' to 3660# avoid trashing a system if it crashes mid-install. 3661.if !make(all) || defined(_PARALLEL_SUBDIR_OK) 3662SUBDIR_PARALLEL= 3663.endif 3664 3665.include <bsd.subdir.mk> 3666 3667.if make(check-old) || make(check-old-dirs) || \ 3668 make(check-old-files) || make(check-old-libs) || \ 3669 make(delete-old) || make(delete-old-dirs) || \ 3670 make(delete-old-files) || make(delete-old-libs) || \ 3671 make(list-old-dirs) || make(list-old-files) || make(list-old-libs) 3672 3673# 3674# check for / delete old files section 3675# 3676 3677.include "ObsoleteFiles.inc" 3678 3679OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \ 3680else you can not start such an application. Consult UPDATING for more \ 3681information regarding how to cope with the removal/revision bump of a \ 3682specific library." 3683 3684.if !defined(BATCH_DELETE_OLD_FILES) 3685RM_I=-i 3686.else 3687RM_I=-fv 3688.endif 3689 3690list-old-files: .PHONY 3691 @cd ${.CURDIR}; \ 3692 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 3693 -V "OLD_FILES:ts\n" -V "OLD_FILES:Musr/share/*.gz:R:ts\n" \ 3694 -V "MOVED_LIBS:ts\n" \ 3695 ${_ALL_libcompats:@v@-V "OLD_FILES:Mlib/*.so.*:S,^lib,usr/lib$v,:ts\n"@} \ 3696 ${_ALL_libcompats:@v@-V "OLD_FILES:Musr/lib/*:S,^usr/lib,usr/lib$v,:ts\n"@} | \ 3697 sort 3698 3699delete-old-files: .PHONY 3700 @echo ">>> Removing old files (only deletes safe to delete libs)" 3701# Ask for every old file if the user really wants to remove it. 3702# It's annoying, but better safe than sorry. 3703# NB: We cannot pass the list of OLD_FILES as a parameter because the 3704# argument list will get too long. Using .for/.endfor make "loops" will make 3705# the Makefile parser segfault. 3706 @exec 3<&0; \ 3707 cd ${.CURDIR}; \ 3708 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} list-old-files | \ 3709 while read file; do \ 3710 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 3711 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \ 3712 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \ 3713 fi; \ 3714 for ext in debug symbols; do \ 3715 if ! [ -e "${DESTDIR}/$${file}" ] && [ -f \ 3716 "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \ 3717 rm ${RM_I} "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" \ 3718 <&3; \ 3719 fi; \ 3720 done; \ 3721 done 3722# Remove compressed copies of uncompressed manpages 3723.if ${MK_MANCOMPRESS} != "yes" 3724 @exec 3<&0; \ 3725 find ${DESTDIR}/usr/share/man ${DESTDIR}/usr/share/openssl/man ! -type d ! -name \*.gz 2>/dev/null | \ 3726 while read manpage; do \ 3727 if [ -e "$${manpage}.gz" ]; then \ 3728 rm ${RM_I} $${manpage}.gz <&3; \ 3729 fi; \ 3730 done 3731# Remove uncompressed copies of compressed manpages 3732.else 3733 @exec 3<&0; \ 3734 find ${DESTDIR}/usr/share/man ${DESTDIR}/usr/share/openssl/man ! -type d ! -name \*.gz 2>/dev/null | \ 3735 while read manpage; do \ 3736 if [ -e "$${manpage}.gz" ]; then \ 3737 rm ${RM_I} $${manpage} <&3; \ 3738 fi; \ 3739 done 3740.endif 3741.if !empty(MAN_ARCH) && ${MAN_ARCH} != "all" 3742 @exec 3<&0; \ 3743 find -E /usr/share/man/man4/ -mindepth 1 -type d ! -regex '.*/(${MAN_ARCH:C/[[:space:]]+/|/gW})' | \ 3744 while read dir; do \ 3745 find $$dir ! -type d -exec rm ${RM_I} {} + <&3; \ 3746 done 3747.endif 3748 @echo ">>> Old files removed" 3749 3750check-old-files: .PHONY 3751 @echo ">>> Checking for old files" 3752 @cd ${.CURDIR}; \ 3753 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} list-old-files | \ 3754 while read file; do \ 3755 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 3756 echo "${DESTDIR}/$${file}"; \ 3757 fi; \ 3758 for ext in debug symbols; do \ 3759 if [ -f "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \ 3760 echo "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}"; \ 3761 fi; \ 3762 done; \ 3763 done 3764# Check for compressed copies of uncompressed manpages 3765.if ${MK_MANCOMPRESS} != "yes" 3766 @find ${DESTDIR}/usr/share/man ${DESTDIR}/usr/share/openssl/man ! -type d ! -name \*.gz 2>/dev/null | \ 3767 while read manpage; do \ 3768 if [ -e "$${manpage}.gz" ]; then \ 3769 echo $${manpage}.gz; \ 3770 fi; \ 3771 done | sort 3772# Check for uncompressed copies of compressed manpages 3773.else 3774 @find ${DESTDIR}/usr/share/man ${DESTDIR}/usr/share/openssl/man ! -type d ! -name \*.gz 2>/dev/null | \ 3775 while read manpage; do \ 3776 if [ -e "$${manpage}.gz" ]; then \ 3777 echo $${manpage}; \ 3778 fi; \ 3779 done | sort 3780.endif 3781.if !empty(MAN_ARCH) && ${MAN_ARCH} != "all" 3782 @find -E /usr/share/man/man4/ -mindepth 1 -type d ! -regex '.*/(${MAN_ARCH:C/[[:space:]]+/|/gW})' | \ 3783 while read dir; do \ 3784 find $$dir ! -type d; \ 3785 done | sort 3786.endif 3787 3788list-old-libs: .PHONY 3789 @cd ${.CURDIR}; \ 3790 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 3791 -V "OLD_LIBS:ts\n" \ 3792 ${_ALL_libcompats:@v@-V "OLD_LIBS:Mlib/*:S,^lib,usr/lib$v,:ts\n"@} \ 3793 ${_ALL_libcompats:@v@-V "OLD_LIBS:Musr/lib/*:S,^usr/lib,usr/lib$v,:ts\n"@} \ 3794 ${_ALL_libcompats:@v@-V "OLD_LIBS:Mlib/casper/*:S,^lib/casper,usr/lib$v,:ts\n"@} | \ 3795 sort 3796 3797delete-old-libs: .PHONY 3798 @echo ">>> Removing old libraries" 3799 @echo "${OLD_LIBS_MESSAGE}" | fmt 3800 @exec 3<&0; \ 3801 cd ${.CURDIR}; \ 3802 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} list-old-libs | \ 3803 while read file; do \ 3804 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 3805 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \ 3806 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \ 3807 fi; \ 3808 for ext in debug symbols; do \ 3809 if ! [ -e "${DESTDIR}/$${file}" ] && [ -f \ 3810 "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \ 3811 rm ${RM_I} "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" \ 3812 <&3; \ 3813 fi; \ 3814 done; \ 3815 done 3816 @echo ">>> Old libraries removed" 3817 3818check-old-libs: .PHONY 3819 @echo ">>> Checking for old libraries" 3820 @cd ${.CURDIR}; \ 3821 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} list-old-libs | \ 3822 while read file; do \ 3823 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 3824 echo "${DESTDIR}/$${file}"; \ 3825 fi; \ 3826 for ext in debug symbols; do \ 3827 if [ -f "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \ 3828 echo "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}"; \ 3829 fi; \ 3830 done; \ 3831 done 3832 3833list-old-dirs: .PHONY 3834 @cd ${.CURDIR}; \ 3835 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 3836 -V "OLD_DIRS:ts\n" | sort -r 3837 3838delete-old-dirs: .PHONY 3839 @echo ">>> Removing old directories" 3840 @cd ${.CURDIR}; \ 3841 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} list-old-dirs | \ 3842 while read dir; do \ 3843 if [ -d "${DESTDIR}/$${dir}" ]; then \ 3844 rmdir -v "${DESTDIR}/$${dir}" || true; \ 3845 elif [ -L "${DESTDIR}/$${dir}" ]; then \ 3846 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \ 3847 fi; \ 3848 if [ -d "${DESTDIR}${DEBUGDIR}/$${dir}" ]; then \ 3849 rmdir -v "${DESTDIR}${DEBUGDIR}/$${dir}" || true; \ 3850 elif [ -L "${DESTDIR}${DEBUGDIR}/$${dir}" ]; then \ 3851 echo "${DESTDIR}${DEBUGDIR}/$${dir} is a link, please remove everything manually."; \ 3852 fi; \ 3853 done 3854 @echo ">>> Old directories removed" 3855 3856check-old-dirs: .PHONY 3857 @echo ">>> Checking for old directories" 3858 @cd ${.CURDIR}; \ 3859 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} list-old-dirs | \ 3860 while read dir; do \ 3861 if [ -d "${DESTDIR}/$${dir}" ]; then \ 3862 echo "${DESTDIR}/$${dir}"; \ 3863 elif [ -L "${DESTDIR}/$${dir}" ]; then \ 3864 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \ 3865 fi; \ 3866 if [ -d "${DESTDIR}${DEBUGDIR}/$${dir}" ]; then \ 3867 echo "${DESTDIR}${DEBUGDIR}/$${dir}"; \ 3868 elif [ -L "${DESTDIR}${DEBUGDIR}/$${dir}" ]; then \ 3869 echo "${DESTDIR}${DEBUGDIR}/$${dir} is a link, please remove everything manually."; \ 3870 fi; \ 3871 done 3872 3873delete-old: delete-old-files delete-old-dirs .PHONY 3874 @echo "To remove old libraries run '${MAKE_CMD} delete-old-libs'." 3875 3876check-old: check-old-files check-old-libs check-old-dirs .PHONY 3877 @echo "To remove old files and directories run '${MAKE_CMD} delete-old'." 3878 @echo "To remove old libraries run '${MAKE_CMD} delete-old-libs'." 3879 3880.endif 3881 3882# 3883# showconfig - show build configuration. 3884# 3885# ignore lower case knobs (not for use with WITH*) 3886# 3887showconfig: .PHONY 3888 @(${MAKE} -n -f ${.CURDIR}/sys/conf/kern.opts.mk -V dummy -dg1 UPDATE_DEPENDFILE=no NO_OBJ=yes MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH}; \ 3889 ${MAKE} -n -f ${.CURDIR}/share/mk/src.opts.mk -V dummy -dg1 UPDATE_DEPENDFILE=no NO_OBJ=yes MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH}) 2>&1 | \ 3890 grep -E '^(MK|OPT)_[A-Z]' | sort -u 3891 3892.if !empty(KRNLOBJDIR) && !empty(KERNCONF) 3893DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/ 3894 3895.if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE) 3896.if !defined(_MKSHOWCONFIG) && exists(${KERNCONFDIR}/${KERNCONF}) 3897FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \ 3898 '${KERNCONFDIR}/${KERNCONF}' ; echo 3899.endif 3900.endif 3901 3902.endif 3903 3904.if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH}) 3905DTBOUTPUTPATH= ${.CURDIR} 3906.endif 3907 3908# 3909# Build 'standalone' Device Tree Blob 3910# 3911builddtb: .PHONY 3912 @PATH=${TMPPATH:Q} MACHINE=${TARGET} \ 3913 sh ${.CURDIR}/sys/tools/fdt/make_dtb.sh ${.CURDIR}/sys \ 3914 "${FDT_DTS_FILE}" ${DTBOUTPUTPATH} 3915 3916############### 3917 3918# cleanworld 3919# In the following, the first 'rm' in a series will usually remove all 3920# files and directories. If it does not, then there are probably some 3921# files with file flags set, so this unsets them and tries the 'rm' a 3922# second time. There are situations where this target will be cleaning 3923# some directories via more than one method, but that duplication is 3924# needed to correctly handle all the possible situations. Removing all 3925# files without file flags set in the first 'rm' instance saves time, 3926# because 'chflags' will need to operate on fewer files afterwards. 3927# 3928# It is expected that BW_CANONICALOBJDIR == the CANONICALOBJDIR as would be 3929# created by bsd.obj.mk, except that we don't want to .include that file 3930# in this makefile. We don't do a cleandir walk if MK_AUTO_OBJ is yes 3931# since it is not possible for files to land in the wrong place. 3932# 3933.if make(cleanworld) 3934BW_CANONICALOBJDIR:=${OBJTOP}/ 3935.elif make(cleankernel) 3936BW_CANONICALOBJDIR:=${KRNLOBJDIR}/${KERNCONF}/ 3937.elif make(cleanuniverse) 3938BW_CANONICALOBJDIR:=${OBJROOT} 3939.if ${MK_UNIFIED_OBJDIR} == "no" 3940.error ${.TARGETS} only supported with WITH_UNIFIED_OBJDIR enabled. 3941.endif 3942.endif 3943cleanworld cleanuniverse cleankernel: .PHONY 3944.if !empty(BW_CANONICALOBJDIR) && exists(${BW_CANONICALOBJDIR}) && \ 3945 ${.CURDIR:tA} != ${BW_CANONICALOBJDIR:tA} 3946 -(cd ${BW_CANONICALOBJDIR} && rm -rf *) 3947 -chflags -R 0 ${BW_CANONICALOBJDIR} 3948 -(cd ${BW_CANONICALOBJDIR} && rm -rf *) 3949.endif 3950.if make(cleanworld) && ${MK_AUTO_OBJ} == "no" && \ 3951 (empty(BW_CANONICALOBJDIR) || ${.CURDIR:tA} == ${BW_CANONICALOBJDIR:tA}) 3952.if ${.CURDIR} == ${.OBJDIR} || ${.CURDIR}/obj == ${.OBJDIR} 3953 # To be safe in this case, fall back to a 'make cleandir' 3954 ${_+_}@cd ${.CURDIR}; ${MAKE} cleandir 3955.endif 3956.endif 3957 3958.if ${TARGET} == ${MACHINE} && ${TARGET_ARCH} == ${MACHINE_ARCH} 3959XDEV_CPUTYPE?=${CPUTYPE} 3960.else 3961XDEV_CPUTYPE?=${TARGET_CPUTYPE} 3962.endif 3963 3964NOFUN=-DNO_FSCHG MK_HTML=no \ 3965 MK_MAN=no MK_NLS=no \ 3966 MK_KERBEROS=no MK_RESCUE=no MK_TESTS=no MK_WERROR=no \ 3967 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ 3968 CPUTYPE=${XDEV_CPUTYPE} 3969 3970XDDIR=${TARGET_ARCH}-freebsd 3971XDTP?=/usr/${XDDIR} 3972.if ${XDTP:N/*} 3973.error XDTP variable should be an absolute path 3974.endif 3975 3976CDBOBJROOT= ${OBJROOT}${MACHINE}.${MACHINE_ARCH}/xdev/ 3977CDBOBJTOP= ${CDBOBJROOT}${XDDIR} 3978CDBENV= \ 3979 INSTALL="sh ${.CURDIR}/tools/install.sh" 3980CDENV= ${CDBENV} \ 3981 TOOLS_PREFIX=${XDTP} 3982CDMAKEARGS= \ 3983 OBJTOP=${CDBOBJTOP:Q} \ 3984 OBJROOT=${CDBOBJROOT:Q} 3985CD2MAKEARGS= ${CDMAKEARGS} 3986 3987.if ${WANT_COMPILER_TYPE} == gcc || \ 3988 (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc) 3989# GCC requires -isystem and -L when using a cross-compiler. --sysroot 3990# won't set header path and -L is used to ensure the base library path 3991# is added before the port PREFIX library path. 3992CD2CFLAGS+= -isystem ${XDDESTDIR}/usr/include -L${XDDESTDIR}/usr/lib 3993# GCC requires -B to find /usr/lib/crti.o when using a cross-compiler 3994# combined with --sysroot. 3995CD2CFLAGS+= -B${XDDESTDIR}/usr/lib 3996# Force using libc++ for external GCC. 3997.if defined(X_COMPILER_TYPE) && \ 3998 ${X_COMPILER_TYPE} == gcc && ${X_COMPILER_VERSION} >= 40800 3999CD2CXXFLAGS+= -isystem ${XDDESTDIR}/usr/include/c++/v1 -std=c++11 \ 4000 -nostdinc++ 4001.endif 4002.endif 4003CD2CFLAGS+= --sysroot=${XDDESTDIR}/ 4004CD2ENV=${CDENV} CC="${CC} ${CD2CFLAGS}" CXX="${CXX} ${CD2CXXFLAGS} ${CD2CFLAGS}" \ 4005 CPP="${CPP} ${CD2CFLAGS}" \ 4006 MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH} 4007 4008CDTMP= ${OBJTOP}/${XDDIR}/tmp 4009CDMAKE=${CDENV} PATH=${CDTMP:Q}/usr/bin:${PATH:Q} ${MAKE} ${CDMAKEARGS} ${NOFUN} 4010CD2MAKE=${CD2ENV} PATH=${CDTMP:Q}/usr/bin:${XDDESTDIR:Q}/usr/bin:${PATH:Q} \ 4011 ${MAKE} ${CD2MAKEARGS} ${NOFUN} 4012.if ${MK_META_MODE} != "no" 4013# Don't rebuild build-tools targets during normal build. 4014CD2MAKE+= BUILD_TOOLS_META=.NOMETA 4015.endif 4016XDDESTDIR=${DESTDIR}${XDTP} 4017 4018.ORDER: xdev-build xdev-install xdev-links 4019xdev: xdev-build xdev-install .PHONY 4020 4021.ORDER: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools 4022xdev-build: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools .PHONY 4023 4024_xb-worldtmp: .PHONY 4025 mkdir -p ${CDTMP}/usr 4026 ${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 4027 -p ${CDTMP}/usr >/dev/null 4028 4029_xb-bootstrap-tools: .PHONY 4030.for _tool in \ 4031 ${_clang_tblgen} \ 4032 ${_yacc} 4033 ${_+_}@${ECHODIR} "===> ${_tool} (obj,all,install)"; \ 4034 cd ${.CURDIR}/${_tool}; \ 4035 if [ -z "${NO_OBJWALK}" ]; then ${CDMAKE} DIRPRFX=${_tool}/ obj; fi; \ 4036 ${CDMAKE} DIRPRFX=${_tool}/ all; \ 4037 ${CDMAKE} DIRPRFX=${_tool}/ DESTDIR=${CDTMP} install 4038.endfor 4039 4040_xb-build-tools: .PHONY 4041 ${_+_}@cd ${.CURDIR}; \ 4042 ${CDBENV} ${MAKE} ${CDMAKEARGS} -f Makefile.inc1 ${NOFUN} build-tools 4043 4044XDEVDIRS= \ 4045 ${_clang_libs} \ 4046 ${_lld} \ 4047 ${_elftctools} \ 4048 usr.bin/ar \ 4049 ${_clang} 4050 4051_xb-cross-tools: .PHONY 4052.for _tool in ${XDEVDIRS} 4053 ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,all)"; \ 4054 cd ${.CURDIR}/${_tool}; \ 4055 if [ -z "${NO_OBJWALK}" ]; then ${CDMAKE} DIRPRFX=${_tool}/ obj; fi; \ 4056 ${CDMAKE} DIRPRFX=${_tool}/ all 4057.endfor 4058 4059_xi-mtree: .PHONY 4060 ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}" 4061 mkdir -p ${XDDESTDIR} 4062 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.root.dist \ 4063 -p ${XDDESTDIR} >/dev/null 4064 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 4065 -p ${XDDESTDIR}/usr >/dev/null 4066 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 4067 -p ${XDDESTDIR}/usr/include >/dev/null 4068.for d in ${LIBCOMPAT_INCLUDE_DIRS} 4069 mkdir -p ${XDDESTDIR}/usr/include/${d} 4070.endfor 4071.for libcompat in ${libcompats} 4072 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ 4073 -p ${XDDESTDIR}/usr >/dev/null 4074.endfor 4075.if ${MK_TESTS} != "no" 4076 mkdir -p ${XDDESTDIR}${TESTSBASE} 4077 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.tests.dist \ 4078 -p ${XDDESTDIR}${TESTSBASE} >/dev/null 4079.endif 4080 4081.ORDER: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries 4082xdev-install: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries .PHONY 4083 4084_xi-cross-tools: .PHONY 4085 @echo "_xi-cross-tools" 4086.for _tool in ${XDEVDIRS} 4087 ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \ 4088 cd ${.CURDIR}/${_tool}; \ 4089 ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR} 4090.endfor 4091 4092_xi-includes: .PHONY 4093.if !defined(NO_OBJWALK) 4094 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 _obj \ 4095 DESTDIR=${XDDESTDIR} 4096.endif 4097 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 includes \ 4098 DESTDIR=${XDDESTDIR} 4099 4100_xi-libraries: .PHONY 4101 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \ 4102 DESTDIR=${XDDESTDIR} 4103 4104xdev-links: .PHONY 4105 ${_+_}cd ${XDDESTDIR}/usr/bin; \ 4106 mkdir -p ../../../../usr/bin; \ 4107 for i in *; do \ 4108 ln -sf ../../${XDTP}/usr/bin/$$i \ 4109 ../../../../usr/bin/${XDDIR}-$$i; \ 4110 ln -sf ../../${XDTP}/usr/bin/$$i \ 4111 ../../../../usr/bin/${XDDIR}${_REVISION}-$$i; \ 4112 done 4113