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