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