1# 2# 3# Make command line options: 4# -DNO_CLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir 5# -DNO_CLEAN do not clean at all (enabled by default) 6# -DDB_FROM_SRC use the user/group databases in src/etc instead of 7# the system database when installing. 8# -DNO_SHARE do not go into share subdir 9# -DKERNFAST define NO_KERNEL{CONFIG,CLEAN,OBJ} 10# -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel 11# -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel 12# -DNO_KERNELOBJ do not run ${MAKE} obj in ${MAKE} buildkernel 13# -DNO_ROOT install without using root privilege 14# -DWITHOUT_CTF do not run the DTrace CTF conversion tools on built objects 15# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list 16# LOCAL_ITOOLS="list of tools" to add additional tools to the ITOOLS list 17# LOCAL_LIB_DIRS="list of dirs" to add additional dirs to libraries target 18# LOCAL_MTREE="list of mtree files" to process to allow local directories 19# to be created before files are installed 20# LOCAL_LEGACY_DIRS="list of dirs" to add additional dirs to the legacy 21# target 22# LOCAL_BSTOOL_DIRS="list of dirs" to add additional dirs to the 23# bootstrap-tools target 24# LOCAL_TOOL_DIRS="list of dirs" to add additional dirs to the build-tools 25# target 26# LOCAL_XTOOL_DIRS="list of dirs" to add additional dirs to the 27# cross-tools target 28# METALOG="path to metadata log" to write permission and ownership 29# when NO_ROOT is set. (default: ${DESTDIR}/${DISTDIR}/METALOG, 30# check /etc/make.conf for DISTDIR) 31# TARGET="machine" to crossbuild world for a different machine type 32# TARGET_ARCH= may be required when a TARGET supports multiple endians 33# BUILDENV_SHELL= shell to launch for the buildenv target (def:${SHELL}) 34# WORLD_FLAGS= additional flags to pass to make(1) during buildworld 35# KERNEL_FLAGS= additional flags to pass to make(1) during buildkernel 36# SUBDIR_OVERRIDE="list of dirs" to build rather than everything. 37# All libraries and includes, and some build tools will still build. 38 39# 40# The intended user-driven targets are: 41# buildworld - rebuild *everything*, including glue to help do upgrades 42# installworld- install everything built by "buildworld" 43# checkworld - run test suite on installed world 44# doxygen - build API documentation of the kernel 45# 46# Standard targets (not defined here) are documented in the makefiles in 47# /usr/share/mk. These include: 48# obj depend all install clean cleandepend cleanobj 49 50.if !defined(TARGET) || !defined(TARGET_ARCH) 51.error Both TARGET and TARGET_ARCH must be defined. 52.endif 53 54.if make(showconfig) || make(test-system-*) 55_MKSHOWCONFIG= t 56.endif 57 58SRCDIR?= ${.CURDIR} 59LOCALBASE?= /usr/local 60TIME_ENV ?= time env 61 62.include "share/mk/src.tools.mk" 63 64# Cross toolchain changes must be in effect before bsd.compiler.mk 65# so that gets the right CC, and pass CROSS_TOOLCHAIN to submakes. 66.if defined(CROSS_TOOLCHAIN) 67.if exists(${LOCALBASE}/share/toolchains/${CROSS_TOOLCHAIN}.mk) 68.include "${LOCALBASE}/share/toolchains/${CROSS_TOOLCHAIN}.mk" 69.elif exists(${CROSS_TOOLCHAIN}) 70.include "${CROSS_TOOLCHAIN}" 71.else 72.error CROSS_TOOLCHAIN ${CROSS_TOOLCHAIN} not found 73.endif 74CROSSENV+=CROSS_TOOLCHAIN="${CROSS_TOOLCHAIN}" 75.elif defined(UNIVERSE_TOOLCHAIN) 76UNIVERSE_TOOLCHAIN_PATH?=${HOST_OBJTOP}/tmp/usr/bin 77XCC?="${UNIVERSE_TOOLCHAIN_PATH}/cc" 78XCXX?="${UNIVERSE_TOOLCHAIN_PATH}/c++" 79XCPP?="${UNIVERSE_TOOLCHAIN_PATH}/cpp" 80XLD?="${UNIVERSE_TOOLCHAIN_PATH}/ld" 81.endif 82.if defined(CROSS_TOOLCHAIN_PREFIX) 83CROSS_COMPILER_PREFIX?=${CROSS_TOOLCHAIN_PREFIX} 84.endif 85 86XCOMPILERS= CC CXX CPP 87.for COMPILER in ${XCOMPILERS} 88.if defined(CROSS_COMPILER_PREFIX) 89X${COMPILER}?= ${CROSS_COMPILER_PREFIX}${${COMPILER}} 90.else 91X${COMPILER}?= ${${COMPILER}} 92.endif 93.endfor 94# If a full path to an external cross compiler is given, don't build 95# a cross compiler. 96.if ${XCC:N${CCACHE_BIN}:M/*} 97MK_CLANG_BOOTSTRAP= no 98# Make sure sub-makes see the option as disabled so the hack in bsd.sys.mk to 99# work around incompatible headers in Clang's resource directory is enabled. 100.MAKEOVERRIDES+= MK_CLANG_BOOTSTRAP 101.endif 102 103# Pull in compiler metadata from buildworld/toolchain if possible to avoid 104# running CC from bsd.compiler.mk. 105.if make(installworld) || make(install) || make(distributeworld) || \ 106 make(stageworld) 107.-include "${OBJTOP}/toolchain-metadata.mk" 108.if !defined(_LOADED_TOOLCHAIN_METADATA) 109.error A build is required first. You may have the wrong MAKEOBJDIRPREFIX set. 110.endif 111.endif 112 113# Pull in COMPILER_TYPE and COMPILER_FREEBSD_VERSION early. Pull it from the 114# tree to be friendlier to foreign OS builds. It's safe to do so unconditionally 115# here since we will always have the right make, unlike in src/Makefile 116# Don't include bsd.linker.mk yet until XBINUTILS is handled (after src.opts.mk) 117_NO_INCLUDE_LINKERMK= t 118# We also want the X_COMPILER* variables if we are using an external toolchain. 119_WANT_TOOLCHAIN_CROSS_VARS= t 120.include "share/mk/bsd.compiler.mk" 121.undef _NO_INCLUDE_LINKERMK 122.undef _WANT_TOOLCHAIN_CROSS_VARS 123# src.opts.mk depends on COMPILER_FEATURES 124.include "share/mk/src.opts.mk" 125 126.if ${TARGET} == ${MACHINE} 127TARGET_CPUTYPE?=${CPUTYPE} 128.else 129TARGET_CPUTYPE?= 130.endif 131.if !empty(TARGET_CPUTYPE) 132_TARGET_CPUTYPE=${TARGET_CPUTYPE} 133.else 134_TARGET_CPUTYPE=dummy 135.endif 136.if ${TARGET} == "arm" 137.if ${TARGET_CPUTYPE:M*soft*} == "" 138TARGET_TRIPLE_ABI= gnueabihf 139.else 140TARGET_TRIPLE_ABI= gnueabi 141.endif 142.endif 143MACHINE_TRIPLE_ABI?= unknown 144MACHINE_TRIPLE?=${MACHINE_ARCH:S/amd64/x86_64/}-${MACHINE_TRIPLE_ABI}-freebsd${OS_REVISION} 145TARGET_TRIPLE_ABI?= unknown 146TARGET_TRIPLE?= ${TARGET_ARCH:S/amd64/x86_64/}-${TARGET_TRIPLE_ABI}-freebsd${OS_REVISION} 147KNOWN_ARCHES?= aarch64/arm64 \ 148 amd64 \ 149 armv7/arm \ 150 i386 \ 151 powerpc \ 152 powerpc64/powerpc \ 153 powerpc64le/powerpc \ 154 riscv64/riscv 155 156.if ${TARGET} == ${TARGET_ARCH} 157_t= ${TARGET} 158.else 159_t= ${TARGET_ARCH}/${TARGET} 160.endif 161.for _t in ${_t} 162.if empty(KNOWN_ARCHES:M${_t}) 163.error Unknown target ${TARGET_ARCH}:${TARGET}. 164.endif 165.endfor 166 167.if ${TARGET_ARCH} == "amd64" 168LIBCOMPAT_INCLUDE_DIRS+= i386 169.elif ${TARGET_ARCH} == "aarch64" 170LIBCOMPAT_INCLUDE_DIRS+= arm 171.endif 172 173.if !defined(_MKSHOWCONFIG) 174.if ((defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == "gcc") || \ 175 (!defined(X_COMPILER_TYPE) && ${COMPILER_TYPE} == "gcc")) 176.if ${TARGET} == "arm" 177_GCC_BROKEN="https://reviews.freebsd.org/D36754" 178.endif 179.if ${TARGET_ARCH} == "powerpc" 180_GCC_BROKEN=Missing atomic builtins in libc++. 181.endif 182.if ${TARGET_ARCH:Mpowerpc64*} 183_GCC_BROKEN=libsys.so.7.full has a LOAD segment with RWX permissions. 184.endif 185.if defined(_GCC_BROKEN) 186.warning Target ${TARGET} is broken with GCC: ${_GCC_BROKEN} 187.if defined(TRY_GCC_BROKEN) 188.warning Trying build anyway. 189.else 190.error Avoiding broken build. Define TRY_GCC_BROKEN to try anyway. 191.endif 192.endif 193.endif 194.endif 195 196.if ${.MAKE.OS} != "FreeBSD" 197CROSSBUILD_HOST=${.MAKE.OS} # Unset for native FreeBSD builds 198.if ${.MAKE.OS} != "Linux" && ${.MAKE.OS} != "Darwin" 199.warning Unsupported crossbuild system: ${.MAKE.OS}. Build will probably fail! 200.endif 201.endif 202# We need to force NO_ROOT/DB_FROM_SRC builds when building on other operating 203# systems since the BSD.foo.dist specs contain users and groups that do not 204# exist by default on a Linux/MacOS system. The distribute* and package* 205# targets used for install media legacy distribution sets also always use and 206# require NO_ROOT mode. 207.if defined(CROSSBUILD_HOST) || make(distributeworld) || make(packageworld) || \ 208 make(distributekernel) || make(packagekernel) 209NO_ROOT:= 1 210DB_FROM_SRC:= 1 211.export NO_ROOT 212.endif 213 214# If all targets are disabled for system llvm then don't expect it to work 215# for cross-builds. 216.if !defined(TOOLS_PREFIX) && ${MK_LLVM_TARGET_ALL} == "no" && \ 217 ${MACHINE} != ${TARGET} && ${MACHINE_ARCH} != ${TARGET_ARCH} && \ 218 !make(showconfig) 219MK_SYSTEM_COMPILER= no 220MK_SYSTEM_LINKER= no 221.endif 222 223# Handle external binutils. 224.if defined(CROSS_TOOLCHAIN_PREFIX) 225CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX} 226.endif 227XBINUTILS= AR ELFCTL LD NM OBJCOPY SIZE STRINGS STRIPBIN 228.for BINUTIL in ${XBINUTILS} 229.if defined(CROSS_BINUTILS_PREFIX) && \ 230 exists(${CROSS_BINUTILS_PREFIX}/${${BINUTIL}}) 231X${BINUTIL}?= ${CROSS_BINUTILS_PREFIX:C,/*$,,}/${${BINUTIL}} 232.else 233X${BINUTIL}?= ${${BINUTIL}} 234.endif 235.endfor 236 237# If a full path to an external linker is given, don't build lld. 238.if ${XLD:M/*} 239MK_LLD_BOOTSTRAP= no 240.endif 241 242# If full paths to all standard bintuils are given, don't build LLVM binutils. 243.if ${XAR:M/*} && ${XNM:M/*} && ${XOBJCOPY:M/*} && ${XSIZE:M/*} && \ 244 ${XSTRINGS:M/*} && ${XSTRIPBIN:M/*} 245MK_LLVM_BINUTILS_BOOTSTRAP= no 246.endif 247 248# We also want the X_LINKER* variables if we are using an external toolchain. 249_WANT_TOOLCHAIN_CROSS_VARS= t 250.include "share/mk/bsd.linker.mk" 251.undef _WANT_TOOLCHAIN_CROSS_VARS 252 253# Begin WITH_SYSTEM_COMPILER / WITH_SYSTEM_LD 254 255# WITH_SYSTEM_COMPILER - Pull in needed values and make a decision. 256 257# Check if there is a local compiler that can satisfy as an external compiler. 258# Which compiler is expected to be used? 259.if ${MK_CLANG_BOOTSTRAP} == "yes" 260WANT_COMPILER_TYPE= clang 261.else 262WANT_COMPILER_TYPE= 263.endif 264 265.if !defined(WANT_COMPILER_FREEBSD_VERSION) && !make(showconfig) && \ 266 !make(test-system-linker) 267.if ${WANT_COMPILER_TYPE} == "clang" 268WANT_COMPILER_FREEBSD_VERSION_FILE= lib/clang/freebsd_cc_version.h 269WANT_COMPILER_FREEBSD_VERSION!= \ 270 awk '$$2 == "FREEBSD_CC_VERSION" {printf("%d\n", $$3)}' \ 271 ${SRCDIR}/${WANT_COMPILER_FREEBSD_VERSION_FILE} || echo unknown 272WANT_COMPILER_VERSION_FILE= lib/clang/include/clang/Basic/Version.inc 273WANT_COMPILER_VERSION!= \ 274 awk '$$2 == "CLANG_VERSION" {split($$3, a, "."); print a[1] * 10000 + a[2] * 100 + a[3]}' \ 275 ${SRCDIR}/${WANT_COMPILER_VERSION_FILE} || echo unknown 276.endif 277.export WANT_COMPILER_FREEBSD_VERSION WANT_COMPILER_VERSION 278.endif # !defined(WANT_COMPILER_FREEBSD_VERSION) 279 280# It needs to be the same revision as we would build for the bootstrap. 281# If the expected vs CC is different then we can't skip. 282# GCC cannot be used for cross-arch yet. For clang we pass -target later if 283# TARGET_ARCH!=MACHINE_ARCH. 284.if ${MK_SYSTEM_COMPILER} == "yes" && \ 285 defined(WANT_COMPILER_FREEBSD_VERSION) && \ 286 ${MK_CLANG_BOOTSTRAP} == "yes" && \ 287 !make(xdev*) && \ 288 ${X_COMPILER_TYPE} == ${WANT_COMPILER_TYPE} && \ 289 (${X_COMPILER_TYPE} == "clang" || ${TARGET_ARCH} == ${MACHINE_ARCH}) && \ 290 ${X_COMPILER_VERSION} == ${WANT_COMPILER_VERSION} && \ 291 ${X_COMPILER_FREEBSD_VERSION} == ${WANT_COMPILER_FREEBSD_VERSION} 292# Everything matches, disable the bootstrap compiler. 293MK_CLANG_BOOTSTRAP= no 294USING_SYSTEM_COMPILER= yes 295.endif # ${WANT_COMPILER_TYPE} == ${COMPILER_TYPE} 296 297# WITH_SYSTEM_LD - Pull in needed values and make a decision. 298 299# Check if there is a local linker that can satisfy as an external linker. 300# Which linker is expected to be used? 301.if ${MK_LLD_BOOTSTRAP} == "yes" 302WANT_LINKER_TYPE= lld 303.else 304WANT_LINKER_TYPE= 305.endif 306 307.if !defined(WANT_LINKER_FREEBSD_VERSION) && !make(showconfig) && \ 308 !make(test-system-compiler) 309.if ${WANT_LINKER_TYPE} == "lld" 310WANT_LINKER_FREEBSD_VERSION_FILE= lib/clang/include/lld/Common/Version.inc 311WANT_LINKER_FREEBSD_VERSION!= \ 312 awk '$$2 == "LLD_FREEBSD_VERSION" {print $$3}' \ 313 ${SRCDIR}/${WANT_LINKER_FREEBSD_VERSION_FILE} || echo unknown 314WANT_LINKER_VERSION_FILE= lib/clang/include/lld/Common/Version.inc 315WANT_LINKER_VERSION!= \ 316 awk '$$2 == "LLD_VERSION_STRING" {gsub("\"", "", $$3); split($$3, a, "."); print a[1] * 10000 + a[2] * 100 + a[3]}' \ 317 ${SRCDIR}/${WANT_LINKER_VERSION_FILE} || echo unknown 318.else 319WANT_LINKER_FREEBSD_VERSION_FILE= 320WANT_LINKER_FREEBSD_VERSION= 321.endif 322.export WANT_LINKER_FREEBSD_VERSION WANT_LINKER_VERSION 323.endif # !defined(WANT_LINKER_FREEBSD_VERSION) 324 325.if ${MK_SYSTEM_LINKER} == "yes" && \ 326 defined(WANT_LINKER_FREEBSD_VERSION) && \ 327 (${MK_LLD_BOOTSTRAP} == "yes") && \ 328 !make(xdev*) && \ 329 ${X_LINKER_TYPE} == ${WANT_LINKER_TYPE} && \ 330 ${X_LINKER_VERSION} == ${WANT_LINKER_VERSION} && \ 331 ${X_LINKER_FREEBSD_VERSION} == ${WANT_LINKER_FREEBSD_VERSION} 332# Everything matches, disable the bootstrap linker. 333MK_LLD_BOOTSTRAP= no 334USING_SYSTEM_LINKER= yes 335.endif # ${WANT_LINKER_TYPE} == ${LINKER_TYPE} 336 337# WITH_SYSTEM_COMPILER / WITH_SYSTEM_LINKER - Handle defaults and debug. 338USING_SYSTEM_COMPILER?= no 339USING_SYSTEM_LINKER?= no 340 341TEST_SYSTEM_COMPILER_VARS= \ 342 USING_SYSTEM_COMPILER MK_SYSTEM_COMPILER \ 343 MK_CROSS_COMPILER MK_CLANG_BOOTSTRAP \ 344 WANT_COMPILER_TYPE WANT_COMPILER_VERSION WANT_COMPILER_VERSION_FILE \ 345 WANT_COMPILER_FREEBSD_VERSION WANT_COMPILER_FREEBSD_VERSION_FILE \ 346 CC COMPILER_TYPE COMPILER_FEATURES COMPILER_VERSION \ 347 COMPILER_FREEBSD_VERSION \ 348 XCC X_COMPILER_TYPE X_COMPILER_FEATURES X_COMPILER_VERSION \ 349 X_COMPILER_FREEBSD_VERSION 350TEST_SYSTEM_LINKER_VARS= \ 351 USING_SYSTEM_LINKER MK_SYSTEM_LINKER \ 352 MK_LLD_BOOTSTRAP \ 353 WANT_LINKER_TYPE WANT_LINKER_VERSION WANT_LINKER_VERSION_FILE \ 354 WANT_LINKER_FREEBSD_VERSION WANT_LINKER_FREEBSD_VERSION_FILE \ 355 LD LINKER_TYPE LINKER_FEATURES LINKER_VERSION \ 356 LINKER_FREEBSD_VERSION \ 357 XLD X_LINKER_TYPE X_LINKER_FEATURES X_LINKER_VERSION \ 358 X_LINKER_FREEBSD_VERSION 359 360.for _t in compiler linker 361test-system-${_t}: .PHONY 362.for v in ${TEST_SYSTEM_${_t:tu}_VARS} 363 ${_+_}@printf "%-35s= %s\n" "${v}" "${${v}}" 364.endfor 365.endfor 366.if (make(buildworld) || make(buildkernel) || make(kernel-toolchain) || \ 367 make(toolchain) || make(_cross-tools)) 368.if ${USING_SYSTEM_COMPILER} == "yes" 369.info SYSTEM_COMPILER: Determined that CC=${CC} matches the source tree. Not bootstrapping a cross-compiler. 370.elif ${MK_CLANG_BOOTSTRAP} == "yes" 371.info SYSTEM_COMPILER: libclang will be built for bootstrapping a cross-compiler. 372.endif 373.if ${USING_SYSTEM_LINKER} == "yes" 374.info SYSTEM_LINKER: Determined that LD=${LD} matches the source tree. Not bootstrapping a cross-linker. 375.elif ${MK_LLD_BOOTSTRAP} == "yes" 376.info SYSTEM_LINKER: libclang will be built for bootstrapping a cross-linker. 377.endif 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 AR="${XAR}" ELFCTL="${XELFCTL}" LD="${XLD}" \ 859 LLVM_LINK="${XLLVM_LINK}" NM=${XNM} OBJCOPY="${XOBJCOPY}" \ 860 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 PATH="${TMPPATH}" ${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 PATH="${TMPPATH}" ${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 PATH="${TMPPATH}" ${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 PATH="${TMPPATH}" ${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 flua ${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 flua ${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 PATH="${TMPPATH}" ${MAKE} -f Makefile.inc1 \ 2268 create-world-packages-jobs \ 2269 SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \ 2270 .MAKE.JOB.PREFIX= 2271 2272.if make(create-world-packages-jobs) 2273.include "${WSTAGEDIR}/packages.mk" 2274.endif 2275 2276create-world-packages-jobs: .PHONY 2277.for pkgname in ${_PKGS} 2278create-world-packages-jobs: create-world-package-${pkgname} 2279create-world-package-${pkgname}: .PHONY 2280 @sh ${SRCDIR}/release/packages/generate-ucl.sh -o ${pkgname} \ 2281 -s ${SRCDIR} -u ${WSTAGEDIR}/${pkgname}.ucl 2282 @if [ "$$(grep -vc '^@dir' ${WSTAGEDIR}/${pkgname}.plist)" -gt 0 ]; then \ 2283 awk -F\" ' \ 2284 /^name/ { printf("===> Creating %s-", $$2); next } \ 2285 /^version/ { print $$2; next } \ 2286 ' ${WSTAGEDIR}/${pkgname}.ucl && \ 2287 ${PKG_CMD} -o ABI=${PKG_ABI} -o ALLOW_BASE_SHLIBS=yes \ 2288 -o SHLIB_PROVIDE_PATHS_NATIVE=/lib,/usr/lib \ 2289 ${_ALL_LIBCOMPATS:range:@i@-o SHLIB_PROVIDE_PATHS_COMPAT_${_ALL_LIBCOMPATS:[$i]}=/usr/lib${_ALL_libcompats:[$i]}@} \ 2290 -o OSVERSION="${SRCRELDATE}" \ 2291 create -f ${PKG_FORMAT} ${PKG_CLEVEL} -T${PKG_CTHREADS} \ 2292 -M ${WSTAGEDIR}/${pkgname}.ucl \ 2293 -p ${WSTAGEDIR}/${pkgname}.plist \ 2294 -r ${WSTAGEDIR} \ 2295 -o ${REPODIR}/${PKG_ABI}/${PKG_OUTPUT_DIR}; \ 2296 else \ 2297 awk -F\" ' \ 2298 /^name/ { printf("===> Skipping %s-", $$2); next } \ 2299 /^version/ { print $$2; next } \ 2300 ' ${WSTAGEDIR}/${pkgname}.ucl; \ 2301 fi 2302.endfor 2303 2304create-sets-packages-jobs: .PHONY create-sets-packages 2305create-sets-packages: .PHONY 2306 @echo "==> Creating set metapackages." 2307 sh "${SRCDIR}/release/packages/create-sets.sh" "${SRCDIR}" \ 2308 "${WSTAGEDIR}" "${REPODIR}/${PKG_ABI}/${PKG_OUTPUT_DIR}" \ 2309 VERSION "${PKG_VERSION}" \ 2310 PKG_NAME_PREFIX "${PKG_NAME_PREFIX}" \ 2311 PKG_MAINTAINER "${PKG_MAINTAINER}" \ 2312 PKG_WWW "${PKG_WWW}" 2313 @for manifest in ${WSTAGEDIR}/set-*.ucl; do \ 2314 echo "--> Processing manifest: $$manifest"; \ 2315 ${PKG_CMD} -o ABI=${PKG_ABI} -o OSVERSION="${SRCRELDATE}" \ 2316 create -f ${PKG_FORMAT} ${PKG_CLEVEL} -T${PKG_CTHREADS} \ 2317 -M $$manifest \ 2318 -o "${REPODIR}/${PKG_ABI}/${PKG_OUTPUT_DIR}" \ 2319 || exit 1; \ 2320 done 2321 2322_default_flavor= -default 2323.if make(*package*) && exists(${KSTAGEDIR}/kernel.meta) 2324. if ${MK_DEBUG_FILES} != "no" 2325_debug=-dbg 2326. endif 2327 2328create-dtb-package: .PHONY 2329 @if [ -f ${KSTAGEDIR}/${DISTDIR}/dtb.plist ]; then \ 2330 flua ${SRCDIR}/release/packages/generate-ucl.lua \ 2331 PKGNAME "dtb" \ 2332 PKGGENNAME "dtb" \ 2333 VERSION "${PKG_VERSION}" \ 2334 PKG_NAME_PREFIX "${PKG_NAME_PREFIX}" \ 2335 PKG_MAINTAINER "${PKG_MAINTAINER}" \ 2336 PKG_WWW "${PKG_WWW}" \ 2337 UCLFILES "${SRCDIR}/release/packages/ucl" \ 2338 ${SRCDIR}/release/packages/template.ucl \ 2339 ${KSTAGEDIR}/${DISTDIR}/dtb.ucl ; \ 2340 awk -F\" ' \ 2341 /name/ { printf("===> Creating %s-", $$2); next } \ 2342 /version/ {print $$2; next } ' \ 2343 ${KSTAGEDIR}/${DISTDIR}/dtb.ucl ; \ 2344 ${PKG_CMD} -o ABI=${PKG_ABI} -o ALLOW_BASE_SHLIBS=yes \ 2345 -o OSVERSION="${SRCRELDATE}" \ 2346 create -f ${PKG_FORMAT} ${PKG_CLEVEL} -T${PKG_CTHREADS} \ 2347 -M ${KSTAGEDIR}/${DISTDIR}/dtb.ucl \ 2348 -p ${KSTAGEDIR}/${DISTDIR}/dtb.plist \ 2349 -r ${KSTAGEDIR}/${DISTDIR} \ 2350 -o ${REPODIR}/${PKG_ABI}/${PKG_OUTPUT_DIR} ; \ 2351 fi 2352 2353create-kernel-packages: .PHONY create-kernel-flavored-packages create-dtb-package 2354create-kernel-flavored-packages: .PHONY 2355.ORDER: create-kernel-flavored-packages create-dtb-package 2356 2357. for flavor in "" ${_debug} 2358create-kernel-flavored-packages: create-kernel-packages-flavor${flavor:C,^""$,${_default_flavor},} 2359create-kernel-packages-flavor${flavor:C,^""$,${_default_flavor},}: _pkgbootstrap .PHONY 2360 @cd ${KSTAGEDIR}/${DISTDIR} ; \ 2361 ${METALOG_SORT_CMD} ${KSTAGEDIR}/kernel.meta | \ 2362 awk -f ${SRCDIR}/release/scripts/mtree-to-plist.awk \ 2363 -v kernel=yes -v _kernconf=${INSTALLKERNEL} ; \ 2364 flua ${SRCDIR}/release/packages/generate-ucl.lua \ 2365 PKGNAME "kernel-${INSTALLKERNEL:tl}${flavor}" \ 2366 PKGGENNAME "kernel" \ 2367 VERSION "${PKG_VERSION}" \ 2368 KERNELDIR "kernel" \ 2369 KERNEL_NAME "${INSTALLKERNEL}" \ 2370 KERNEL_FLAVOR "${flavor}" \ 2371 PKG_NAME_PREFIX "${PKG_NAME_PREFIX}" \ 2372 PKG_MAINTAINER "${PKG_MAINTAINER}" \ 2373 PKG_WWW "${PKG_WWW}" \ 2374 UCLFILES "${SRCDIR}/release/packages/ucl" \ 2375 ${SRCDIR}/release/packages/template.ucl \ 2376 ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl ; \ 2377 awk -F\" ' \ 2378 /name/ { printf("===> Creating %s-", $$2); next } \ 2379 /version/ {print $$2; next } ' \ 2380 ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl ; \ 2381 ${PKG_CMD} -o ABI=${PKG_ABI} -o ALLOW_BASE_SHLIBS=yes \ 2382 -o OSVERSION="${SRCRELDATE}" \ 2383 create -f ${PKG_FORMAT} ${PKG_CLEVEL} -T${PKG_CTHREADS} \ 2384 -M ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl \ 2385 -p ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.plist \ 2386 -r ${KSTAGEDIR}/${DISTDIR} \ 2387 -o ${REPODIR}/${PKG_ABI}/${PKG_OUTPUT_DIR} 2388. endfor 2389.else 2390create-kernel-packages: .PHONY 2391 2392.endif 2393.if !empty(INSTALLEXTRAKERNELS) 2394.for _kernel in ${INSTALLEXTRAKERNELS} 2395. if exists(${KSTAGEDIR}/kernel.${_kernel}.meta) 2396. if ${MK_DEBUG_FILES} != "no" 2397_debug=-dbg 2398. endif 2399. for flavor in "" ${_debug} 2400create-kernel-packages: create-kernel-packages-extra-flavor${flavor:C,^""$,${_default_flavor},}-${_kernel} 2401create-kernel-packages-extra-flavor${flavor:C,^""$,${_default_flavor},}-${_kernel}: _pkgbootstrap .PHONY 2402 @cd ${KSTAGEDIR}/kernel.${_kernel} ; \ 2403 ${METALOG_SORT_CMD} ${KSTAGEDIR}/kernel.${_kernel}.meta | \ 2404 awk -f ${SRCDIR}/release/scripts/mtree-to-plist.awk \ 2405 -v kernel=yes -v _kernconf=${_kernel} ; \ 2406 flua ${SRCDIR}/release/packages/generate-ucl.lua \ 2407 PKGNAME "kernel-${_kernel:tl}${flavor}" \ 2408 PKGGENNAME "kernel" \ 2409 FORCEINCLUDE "kernel${flavor}" \ 2410 VERSION "${PKG_VERSION}" \ 2411 KERNEL_NAME "${_kernel:tl}" \ 2412 KERNEL_FLAVOR "${flavor}" \ 2413 KERNELDIR "kernel.${_kernel}" \ 2414 PKG_NAME_PREFIX "${PKG_NAME_PREFIX}" \ 2415 PKG_MAINTAINER "${PKG_MAINTAINER}" \ 2416 PKG_WWW "${PKG_WWW}" \ 2417 UCLFILES "${SRCDIR}/release/packages/ucl" \ 2418 ${SRCDIR}/release/packages/template.ucl \ 2419 ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.ucl ; \ 2420 awk -F\" ' \ 2421 /name/ { printf("===> Creating %s-", $$2); next } \ 2422 /version/ {print $$2; next } ' \ 2423 ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.ucl ; \ 2424 ${PKG_CMD} -o ABI=${PKG_ABI} -o ALLOW_BASE_SHLIBS=yes \ 2425 -o OSVERSION="${SRCRELDATE}" \ 2426 create -f ${PKG_FORMAT} ${PKG_CLEVEL} -T${PKG_CTHREADS} \ 2427 -M ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.ucl \ 2428 -p ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.plist \ 2429 -r ${KSTAGEDIR}/kernel.${_kernel} \ 2430 -o ${REPODIR}/${PKG_ABI}/${PKG_OUTPUT_DIR} 2431. endfor 2432. endif 2433. endfor 2434.endif 2435 2436sign-packages: .PHONY 2437 ${_+_}@cd ${.CURDIR}; \ 2438 ${MAKE} -f Makefile.inc1 \ 2439 PKG_VERSION=${PKG_VERSION} \ 2440 SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \ 2441 real-sign-packages 2442 2443real-sign-packages: _pkgbootstrap .PHONY 2444 printf "version = 2;\n" > ${WSTAGEDIR}/meta 2445 @${PKG_CMD} -o ABI=${PKG_ABI} -o OSVERSION="${SRCRELDATE}" \ 2446 -o WORKERS_COUNT=${PKG_WORKERS_COUNT} repo \ 2447 -m ${WSTAGEDIR}/meta \ 2448 -o ${REPODIR}/${PKG_ABI}/${PKG_VERSION} \ 2449 ${REPODIR}/${PKG_ABI}/${PKG_VERSION} \ 2450 ${PKG_REPO_SIGNING_KEY} ; \ 2451 cd ${REPODIR}/${PKG_ABI}; \ 2452 ln -hfs ${PKG_OUTPUT_DIR} latest 2453 2454# 2455# 2456# checkworld 2457# 2458# Run test suite on installed world. 2459# 2460checkworld: .PHONY 2461 @if [ ! -x "${LOCALBASE}/bin/kyua" ] && [ ! -x "/usr/bin/kyua" ]; then \ 2462 echo "You need kyua (devel/kyua) to run the test suite." | /usr/bin/fmt; \ 2463 exit 1; \ 2464 fi 2465 ${_+_}PATH="$$PATH:${LOCALBASE}/bin" kyua test -k ${TESTSBASE}/Kyuafile 2466 2467# 2468# 2469# doxygen 2470# 2471# Build the API documentation with doxygen 2472# 2473doxygen: .PHONY 2474 @if [ ! -x "${LOCALBASE}/bin/doxygen" ]; then \ 2475 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \ 2476 exit 1; \ 2477 fi 2478 @if [ ! -x "${LOCALBASE}/bin/tex" ]; then \ 2479 echo "You need TeX (print/texlive-full) to generate the API documentation of the kernel." | /usr/bin/fmt; \ 2480 exit 1; \ 2481 fi 2482 @if [ ! -x "${LOCALBASE}/bin/dot" ]; then \ 2483 echo "You need graphviz (graphics/graphviz) to generate the API documentation of the kernel." | /usr/bin/fmt; \ 2484 exit 1; \ 2485 fi 2486 ${_+_}cd ${.CURDIR}/tools/kerneldoc/subsys; ${MAKE} obj all 2487 2488# 2489# ------------------------------------------------------------------------ 2490# 2491# From here onwards are utility targets used by the 'make world' and 2492# related targets. If your 'world' breaks, you may like to try to fix 2493# the problem and manually run the following targets to attempt to 2494# complete the build. Beware, this is *not* guaranteed to work, you 2495# need to have a pretty good grip on the current state of the system 2496# to attempt to manually finish it. If in doubt, 'make world' again. 2497# 2498 2499# 2500# legacy: Build compatibility shims for the next three targets. This is a 2501# minimal set of tools and shims necessary to compensate for older systems 2502# which don't have the APIs required by the targets built in bootstrap-tools, 2503# build-tools or cross-tools. 2504# 2505legacy: .PHONY 2506.if ${BOOTSTRAPPING} < ${MINIMUM_SUPPORTED_OSREL} && ${BOOTSTRAPPING} != 0 2507 @echo "ERROR: Source upgrades from versions prior to ${MINIMUM_SUPPORTED_REL} are not supported."; \ 2508 false 2509.endif 2510 2511.for _tool in \ 2512 tools/build \ 2513 ${LOCAL_LEGACY_DIRS} 2514 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,all,install)"; \ 2515 cd ${.CURDIR}/${_tool}; \ 2516 if [ -z "${NO_OBJWALK}" ]; then ${MAKE} DIRPRFX=${_tool}/ obj; fi; \ 2517 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${WORLDTMP}/legacy includes; \ 2518 ${MAKE} DIRPRFX=${_tool}/ MK_INCLUDES=no all; \ 2519 ${MAKE} DIRPRFX=${_tool}/ MK_INCLUDES=no \ 2520 DESTDIR=${WORLDTMP}/legacy install 2521.endfor 2522 2523# 2524# bootstrap-tools: Build tools needed for compatibility. These are binaries that 2525# are built to build other binaries in the system. However, the focus of these 2526# binaries is usually quite narrow. Bootstrap tools use the host's compiler and 2527# libraries, augmented by -legacy, in addition to the libraries built during 2528# bootstrap-tools. 2529# 2530_bt= _bootstrap-tools 2531 2532# We want to run the build with only ${WORLDTMP} in $PATH to ensure we don't 2533# accidentally run tools that are incompatible but happen to be in $PATH. 2534# This is especially important when building on Linux/MacOS where many of the 2535# programs used during the build accept different flags or generate different 2536# output. On those platforms we only symlink the tools known to be compatible 2537# (e.g. basic utilities such as mkdir) into ${WORLDTMP} and build all others 2538# from the FreeBSD sources during the bootstrap-tools stage. 2539# We want to build without the user's $PATH starting in the bootstrap-tools 2540# phase so the tools used in that phase (ln, cp, etc) must have already been 2541# linked to $WORLDTMP. The tools are listed in the _host_tools_to_symlink 2542# variable in tools/build/Makefile and are linked during the legacy phase. 2543# Since they could be Linux or MacOS binaries, too we must only use flags that 2544# are portable across operating systems. 2545 2546# If BOOTSTRAP_ALL_TOOLS is set we will build all the required tools from the 2547# current source tree. Otherwise we create a symlink to the version found in 2548# $PATH during the bootstrap-tools stage. 2549# When building on non-FreeBSD systems we can't assume that the host binaries 2550# accept compatible flags or produce compatible output. Therefore we force 2551# BOOTSTRAP_ALL_TOOLS and just build the FreeBSD version of the binary. 2552.if defined(CROSSBUILD_HOST) 2553BOOTSTRAP_ALL_TOOLS:= 1 2554.endif 2555.if defined(BOOTSTRAP_ALL_TOOLS) 2556# BOOTSTRAPPING will be set on the command line so we can't override it here. 2557# Instead set BOOTSTRAPPING_OSRELDATE so that the value 0 is set ${BSARGS} 2558BOOTSTRAPPING_OSRELDATE:= 0 2559.endif 2560 2561.if ${MK_GAMES} != "no" 2562_strfile= usr.bin/fortune/strfile 2563.endif 2564 2565# vtfontcvt is used to build font files for loader and to generate 2566# C source for loader built in font (8x16.c). 2567_vtfontcvt= usr.bin/vtfontcvt 2568 2569# zic is used to compile timezone data 2570.if ${MK_ZONEINFO} != "no" 2571_zic= usr.sbin/zic 2572.endif 2573 2574# If we are not building the bootstrap because BOOTSTRAPPING is sufficient 2575# we symlink the host version to $WORLDTMP instead. By doing this we can also 2576# detect when a bootstrap tool is being used without the required MK_FOO. 2577# If you add a new bootstrap tool where we could also use the host version, 2578# please ensure that you also add a .else case where you add the tool to the 2579# _bootstrap_tools_links variable. 2580.if ${BOOTSTRAPPING} < 1000033 2581# Note: lex needs m4 to build but m4 also depends on lex (which needs m4 to 2582# generate any files). To fix this cyclic dependency we can build a bootstrap 2583# version of m4 (with pre-generated files) then use that to build the real m4. 2584# We can't simply use the host m4 since e.g. the macOS version does not accept 2585# the flags that are passed by lex. 2586# For lex we also use the pre-gerated files since we would otherwise need to 2587# build awk and sed first (which need lex to build) 2588# TODO: add a _bootstrap_lex and then build the real lex afterwards 2589_lex= usr.bin/lex 2590_m4= tools/build/bootstrap-m4 usr.bin/m4 2591${_bt}-tools/build/bootstrap-m4: ${_bt}-usr.bin/lex ${_bt}-lib/libopenbsd ${_bt}-usr.bin/yacc 2592${_bt}-usr.bin/m4: ${_bt}-lib/libopenbsd ${_bt}-usr.bin/yacc ${_bt}-usr.bin/lex ${_bt}-tools/build/bootstrap-m4 2593_bt_m4_depend=${_bt}-usr.bin/m4 2594_bt_lex_depend=${_bt}-usr.bin/lex ${_bt_m4_depend} 2595.else 2596_bootstrap_tools_links+=m4 lex 2597.endif 2598 2599# ELF Tool Chain libraries are needed for ELF tools and dtrace tools. 2600# r296685 fix cross-endian objcopy 2601# r310724 fixed PR 215350, a crash in libdwarf with objects built by GCC 6.2. 2602# r334881 added libdwarf constants used by ctfconvert. 2603# r338478 fixed a crash in objcopy for mips64el objects 2604# r339083 libelf: correct mips64el test to use ELF header 2605# r348347 Add missing powerpc64 relocation support to libdwarf 2606.if ${BOOTSTRAPPING} < 1300030 2607_elftoolchain_libs= lib/libelf lib/libdwarf lib/libzstd 2608${_bt}-lib/libelf: ${_bt_m4_depend} 2609${_bt}-lib/libdwarf: ${_bt_m4_depend} 2610_bt_libelf_depend=${_bt}-lib/libelf 2611.endif 2612 2613_libkldelf= lib/libkldelf 2614${_bt}-lib/libkldelf: ${_bt_libelf_depend} 2615_bt_libkldelf_depend=${_bt}-lib/libkldelf 2616 2617_kldxref= usr.sbin/kldxref 2618${_bt}-usr.sbin/kldxref: ${_bt_libelf_depend} ${_bt_libkldelf_depend} 2619 2620# flua is required to regenerate syscall files, and for the pkgbase build. 2621# To protect us from changes in newer versions of flua or lua libraries 2622# that might be installed on the host, always bootstrap it. 2623${_bt}-libexec/flua: ${_bt}-lib/liblua 2624${_bt}-libexec/flua: ${_bt}-lib/libmd ${_bt}-lib/libucl ${_bt}-lib/libyaml 2625 2626# r245440 mtree -N support added 2627# r313404 requires sha384.h for libnetbsd, added to libmd in r292782 2628.if ${BOOTSTRAPPING} < 1100093 2629_libnetbsd= lib/libnetbsd 2630_nmtree= lib/libmd \ 2631 usr.sbin/nmtree 2632 2633${_bt}-lib/libnetbsd: ${_bt}-lib/libmd 2634${_bt}-usr.sbin/nmtree: ${_bt}-lib/libnetbsd 2635.else 2636_bootstrap_tools_links+=mtree 2637.endif 2638 2639# r246097: log addition login.conf.db, passwd, pwd.db, and spwd.db with cat -l 2640.if ${BOOTSTRAPPING} < 1000027 2641_cat= bin/cat 2642.else 2643_bootstrap_tools_links+=cat 2644.endif 2645 2646# r277259 crunchide: Correct 64-bit section header offset 2647# r281674 crunchide: always include both 32- and 64-bit ELF support 2648.if ${BOOTSTRAPPING} < 1100078 2649_crunchide= usr.sbin/crunch/crunchide 2650.else 2651_bootstrap_tools_links+=crunchide 2652.endif 2653 2654# 1400052, 1300526, 1203507: Removed -dc from linker invocation 2655.if ${BOOTSTRAPPING} < 1203507 || \ 2656 (${BOOTSTRAPPING} > 1300000 && ${BOOTSTRAPPING} < 1300526) || \ 2657 (${BOOTSTRAPPING} > 1400000 && ${BOOTSTRAPPING} < 1400052) 2658_crunchgen= usr.sbin/crunch/crunchgen 2659.else 2660_bootstrap_tools_links+=crunchgen 2661.endif 2662 2663# The ATKBD_DFLT_KEYMAP, UKBD_DFLT_KEYMAP and KBDMUX_DFLT_KEYMAP kernel options 2664# require kbdcontrol. Note that, even on FreeBSD, the host will lack kbdcontrol 2665# if built with WITHOUT_LEGACY_CONSOLE. 2666.if defined(BOOTSTRAP_ALL_TOOLS) || !exists(/usr/sbin/kbdcontrol) 2667_kbdcontrol= usr.sbin/kbdcontrol 2668.else 2669_bootstrap_tools_links+=kbdcontrol 2670.endif 2671 2672.if ${MK_DISK_IMAGE_TOOLS_BOOTSTRAP} != "no" 2673_etdump= usr.bin/etdump 2674_makefs= usr.sbin/makefs 2675 2676_libnetbsd= lib/libnetbsd 2677${_bt}-usr.sbin/makefs: ${_bt}-lib/libnetbsd 2678 2679.if defined(BOOTSTRAP_ALL_TOOLS) 2680_libsbuf= lib/libsbuf 2681${_bt}-usr.sbin/makefs: ${_bt}-lib/libsbuf 2682.endif 2683.endif 2684 2685# 1300102: VHDX support 2686.if ${BOOTSTRAPPING} < 1201520 || \ 2687 (${BOOTSTRAPPING} > 1300000 && ${BOOTSTRAPPING} < 1300102) || \ 2688 ${MK_DISK_IMAGE_TOOLS_BOOTSTRAP} != "no" 2689_mkimg= usr.bin/mkimg 2690.else 2691_bootstrap_tools_links+=mkimg 2692.endif 2693 2694_yacc= usr.bin/yacc 2695 2696.if ${MK_BSNMP} != "no" 2697_gensnmptree= usr.sbin/bsnmpd/gensnmptree 2698.endif 2699 2700 2701# We need to build tblgen when we're building clang or lld, either as 2702# bootstrap tools, or as the part of the normal build. 2703# llvm-tblgen is also needed for various llvm binutils (e.g. objcopy). 2704.if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_CLANG} != "no" || \ 2705 ${MK_LLD_BOOTSTRAP} != "no" || ${MK_LLD} != "no" || \ 2706 ${MK_LLDB} != "no" || \ 2707 ${MK_LLVM_BINUTILS_BOOTSTRAP} != "no" || ${MK_LLVM_BINUTILS} != "no" 2708_clang_tblgen= \ 2709 lib/clang/libllvmminimal \ 2710 usr.bin/clang/llvm-min-tblgen \ 2711 usr.bin/clang/llvm-tblgen 2712.if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_CLANG} != "no" || \ 2713 ${MK_LLDB} != "no" 2714_clang_tblgen+= lib/clang/libclangminimal 2715_clang_tblgen+= usr.bin/clang/clang-tblgen 2716.endif 2717.if ${MK_LLDB} != "no" 2718_clang_tblgen+= usr.bin/clang/lldb-tblgen 2719.endif 2720${_bt}-usr.bin/clang/clang-tblgen: ${_bt}-lib/clang/libllvmminimal 2721${_bt}-usr.bin/clang/lldb-tblgen: ${_bt}-lib/clang/libllvmminimal 2722${_bt}-usr.bin/clang/llvm-min-tblgen: ${_bt}-lib/clang/libllvmminimal 2723${_bt}-usr.bin/clang/llvm-tblgen: ${_bt}-lib/clang/libllvmminimal 2724${_bt}-usr.bin/clang/llvm-tblgen: ${_bt}-usr.bin/clang/llvm-min-tblgen 2725.endif 2726 2727# C.UTF-8 is always built in share/ctypes and we need localedef for that. 2728_localedef= usr.bin/localedef 2729${_bt}-usr.bin/localedef: ${_bt}-usr.bin/yacc ${_bt_lex_depend} 2730 2731.if ${MK_ICONV} != "no" 2732_mkesdb= usr.bin/mkesdb 2733_mkcsmapper= usr.bin/mkcsmapper 2734${_bt}-usr.bin/mkesdb: ${_bt}-usr.bin/yacc ${_bt_lex_depend} 2735${_bt}-usr.bin/mkcsmapper: ${_bt}-usr.bin/yacc ${_bt_lex_depend} 2736.endif 2737 2738.if ${MK_KERBEROS} != "no" 2739.if ${MK_MITKRB5} != "no" 2740_kerberos5_bootstrap_tools= \ 2741 krb5/util/build-tools \ 2742 krb5/util/compile_et \ 2743 krb5/util/support \ 2744 krb5/util/et \ 2745 krb5/util/ss \ 2746 krb5/util/profile \ 2747 krb5/util/verto 2748# krb5/include \ 2749# krb5/lib/crypto \ 2750# krb5/lib/krb5 \ 2751# krb5/lib/gssapi 2752.else 2753_kerberos5_bootstrap_tools= \ 2754 kerberos5/tools/make-roken \ 2755 kerberos5/lib/libroken \ 2756 kerberos5/lib/libvers \ 2757 kerberos5/tools/asn1_compile \ 2758 kerberos5/tools/slc \ 2759 usr.bin/compile_et 2760 2761.endif 2762.ORDER: ${_kerberos5_bootstrap_tools:C/^/${_bt}-/g} 2763.for _tool in ${_kerberos5_bootstrap_tools} 2764${_bt}-${_tool}: ${_bt}-usr.bin/yacc ${_bt_lex_depend} 2765.endfor 2766.endif 2767 2768${_bt}-usr.bin/mandoc: ${_bt}-lib/libopenbsd 2769 2770# The tools listed in _basic_bootstrap_tools will generally not be 2771# bootstrapped unless BOOTSTRAP_ALL_TOOL is set. However, when building on a 2772# Linux or MacOS host the host versions are incompatible so we need to build 2773# them from the source tree. Usually the link name will be the same as the subdir, 2774# but some directories such as grep or test install multiple binaries. In that 2775# case we use the _basic_bootstrap_tools_multilink variable which is a list of 2776# subdirectory and comma-separated list of files. 2777_basic_bootstrap_tools_multilink=usr.bin/grep grep,egrep,fgrep 2778_basic_bootstrap_tools_multilink+=bin/test test,[ 2779# bootstrap tools needed by buildworld: 2780_basic_bootstrap_tools+=usr.bin/cut bin/expr usr.bin/gencat usr.bin/join \ 2781 usr.bin/mktemp bin/realpath bin/rmdir usr.bin/sed usr.bin/sort \ 2782 usr.bin/truncate usr.bin/tsort 2783# Some build scripts use nawk instead of awk (this happens at least in 2784# cddl/contrib/opensolaris/lib/libdtrace/common/mknames.sh) so we need both awk 2785# and nawk in ${WORLDTMP}/legacy/bin. 2786_basic_bootstrap_tools_multilink+=usr.bin/awk awk,nawk 2787# file2c is required for building usr.sbin/config: 2788_basic_bootstrap_tools+=usr.bin/file2c 2789# uuencode/uudecode required for share/tabset 2790_basic_bootstrap_tools_multilink+=usr.bin/bintrans uuencode,uudecode 2791# xargs is required by mkioctls 2792_basic_bootstrap_tools+=usr.bin/xargs 2793# cap_mkdb is required for share/termcap: 2794_basic_bootstrap_tools+=usr.bin/cap_mkdb 2795# services_mkdb/pwd_mkdb are required for installworld: 2796_basic_bootstrap_tools+=usr.sbin/services_mkdb usr.sbin/pwd_mkdb 2797# ldd is required for installcheck (TODO: just always use /usr/bin/ldd instead?) 2798.if !defined(CROSSBUILD_HOST) 2799# ldd is only needed for updating the running system so we don't need to 2800# bootstrap ldd on non-FreeBSD systems 2801_basic_bootstrap_tools+=usr.bin/ldd 2802.endif 2803# sysctl/chflags are required for installkernel: 2804.if !defined(CROSSBUILD_HOST) 2805_basic_bootstrap_tools+=bin/chflags 2806# Note: sysctl does not bootstrap on FreeBSD < 13 anymore, but that doesn't 2807# matter since we don't need any of the new features for the build. 2808_bootstrap_tools_links+=sysctl 2809.else 2810# When building on non-FreeBSD, install a fake chflags instead since the 2811# version from the source tree cannot work. We also don't need sysctl since we 2812# are install with -DNO_ROOT. 2813_other_bootstrap_tools+=tools/build/cross-build/fake_chflags 2814.endif 2815# mkfifo is used by sys/conf/newvers.sh 2816_basic_bootstrap_tools+=usr.bin/mkfifo 2817# jot is needed for the mkimg tests 2818_basic_bootstrap_tools+=usr.bin/jot 2819 2820.if defined(BOOTSTRAP_ALL_TOOLS) 2821# sha256 and sha512 are used by release/ (and possibly others) 2822_basic_bootstrap_tools+=sbin/md5 2823.endif 2824 2825# tzsetup is needed as an install tool 2826.if ${MK_ZONEINFO} != "no" 2827_basic_bootstrap_tools+=usr.sbin/tzsetup 2828.endif 2829 2830# certctl is needed as an install tool. libcrypto is rather heavy, so we'll 2831# build that alongside it only for platforms that don't expose headers for 2832# OpenSSL, like macOS, or when building on releases with OpenSSL 1.x. 2833.if ${MK_CAROOT} != "no" && ${MK_OPENSSL} != "no" 2834.if ${.MAKE.OS} == "Darwin" || \ 2835 (${.MAKE.OS} == "FreeBSD" && ${BOOTSTRAPPING} < 1400000) 2836_bootstrap_libcrypto=secure/lib/libcrypto 2837${_bt}-usr.sbin/certctl: ${_bt}-secure/lib/libcrypto 2838.endif 2839_certctl=usr.sbin/certctl 2840.endif 2841 2842.if defined(BOOTSTRAP_ALL_TOOLS) 2843_other_bootstrap_tools+=${_basic_bootstrap_tools} 2844.for _subdir _links in ${_basic_bootstrap_tools_multilink} 2845_other_bootstrap_tools+=${_subdir} 2846.endfor 2847${_bt}-usr.bin/awk: ${_bt_lex_depend} ${_bt}-usr.bin/yacc 2848${_bt}-bin/expr: ${_bt_lex_depend} ${_bt}-usr.bin/yacc 2849# If we are bootstrapping file2c, we have to build it before config: 2850${_bt}-usr.sbin/config: ${_bt}-usr.bin/file2c ${_bt_lex_depend} 2851# Note: no symlink to make/bmake in the !BOOTSTRAP_ALL_TOOLS case here since 2852# the links to make/bmake make links will have already have been created in the 2853# `make legacy` step. Not adding a link to make is important on non-FreeBSD 2854# since "make" will usually point to GNU make there. 2855_other_bootstrap_tools+=usr.bin/bmake 2856 2857# Avoid dependency on host bz2 headers: 2858_other_bootstrap_tools+=lib/libbz2 2859${_bt}-usr.bin/grep: ${_bt}-lib/libbz2 2860 2861# libdwarf depends on libz 2862_other_bootstrap_tools+=lib/libz 2863${_bt}-lib/libdwarf: ${_bt}-lib/libz 2864 2865# libroken depends on libcrypt 2866_other_bootstrap_tools+=lib/libcrypt 2867${_bt}-lib/libroken: ${_bt}-lib/libcrypt 2868.else 2869# All tools in _basic_bootstrap_tools have the same name as the subdirectory 2870# so we can use :T to get the name of the symlinks that we need to create. 2871_bootstrap_tools_links+=${_basic_bootstrap_tools:T} 2872.for _subdir _links in ${_basic_bootstrap_tools_multilink} 2873_bootstrap_tools_links+=${_links:S/,/ /g} 2874.endfor 2875.endif # defined(BOOTSTRAP_ALL_TOOLS) 2876 2877# Link the tools that we need for building but don't need to bootstrap because 2878# the host version is known to be compatible into ${WORLDTMP}/legacy 2879# We do this before building any of the bootstrap tools in case they depend on 2880# the presence of any of the links (e.g. as m4/lex/awk) 2881${_bt}-links: .PHONY 2882 2883.for _tool in ${_bootstrap_tools_links} 2884${_bt}-link-${_tool}: .PHONY 2885 @rm -f "${WORLDTMP}/legacy/bin/${_tool}"; \ 2886 source_path=`which ${_tool} || true`; \ 2887 if [ ! -e "$${source_path}" ] ; then \ 2888 echo "Cannot find host tool '${_tool}'"; false; \ 2889 fi; \ 2890 install -p "$${source_path}" "${WORLDTMP}/legacy/bin/${_tool}" 2891${_bt}-links: ${_bt}-link-${_tool} 2892.endfor 2893 2894bootstrap-tools: ${_bt}-links .PHONY 2895 2896# Please document (add comment) why something is in 'bootstrap-tools'. 2897# Try to bound the building of the bootstrap-tool to just the 2898# FreeBSD versions that need the tool built at this stage of the build. 2899.for _tool in \ 2900 ${_clang_tblgen} \ 2901 ${_kerberos5_bootstrap_tools} \ 2902 ${_strfile} \ 2903 usr.bin/dtc \ 2904 ${_cat} \ 2905 ${_bootstrap_libcrypto} \ 2906 ${_certctl} \ 2907 ${_kbdcontrol} \ 2908 ${_elftoolchain_libs} \ 2909 ${_libkldelf} \ 2910 ${_kldxref} \ 2911 lib/liblua \ 2912 lib/libmd \ 2913 lib/libopenbsd \ 2914 lib/libucl \ 2915 lib/libyaml \ 2916 usr.bin/mandoc \ 2917 usr.bin/rpcgen \ 2918 ${_yacc} \ 2919 ${_m4} \ 2920 ${_lex} \ 2921 ${_other_bootstrap_tools} \ 2922 usr.bin/xinstall \ 2923 ${_gensnmptree} \ 2924 usr.sbin/config \ 2925 libexec/flua \ 2926 ${_crunchide} \ 2927 ${_crunchgen} \ 2928 ${_etdump} \ 2929 ${_libnetbsd} \ 2930 ${_libsbuf} \ 2931 ${_makefs} \ 2932 ${_mkimg} \ 2933 ${_nmtree} \ 2934 ${_vtfontcvt} \ 2935 ${_localedef} \ 2936 ${_mkcsmapper} \ 2937 ${_mkesdb} \ 2938 ${_zic} \ 2939 ${LOCAL_BSTOOL_DIRS} 2940# We don't enforce any particular uniqueness of targets in the above list; it 2941# may be the case that different bootstrap tools may have shared dependencies 2942# at different BOOTSTRAPPING points, so we don't object to them using their own 2943# conditionals and duplicating them into their ${_foo} variable to ease future 2944# maintenance if we purge some entries. These target names are purposefully 2945# unique and this is the only place that should be generating commands for them, 2946# but the target may have been defined earlier to express dependencies -- thus, 2947# we specifically want commands() here. 2948.if !commands(${_bt}-${_tool}) 2949${_bt}-${_tool}: ${_bt}-links .PHONY .MAKE 2950 ${_+_}@${ECHODIR} "===> ${_tool} (obj,all,install)"; \ 2951 cd ${.CURDIR}/${_tool}; \ 2952 if [ -z "${NO_OBJWALK}" ]; then ${MAKE} DIRPRFX=${_tool}/ obj; fi; \ 2953 if [ "${_tool}" = "usr.bin/lex" ]; then \ 2954 ${MAKE} DIRPRFX=${_tool}/ bootstrap; \ 2955 fi; \ 2956 ${MAKE} DIRPRFX=${_tool}/ all; \ 2957 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${WORLDTMP}/legacy install 2958bootstrap-tools: ${_bt}-${_tool} 2959.endif 2960.endfor 2961.if target(${_bt}-lib/libmd) 2962# If we are bootstrapping libmd (e.g. when building on macOS/Linux) add the 2963# necessary dependencies: 2964${_bt}-usr.bin/sort: ${_bt}-lib/libmd 2965${_bt}-usr.bin/xinstall: ${_bt}-lib/libmd 2966${_bt}-sbin/md5: ${_bt}-lib/libmd 2967.endif 2968 2969 2970# 2971# build-tools: Build special purpose build tools 2972# 2973.if !defined(NO_SHARE) && ${MK_SYSCONS} != "no" 2974_share= share/syscons/scrnmaps 2975.endif 2976 2977.if ${MK_RESCUE} != "no" 2978# rescue includes programs that have build-tools targets 2979_rescue=rescue/rescue 2980.endif 2981 2982.if ${MK_TCSH} != "no" 2983_tcsh=bin/csh 2984.endif 2985.if ${MK_FILE} != "no" 2986_libmagic=lib/libmagic 2987.endif 2988 2989.if ${MK_PMC} != "no" 2990_jevents=lib/libpmc/pmu-events 2991.endif 2992 2993# kernel-toolchain skips _cleanobj, so handle cleaning up previous 2994# build-tools directories if needed. 2995.if ${MK_CLEAN} == "yes" && make(kernel-toolchain) 2996_bt_clean= ${CLEANDIR} 2997.endif 2998 2999.for _tool in \ 3000 ${_tcsh} \ 3001 bin/sh \ 3002 ${LOCAL_TOOL_DIRS} \ 3003 ${_jevents} \ 3004 lib/ncurses/tinfo \ 3005 ${_rescue} \ 3006 ${_share} \ 3007 usr.bin/awk \ 3008 ${_libmagic} \ 3009 usr.bin/vi/catalog 3010build-tools_${_tool}: .PHONY 3011 ${_+_}@${ECHODIR} "===> ${_tool} (${_bt_clean:D${_bt_clean},}obj,build-tools)"; \ 3012 cd ${.CURDIR}/${_tool}; \ 3013 if [ -n "${_bt_clean}" ]; then ${MAKE} DIRPRFX=${_tool}/ ${_bt_clean}; fi; \ 3014 if [ -z "${NO_OBJWALK}" ]; then ${MAKE} DIRPRFX=${_tool}/ obj; fi; \ 3015 ${MAKE} DIRPRFX=${_tool}/ build-tools 3016build-tools: build-tools_${_tool} 3017.endfor 3018 3019# 3020# kernel-tools: Build kernel-building tools 3021# 3022kernel-tools: .PHONY 3023 mkdir -p ${WORLDTMP}/usr 3024 ${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 3025 -p ${WORLDTMP}/usr >/dev/null 3026 3027# 3028# cross-tools: All the tools needed to build the rest of the system after 3029# we get done with the earlier stages. It is the last set of tools needed 3030# to begin building the target binaries. 3031# 3032.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${BUILD_WITH_STRICT_TMPPATH} != 0 3033.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386" 3034_btxld= usr.sbin/btxld 3035.endif 3036.endif 3037 3038# Rebuild ctfconvert and ctfmerge to avoid difficult-to-diagnose failures 3039# resulting from missing bug fixes or ELF Toolchain updates. 3040.if ${MK_CDDL} != "no" 3041_dtrace_tools= cddl/lib/libctf cddl/lib/libspl cddl/usr.bin/ctfconvert \ 3042 cddl/usr.bin/ctfmerge 3043.endif 3044 3045.if ${MK_ELFTOOLCHAIN_BOOTSTRAP} != "no" 3046# Some bespoke tools from or based on ELF Tool Chain. elfcopy is included 3047# because llvm-objcopy is currently not capable of translating ELF to PE32+, 3048# which is required for EFI boot programs. 3049_elftctools= lib/libelftc \ 3050 lib/libpe \ 3051 usr.bin/elfcopy \ 3052 usr.bin/elfctl \ 3053 usr.bin/elfdump 3054# If we're given an XNM we don't need to build standard binary utilities. 3055.if ${XNM:M/*} == "" 3056_elftctools+= usr.bin/nm \ 3057 usr.bin/size \ 3058 usr.bin/strings 3059# These are not required by the build, but can be useful for developers who 3060# cross-build on a FreeBSD 10 host: 3061_elftctools+= usr.bin/addr2line 3062.endif 3063.endif 3064 3065.if ${MK_CLANG_BOOTSTRAP} != "no" 3066_clang= usr.bin/clang/clang 3067.endif 3068.if ${MK_LLD_BOOTSTRAP} != "no" 3069_lld= usr.bin/clang/lld 3070.endif 3071.if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_LLD_BOOTSTRAP} != "no" || \ 3072 ${MK_LLVM_BINUTILS_BOOTSTRAP} != "no" 3073_clang_libs= lib/clang 3074.endif 3075.if ${MK_LLVM_BINUTILS_BOOTSTRAP} != "no" 3076_llvm_binutils= usr.bin/clang/llvm-ar \ 3077 usr.bin/clang/llvm-nm \ 3078 usr.bin/clang/llvm-objcopy \ 3079 usr.bin/clang/llvm-size 3080.endif 3081.if ${MK_USB} != "no" 3082_usb_tools= stand/usb/tools 3083.endif 3084 3085.if ${BUILD_WITH_STRICT_TMPPATH} != 0 || defined(BOOTSTRAP_ALL_TOOLS) 3086_ar=usr.bin/ar 3087.endif 3088 3089cross-tools: .MAKE .PHONY 3090.for _tool in \ 3091 ${LOCAL_XTOOL_DIRS} \ 3092 ${_ar} \ 3093 ${_clang_libs} \ 3094 ${_clang} \ 3095 ${_lld} \ 3096 ${_llvm_binutils} \ 3097 ${_elftctools} \ 3098 ${_dtrace_tools} \ 3099 ${_btxld} \ 3100 ${_usb_tools} 3101 ${_+_}@${ECHODIR} "===> ${_tool} (obj,all,install)"; \ 3102 cd ${.CURDIR}/${_tool}; \ 3103 if [ -z "${NO_OBJWALK}" ]; then ${MAKE} DIRPRFX=${_tool}/ obj; fi; \ 3104 ${MAKE} DIRPRFX=${_tool}/ all; \ 3105 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${WORLDTMP} install 3106.endfor 3107 3108# 3109# native-xtools is the current target for qemu-user cross builds of ports 3110# via poudriere and the imgact_binmisc kernel module. 3111# This target merely builds a toolchan/sysroot, then builds the tools it wants 3112# with the options it wants in a special MAKEOBJDIRPREFIX, using the toolchain 3113# already built. It then installs the static tools to NXBDESTDIR for Poudriere 3114# to pickup. 3115# 3116NXBOBJROOT= ${OBJROOT}${MACHINE}.${MACHINE_ARCH}/nxb/ 3117NXBOBJTOP= ${NXBOBJROOT}${NXB_TARGET}.${NXB_TARGET_ARCH} 3118NXTP?= /nxb-bin 3119.if ${NXTP:N/*} 3120.error NXTP variable should be an absolute path 3121.endif 3122NXBDESTDIR?= ${DESTDIR}${NXTP} 3123 3124# This is the list of tools to be built/installed as static and where 3125# appropriate to build for the given TARGET.TARGET_ARCH. 3126NXBDIRS+= \ 3127 bin/cat \ 3128 bin/chmod \ 3129 bin/cp \ 3130 ${_tcsh} \ 3131 bin/echo \ 3132 bin/expr \ 3133 bin/hostname \ 3134 bin/ln \ 3135 bin/ls \ 3136 bin/mkdir \ 3137 bin/mv \ 3138 bin/ps \ 3139 bin/realpath \ 3140 bin/rm \ 3141 bin/rmdir \ 3142 bin/sh \ 3143 bin/sleep \ 3144 sbin/md5 \ 3145 sbin/sysctl \ 3146 usr.bin/addr2line \ 3147 usr.bin/ar \ 3148 usr.bin/awk \ 3149 usr.bin/basename \ 3150 usr.bin/bmake \ 3151 usr.bin/bzip2 \ 3152 usr.bin/cmp \ 3153 usr.bin/diff \ 3154 usr.bin/dirname \ 3155 usr.bin/elfcopy \ 3156 usr.bin/env \ 3157 usr.bin/fetch \ 3158 usr.bin/find \ 3159 usr.bin/grep \ 3160 usr.bin/gzip \ 3161 usr.bin/head \ 3162 usr.bin/id \ 3163 usr.bin/lex \ 3164 usr.bin/limits \ 3165 usr.bin/mandoc \ 3166 usr.bin/mktemp \ 3167 usr.bin/mt \ 3168 usr.bin/nm \ 3169 usr.bin/patch \ 3170 usr.bin/readelf \ 3171 usr.bin/sed \ 3172 usr.bin/size \ 3173 usr.bin/sort \ 3174 usr.bin/strings \ 3175 usr.bin/tar \ 3176 usr.bin/touch \ 3177 usr.bin/tr \ 3178 usr.bin/true \ 3179 usr.bin/uniq \ 3180 usr.bin/unzip \ 3181 usr.bin/wc \ 3182 usr.bin/xargs \ 3183 usr.bin/xinstall \ 3184 usr.bin/xz \ 3185 usr.bin/yacc \ 3186 usr.sbin/chown 3187 3188SUBDIR_DEPEND_usr.bin/clang= lib/clang 3189.if ${MK_CLANG} != "no" 3190NXBDIRS+= lib/clang 3191NXBDIRS+= usr.bin/clang 3192.endif 3193# XXX: native-xtools passes along ${NXBDIRS} in SUBDIR_OVERRIDE that needs 3194# to be evaluated after NXBDIRS is set. 3195.if make(install) && !empty(SUBDIR_OVERRIDE) 3196SUBDIR= ${SUBDIR_OVERRIDE} 3197.endif 3198 3199NXBMAKEARGS+= \ 3200 OBJTOP=${NXBOBJTOP:Q} \ 3201 OBJROOT=${NXBOBJROOT:Q} \ 3202 -DNO_SHARED \ 3203 -DNO_CPU_CFLAGS \ 3204 -DNO_PIC \ 3205 MK_CASPER=no \ 3206 MK_CLANG_EXTRAS=no \ 3207 MK_CLANG_FORMAT=no \ 3208 MK_CLANG_FULL=no \ 3209 MK_CTF=no \ 3210 MK_DEBUG_FILES=no \ 3211 MK_HTML=no \ 3212 MK_LLDB=no \ 3213 MK_LLVM_LINK_STATIC_LIBRARIES=yes \ 3214 MK_MAN=no \ 3215 MK_MAN_UTILS=yes \ 3216 MK_OFED=no \ 3217 MK_OPENSSH=no \ 3218 MK_RETPOLINE=no \ 3219 MK_SENDMAIL=no \ 3220 MK_SSP=no \ 3221 MK_TESTS=no \ 3222 MK_WERROR=no \ 3223 MK_ZFS=no 3224 3225NXBMAKEENV+= \ 3226 MAKEOBJDIRPREFIX= 3227 3228# This should match all of the knobs in lib/Makefile that it takes to avoid 3229# descending into lib/clang! 3230NXBTNOTOOLS= MK_CLANG=no MK_LLD=no MK_LLDB=no MK_LLVM_BINUTILS=no 3231 3232.if make(native-xtools*) && \ 3233 (!defined(NXB_TARGET) || !defined(NXB_TARGET_ARCH)) 3234.error Missing NXB_TARGET / NXB_TARGET_ARCH 3235.endif 3236# For 'toolchain' we want to produce native binaries that themselves generate 3237# native binaries. 3238NXBTMAKE= ${NXBMAKEENV} ${MAKE} ${NXBMAKEARGS:N-DNO_PIC:N-DNO_SHARED} \ 3239 TARGET=${MACHINE} TARGET_ARCH=${MACHINE_ARCH} 3240# For 'everything' we want to produce native binaries (hence -target to 3241# be MACHINE) that themselves generate TARGET.TARGET_ARCH binaries. 3242# TARGET/TARGET_ARCH are still passed along from user. 3243# 3244# Use the toolchain we create as an external toolchain. 3245.if ${USING_SYSTEM_COMPILER} == "yes" || ${XCC:N${CCACHE_BIN}:M/*} 3246NXBMAKE+= XCC="${XCC}" \ 3247 XCXX="${XCXX}" \ 3248 XCPP="${XCPP}" 3249.else 3250NXBMAKE+= XCC="${NXBOBJTOP}/tmp/usr/bin/cc" \ 3251 XCXX="${NXBOBJTOP}/tmp/usr/bin/c++" \ 3252 XCPP="${NXBOBJTOP}/tmp/usr/bin/cpp" 3253.endif 3254NXBMAKE+= ${NXBMAKEENV} ${MAKE} -f Makefile.inc1 ${NXBMAKEARGS} \ 3255 MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH} \ 3256 TARGET=${NXB_TARGET} TARGET_ARCH=${NXB_TARGET_ARCH} \ 3257 TARGET_TRIPLE=${MACHINE_TRIPLE:Q} 3258# NXBDIRS is improperly based on MACHINE rather than NXB_TARGET. Need to 3259# invoke a sub-make to reevaluate MK_CLANG, etc, for NXBDIRS. 3260NXBMAKE+= SUBDIR_OVERRIDE='$${NXBDIRS:M*}' 3261# Need to avoid the -isystem logic when using clang as an external toolchain 3262# even if the TARGET being built for wants GCC. 3263NXBMAKE+= WANT_COMPILER_TYPE='$${X_COMPILER_TYPE}' 3264native-xtools: .PHONY 3265 ${_+_}cd ${.CURDIR}; ${NXBTMAKE} _cleanobj 3266 # Build the bootstrap/host/cross tools that produce native binaries 3267 ${_+_}cd ${.CURDIR}; ${NXBTMAKE} kernel-toolchain 3268 # Populate includes/libraries sysroot that produce native binaries. 3269 # This is split out from 'toolchain' above mostly so that target LLVM 3270 # libraries have a proper LLVM_DEFAULT_TARGET_TRIPLE without 3271 # polluting the cross-compiler build. The LLVM libs are skipped 3272 # here to avoid the problem but are kept in 'toolchain' so that 3273 # needed build tools are built. 3274 ${_+_}cd ${.CURDIR}; ${NXBTMAKE} _includes ${NXBTNOTOOLS} 3275 ${_+_}cd ${.CURDIR}; ${NXBTMAKE} _libraries ${NXBTNOTOOLS} 3276.if !defined(NO_OBJWALK) 3277 ${_+_}cd ${.CURDIR}; ${NXBMAKE} _obj 3278.endif 3279 ${_+_}cd ${.CURDIR}; ${NXBMAKE} everything 3280 @echo ">> native-xtools done. Use 'make native-xtools-install' to install to a given DESTDIR" 3281 3282native-xtools-install: .PHONY 3283 mkdir -p ${NXBDESTDIR}/bin ${NXBDESTDIR}/sbin ${NXBDESTDIR}/usr 3284 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 3285 -p ${NXBDESTDIR}/usr >/dev/null 3286 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 3287 -p ${NXBDESTDIR}/usr/include >/dev/null 3288.for d in ${LIBCOMPAT_INCLUDE_DIRS} 3289 mkdir -p ${NXBDESTDIR}/usr/include/${d} 3290.endfor 3291 ${_+_}cd ${.CURDIR}; ${NXBMAKE} \ 3292 DESTDIR=${NXBDESTDIR} \ 3293 -DNO_ROOT \ 3294 install 3295 3296# 3297# hierarchy - ensure that all the needed directories are present 3298# 3299hierarchy hier: .MAKE .PHONY 3300 ${_+_}cd ${.CURDIR}/etc; ${HMAKE} distrib-dirs 3301 3302# 3303# libraries - build all libraries, and install them under ${DESTDIR}. 3304# 3305# The list of libraries with dependents (${_prebuild_libs}) and their 3306# interdependencies (__L) are built automatically by the 3307# ${.CURDIR}/tools/make_libdeps.sh script. 3308# 3309libraries: .MAKE .PHONY 3310 ${_+_}cd ${.CURDIR}; \ 3311 ${MAKE} -f Makefile.inc1 _prereq_libs; \ 3312 ${MAKE} -f Makefile.inc1 _startup_libs; \ 3313 ${MAKE} -f Makefile.inc1 _prebuild_libs -DLIBCRYPTO_WITHOUT_SUBDIRS; \ 3314 ${MAKE} -f Makefile.inc1 _generic_libs 3315 3316# 3317# static libgcc.a prerequisite for shared libc 3318# 3319_prereq_libs= lib/libcompiler_rt 3320.if ${MK_SSP} != "no" 3321_prereq_libs+= lib/libssp_nonshared 3322.endif 3323.if ${MK_ASAN} != "no" 3324_prereq_libs+= lib/libclang_rt/asan 3325_prereq_libs+= lib/libclang_rt/asan-preinit 3326_prereq_libs+= lib/libclang_rt/asan_cxx 3327_prereq_libs+= lib/libclang_rt/asan_static 3328.endif 3329.if ${MK_UBSAN} != "no" 3330_prereq_libs+= lib/libclang_rt/ubsan_minimal 3331_prereq_libs+= lib/libclang_rt/ubsan_standalone 3332_prereq_libs+= lib/libclang_rt/ubsan_standalone_cxx 3333.endif 3334 3335# These dependencies are not automatically generated: 3336# 3337# lib/csu and lib/libc must be built before 3338# all shared libraries for ELF. 3339# 3340_startup_libs= lib/csu 3341_startup_libs+= lib/libc 3342_startup_libs+= lib/libc_nonshared 3343_startup_libs+= lib/libcxxrt 3344_startup_libs+= lib/libsys 3345 3346_prereq_libs+= lib/libgcc_eh lib/libgcc_s 3347_startup_libs+= lib/libgcc_eh lib/libgcc_s 3348 3349lib/libc__L: lib/libsys__L 3350lib/libgcc_s__L: lib/libc__L 3351lib/libgcc_s__L: lib/libc_nonshared__L 3352lib/libcxxrt__L: lib/libgcc_s__L 3353lib/libcrypt__L: lib/libmd__L 3354 3355_prebuild_libs= ${_kerberos5_lib_libasn1} \ 3356 ${_kerberos5_lib_libhdb} \ 3357 ${_kerberos5_lib_libheimbase} \ 3358 ${_kerberos5_lib_libheimntlm} \ 3359 ${_libsqlite3} \ 3360 ${_kerberos5_lib_libheimipcc} \ 3361 ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \ 3362 ${_kerberos5_lib_libroken} \ 3363 ${_kerberos5_lib_libwind} \ 3364 ${_krb5_util_et} \ 3365 ${_krb5_util_profile} \ 3366 lib/libbz2 ${_libcom_err} lib/libcrypt \ 3367 lib/libc++ \ 3368 lib/libelf lib/libexpat \ 3369 lib/libfigpar \ 3370 ${_lib_libgssapi} \ 3371 lib/libjail \ 3372 lib/libkiconv lib/libkldelf lib/libkvm \ 3373 lib/liblzma lib/libmd lib/libnv \ 3374 lib/libzstd \ 3375 ${_lib_casper} \ 3376 lib/ncurses/tinfo \ 3377 lib/ncurses/ncurses \ 3378 lib/libedit \ 3379 ${_krb5_util_ss} \ 3380 ${_krb5_util_support} \ 3381 ${_krb5_util_verto} \ 3382 ${_krb5_lib_krb5} \ 3383 ${_krb5_lib_crypto} \ 3384 ${_krb5_lib_gssapikrb5} \ 3385 ${_krb5_lib_gssrpc} \ 3386 ${_krb5_lib_kdb5} \ 3387 ${_krb5_lib_krad} \ 3388 ${_krb5_lib_kadm5srvmit} \ 3389 ${_krb5_lib_kadm5clntmit} \ 3390 lib/libpam/libpam lib/libthr \ 3391 ${_lib_libradius} lib/libsbuf lib/libtacplus \ 3392 lib/libgeom \ 3393 ${_lib_librt} \ 3394 ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \ 3395 ${_cddl_lib_libavl} \ 3396 ${_cddl_lib_libicp} \ 3397 ${_cddl_lib_libicp_rescue} \ 3398 ${_cddl_lib_libspl} \ 3399 ${_cddl_lib_libzfs_core} ${_cddl_lib_libzfs} \ 3400 ${_cddl_lib_libzutil} \ 3401 ${_cddl_lib_libctf} ${_cddl_lib_libzfsbootenv} \ 3402 lib/libufs \ 3403 lib/libutil lib/libpjdlog ${_lib_libypclnt} lib/libz lib/msun \ 3404 lib/libxo \ 3405 ${_secure_lib_libcrypto} ${_secure_lib_libssl} \ 3406 ${_lib_libldns} ${_secure_lib_libssh} 3407 3408.if ${MK_DIALOG} != "no" 3409_prebuild_libs+= gnu/lib/libdialog 3410gnu/lib/libdialog__L: lib/msun__L lib/ncurses/tinfo__L lib/ncurses/ncurses__L 3411.endif 3412 3413.if ${MK_GOOGLETEST} != "no" 3414_prebuild_libs+= lib/libregex 3415.endif 3416 3417lib/libgeom__L: lib/libexpat__L lib/libsbuf__L 3418lib/libkldelf__L: lib/libelf__L 3419lib/libkvm__L: lib/libelf__L 3420 3421.if ${MK_RADIUS_SUPPORT} != "no" 3422_lib_libradius= lib/libradius 3423.endif 3424 3425lib/ncurses/ncurses__L: lib/ncurses/tinfo__L 3426 3427lib/libedit__L: lib/ncurses/ncurses__L 3428 3429.if ${MK_OFED} != "no" 3430_prebuild_libs+= \ 3431 lib/ofed/libibverbs \ 3432 lib/ofed/libibmad \ 3433 lib/ofed/libibumad \ 3434 lib/ofed/complib \ 3435 lib/ofed/libbnxtre \ 3436 lib/ofed/libmlx5 3437 3438lib/ofed/libibmad__L: lib/ofed/libibumad__L 3439lib/ofed/complib__L: lib/libthr__L 3440lib/ofed/libbnxtre__L: lib/ofed/libibverbs__L lib/libthr__L 3441lib/ofed/libmlx5__L: lib/ofed/libibverbs__L lib/libthr__L 3442.endif 3443 3444.if ${MK_CASPER} != "no" 3445_lib_casper= lib/libcasper 3446.endif 3447 3448lib/libpjdlog__L: lib/libutil__L 3449lib/libcasper__L: lib/libnv__L 3450lib/liblzma__L: lib/libmd__L lib/libthr__L 3451lib/libzstd__L: lib/libthr__L 3452lib/librt__L: lib/libthr__L 3453 3454_generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} 3455.if ${MK_IPFILTER} != "no" 3456_generic_libs+= sbin/ipf/libipf 3457.endif 3458.for _DIR in ${LOCAL_LIB_DIRS} 3459.if ${_DIR} == ".WAIT" || (empty(_generic_libs:M${_DIR}) && exists(${.CURDIR}/${_DIR}/Makefile)) 3460_generic_libs+= ${_DIR} 3461.endif 3462.endfor 3463 3464lib/libtacplus__L: lib/libmd__L lib/libpam/libpam__L 3465lib/libxo__L: lib/libutil__L 3466 3467.if ${MK_CDDL} != "no" 3468_cddl_lib_libumem= cddl/lib/libumem 3469_cddl_lib_libnvpair= cddl/lib/libnvpair 3470_cddl_lib_libavl= cddl/lib/libavl 3471_cddl_lib_libspl= cddl/lib/libspl 3472 3473cddl/lib/libavl__L: cddl/lib/libspl__L 3474cddl/lib/libnvpair__L: cddl/lib/libspl__L 3475 3476.if ${MK_ZFS} != "no" 3477_lib_librt= lib/librt 3478_cddl_lib_libicp= cddl/lib/libicp 3479_cddl_lib_libicp_rescue= cddl/lib/libicp_rescue 3480_cddl_lib_libzutil= cddl/lib/libzutil 3481_cddl_lib_libzfs_core= cddl/lib/libzfs_core 3482_cddl_lib_libzfs= cddl/lib/libzfs 3483_cddl_lib_libzfsbootenv= cddl/lib/libzfsbootenv 3484 3485cddl/lib/libzutil__L: cddl/lib/libavl__L lib/libgeom__L lib/msun__L 3486 3487cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L cddl/lib/libspl__L cddl/lib/libzutil__L 3488 3489cddl/lib/libzfs__L: cddl/lib/libzfs_core__L lib/msun__L lib/libutil__L lib/librt__L 3490cddl/lib/libzfs__L: lib/libthr__L lib/libmd__L lib/libz__L cddl/lib/libumem__L 3491cddl/lib/libzfs__L: cddl/lib/libavl__L lib/libgeom__L 3492cddl/lib/libzfs__L: cddl/lib/libnvpair__L cddl/lib/libzutil__L 3493cddl/lib/libzfs__L: secure/lib/libcrypto__L 3494 3495cddl/lib/libzfsbootenv__L: cddl/lib/libzfs__L 3496lib/libbe__L: cddl/lib/libzfs__L cddl/lib/libzfsbootenv__L 3497.endif 3498_cddl_lib_libctf= cddl/lib/libctf 3499_cddl_lib= cddl/lib 3500cddl/lib/libctf__L: lib/libz__L cddl/lib/libspl__L 3501cddl/lib/libdtrace__L: lib/libxo__L 3502.endif 3503# cddl/lib/libdtrace requires lib/libproc and lib/librtld_db 3504_prebuild_libs+= lib/libprocstat lib/libproc lib/librtld_db 3505lib/libprocstat__L: lib/libelf__L lib/libkvm__L lib/libutil__L 3506lib/libproc__L: lib/libprocstat__L 3507lib/librtld_db__L: lib/libprocstat__L 3508 3509.if ${MK_CRYPT} != "no" 3510.if ${MK_OPENSSL} != "no" 3511_secure_lib_libcrypto= secure/lib/libcrypto 3512_secure_lib_libssl= secure/lib/libssl 3513lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L 3514secure/lib/libcrypto__L: lib/libthr__L 3515.if ${MK_LDNS} != "no" 3516_lib_libldns= lib/libldns 3517lib/libldns__L: secure/lib/libssl__L 3518.endif 3519.if ${MK_OPENSSH} != "no" 3520_secure_lib_libssh= secure/lib/libssh 3521secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L 3522.if ${MK_LDNS} != "no" 3523secure/lib/libssh__L: lib/libldns__L 3524.endif 3525 3526.if ${MK_KERBEROS_SUPPORT} != "no" 3527.if ${MK_MITKRB5} != "no" 3528secure/lib/libssh__L: krb5/lib/gssapi__L krb5/lib/krb5__L \ 3529 krb5/lib/crypto__L krb5/util/et__L lib/libmd__L krb5/util/support__L 3530.else 3531secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \ 3532 kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \ 3533 lib/libmd__L kerberos5/lib/libroken__L 3534.endif 3535.endif 3536.endif 3537.endif 3538_secure_lib= secure/lib 3539.endif 3540 3541.if ${MK_KERBEROS} != "no" 3542.if ${MK_MITKRB5} != "no" 3543krb5/util/et__L: krb5/util/support__L 3544krb5/util/profile__L: krb5/util/et__L krb5/util/support__L 3545krb5/lib/crypto__L: krb5/util/et__L krb5/util/support__L \ 3546 secure/lib/libcrypto__L 3547krb5/lib/gssapi__L: krb5/lib/krb5__L krb5/lib/crypto__L krb5/util/et__L \ 3548 krb5/util/support__L 3549krb5/lib/kadm5clnt__L: krb5/util/profile__L krb5/lib/rpc__L \ 3550 krb5/lib/gssapi__L krb5/lib/krb5__L krb5/lib/crypto__L \ 3551 krb5/util/support__L krb5/util/et__L 3552krb5/lib/kadm5srv__L: krb5/util/profile__L krb5/lib/rpc__L \ 3553 krb5/lib/gssapi__L krb5/lib/kdb__L krb5/lib/krb5 krb5/lib/crypto__L \ 3554 krb5/util/support__L krb5/util/et__L 3555krb5/lib/kdb__L: krb5/util/profile__L krb5/lib/rpc__L krb5/lib/krb5__L \ 3556 krb5/lib/crypto__L krb5/util/et__L krb5/util/support__L krb5/lib/gssapi__L 3557krb5/lib/krad__L: krb5/lib/krb5__L krb5/lib/crypto__L krb5/util/et__L \ 3558 krb5/util/support__L krb5/util/verto__L 3559krb5/lib/krb5__L: krb5/util/profile__L krb5/lib/crypto__L krb5/util/et__L \ 3560 krb5/util/support__L 3561krb5/lib/rpc__L: krb5/lib/gssapi__L krb5/lib/krb5__L krb5/lib/crypto__L \ 3562 krb5/util/et__L krb5/util/support__L 3563.else 3564kerberos5/lib/libasn1__L: lib/libcom_err__L kerberos5/lib/libroken__L 3565kerberos5/lib/libhdb__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ 3566 kerberos5/lib/libkrb5__L kerberos5/lib/libroken__L \ 3567 kerberos5/lib/libwind__L lib/libsqlite3__L 3568kerberos5/lib/libheimntlm__L: secure/lib/libcrypto__L kerberos5/lib/libkrb5__L \ 3569 kerberos5/lib/libroken__L lib/libcom_err__L 3570kerberos5/lib/libhx509__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ 3571 secure/lib/libcrypto__L kerberos5/lib/libroken__L kerberos5/lib/libwind__L 3572kerberos5/lib/libkrb5__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ 3573 lib/libcrypt__L secure/lib/libcrypto__L kerberos5/lib/libhx509__L \ 3574 kerberos5/lib/libroken__L kerberos5/lib/libwind__L \ 3575 kerberos5/lib/libheimbase__L kerberos5/lib/libheimipcc__L 3576kerberos5/lib/libroken__L: lib/libcrypt__L 3577kerberos5/lib/libwind__L: kerberos5/lib/libroken__L lib/libcom_err__L 3578kerberos5/lib/libheimbase__L: lib/libthr__L 3579kerberos5/lib/libheimipcc__L: kerberos5/lib/libroken__L kerberos5/lib/libheimbase__L lib/libthr__L 3580.endif 3581.endif 3582 3583lib/libsqlite3__L: lib/libthr__L 3584 3585.if ${MK_KERBEROS} != "no" && ${MK_MITKRB5} == "no" 3586_lib_libgssapi= lib/libgssapi 3587.endif 3588 3589.if ${MK_KERBEROS} != "no" 3590.if ${MK_MITKRB5} != "no" 3591_krb5_util= krb5/util 3592_krb5_util_build_tools= krb5/util/build-tools 3593_krb5_util_compileet= krb5/util/compile_et 3594_krb5_util_et= krb5/util/et 3595_krb5_util_profile= krb5/util/profile 3596_krb5_util_ss= krb5/util/ss 3597_krb5_util_support= krb5/util/support 3598_krb5_util_verto= krb5/util/verto 3599_krb5_lib= krb5/lib 3600_krb5_lib_krb5= krb5/lib/krb5 3601_krb5_lib_kdb5= krb5/lib/kdb 3602_krb5_lib_crypto= krb5/lib/crypto 3603_krb5_lib_gssapikrb5= krb5/lib/gssapi 3604_krb5_lib_gssrpc= krb5/lib/rpc 3605_krb5_lib_apputils= krb5/lib/apputils 3606_krb5_lib_kadm5clntmit= krb5/lib/kadm5clnt 3607_krb5_lib_kadm5srvmit= krb5/lib/kadm5srv 3608_krb5_lib_kadm_common= krb5/lib/kadm_common 3609_krb5_lib_kproputil= krb5/lib/kprop_util 3610_krb5_lib_krad= krb5/lib/krad 3611.else 3612_kerberos5_lib= kerberos5/lib 3613_kerberos5_lib_libasn1= kerberos5/lib/libasn1 3614_kerberos5_lib_libhdb= kerberos5/lib/libhdb 3615_kerberos5_lib_libheimbase= kerberos5/lib/libheimbase 3616_kerberos5_lib_libkrb5= kerberos5/lib/libkrb5 3617_kerberos5_lib_libhx509= kerberos5/lib/libhx509 3618_kerberos5_lib_libroken= kerberos5/lib/libroken 3619_kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm 3620_libsqlite3= lib/libsqlite3 3621_kerberos5_lib_libheimipcc= kerberos5/lib/libheimipcc 3622_kerberos5_lib_libwind= kerberos5/lib/libwind 3623_libcom_err= lib/libcom_err 3624.endif 3625.endif 3626 3627.if ${MK_NIS} != "no" 3628_lib_libypclnt= lib/libypclnt 3629.endif 3630 3631.if ${MK_OPENSSL} == "no" 3632lib/libradius__L: lib/libmd__L 3633.endif 3634 3635lib/libproc__L: \ 3636 ${_cddl_lib_libctf:D${_cddl_lib_libctf}__L} \ 3637 lib/libelf__L lib/librtld_db__L lib/libutil__L lib/libcxxrt__L 3638 3639.for _lib in ${_prereq_libs} 3640${_lib}__PL: .PHONY .MAKE 3641.if !defined(_MKSHOWCONFIG) && exists(${.CURDIR}/${_lib}) 3642 ${_+_}@${ECHODIR} "===> ${_lib} (obj,all,install)"; \ 3643 cd ${.CURDIR}/${_lib}; \ 3644 if [ -z "${NO_OBJWALK}" ]; then ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj; fi; \ 3645 ${MAKE} MK_TESTS=no -DNO_PIC \ 3646 DIRPRFX=${_lib}/ all; \ 3647 ${MAKE} MK_TESTS=no -DNO_PIC \ 3648 DIRPRFX=${_lib}/ install 3649.endif 3650.endfor 3651 3652.for _lib in ${_startup_libs} ${_prebuild_libs} ${_generic_libs} 3653${_lib}__L: .PHONY .MAKE 3654.if !defined(_MKSHOWCONFIG) && exists(${.CURDIR}/${_lib}) 3655 ${_+_}@${ECHODIR} "===> ${_lib} (obj,all,install)"; \ 3656 cd ${.CURDIR}/${_lib}; \ 3657 if [ -z "${NO_OBJWALK}" ]; then ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj; fi; \ 3658 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ all; \ 3659 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ install 3660.endif 3661.endfor 3662 3663_prereq_libs: ${_prereq_libs:S/$/__PL/} 3664_startup_libs: ${_startup_libs:S/$/__L/} 3665_prebuild_libs: ${_prebuild_libs:S/$/__L/} 3666_generic_libs: ${_generic_libs:S/$/__L/} 3667 3668# Enable SUBDIR_PARALLEL when not calling 'make all', unless called from 3669# 'everything' with _PARALLEL_SUBDIR_OK set. This is because it is unlikely 3670# that running 'make all' from the top-level, especially with a SUBDIR_OVERRIDE 3671# or LOCAL_DIRS set, will have a reliable build if SUBDIRs are built in 3672# parallel. This is safe for the world stage of buildworld though since it has 3673# already built libraries in a proper order and installed includes into 3674# WORLDTMP. Special handling is done for SUBDIR ordering for 'install*' to 3675# avoid trashing a system if it crashes mid-install. 3676.if !make(all) || defined(_PARALLEL_SUBDIR_OK) 3677SUBDIR_PARALLEL= 3678.endif 3679 3680.include <bsd.subdir.mk> 3681 3682.if make(check-old) || make(check-old-dirs) || \ 3683 make(check-old-files) || make(check-old-libs) || \ 3684 make(delete-old) || make(delete-old-dirs) || \ 3685 make(delete-old-files) || make(delete-old-libs) || \ 3686 make(list-old-dirs) || make(list-old-files) || make(list-old-libs) 3687 3688# 3689# check for / delete old files section 3690# 3691 3692.include "ObsoleteFiles.inc" 3693 3694OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \ 3695else you can not start such an application. Consult UPDATING for more \ 3696information regarding how to cope with the removal/revision bump of a \ 3697specific library." 3698 3699.if !defined(BATCH_DELETE_OLD_FILES) 3700RM_I=-i 3701.else 3702RM_I=-fv 3703.endif 3704 3705list-old-files: .PHONY 3706 @cd ${.CURDIR}; \ 3707 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 3708 -V "OLD_FILES:ts\n" -V "OLD_FILES:Musr/share/*.gz:R:ts\n" \ 3709 -V "MOVED_LIBS:ts\n" \ 3710 ${_ALL_libcompats:@v@-V "OLD_FILES:Mlib/*.so.*:S,^lib,usr/lib$v,:ts\n"@} \ 3711 ${_ALL_libcompats:@v@-V "OLD_FILES:Musr/lib/*:S,^usr/lib,usr/lib$v,:ts\n"@} | \ 3712 sort 3713 3714delete-old-files: .PHONY 3715 @echo ">>> Removing old files (only deletes safe to delete libs)" 3716# Ask for every old file if the user really wants to remove it. 3717# It's annoying, but better safe than sorry. 3718# NB: We cannot pass the list of OLD_FILES as a parameter because the 3719# argument list will get too long. Using .for/.endfor make "loops" will make 3720# the Makefile parser segfault. 3721 @exec 3<&0; \ 3722 cd ${.CURDIR}; \ 3723 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} list-old-files | \ 3724 while read file; do \ 3725 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 3726 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \ 3727 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \ 3728 fi; \ 3729 for ext in debug symbols; do \ 3730 if ! [ -e "${DESTDIR}/$${file}" ] && [ -f \ 3731 "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \ 3732 rm ${RM_I} "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" \ 3733 <&3; \ 3734 fi; \ 3735 done; \ 3736 done 3737# Remove compressed copies of uncompressed manpages 3738.if ${MK_MANCOMPRESS} != "yes" 3739 @exec 3<&0; \ 3740 find ${DESTDIR}/usr/share/man ${DESTDIR}/usr/share/openssl/man ! -type d ! -name \*.gz 2>/dev/null | \ 3741 while read manpage; do \ 3742 if [ -e "$${manpage}.gz" ]; then \ 3743 rm ${RM_I} $${manpage}.gz <&3; \ 3744 fi; \ 3745 done 3746# Remove uncompressed copies of compressed manpages 3747.else 3748 @exec 3<&0; \ 3749 find ${DESTDIR}/usr/share/man ${DESTDIR}/usr/share/openssl/man ! -type d ! -name \*.gz 2>/dev/null | \ 3750 while read manpage; do \ 3751 if [ -e "$${manpage}.gz" ]; then \ 3752 rm ${RM_I} $${manpage} <&3; \ 3753 fi; \ 3754 done 3755.endif 3756.if !empty(MAN_ARCH) && ${MAN_ARCH} != "all" 3757 @exec 3<&0; \ 3758 find -E /usr/share/man/man4/ -mindepth 1 -type d ! -regex '.*/(${MAN_ARCH:C/[[:space:]]+/|/gW})' | \ 3759 while read dir; do \ 3760 find $$dir ! -type d -exec rm ${RM_I} {} + <&3; \ 3761 done 3762.endif 3763 @echo ">>> Old files removed" 3764 3765check-old-files: .PHONY 3766 @echo ">>> Checking for old files" 3767 @cd ${.CURDIR}; \ 3768 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} list-old-files | \ 3769 while read file; do \ 3770 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 3771 echo "${DESTDIR}/$${file}"; \ 3772 fi; \ 3773 for ext in debug symbols; do \ 3774 if [ -f "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \ 3775 echo "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}"; \ 3776 fi; \ 3777 done; \ 3778 done 3779# Check for compressed copies of uncompressed manpages 3780.if ${MK_MANCOMPRESS} != "yes" 3781 @find ${DESTDIR}/usr/share/man ${DESTDIR}/usr/share/openssl/man ! -type d ! -name \*.gz 2>/dev/null | \ 3782 while read manpage; do \ 3783 if [ -e "$${manpage}.gz" ]; then \ 3784 echo $${manpage}.gz; \ 3785 fi; \ 3786 done | sort 3787# Check for uncompressed copies of compressed manpages 3788.else 3789 @find ${DESTDIR}/usr/share/man ${DESTDIR}/usr/share/openssl/man ! -type d ! -name \*.gz 2>/dev/null | \ 3790 while read manpage; do \ 3791 if [ -e "$${manpage}.gz" ]; then \ 3792 echo $${manpage}; \ 3793 fi; \ 3794 done | sort 3795.endif 3796.if !empty(MAN_ARCH) && ${MAN_ARCH} != "all" 3797 @find -E /usr/share/man/man4/ -mindepth 1 -type d ! -regex '.*/(${MAN_ARCH:C/[[:space:]]+/|/gW})' | \ 3798 while read dir; do \ 3799 find $$dir ! -type d; \ 3800 done | sort 3801.endif 3802 3803list-old-libs: .PHONY 3804 @cd ${.CURDIR}; \ 3805 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 3806 -V "OLD_LIBS:ts\n" \ 3807 ${_ALL_libcompats:@v@-V "OLD_LIBS:Mlib/*:S,^lib,usr/lib$v,:ts\n"@} \ 3808 ${_ALL_libcompats:@v@-V "OLD_LIBS:Musr/lib/*:S,^usr/lib,usr/lib$v,:ts\n"@} \ 3809 ${_ALL_libcompats:@v@-V "OLD_LIBS:Mlib/casper/*:S,^lib/casper,usr/lib$v,:ts\n"@} | \ 3810 sort 3811 3812delete-old-libs: .PHONY 3813 @echo ">>> Removing old libraries" 3814 @echo "${OLD_LIBS_MESSAGE}" | fmt 3815 @exec 3<&0; \ 3816 cd ${.CURDIR}; \ 3817 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} list-old-libs | \ 3818 while read file; do \ 3819 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 3820 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \ 3821 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \ 3822 fi; \ 3823 for ext in debug symbols; do \ 3824 if ! [ -e "${DESTDIR}/$${file}" ] && [ -f \ 3825 "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \ 3826 rm ${RM_I} "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" \ 3827 <&3; \ 3828 fi; \ 3829 done; \ 3830 done 3831 @echo ">>> Old libraries removed" 3832 3833check-old-libs: .PHONY 3834 @echo ">>> Checking for old libraries" 3835 @cd ${.CURDIR}; \ 3836 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} list-old-libs | \ 3837 while read file; do \ 3838 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 3839 echo "${DESTDIR}/$${file}"; \ 3840 fi; \ 3841 for ext in debug symbols; do \ 3842 if [ -f "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \ 3843 echo "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}"; \ 3844 fi; \ 3845 done; \ 3846 done 3847 3848list-old-dirs: .PHONY 3849 @cd ${.CURDIR}; \ 3850 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 3851 -V "OLD_DIRS:ts\n" | sort -r 3852 3853delete-old-dirs: .PHONY 3854 @echo ">>> Removing old directories" 3855 @cd ${.CURDIR}; \ 3856 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} list-old-dirs | \ 3857 while read dir; do \ 3858 if [ -d "${DESTDIR}/$${dir}" ]; then \ 3859 rmdir -v "${DESTDIR}/$${dir}" || true; \ 3860 elif [ -L "${DESTDIR}/$${dir}" ]; then \ 3861 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \ 3862 fi; \ 3863 if [ -d "${DESTDIR}${DEBUGDIR}/$${dir}" ]; then \ 3864 rmdir -v "${DESTDIR}${DEBUGDIR}/$${dir}" || true; \ 3865 elif [ -L "${DESTDIR}${DEBUGDIR}/$${dir}" ]; then \ 3866 echo "${DESTDIR}${DEBUGDIR}/$${dir} is a link, please remove everything manually."; \ 3867 fi; \ 3868 done 3869 @echo ">>> Old directories removed" 3870 3871check-old-dirs: .PHONY 3872 @echo ">>> Checking for old directories" 3873 @cd ${.CURDIR}; \ 3874 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} list-old-dirs | \ 3875 while read dir; do \ 3876 if [ -d "${DESTDIR}/$${dir}" ]; then \ 3877 echo "${DESTDIR}/$${dir}"; \ 3878 elif [ -L "${DESTDIR}/$${dir}" ]; then \ 3879 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \ 3880 fi; \ 3881 if [ -d "${DESTDIR}${DEBUGDIR}/$${dir}" ]; then \ 3882 echo "${DESTDIR}${DEBUGDIR}/$${dir}"; \ 3883 elif [ -L "${DESTDIR}${DEBUGDIR}/$${dir}" ]; then \ 3884 echo "${DESTDIR}${DEBUGDIR}/$${dir} is a link, please remove everything manually."; \ 3885 fi; \ 3886 done 3887 3888delete-old: delete-old-files delete-old-dirs .PHONY 3889 @echo "To remove old libraries run '${MAKE_CMD} delete-old-libs'." 3890 3891check-old: check-old-files check-old-libs check-old-dirs .PHONY 3892 @echo "To remove old files and directories run '${MAKE_CMD} delete-old'." 3893 @echo "To remove old libraries run '${MAKE_CMD} delete-old-libs'." 3894 3895.endif 3896 3897# 3898# showconfig - show build configuration. 3899# 3900# ignore lower case knobs (not for use with WITH*) 3901# 3902showconfig: .PHONY 3903 @(${MAKE} -n -f ${.CURDIR}/sys/conf/kern.opts.mk -V dummy -dg1 UPDATE_DEPENDFILE=no NO_OBJ=yes MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH}; \ 3904 ${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 | \ 3905 grep -E '^(MK|OPT)_[A-Z]' | sort -u 3906 3907.if !empty(KRNLOBJDIR) && !empty(KERNCONF) 3908DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/ 3909 3910.if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE) 3911.if !defined(_MKSHOWCONFIG) && exists(${KERNCONFDIR}/${KERNCONF}) 3912FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \ 3913 '${KERNCONFDIR}/${KERNCONF}' ; echo 3914.endif 3915.endif 3916 3917.endif 3918 3919.if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH}) 3920DTBOUTPUTPATH= ${.CURDIR} 3921.endif 3922 3923# 3924# Build 'standalone' Device Tree Blob 3925# 3926builddtb: .PHONY 3927 @PATH=${TMPPATH:Q} MACHINE=${TARGET} \ 3928 sh ${.CURDIR}/sys/tools/fdt/make_dtb.sh ${.CURDIR}/sys \ 3929 "${FDT_DTS_FILE}" ${DTBOUTPUTPATH} 3930 3931############### 3932 3933# cleanworld 3934# In the following, the first 'rm' in a series will usually remove all 3935# files and directories. If it does not, then there are probably some 3936# files with file flags set, so this unsets them and tries the 'rm' a 3937# second time. There are situations where this target will be cleaning 3938# some directories via more than one method, but that duplication is 3939# needed to correctly handle all the possible situations. Removing all 3940# files without file flags set in the first 'rm' instance saves time, 3941# because 'chflags' will need to operate on fewer files afterwards. 3942# 3943# It is expected that BW_CANONICALOBJDIR == the CANONICALOBJDIR as would be 3944# created by bsd.obj.mk, except that we don't want to .include that file 3945# in this makefile. We don't do a cleandir walk if MK_AUTO_OBJ is yes 3946# since it is not possible for files to land in the wrong place. 3947# 3948.if make(cleanworld) 3949BW_CANONICALOBJDIR:=${OBJTOP}/ 3950.elif make(cleankernel) 3951BW_CANONICALOBJDIR:=${KRNLOBJDIR}/${KERNCONF}/ 3952.elif make(cleanuniverse) 3953BW_CANONICALOBJDIR:=${OBJROOT} 3954.if ${MK_UNIFIED_OBJDIR} == "no" 3955.error ${.TARGETS} only supported with WITH_UNIFIED_OBJDIR enabled. 3956.endif 3957.endif 3958cleanworld cleanuniverse cleankernel: .PHONY 3959.if !empty(BW_CANONICALOBJDIR) && exists(${BW_CANONICALOBJDIR}) && \ 3960 ${.CURDIR:tA} != ${BW_CANONICALOBJDIR:tA} 3961 -(cd ${BW_CANONICALOBJDIR} && rm -rf *) 3962 -chflags -R 0 ${BW_CANONICALOBJDIR} 3963 -(cd ${BW_CANONICALOBJDIR} && rm -rf *) 3964.endif 3965.if make(cleanworld) && ${MK_AUTO_OBJ} == "no" && \ 3966 (empty(BW_CANONICALOBJDIR) || ${.CURDIR:tA} == ${BW_CANONICALOBJDIR:tA}) 3967.if ${.CURDIR} == ${.OBJDIR} || ${.CURDIR}/obj == ${.OBJDIR} 3968 # To be safe in this case, fall back to a 'make cleandir' 3969 ${_+_}@cd ${.CURDIR}; ${MAKE} cleandir 3970.endif 3971.endif 3972 3973.if ${TARGET} == ${MACHINE} && ${TARGET_ARCH} == ${MACHINE_ARCH} 3974XDEV_CPUTYPE?=${CPUTYPE} 3975.else 3976XDEV_CPUTYPE?=${TARGET_CPUTYPE} 3977.endif 3978 3979NOFUN=-DNO_FSCHG MK_HTML=no \ 3980 MK_MAN=no MK_NLS=no \ 3981 MK_KERBEROS=no MK_RESCUE=no MK_TESTS=no MK_WERROR=no \ 3982 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ 3983 CPUTYPE=${XDEV_CPUTYPE} 3984 3985XDDIR=${TARGET_ARCH}-freebsd 3986XDTP?=/usr/${XDDIR} 3987.if ${XDTP:N/*} 3988.error XDTP variable should be an absolute path 3989.endif 3990 3991CDBOBJROOT= ${OBJROOT}${MACHINE}.${MACHINE_ARCH}/xdev/ 3992CDBOBJTOP= ${CDBOBJROOT}${XDDIR} 3993CDBENV= \ 3994 INSTALL="sh ${.CURDIR}/tools/install.sh" 3995CDENV= ${CDBENV} \ 3996 TOOLS_PREFIX=${XDTP} 3997CDMAKEARGS= \ 3998 OBJTOP=${CDBOBJTOP:Q} \ 3999 OBJROOT=${CDBOBJROOT:Q} 4000CD2MAKEARGS= ${CDMAKEARGS} 4001 4002.if ${WANT_COMPILER_TYPE} == gcc || \ 4003 (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc) 4004# GCC requires -isystem and -L when using a cross-compiler. --sysroot 4005# won't set header path and -L is used to ensure the base library path 4006# is added before the port PREFIX library path. 4007CD2CFLAGS+= -isystem ${XDDESTDIR}/usr/include -L${XDDESTDIR}/usr/lib 4008# GCC requires -B to find /usr/lib/crti.o when using a cross-compiler 4009# combined with --sysroot. 4010CD2CFLAGS+= -B${XDDESTDIR}/usr/lib 4011# Force using libc++ for external GCC. 4012.if defined(X_COMPILER_TYPE) && \ 4013 ${X_COMPILER_TYPE} == gcc && ${X_COMPILER_VERSION} >= 40800 4014CD2CXXFLAGS+= -isystem ${XDDESTDIR}/usr/include/c++/v1 -std=c++11 \ 4015 -nostdinc++ 4016.endif 4017.endif 4018CD2CFLAGS+= --sysroot=${XDDESTDIR}/ 4019CD2ENV=${CDENV} CC="${CC} ${CD2CFLAGS}" CXX="${CXX} ${CD2CXXFLAGS} ${CD2CFLAGS}" \ 4020 CPP="${CPP} ${CD2CFLAGS}" \ 4021 MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH} 4022 4023CDTMP= ${OBJTOP}/${XDDIR}/tmp 4024CDMAKE=${CDENV} PATH=${CDTMP:Q}/usr/bin:${PATH:Q} ${MAKE} ${CDMAKEARGS} ${NOFUN} 4025CD2MAKE=${CD2ENV} PATH=${CDTMP:Q}/usr/bin:${XDDESTDIR:Q}/usr/bin:${PATH:Q} \ 4026 ${MAKE} ${CD2MAKEARGS} ${NOFUN} 4027.if ${MK_META_MODE} != "no" 4028# Don't rebuild build-tools targets during normal build. 4029CD2MAKE+= BUILD_TOOLS_META=.NOMETA 4030.endif 4031XDDESTDIR=${DESTDIR}${XDTP} 4032 4033.ORDER: xdev-build xdev-install xdev-links 4034xdev: xdev-build xdev-install .PHONY 4035 4036.ORDER: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools 4037xdev-build: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools .PHONY 4038 4039_xb-worldtmp: .PHONY 4040 mkdir -p ${CDTMP}/usr 4041 ${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 4042 -p ${CDTMP}/usr >/dev/null 4043 4044_xb-bootstrap-tools: .PHONY 4045.for _tool in \ 4046 ${_clang_tblgen} \ 4047 ${_yacc} 4048 ${_+_}@${ECHODIR} "===> ${_tool} (obj,all,install)"; \ 4049 cd ${.CURDIR}/${_tool}; \ 4050 if [ -z "${NO_OBJWALK}" ]; then ${CDMAKE} DIRPRFX=${_tool}/ obj; fi; \ 4051 ${CDMAKE} DIRPRFX=${_tool}/ all; \ 4052 ${CDMAKE} DIRPRFX=${_tool}/ DESTDIR=${CDTMP} install 4053.endfor 4054 4055_xb-build-tools: .PHONY 4056 ${_+_}@cd ${.CURDIR}; \ 4057 ${CDBENV} ${MAKE} ${CDMAKEARGS} -f Makefile.inc1 ${NOFUN} build-tools 4058 4059XDEVDIRS= \ 4060 ${_clang_libs} \ 4061 ${_lld} \ 4062 ${_elftctools} \ 4063 usr.bin/ar \ 4064 ${_clang} 4065 4066_xb-cross-tools: .PHONY 4067.for _tool in ${XDEVDIRS} 4068 ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,all)"; \ 4069 cd ${.CURDIR}/${_tool}; \ 4070 if [ -z "${NO_OBJWALK}" ]; then ${CDMAKE} DIRPRFX=${_tool}/ obj; fi; \ 4071 ${CDMAKE} DIRPRFX=${_tool}/ all 4072.endfor 4073 4074_xi-mtree: .PHONY 4075 ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}" 4076 mkdir -p ${XDDESTDIR} 4077 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.root.dist \ 4078 -p ${XDDESTDIR} >/dev/null 4079 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 4080 -p ${XDDESTDIR}/usr >/dev/null 4081 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 4082 -p ${XDDESTDIR}/usr/include >/dev/null 4083.for d in ${LIBCOMPAT_INCLUDE_DIRS} 4084 mkdir -p ${XDDESTDIR}/usr/include/${d} 4085.endfor 4086.for libcompat in ${libcompats} 4087 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ 4088 -p ${XDDESTDIR}/usr >/dev/null 4089.endfor 4090.if ${MK_TESTS} != "no" 4091 mkdir -p ${XDDESTDIR}${TESTSBASE} 4092 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.tests.dist \ 4093 -p ${XDDESTDIR}${TESTSBASE} >/dev/null 4094.endif 4095 4096.ORDER: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries 4097xdev-install: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries .PHONY 4098 4099_xi-cross-tools: .PHONY 4100 @echo "_xi-cross-tools" 4101.for _tool in ${XDEVDIRS} 4102 ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \ 4103 cd ${.CURDIR}/${_tool}; \ 4104 ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR} 4105.endfor 4106 4107_xi-includes: .PHONY 4108.if !defined(NO_OBJWALK) 4109 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 _obj \ 4110 DESTDIR=${XDDESTDIR} 4111.endif 4112 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 includes \ 4113 DESTDIR=${XDDESTDIR} 4114 4115_xi-libraries: .PHONY 4116 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \ 4117 DESTDIR=${XDDESTDIR} 4118 4119xdev-links: .PHONY 4120 ${_+_}cd ${XDDESTDIR}/usr/bin; \ 4121 mkdir -p ../../../../usr/bin; \ 4122 for i in *; do \ 4123 ln -sf ../../${XDTP}/usr/bin/$$i \ 4124 ../../../../usr/bin/${XDDIR}-$$i; \ 4125 ln -sf ../../${XDTP}/usr/bin/$$i \ 4126 ../../../../usr/bin/${XDDIR}${_REVISION}-$$i; \ 4127 done 4128