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