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