1# 2# $FreeBSD$ 3# 4# Make command line options: 5# -DNO_CLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir 6# -DNO_CLEAN do not clean at all 7# -DDB_FROM_SRC use the user/group databases in src/etc instead of 8# the system database when installing. 9# -DNO_SHARE do not go into share subdir 10# -DKERNFAST define NO_KERNEL{CONFIG,CLEAN,OBJ} 11# -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel 12# -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel 13# -DNO_KERNELOBJ do not run ${MAKE} obj in ${MAKE} buildkernel 14# -DNO_PORTSUPDATE do not update ports in ${MAKE} update 15# -DNO_ROOT install without using root privilege 16# -DNO_DOCUPDATE do not update doc in ${MAKE} update 17# -DWITHOUT_CTF do not run the DTrace CTF conversion tools on built objects 18# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list 19# LOCAL_ITOOLS="list of tools" to add additional tools to the ITOOLS list 20# LOCAL_LIB_DIRS="list of dirs" to add additional dirs to libraries target 21# LOCAL_MTREE="list of mtree files" to process to allow local directories 22# to be created before files are installed 23# LOCAL_TOOL_DIRS="list of dirs" to add additional dirs to the build-tools 24# list 25# LOCAL_XTOOL_DIRS="list of dirs" to add additional dirs to the 26# cross-tools target 27# METALOG="path to metadata log" to write permission and ownership 28# when NO_ROOT is set. (default: ${DESTDIR}/METALOG) 29# TARGET="machine" to crossbuild world for a different machine type 30# TARGET_ARCH= may be required when a TARGET supports multiple endians 31# BUILDENV_SHELL= shell to launch for the buildenv target (def:${SHELL}) 32# WORLD_FLAGS= additional flags to pass to make(1) during buildworld 33# KERNEL_FLAGS= additional flags to pass to make(1) during buildkernel 34# SUBDIR_OVERRIDE="list of dirs" to build rather than everything. 35# All libraries and includes, and some build tools will still build. 36 37# 38# The intended user-driven targets are: 39# buildworld - rebuild *everything*, including glue to help do upgrades 40# installworld- install everything built by "buildworld" 41# checkworld - run test suite on installed world 42# doxygen - build API documentation of the kernel 43# update - convenient way to update your source tree (eg: svn/svnup) 44# 45# Standard targets (not defined here) are documented in the makefiles in 46# /usr/share/mk. These include: 47# obj depend all install clean cleandepend cleanobj 48 49.if !defined(TARGET) || !defined(TARGET_ARCH) 50.error "Both TARGET and TARGET_ARCH must be defined." 51.endif 52 53.if make(showconfig) || make(test-system-*) 54_MKSHOWCONFIG= t 55.endif 56 57SRCDIR?= ${.CURDIR} 58LOCALBASE?= /usr/local 59 60.include "share/mk/src.tools.mk" 61 62# Cross toolchain changes must be in effect before bsd.compiler.mk 63# so that gets the right CC, and pass CROSS_TOOLCHAIN to submakes. 64.if defined(CROSS_TOOLCHAIN) 65.if exists(${LOCALBASE}/share/toolchains/${CROSS_TOOLCHAIN}.mk) 66.include "${LOCALBASE}/share/toolchains/${CROSS_TOOLCHAIN}.mk" 67.elif exists(/usr/share/toolchains/${CROSS_TOOLCHAIN}.mk) 68.include "/usr/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.endif 76.if defined(CROSS_TOOLCHAIN_PREFIX) 77CROSS_COMPILER_PREFIX?=${CROSS_TOOLCHAIN_PREFIX} 78.endif 79 80XCOMPILERS= CC CXX CPP 81.for COMPILER in ${XCOMPILERS} 82.if defined(CROSS_COMPILER_PREFIX) 83X${COMPILER}?= ${CROSS_COMPILER_PREFIX}${${COMPILER}} 84.else 85X${COMPILER}?= ${${COMPILER}} 86.endif 87.endfor 88# If a full path to an external cross compiler is given, don't build 89# a cross compiler. 90.if ${XCC:N${CCACHE_BIN}:M/*} 91MK_CLANG_BOOTSTRAP= no 92.endif 93 94# Pull in compiler metadata from buildworld/toolchain if possible to avoid 95# running CC from bsd.compiler.mk. 96.if make(installworld) || make(install) || make(distributeworld) || \ 97 make(stageworld) 98.-include "${OBJTOP}/toolchain-metadata.mk" 99.if !defined(_LOADED_TOOLCHAIN_METADATA) 100.error A build is required first. You may have the wrong MAKEOBJDIRPREFIX set. 101.endif 102.endif 103 104# Pull in COMPILER_TYPE and COMPILER_FREEBSD_VERSION early. Pull it from the 105# tree to be friendlier to foreign OS builds. It's safe to do so unconditionally 106# here since we will always have the right make, unlike in src/Makefile 107# Don't include bsd.linker.mk yet until XBINUTILS is handled (after src.opts.mk) 108_NO_INCLUDE_LINKERMK= t 109# We also want the X_COMPILER* variables if we are using an external toolchain. 110_WANT_TOOLCHAIN_CROSS_VARS= t 111.include "share/mk/bsd.compiler.mk" 112.undef _NO_INCLUDE_LINKERMK 113.undef _WANT_TOOLCHAIN_CROSS_VARS 114# src.opts.mk depends on COMPILER_FEATURES 115.include "share/mk/src.opts.mk" 116 117.if ${TARGET} == ${MACHINE} 118TARGET_CPUTYPE?=${CPUTYPE} 119.else 120TARGET_CPUTYPE?= 121.endif 122.if !empty(TARGET_CPUTYPE) 123_TARGET_CPUTYPE=${TARGET_CPUTYPE} 124.else 125_TARGET_CPUTYPE=dummy 126.endif 127.if ${TARGET} == "arm" 128.if ${TARGET_ARCH:Marmv[67]*} != "" && ${TARGET_CPUTYPE:M*soft*} == "" 129TARGET_ABI= gnueabihf 130.else 131TARGET_ABI= gnueabi 132.endif 133.endif 134MACHINE_ABI?= unknown 135MACHINE_TRIPLE?=${MACHINE_ARCH:S/amd64/x86_64/:C/[hs]f$//:S/mipsn32/mips64/}-${MACHINE_ABI}-freebsd13.0 136TARGET_ABI?= unknown 137TARGET_TRIPLE?= ${TARGET_ARCH:S/amd64/x86_64/:C/[hs]f$//:S/mipsn32/mips64/}-${TARGET_ABI}-freebsd13.0 138KNOWN_ARCHES?= aarch64/arm64 \ 139 amd64 \ 140 armv6/arm \ 141 armv7/arm \ 142 i386 \ 143 mips \ 144 mipsel/mips \ 145 mips64el/mips \ 146 mipsn32el/mips \ 147 mips64/mips \ 148 mipsn32/mips \ 149 mipshf/mips \ 150 mipselhf/mips \ 151 mips64elhf/mips \ 152 mips64hf/mips \ 153 powerpc \ 154 powerpc64/powerpc \ 155 powerpcspe/powerpc \ 156 riscv64/riscv \ 157 riscv64sf/riscv 158 159.if ${TARGET} == ${TARGET_ARCH} 160_t= ${TARGET} 161.else 162_t= ${TARGET_ARCH}/${TARGET} 163.endif 164.for _t in ${_t} 165.if empty(KNOWN_ARCHES:M${_t}) 166.error Unknown target ${TARGET_ARCH}:${TARGET}. 167.endif 168.endfor 169 170# If all targets are disabled for system llvm then don't expect it to work 171# for cross-builds. 172.if !defined(TOOLS_PREFIX) && ${MK_LLVM_TARGET_ALL} == "no" && \ 173 ${MACHINE} != ${TARGET} && ${MACHINE_ARCH} != ${TARGET_ARCH} && \ 174 !make(showconfig) 175MK_SYSTEM_COMPILER= no 176MK_SYSTEM_LINKER= no 177.endif 178 179# Handle external binutils. 180.if defined(CROSS_TOOLCHAIN_PREFIX) 181CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX} 182.endif 183XBINUTILS= AS AR LD NM OBJCOPY RANLIB SIZE STRINGS STRIPBIN 184.for BINUTIL in ${XBINUTILS} 185.if defined(CROSS_BINUTILS_PREFIX) && \ 186 exists(${CROSS_BINUTILS_PREFIX}/${${BINUTIL}}) 187X${BINUTIL}?= ${CROSS_BINUTILS_PREFIX:C,/*$,,}/${${BINUTIL}} 188.else 189X${BINUTIL}?= ${${BINUTIL}} 190.endif 191.endfor 192 193# If a full path to an external linker is given, don't build lld. 194.if ${XLD:M/*} 195MK_LLD_BOOTSTRAP= no 196.endif 197 198# We also want the X_LINKER* variables if we are using an external toolchain. 199_WANT_TOOLCHAIN_CROSS_VARS= t 200.include "share/mk/bsd.linker.mk" 201.undef _WANT_TOOLCHAIN_CROSS_VARS 202 203# Begin WITH_SYSTEM_COMPILER / WITH_SYSTEM_LD 204 205# WITH_SYSTEM_COMPILER - Pull in needed values and make a decision. 206 207# Check if there is a local compiler that can satisfy as an external compiler. 208# Which compiler is expected to be used? 209.if ${MK_CLANG_BOOTSTRAP} == "yes" 210WANT_COMPILER_TYPE= clang 211.else 212WANT_COMPILER_TYPE= 213.endif 214 215.if !defined(WANT_COMPILER_FREEBSD_VERSION) && !make(showconfig) && \ 216 !make(test-system-linker) 217.if ${WANT_COMPILER_TYPE} == "clang" 218WANT_COMPILER_FREEBSD_VERSION_FILE= lib/clang/freebsd_cc_version.h 219WANT_COMPILER_FREEBSD_VERSION!= \ 220 awk '$$2 == "FREEBSD_CC_VERSION" {printf("%d\n", $$3)}' \ 221 ${SRCDIR}/${WANT_COMPILER_FREEBSD_VERSION_FILE} || echo unknown 222WANT_COMPILER_VERSION_FILE= lib/clang/include/clang/Basic/Version.inc 223WANT_COMPILER_VERSION!= \ 224 awk '$$2 == "CLANG_VERSION" {split($$3, a, "."); print a[1] * 10000 + a[2] * 100 + a[3]}' \ 225 ${SRCDIR}/${WANT_COMPILER_VERSION_FILE} || echo unknown 226.endif 227.export WANT_COMPILER_FREEBSD_VERSION WANT_COMPILER_VERSION 228.endif # !defined(WANT_COMPILER_FREEBSD_VERSION) 229 230# It needs to be the same revision as we would build for the bootstrap. 231# If the expected vs CC is different then we can't skip. 232# GCC cannot be used for cross-arch yet. For clang we pass -target later if 233# TARGET_ARCH!=MACHINE_ARCH. 234.if ${MK_SYSTEM_COMPILER} == "yes" && \ 235 defined(WANT_COMPILER_FREEBSD_VERSION) && \ 236 ${MK_CLANG_BOOTSTRAP} == "yes" && \ 237 !make(xdev*) && \ 238 ${X_COMPILER_TYPE} == ${WANT_COMPILER_TYPE} && \ 239 (${X_COMPILER_TYPE} == "clang" || ${TARGET_ARCH} == ${MACHINE_ARCH}) && \ 240 ${X_COMPILER_VERSION} == ${WANT_COMPILER_VERSION} && \ 241 ${X_COMPILER_FREEBSD_VERSION} == ${WANT_COMPILER_FREEBSD_VERSION} 242# Everything matches, disable the bootstrap compiler. 243MK_CLANG_BOOTSTRAP= no 244USING_SYSTEM_COMPILER= yes 245.endif # ${WANT_COMPILER_TYPE} == ${COMPILER_TYPE} 246 247# WITH_SYSTEM_LD - Pull in needed values and make a decision. 248 249# Check if there is a local linker that can satisfy as an external linker. 250# Which linker is expected to be used? 251.if ${MK_LLD_BOOTSTRAP} == "yes" 252WANT_LINKER_TYPE= lld 253.else 254WANT_LINKER_TYPE= 255.endif 256 257.if !defined(WANT_LINKER_FREEBSD_VERSION) && !make(showconfig) && \ 258 !make(test-system-compiler) 259.if ${WANT_LINKER_TYPE} == "lld" 260WANT_LINKER_FREEBSD_VERSION_FILE= lib/clang/include/VCSVersion.inc 261_WANT_LINKER_FREEBSD_VERSION!= \ 262 awk '$$2 == "LLD_REVISION" {gsub(/"/, "", $$3); print $$3}' \ 263 ${SRCDIR}/${WANT_LINKER_FREEBSD_VERSION_FILE} || echo unknown 264WANT_LINKER_FREEBSD_VERSION=${_WANT_LINKER_FREEBSD_VERSION:C/.*-(.*)/\1/} 265WANT_LINKER_VERSION_FILE= lib/clang/include/lld/Common/Version.inc 266WANT_LINKER_VERSION!= \ 267 awk '$$2 == "LLD_VERSION" {split($$3, a, "."); print a[1] * 10000 + a[2] * 100 + a[3]}' \ 268 ${SRCDIR}/${WANT_LINKER_VERSION_FILE} || echo unknown 269.else 270WANT_LINKER_FREEBSD_VERSION_FILE= 271WANT_LINKER_FREEBSD_VERSION= 272.endif 273.export WANT_LINKER_FREEBSD_VERSION WANT_LINKER_VERSION 274.endif # !defined(WANT_LINKER_FREEBSD_VERSION) 275 276.if ${MK_SYSTEM_LINKER} == "yes" && \ 277 defined(WANT_LINKER_FREEBSD_VERSION) && \ 278 (${MK_LLD_BOOTSTRAP} == "yes") && \ 279 !make(xdev*) && \ 280 ${X_LINKER_TYPE} == ${WANT_LINKER_TYPE} && \ 281 ${X_LINKER_VERSION} == ${WANT_LINKER_VERSION} && \ 282 ${X_LINKER_FREEBSD_VERSION} == ${WANT_LINKER_FREEBSD_VERSION} 283# Everything matches, disable the bootstrap linker. 284MK_LLD_BOOTSTRAP= no 285USING_SYSTEM_LINKER= yes 286.endif # ${WANT_LINKER_TYPE} == ${LINKER_TYPE} 287 288# WITH_SYSTEM_COMPILER / WITH_SYSTEM_LINKER - Handle defaults and debug. 289USING_SYSTEM_COMPILER?= no 290USING_SYSTEM_LINKER?= no 291 292TEST_SYSTEM_COMPILER_VARS= \ 293 USING_SYSTEM_COMPILER MK_SYSTEM_COMPILER \ 294 MK_CROSS_COMPILER MK_CLANG_BOOTSTRAP \ 295 WANT_COMPILER_TYPE WANT_COMPILER_VERSION WANT_COMPILER_VERSION_FILE \ 296 WANT_COMPILER_FREEBSD_VERSION WANT_COMPILER_FREEBSD_VERSION_FILE \ 297 CC COMPILER_TYPE COMPILER_FEATURES COMPILER_VERSION \ 298 COMPILER_FREEBSD_VERSION \ 299 XCC X_COMPILER_TYPE X_COMPILER_FEATURES X_COMPILER_VERSION \ 300 X_COMPILER_FREEBSD_VERSION 301TEST_SYSTEM_LINKER_VARS= \ 302 USING_SYSTEM_LINKER MK_SYSTEM_LINKER \ 303 MK_LLD_BOOTSTRAP \ 304 WANT_LINKER_TYPE WANT_LINKER_VERSION WANT_LINKER_VERSION_FILE \ 305 WANT_LINKER_FREEBSD_VERSION WANT_LINKER_FREEBSD_VERSION_FILE \ 306 LD LINKER_TYPE LINKER_FEATURES LINKER_VERSION \ 307 LINKER_FREEBSD_VERSION \ 308 XLD X_LINKER_TYPE X_LINKER_FEATURES X_LINKER_VERSION \ 309 X_LINKER_FREEBSD_VERSION 310 311.for _t in compiler linker 312test-system-${_t}: .PHONY 313.for v in ${TEST_SYSTEM_${_t:tu}_VARS} 314 ${_+_}@printf "%-35s= %s\n" "${v}" "${${v}}" 315.endfor 316.endfor 317.if (make(buildworld) || make(buildkernel) || make(kernel-toolchain) || \ 318 make(toolchain) || make(_cross-tools)) 319.if ${USING_SYSTEM_COMPILER} == "yes" 320.info SYSTEM_COMPILER: Determined that CC=${CC} matches the source tree. Not bootstrapping a cross-compiler. 321.elif ${MK_CLANG_BOOTSTRAP} == "yes" 322.info SYSTEM_COMPILER: libclang will be built for bootstrapping a cross-compiler. 323.endif 324.if ${USING_SYSTEM_LINKER} == "yes" 325.info SYSTEM_LINKER: Determined that LD=${LD} matches the source tree. Not bootstrapping a cross-linker. 326.elif ${MK_LLD_BOOTSTRAP} == "yes" 327.info SYSTEM_LINKER: libclang will be built for bootstrapping a cross-linker. 328.endif 329.endif 330 331# End WITH_SYSTEM_COMPILER / WITH_SYSTEM_LD 332 333# Store some compiler metadata for use in installworld where we don't 334# want to invoke CC at all. 335_TOOLCHAIN_METADATA_VARS= COMPILER_VERSION \ 336 COMPILER_TYPE \ 337 COMPILER_FEATURES \ 338 COMPILER_FREEBSD_VERSION \ 339 COMPILER_RESOURCE_DIR \ 340 LINKER_VERSION \ 341 LINKER_FEATURES \ 342 LINKER_TYPE \ 343 LINKER_FREEBSD_VERSION 344toolchain-metadata.mk: .PHONY .META 345 @: > ${.TARGET} 346 @echo ".info Using cached toolchain metadata from build at $$(hostname) on $$(date)" \ 347 > ${.TARGET} 348 @echo "_LOADED_TOOLCHAIN_METADATA=t" >> ${.TARGET} 349.for v in ${_TOOLCHAIN_METADATA_VARS} 350 @echo "${v}=${${v}}" >> ${.TARGET} 351 @echo "X_${v}=${X_${v}}" >> ${.TARGET} 352.endfor 353 @echo ".export ${_TOOLCHAIN_METADATA_VARS}" >> ${.TARGET} 354 @echo ".export ${_TOOLCHAIN_METADATA_VARS:C,^,X_,}" >> ${.TARGET} 355 356 357# We must do lib/ and libexec/ before bin/ in case of a mid-install error to 358# keep the users system reasonably usable. For static->dynamic root upgrades, 359# we don't want to install a dynamic binary without rtld and the needed 360# libraries. More commonly, for dynamic root, we don't want to install a 361# binary that requires a newer library version that hasn't been installed yet. 362# This ordering is not a guarantee though. The only guarantee of a working 363# system here would require fine-grained ordering of all components based 364# on their dependencies. 365.if !empty(SUBDIR_OVERRIDE) 366SUBDIR= ${SUBDIR_OVERRIDE} 367.else 368SUBDIR= lib libexec 369# Add LOCAL_LIB_DIRS, but only if they will not be picked up as a SUBDIR 370# of a LOCAL_DIRS directory. This allows LOCAL_DIRS=foo and 371# LOCAL_LIB_DIRS=foo/lib to behave as expected. 372.for _DIR in ${LOCAL_DIRS:M*/} ${LOCAL_DIRS:N*/:S|$|/|} 373_REDUNDANT_LIB_DIRS+= ${LOCAL_LIB_DIRS:M${_DIR}*} 374.endfor 375.for _DIR in ${LOCAL_LIB_DIRS} 376.if ${_DIR} == ".WAIT" || (empty(_REDUNDANT_LIB_DIRS:M${_DIR}) && exists(${.CURDIR}/${_DIR}/Makefile)) 377SUBDIR+= ${_DIR} 378.endif 379.endfor 380.if !defined(NO_ROOT) && (make(installworld) || make(install)) 381# Ensure libraries are installed before progressing. 382SUBDIR+=.WAIT 383.endif 384SUBDIR+=bin 385.if ${MK_CDDL} != "no" 386SUBDIR+=cddl 387.endif 388SUBDIR+=gnu include 389.if ${MK_KERBEROS} != "no" 390SUBDIR+=kerberos5 391.endif 392.if ${MK_RESCUE} != "no" 393SUBDIR+=rescue 394.endif 395SUBDIR+=sbin 396.if ${MK_CRYPT} != "no" 397SUBDIR+=secure 398.endif 399.if !defined(NO_SHARE) 400SUBDIR+=share 401.endif 402.if ${MK_BOOT} != "no" 403SUBDIR+=stand 404.endif 405SUBDIR+=sys usr.bin usr.sbin 406.if ${MK_TESTS} != "no" 407SUBDIR+= tests 408.endif 409 410# Local directories are built in parallel with the base system directories. 411# Users may insert a .WAIT directive at the beginning or elsewhere within 412# the LOCAL_DIRS and LOCAL_LIB_DIRS lists as needed. 413.for _DIR in ${LOCAL_DIRS} 414.if ${_DIR} == ".WAIT" || exists(${.CURDIR}/${_DIR}/Makefile) 415SUBDIR+= ${_DIR} 416.endif 417.endfor 418 419# We must do etc/ last as it hooks into building the man whatis file 420# by calling 'makedb' in share/man. This is only relevant for 421# install/distribute so they build the whatis file after every manpage is 422# installed. 423.if make(installworld) || make(install) 424SUBDIR+=.WAIT 425.endif 426SUBDIR+=etc 427 428.endif # !empty(SUBDIR_OVERRIDE) 429 430.if defined(NOCLEAN) 431.warning NOCLEAN option is deprecated. Use NO_CLEAN instead. 432NO_CLEAN= ${NOCLEAN} 433.endif 434.if defined(NO_CLEANDIR) 435CLEANDIR= clean cleandepend 436.else 437CLEANDIR= cleandir 438.endif 439 440.if defined(WORLDFAST) 441NO_CLEAN= t 442NO_OBJWALK= t 443.endif 444 445.if ${MK_META_MODE} == "yes" 446# If filemon is used then we can rely on the build being incremental-safe. 447# The .meta files will also track the build command and rebuild should 448# it change. 449.if empty(.MAKE.MODE:Mnofilemon) 450NO_CLEAN= t 451.endif 452.endif 453.if defined(NO_OBJWALK) || ${MK_AUTO_OBJ} == "yes" 454NO_OBJWALK= t 455NO_KERNELOBJ= t 456.endif 457.if !defined(NO_OBJWALK) 458_obj= obj 459.endif 460 461LOCAL_TOOL_DIRS?= 462PACKAGEDIR?= ${DESTDIR}/${DISTDIR} 463 464.if empty(SHELL:M*csh*) 465BUILDENV_SHELL?=${SHELL} 466.else 467BUILDENV_SHELL?=/bin/sh 468.endif 469 470.if !defined(_MKSHOWCONFIG) 471.if !defined(SVN_CMD) || empty(SVN_CMD) 472. for _P in /usr/bin /usr/local/bin 473. for _S in svn svnlite 474. if exists(${_P}/${_S}) 475SVN_CMD= ${_P}/${_S} 476. endif 477. endfor 478. endfor 479.export SVN_CMD 480.endif 481SVNFLAGS?= -r HEAD 482.if !defined(VCS_REVISION) || empty(VCS_REVISION) 483.if !defined(SVNVERSION_CMD) || empty(SVNVERSION_CMD) 484. for _D in ${PATH:S,:, ,g} 485. if exists(${_D}/svnversion) 486SVNVERSION_CMD?=${_D}/svnversion 487. endif 488. if exists(${_D}/svnliteversion) 489SVNVERSION_CMD?=${_D}/svnliteversion 490. endif 491. endfor 492.endif 493_VCS_REVISION?= $$(eval ${SVNVERSION_CMD} ${SRCDIR}) 494. if !empty(_VCS_REVISION) 495VCS_REVISION= $$(echo r${_VCS_REVISION}) 496. endif 497.export VCS_REVISION 498.endif 499 500.if !defined(OSRELDATE) 501.if exists(/usr/include/osreldate.h) 502OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \ 503 /usr/include/osreldate.h 504.else 505OSRELDATE= 0 506.endif 507.export OSRELDATE 508.endif 509 510# Set VERSION for CTFMERGE to use via the default CTFFLAGS=-L VERSION. 511.if !defined(_REVISION) 512_REVISION!= ${MAKE} -C ${SRCDIR}/release MK_AUTO_OBJ=no -V REVISION 513.export _REVISION 514.endif 515.if !defined(_BRANCH) 516_BRANCH!= ${MAKE} -C ${SRCDIR}/release MK_AUTO_OBJ=no -V BRANCH 517.export _BRANCH 518.endif 519.if !defined(SRCRELDATE) 520SRCRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \ 521 ${SRCDIR}/sys/sys/param.h 522.export SRCRELDATE 523.endif 524.if !defined(VERSION) 525VERSION= FreeBSD ${_REVISION}-${_BRANCH:C/-p[0-9]+$//} ${TARGET_ARCH} ${SRCRELDATE} 526.export VERSION 527.endif 528 529.if !defined(PKG_VERSION) 530.if ${_BRANCH:MSTABLE*} || ${_BRANCH:MCURRENT*} 531TIMENOW= %Y%m%d%H%M%S 532EXTRA_REVISION= .s${TIMENOW:gmtime} 533.elif ${_BRANCH:MALPHA*} 534EXTRA_REVISION= _${_BRANCH:C/-ALPHA/.a/} 535.elif ${_BRANCH:MBETA*} 536EXTRA_REVISION= _${_BRANCH:C/-BETA/.b/} 537.elif ${_BRANCH:MRC*} 538EXTRA_REVISION= _${_BRANCH:C/-RC/.r/} 539.elif ${_BRANCH:MPRERELEASE*} 540EXTRA_REVISION= _${_BRANCH:C/-PRERELEASE/.p/} 541.elif ${_BRANCH:M*-p*} 542EXTRA_REVISION= _${_BRANCH:C/.*-p([0-9]+$)/\1/} 543.endif 544PKG_VERSION= ${_REVISION}${EXTRA_REVISION} 545.endif 546.endif # !defined(PKG_VERSION) 547 548.if !defined(PKG_TIMESTAMP) 549TIMEEPOCHNOW= %s 550SOURCE_DATE_EPOCH= ${TIMEEPOCHNOW:gmtime} 551.else 552SOURCE_DATE_EPOCH= ${PKG_TIMESTAMP} 553.endif 554 555PKG_NAME_PREFIX?= FreeBSD 556PKG_MAINTAINER?= re@FreeBSD.org 557PKG_WWW?= https://www.FreeBSD.org 558.export PKG_NAME_PREFIX 559.export PKG_MAINTAINER 560.export PKG_WWW 561 562.if !defined(_MKSHOWCONFIG) 563_CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} -f /dev/null \ 564 -m ${.CURDIR}/share/mk MK_AUTO_OBJ=no -V CPUTYPE 565.if ${_CPUTYPE} != ${_TARGET_CPUTYPE} 566.error CPUTYPE global should be set with ?=. 567.endif 568.endif 569.if make(buildworld) 570BUILD_ARCH!= uname -p 571.if ${MACHINE_ARCH} != ${BUILD_ARCH} 572.error To cross-build, set TARGET_ARCH. 573.endif 574.endif 575WORLDTMP?= ${OBJTOP}/tmp 576BPATH= ${CCACHE_WRAPPER_PATH_PFX}${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/bin:${WORLDTMP}/legacy/usr/libexec 577XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin 578 579# When building we want to find the cross tools before the host tools in ${BPATH}. 580# We also need to add UNIVERSE_TOOLCHAIN_PATH so that we can find the shared 581# toolchain files (clang, lld, etc.) during make universe/tinderbox 582STRICTTMPPATH= ${XPATH}:${BPATH}:${UNIVERSE_TOOLCHAIN_PATH} 583# We should not be using tools from /usr/bin accidentally since this could cause 584# the build to break on other systems that don't have that tool. For now we 585# still allow using the old behaviour (inheriting $PATH) if 586# BUILD_WITH_STRICT_TMPPATH is set to 0 but this will eventually be removed. 587 588# Currently strict $PATH can cause build failures and does not work yet with 589# USING_SYSTEM_LINKER/USING_SYSTEM_COMPILER. Once these issues have been 590# resolved it will be turned on by default. 591BUILD_WITH_STRICT_TMPPATH?=0 592.if ${BUILD_WITH_STRICT_TMPPATH} != 0 593TMPPATH= ${STRICTTMPPATH} 594.else 595TMPPATH= ${STRICTTMPPATH}:${PATH} 596.endif 597 598# 599# Avoid running mktemp(1) unless actually needed. 600# It may not be functional, e.g., due to new ABI 601# when in the middle of installing over this system. 602# 603.if make(distributeworld) || make(installworld) || make(stageworld) 604.if ${BUILD_WITH_STRICT_TMPPATH} != 0 605MKTEMP=${WORLDTMP}/legacy/usr/bin/mktemp 606.if !exists(${MKTEMP}) 607.error "mktemp binary doesn't exist in expected location: ${MKTEMP}" 608.endif 609.else 610MKTEMP=mktemp 611.endif 612INSTALLTMP!= ${MKTEMP} -d -u -t install 613.endif 614 615.if make(stagekernel) || make(distributekernel) 616TAGS+= kernel 617PACKAGE= kernel 618.endif 619 620# 621# Building a world goes through the following stages 622# 623# 1. legacy stage [BMAKE] 624# This stage is responsible for creating compatibility 625# shims that are needed by the bootstrap-tools, 626# build-tools and cross-tools stages. These are generally 627# APIs that tools from one of those three stages need to 628# build that aren't present on the host. 629# 1. bootstrap-tools stage [BMAKE] 630# This stage is responsible for creating programs that 631# are needed for backward compatibility reasons. They 632# are not built as cross-tools. 633# 2. build-tools stage [TMAKE] 634# This stage is responsible for creating the object 635# tree and building any tools that are needed during 636# the build process. Some programs are listed during 637# this phase because they build binaries to generate 638# files needed to build these programs. This stage also 639# builds the 'build-tools' target rather than 'all'. 640# 3. cross-tools stage [XMAKE] 641# This stage is responsible for creating any tools that 642# are needed for building the system. A cross-compiler is one 643# of them. This differs from build tools in two ways: 644# 1. the 'all' target is built rather than 'build-tools' 645# 2. these tools are installed into TMPPATH for stage 4. 646# 4. world stage [WMAKE] 647# This stage actually builds the world. 648# 5. install stage (optional) [IMAKE] 649# This stage installs a previously built world. 650# 651 652BOOTSTRAPPING?= 0 653# Keep these in sync 654MINIMUM_SUPPORTED_OSREL?= 1002501 655MINIMUM_SUPPORTED_REL?= 10.3 656 657# Common environment for world related stages 658CROSSENV+= \ 659 MACHINE_ARCH=${TARGET_ARCH} \ 660 MACHINE=${TARGET} \ 661 CPUTYPE=${TARGET_CPUTYPE} 662.if ${MK_META_MODE} != "no" 663# Don't rebuild build-tools targets during normal build. 664CROSSENV+= BUILD_TOOLS_META=.NOMETA 665.endif 666.if defined(TARGET_CFLAGS) 667CROSSENV+= ${TARGET_CFLAGS} 668.endif 669.if (${TARGET} != ${MACHINE} && !defined(WITH_LOCAL_MODULES)) || \ 670 defined(WITHOUT_LOCAL_MODULES) 671CROSSENV+= LOCAL_MODULES= 672.endif 673 674BOOTSTRAPPING_OSRELDATE?=${OSRELDATE} 675 676# bootstrap-tools stage 677BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \ 678 TOOLS_PREFIX=${TOOLS_PREFIX_UNDEF:U${WORLDTMP}} \ 679 PATH=${BPATH}:${PATH} \ 680 WORLDTMP=${WORLDTMP} \ 681 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" 682# need to keep this in sync with targets/pseudo/bootstrap-tools/Makefile 683BSARGS= DESTDIR= \ 684 OBJTOP='${WORLDTMP}/obj-tools' \ 685 OBJROOT='$${OBJTOP}/' \ 686 MAKEOBJDIRPREFIX= \ 687 BOOTSTRAPPING=${BOOTSTRAPPING_OSRELDATE} \ 688 BWPHASE=${.TARGET:C,^_,,} \ 689 SSP_CFLAGS= \ 690 MK_HTML=no NO_LINT=yes MK_MAN=no \ 691 -DNO_PIC MK_PROFILE=no -DNO_SHARED \ 692 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \ 693 MK_CLANG_EXTRAS=no MK_CLANG_FORMAT=no MK_CLANG_FULL=no \ 694 MK_LLDB=no MK_RETPOLINE=no MK_TESTS=no \ 695 MK_INCLUDES=yes 696 697BMAKE= \ 698 ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ 699 ${BSARGS} 700.if empty(.MAKEOVERRIDES:MMK_LLVM_TARGET_ALL) 701BMAKE+= MK_LLVM_TARGET_ALL=no 702.endif 703 704# build-tools stage 705TMAKE= \ 706 ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ 707 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ 708 DESTDIR= \ 709 BOOTSTRAPPING=${BOOTSTRAPPING_OSRELDATE} \ 710 BWPHASE=${.TARGET:C,^_,,} \ 711 SSP_CFLAGS= \ 712 -DNO_LINT \ 713 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \ 714 MK_CLANG_EXTRAS=no MK_CLANG_FORMAT=no MK_CLANG_FULL=no \ 715 MK_LLDB=no MK_RETPOLINE=no MK_TESTS=no 716 717# cross-tools stage 718# TOOLS_PREFIX set in BMAKE 719XMAKE= ${BMAKE} \ 720 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ 721 MK_CLANG_IS_CC=${MK_CLANG_BOOTSTRAP} \ 722 MK_GDB=no MK_TESTS=no 723 724# kernel-tools stage 725KTMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \ 726 PATH=${BPATH}:${PATH} \ 727 WORLDTMP=${WORLDTMP} 728KTMAKE= \ 729 TOOLS_PREFIX=${TOOLS_PREFIX_UNDEF:U${WORLDTMP}} \ 730 ${KTMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ 731 DESTDIR= \ 732 OBJTOP='${WORLDTMP}/obj-kernel-tools' \ 733 OBJROOT='$${OBJTOP}/' \ 734 MAKEOBJDIRPREFIX= \ 735 BOOTSTRAPPING=${BOOTSTRAPPING_OSRELDATE} \ 736 SSP_CFLAGS= \ 737 MK_HTML=no -DNO_LINT MK_MAN=no \ 738 -DNO_PIC MK_PROFILE=no -DNO_SHARED \ 739 -DNO_CPU_CFLAGS MK_RETPOLINE=no MK_WARNS=no MK_CTF=no 740 741# world stage 742WMAKEENV= ${CROSSENV} \ 743 INSTALL="sh ${.CURDIR}/tools/install.sh" \ 744 PATH=${TMPPATH} \ 745 SYSROOT=${WORLDTMP} 746 747# make hierarchy 748HMAKE= PATH=${TMPPATH} ${MAKE} LOCAL_MTREE=${LOCAL_MTREE:Q} 749.if defined(NO_ROOT) 750HMAKE+= PATH=${TMPPATH} METALOG=${METALOG} -DNO_ROOT 751.endif 752 753CROSSENV+= CC="${XCC} ${XCFLAGS}" CXX="${XCXX} ${XCXXFLAGS} ${XCFLAGS}" \ 754 CPP="${XCPP} ${XCFLAGS}" \ 755 AS="${XAS}" AR="${XAR}" LD="${XLD}" LLVM_LINK="${XLLVM_LINK}" \ 756 NM=${XNM} OBJCOPY="${XOBJCOPY}" \ 757 RANLIB=${XRANLIB} STRINGS=${XSTRINGS} \ 758 SIZE="${XSIZE}" STRIPBIN="${XSTRIPBIN}" 759 760.if defined(CROSS_BINUTILS_PREFIX) && exists(${CROSS_BINUTILS_PREFIX}) 761# In the case of xdev-build tools, CROSS_BINUTILS_PREFIX won't be a 762# directory, but the compiler will look in the right place for its 763# tools so we don't need to tell it where to look. 764BFLAGS+= -B${CROSS_BINUTILS_PREFIX} 765.endif 766 767 768# The internal bootstrap compiler has a default sysroot set by TOOLS_PREFIX 769# and target set by TARGET/TARGET_ARCH. However, there are several needs to 770# always pass an explicit --sysroot and -target. 771# - External compiler needs sysroot and target flags. 772# - External ld needs sysroot. 773# - To be clear about the use of a sysroot when using the internal compiler. 774# - Easier debugging. 775# - Allowing WITH_SYSTEM_COMPILER+WITH_META_MODE to work together due to 776# the flip-flopping build command when sometimes using external and 777# sometimes using internal. 778# - Allow using lld which has no support for default paths. 779.if !defined(CROSS_BINUTILS_PREFIX) || !exists(${CROSS_BINUTILS_PREFIX}) 780BFLAGS+= -B${WORLDTMP}/usr/bin 781.endif 782.if ${WANT_COMPILER_TYPE} == gcc || \ 783 (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc) 784.elif ${WANT_COMPILER_TYPE} == clang || \ 785 (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == clang) 786XCFLAGS+= -target ${TARGET_TRIPLE} 787.endif 788XCFLAGS+= --sysroot=${WORLDTMP} 789 790.if !empty(BFLAGS) 791XCFLAGS+= ${BFLAGS} 792.endif 793 794.if ${MK_LIB32} == "yes" 795_LIBCOMPAT= 32 796.include "Makefile.libcompat" 797.elif ${MK_LIBSOFT} == "yes" 798_LIBCOMPAT= SOFT 799.include "Makefile.libcompat" 800.endif 801 802# META_MODE normally ignores host file changes since every build updates 803# timestamps (see NO_META_IGNORE_HOST in sys.mk). There are known times 804# when the ABI breaks though that we want to force rebuilding WORLDTMP 805# to get updated host tools. 806.if ${MK_META_MODE} == "yes" && defined(NO_CLEAN) && \ 807 !defined(NO_META_IGNORE_HOST) && !defined(NO_META_IGNORE_HOST_HEADERS) && \ 808 !defined(_MKSHOWCONFIG) 809# r318736 - ino64 major ABI breakage 810META_MODE_BAD_ABI_VERS+= 1200031 811 812.if !defined(OBJDIR_HOST_OSRELDATE) 813.if exists(${OBJTOP}/host-osreldate.h) 814OBJDIR_HOST_OSRELDATE!= \ 815 awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \ 816 ${OBJTOP}/host-osreldate.h 817.elif exists(${WORLDTMP}/usr/include/osreldate.h) 818OBJDIR_HOST_OSRELDATE= 0 819.endif 820.export OBJDIR_HOST_OSRELDATE 821.endif 822 823# Note that this logic is the opposite of normal BOOTSTRAP handling. We want 824# to compare the WORLDTMP's OSRELDATE to the host's OSRELDATE. If the WORLDTMP 825# is older than the ABI-breakage OSRELDATE of the HOST then we rebuild. 826.if defined(OBJDIR_HOST_OSRELDATE) 827.for _ver in ${META_MODE_BAD_ABI_VERS} 828.if ${OSRELDATE} >= ${_ver} && ${OBJDIR_HOST_OSRELDATE} < ${_ver} 829_meta_mode_need_rebuild= ${_ver} 830.endif 831.endfor 832.if defined(_meta_mode_need_rebuild) 833.info META_MODE: Rebuilding host tools due to ABI breakage in __FreeBSD_version ${_meta_mode_need_rebuild}. 834NO_META_IGNORE_HOST_HEADERS= 1 835.export NO_META_IGNORE_HOST_HEADERS 836.endif # defined(_meta_mode_need_rebuild) 837.endif # defined(OBJDIR_HOST_OSRELDATE) 838.endif # ${MK_META_MODE} == "yes" && defined(NO_CLEAN) ... 839# This is only used for META_MODE+filemon to track what the oldest 840# __FreeBSD_version is in WORLDTMP. This purposely does NOT have 841# a make dependency on /usr/include/osreldate.h as the file should 842# only be copied when it is missing or meta mode determines it has changed. 843# Since host files are normally ignored without NO_META_IGNORE_HOST 844# the file will never be updated unless that flag is specified. This 845# allows tracking the oldest osreldate to force rebuilds via 846# META_MODE_BADABI_REVS above. 847host-osreldate.h: # DO NOT ADD /usr/include/osreldate.h here 848 @cp -f /usr/include/osreldate.h ${.TARGET} 849 850WMAKE= ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ 851 BWPHASE=${.TARGET:C,^_,,} \ 852 DESTDIR=${WORLDTMP} 853 854IMAKEENV= ${CROSSENV} 855IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 \ 856 ${IMAKE_INSTALL} ${IMAKE_MTREE} 857.if empty(.MAKEFLAGS:M-n) 858IMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMP} \ 859 LD_LIBRARY_PATH=${INSTALLTMP} \ 860 PATH_LOCALE=${INSTALLTMP}/locale 861IMAKE+= __MAKE_SHELL=${INSTALLTMP}/sh 862.else 863IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP} 864.endif 865 866# When generating install media, do not allow user and group information from 867# the build host to affect the contents of the distribution. 868.if make(distributeworld) || make(distrib-dirs) || make(distribution) || \ 869 make(stageworld) 870DB_FROM_SRC= yes 871.endif 872 873.if defined(DB_FROM_SRC) 874INSTALLFLAGS+= -N ${.CURDIR}/etc 875MTREEFLAGS+= -N ${.CURDIR}/etc 876.endif 877_INSTALL_DDIR= ${DESTDIR}/${DISTDIR} 878INSTALL_DDIR= ${_INSTALL_DDIR:S://:/:g:C:/$::} 879.if defined(NO_ROOT) 880METALOG?= ${DESTDIR}/${DISTDIR}/METALOG 881METALOG:= ${METALOG:C,//+,/,g} 882IMAKE+= -DNO_ROOT METALOG=${METALOG} 883INSTALLFLAGS+= -U -M ${METALOG} -D ${INSTALL_DDIR} 884MTREEFLAGS+= -W 885.endif 886.if defined(BUILD_PKGS) 887INSTALLFLAGS+= -h sha256 888.endif 889.if defined(DB_FROM_SRC) || defined(NO_ROOT) 890IMAKE_INSTALL= INSTALL="${INSTALL_CMD} ${INSTALLFLAGS}" 891IMAKE_MTREE= MTREE_CMD="${MTREE_CMD} ${MTREEFLAGS}" 892.endif 893 894DESTDIR_MTREEFLAGS= -deU 895# When creating worldtmp we don't need to set the directories as owned by root 896# so we also pass -W 897WORLDTMP_MTREEFLAGS= -deUW 898.if defined(NO_ROOT) 899# When building with -DNO_ROOT we shouldn't be changing the directories 900# that are created by mtree to be owned by root/wheel. 901DESTDIR_MTREEFLAGS+= -W 902.endif 903DISTR_MTREE= ${MTREE_CMD} 904.if ${BUILD_WITH_STRICT_TMPPATH} != 0 905DISTR_MTREE= ${WORLDTMP}/legacy/usr/sbin/mtree 906.endif 907WORLDTMP_MTREE= ${DISTR_MTREE} ${WORLDTMP_MTREEFLAGS} 908DESTDIR_MTREE= ${DISTR_MTREE} ${DESTDIR_MTREEFLAGS} 909 910# kernel stage 911KMAKEENV= ${WMAKEENV:NSYSROOT=*} 912KMAKE= ${KMAKEENV} ${MAKE} ${.MAKEFLAGS} ${KERNEL_FLAGS} KERNEL=${INSTKERNNAME} 913 914# 915# buildworld 916# 917# Attempt to rebuild the entire system, with reasonable chance of 918# success, regardless of how old your existing system is. 919# 920_sanity_check: .PHONY .MAKE 921.if ${.CURDIR:C/[^,]//g} != "" 922# The m4 build of sendmail files doesn't like it if ',' is used 923# anywhere in the path of it's files. 924 @echo 925 @echo "*** Error: path to source tree contains a comma ','" 926 @echo 927 @false 928.elif ${.CURDIR:M*\:*} != "" 929# Using ':' leaks into PATH and breaks finding cross-tools. 930 @echo 931 @echo "*** Error: path to source tree contains a colon ':'" 932 @echo 933 @false 934.endif 935 936# Our current approach to dependency tracking cannot cope with certain source 937# tree changes, particularly with respect to removing source files and 938# replacing generated files. Handle these cases here in an ad-hoc fashion. 939_cleanobj_fast_depend_hack: .PHONY 940 @echo ">>> Deleting stale dependencies..."; 941 sh ${.CURDIR}/tools/build/depend-cleanup.sh ${OBJTOP} 942# Date SVN Rev Syscalls/Changes 943# Syscall stubs rewritten in C and obsolete MD assembly implementations 944# 20191009 r353340 removal of opensolaris_atomic.S (also r353381) 945.if ${MACHINE} != i386 946.for f in opensolaris_atomic 947 @if [ -e "${OBJTOP}/cddl/lib/libzpool/.depend.${f}.o" ] && \ 948 egrep -qw 'opensolaris_atomic\.S' ${OBJTOP}/cddl/lib/libzpool/.depend.${f}.o; then \ 949 echo "Removing stale dependencies for opensolaris_atomic"; \ 950 rm -f ${OBJTOP}/cddl/lib/libzpool/.depend.${f}.* \ 951 ${LIBCOMPAT:D${LIBCOMPAT_OBJTOP}/cddl/lib/libzpool/.depend.${f}.*}; \ 952 fi 953.endfor 954.endif 955# 20190925 r352689 removal of obsolete i386 memchr.S 956.for f in memchr 957 @if [ -e "${OBJTOP}/lib/libc/.depend.${f}.o" ] && \ 958 egrep -qw 'i386/string/memchr\.S' ${OBJTOP}/lib/libc/.depend.${f}.o; then \ 959 echo "Removing stale dependencies for memchr"; \ 960 rm -f ${OBJTOP}/lib/libc/.depend.${f}.*; \ 961 fi 962.if defined(_LIBCOMPAT) 963 @if [ -e "${LIBCOMPAT_OBJTOP}/lib/libc/.depend.${f}.o" ] && \ 964 egrep -qw 'i386/string/memchr\.S' ${LIBCOMPAT_OBJTOP}/lib/libc/.depend.${f}.o; then \ 965 echo "Removing stale dependencies for memchr"; \ 966 rm -f ${LIBCOMPAT_OBJTOP}/lib/libc/.depend.${f}.*; \ 967 fi 968.endif 969.endfor 970 971_worldtmp: .PHONY 972 @echo 973 @echo "--------------------------------------------------------------" 974 @echo ">>> Rebuilding the temporary build tree" 975 @echo "--------------------------------------------------------------" 976.if !defined(NO_CLEAN) 977 rm -rf ${WORLDTMP} 978.else 979# Note: for delete-old we need to set $PATH to also include the host $PATH 980# since otherwise a partial build with missing symlinks in ${WORLDTMP}/legacy/ 981# will fail to run due to missing binaries. $WMAKE sets PATH to only ${TMPPATH} 982# so we remove that assingnment from $WMAKE and prepend the new $PATH 983 ${_+_}@if [ -e "${WORLDTMP}" ]; then \ 984 echo ">>> Deleting stale files in build tree..."; \ 985 cd ${.CURDIR}; env PATH=${TMPPATH}:${PATH} ${WMAKE:NPATH=*} \ 986 _NO_INCLUDE_COMPILERMK=t -DBATCH_DELETE_OLD_FILES delete-old \ 987 delete-old-libs >/dev/null; \ 988 fi 989 rm -rf ${WORLDTMP}/legacy/usr/include 990.if ${USING_SYSTEM_COMPILER} == "yes" 991.for cc in cc c++ 992 if [ -x ${WORLDTMP}/usr/bin/${cc} ]; then \ 993 inum=$$(stat -f %i ${WORLDTMP}/usr/bin/${cc}); \ 994 find ${WORLDTMP}/usr/bin -inum $${inum} -delete; \ 995 fi 996.endfor 997.endif # ${USING_SYSTEM_COMPILER} == "yes" 998.if ${USING_SYSTEM_LINKER} == "yes" 999 @rm -f ${WORLDTMP}/usr/bin/ld ${WORLDTMP}/usr/bin/ld.lld 1000.endif # ${USING_SYSTEM_LINKER} == "yes" 1001.endif # !defined(NO_CLEAN) 1002 @mkdir -p ${WORLDTMP} 1003 @touch ${WORLDTMP}/${.TARGET} 1004# We can't use mtree to create the worldtmp directories since it may not be 1005# available on the target system (this happens e.g. when building on non-FreeBSD) 1006 cd ${.CURDIR}/tools/build; \ 1007 ${MAKE} DIRPRFX=tools/build/ DESTDIR=${WORLDTMP}/legacy installdirs 1008# In order to build without inheriting $PATH we need to add symlinks to the host 1009# tools in $WORLDTMP for the tools that we don't build during bootstrap-tools 1010 cd ${.CURDIR}/tools/build; \ 1011 ${MAKE} DIRPRFX=tools/build/ DESTDIR=${WORLDTMP}/legacy host-symlinks 1012 1013_legacy: 1014 @echo 1015 @echo "--------------------------------------------------------------" 1016 @echo ">>> stage 1.1: legacy release compatibility shims" 1017 @echo "--------------------------------------------------------------" 1018 ${_+_}cd ${.CURDIR}; ${BMAKE} legacy 1019_bootstrap-tools: 1020 @echo 1021 @echo "--------------------------------------------------------------" 1022 @echo ">>> stage 1.2: bootstrap tools" 1023 @echo "--------------------------------------------------------------" 1024 ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools 1025 mkdir -p ${WORLDTMP}/usr ${WORLDTMP}/lib/casper ${WORLDTMP}/lib/geom 1026 ${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 1027 -p ${WORLDTMP}/usr >/dev/null 1028 ${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 1029 -p ${WORLDTMP}/usr/include >/dev/null 1030 ln -sf ${.CURDIR}/sys ${WORLDTMP} 1031.if ${MK_DEBUG_FILES} != "no" 1032 ${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.debug.dist \ 1033 -p ${WORLDTMP}/usr/lib >/dev/null 1034.endif 1035.for _mtree in ${LOCAL_MTREE} 1036 ${WORLDTMP_MTREE} -f ${.CURDIR}/${_mtree} -p ${WORLDTMP} > /dev/null 1037.endfor 1038_cleanobj: 1039.if !defined(NO_CLEAN) 1040 @echo 1041 @echo "--------------------------------------------------------------" 1042 @echo ">>> stage 2.1: cleaning up the object tree" 1043 @echo "--------------------------------------------------------------" 1044 # Avoid including bsd.compiler.mk in clean and obj with _NO_INCLUDE_COMPILERMK 1045 # since the restricted $PATH might not contain a valid cc binary 1046 ${_+_}cd ${.CURDIR}; ${WMAKE} _NO_INCLUDE_COMPILERMK=t ${CLEANDIR} 1047.if defined(_LIBCOMPAT) 1048 ${_+_}cd ${.CURDIR}; ${LIBCOMPATWMAKE} _NO_INCLUDE_COMPILERMK=t -f Makefile.inc1 ${CLEANDIR} 1049.endif 1050.else 1051 ${_+_}cd ${.CURDIR}; ${WMAKE} _NO_INCLUDE_COMPILERMK=t _cleanobj_fast_depend_hack 1052.endif # !defined(NO_CLEAN) 1053_obj: 1054 @echo 1055 @echo "--------------------------------------------------------------" 1056 @echo ">>> stage 2.2: rebuilding the object tree" 1057 @echo "--------------------------------------------------------------" 1058 ${_+_}cd ${.CURDIR}; ${WMAKE} _NO_INCLUDE_COMPILERMK=t obj 1059_build-tools: 1060 @echo 1061 @echo "--------------------------------------------------------------" 1062 @echo ">>> stage 2.3: build tools" 1063 @echo "--------------------------------------------------------------" 1064 ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools 1065_cross-tools: 1066 @echo 1067 @echo "--------------------------------------------------------------" 1068 @echo ">>> stage 3: cross tools" 1069 @echo "--------------------------------------------------------------" 1070 @rm -f ${OBJTOP}/toolchain-metadata.mk 1071 ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools 1072 ${_+_}cd ${.CURDIR}; ${XMAKE} kernel-tools 1073_build-metadata: 1074 @echo 1075 @echo "--------------------------------------------------------------" 1076 @echo ">>> stage 3.1: recording build metadata" 1077 @echo "--------------------------------------------------------------" 1078 ${_+_}cd ${.CURDIR}; ${WMAKE} toolchain-metadata.mk 1079 ${_+_}cd ${.CURDIR}; ${WMAKE} host-osreldate.h 1080_includes: 1081 @echo 1082 @echo "--------------------------------------------------------------" 1083 @echo ">>> stage 4.1: building includes" 1084 @echo "--------------------------------------------------------------" 1085# Special handling for SUBDIR_OVERRIDE in buildworld as they most likely need 1086# headers from default SUBDIR. Do SUBDIR_OVERRIDE includes last. 1087 ${_+_}cd ${.CURDIR}; ${WMAKE} SUBDIR_OVERRIDE= SHARED=symlinks \ 1088 MK_INCLUDES=yes includes 1089.if !empty(SUBDIR_OVERRIDE) && make(buildworld) 1090 ${_+_}cd ${.CURDIR}; ${WMAKE} MK_INCLUDES=yes SHARED=symlinks includes 1091.endif 1092_libraries: 1093 @echo 1094 @echo "--------------------------------------------------------------" 1095 @echo ">>> stage 4.2: building libraries" 1096 @echo "--------------------------------------------------------------" 1097 ${_+_}cd ${.CURDIR}; \ 1098 ${WMAKE} -DNO_FSCHG MK_HTML=no -DNO_LINT MK_MAN=no \ 1099 MK_PROFILE=no MK_TESTS=no MK_TESTS_SUPPORT=${MK_TESTS_SUPPORT} \ 1100 libraries 1101everything: .PHONY 1102 @echo 1103 @echo "--------------------------------------------------------------" 1104 @echo ">>> stage 4.4: building everything" 1105 @echo "--------------------------------------------------------------" 1106 ${_+_}cd ${.CURDIR}; _PARALLEL_SUBDIR_OK=1 ${WMAKE} all 1107 1108WMAKE_TGTS= 1109.if !defined(WORLDFAST) 1110WMAKE_TGTS+= _sanity_check _worldtmp _legacy 1111.if empty(SUBDIR_OVERRIDE) 1112WMAKE_TGTS+= _bootstrap-tools 1113.endif 1114WMAKE_TGTS+= _cleanobj 1115.if !defined(NO_OBJWALK) 1116WMAKE_TGTS+= _obj 1117.endif 1118WMAKE_TGTS+= _build-tools _cross-tools 1119WMAKE_TGTS+= _build-metadata 1120WMAKE_TGTS+= _includes 1121.endif 1122.if !defined(NO_LIBS) 1123WMAKE_TGTS+= _libraries 1124.endif 1125.if defined(_LIBCOMPAT) && empty(SUBDIR_OVERRIDE) 1126WMAKE_TGTS+= build${libcompat} 1127.endif 1128WMAKE_TGTS+= everything 1129 1130# record buildworld time in seconds 1131.if make(buildworld) 1132_BUILDWORLD_START!= date '+%s' 1133.export _BUILDWORLD_START 1134.endif 1135 1136buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue .PHONY 1137.ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue 1138 1139buildworld_prologue: .PHONY 1140 @echo "--------------------------------------------------------------" 1141 @echo ">>> World build started on `LC_ALL=C date`" 1142 @echo "--------------------------------------------------------------" 1143 1144buildworld_epilogue: .PHONY 1145 @echo 1146 @echo "--------------------------------------------------------------" 1147 @echo ">>> World build completed on `LC_ALL=C date`" 1148 @seconds=$$(($$(date '+%s') - ${_BUILDWORLD_START})); \ 1149 echo -n ">>> World built in $$seconds seconds, "; \ 1150 echo "ncpu: $$(sysctl -n hw.ncpu)${.MAKE.JOBS:S/^/, make -j/}" 1151 @echo "--------------------------------------------------------------" 1152 1153# 1154# We need to have this as a target because the indirection between Makefile 1155# and Makefile.inc1 causes the correct PATH to be used, rather than a 1156# modification of the current environment's PATH. In addition, we need 1157# to quote multiword values. 1158# 1159buildenvvars: .PHONY 1160 @echo ${WMAKEENV:Q} ${.MAKE.EXPORTED:@v@$v=\"${$v}\"@} 1161 1162.if ${.TARGETS:Mbuildenv} 1163.if ${.MAKEFLAGS:M-j} 1164.error The buildenv target is incompatible with -j 1165.endif 1166.endif 1167BUILDENV_DIR?= ${.CURDIR} 1168# 1169# Note: make will report any errors the shell reports. This can 1170# be odd if the last command in an interactive shell generates an 1171# error or is terminated by SIGINT. These reported errors look bad, 1172# but are harmless. Allowing them also allows BUIDLENV_SHELL to 1173# be a complex command whose status will be returned to the caller. 1174# Some scripts in tools rely on this behavior to report build errors. 1175# 1176buildenv: .PHONY 1177 @echo Entering world for ${TARGET_ARCH}:${TARGET} 1178.if ${BUILDENV_SHELL:M*zsh*} 1179 @echo For ZSH you must run: export CPUTYPE=${TARGET_CPUTYPE} 1180.endif 1181 @cd ${BUILDENV_DIR} && env ${WMAKEENV} BUILDENV=1 ${BUILDENV_SHELL} 1182 1183TOOLCHAIN_TGTS= ${WMAKE_TGTS:Neverything:Nbuild${libcompat}} 1184toolchain: ${TOOLCHAIN_TGTS} .PHONY 1185KERNEL_TOOLCHAIN_TGTS= ${TOOLCHAIN_TGTS:N_obj:N_cleanobj:N_includes:N_libraries} 1186.if make(kernel-toolchain) 1187.ORDER: ${KERNEL_TOOLCHAIN_TGTS} 1188.endif 1189kernel-toolchain: ${KERNEL_TOOLCHAIN_TGTS} .PHONY 1190 1191# 1192# installcheck 1193# 1194# Checks to be sure system is ready for installworld/installkernel. 1195# 1196installcheck: _installcheck_world _installcheck_kernel .PHONY 1197_installcheck_world: .PHONY 1198 @echo "--------------------------------------------------------------" 1199 @echo ">>> Install check world" 1200 @echo "--------------------------------------------------------------" 1201_installcheck_kernel: .PHONY 1202 @echo "--------------------------------------------------------------" 1203 @echo ">>> Install check kernel" 1204 @echo "--------------------------------------------------------------" 1205 1206# 1207# Require DESTDIR to be set if installing for a different architecture or 1208# using the user/group database in the source tree. 1209# 1210.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE} || \ 1211 defined(DB_FROM_SRC) 1212.if !make(distributeworld) 1213_installcheck_world: __installcheck_DESTDIR 1214_installcheck_kernel: __installcheck_DESTDIR 1215__installcheck_DESTDIR: .PHONY 1216.if !defined(DESTDIR) || empty(DESTDIR) 1217 @echo "ERROR: Please set DESTDIR!"; \ 1218 false 1219.endif 1220.endif 1221.endif 1222 1223.if !defined(DB_FROM_SRC) 1224# 1225# Check for missing UIDs/GIDs. 1226# 1227CHECK_UIDS= auditdistd 1228CHECK_GIDS= audit 1229CHECK_UIDS+= ntpd 1230CHECK_GIDS+= ntpd 1231CHECK_UIDS+= proxy 1232CHECK_GIDS+= proxy authpf 1233CHECK_UIDS+= smmsp 1234CHECK_GIDS+= smmsp 1235CHECK_UIDS+= unbound 1236CHECK_GIDS+= unbound 1237_installcheck_world: __installcheck_UGID 1238__installcheck_UGID: .PHONY 1239.for uid in ${CHECK_UIDS} 1240 @if ! `id -u ${uid} >/dev/null 2>&1`; then \ 1241 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \ 1242 false; \ 1243 fi 1244.endfor 1245.for gid in ${CHECK_GIDS} 1246 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \ 1247 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \ 1248 false; \ 1249 fi 1250.endfor 1251.endif 1252# 1253# If installing over the running system (DESTDIR is / or unset) and the install 1254# includes rescue, try running rescue from the objdir as a sanity check. If 1255# rescue is not functional (e.g., because it depends on a system call not 1256# supported by the currently running kernel), abort the installation. 1257# 1258.if !make(distributeworld) && ${MK_RESCUE} != "no" && \ 1259 (empty(DESTDIR) || ${DESTDIR} == "/") && empty(BYPASS_INSTALLCHECK_SH) 1260_installcheck_world: __installcheck_sh_check 1261__installcheck_sh_check: .PHONY 1262 @if [ "`${OBJTOP}/rescue/rescue/rescue sh -c 'echo OK'`" != \ 1263 OK ]; then \ 1264 echo "rescue/sh check failed, installation aborted" >&2; \ 1265 false; \ 1266 fi 1267.endif 1268 1269# 1270# Required install tools to be saved in a scratch dir for safety. 1271# 1272.if ${MK_ZONEINFO} != "no" 1273_zoneinfo= zic tzsetup 1274.endif 1275 1276ITOOLS= [ awk cap_mkdb cat chflags chmod chown cmp cp \ 1277 date echo egrep find grep id install ${_install-info} \ 1278 ln make mkdir mtree mv pwd_mkdb \ 1279 rm sed services_mkdb sh sort strip sysctl test true uname wc ${_zoneinfo} \ 1280 ${LOCAL_ITOOLS} 1281 1282# Needed for share/man 1283.if ${MK_MAN_UTILS} != "no" 1284ITOOLS+=makewhatis 1285.endif 1286 1287# 1288# distributeworld 1289# 1290# Distributes everything compiled by a `buildworld'. 1291# 1292# installworld 1293# 1294# Installs everything compiled by a 'buildworld'. 1295# 1296 1297# Non-base distributions produced by the base system 1298EXTRA_DISTRIBUTIONS= 1299.if defined(_LIBCOMPAT) 1300EXTRA_DISTRIBUTIONS+= lib${libcompat} 1301.endif 1302.if ${MK_TESTS} != "no" 1303EXTRA_DISTRIBUTIONS+= tests 1304.endif 1305 1306DEBUG_DISTRIBUTIONS= 1307.if ${MK_DEBUG_FILES} != "no" 1308DEBUG_DISTRIBUTIONS+= base ${EXTRA_DISTRIBUTIONS:S,tests,,} 1309.endif 1310 1311MTREE_MAGIC?= mtree 2.0 1312 1313distributeworld installworld stageworld: _installcheck_world .PHONY 1314 mkdir -p ${INSTALLTMP} 1315 progs=$$(for prog in ${ITOOLS}; do \ 1316 if progpath=`which $$prog`; then \ 1317 echo $$progpath; \ 1318 else \ 1319 echo "Required tool $$prog not found in PATH." >&2; \ 1320 exit 1; \ 1321 fi; \ 1322 done); \ 1323 libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | \ 1324 while read line; do \ 1325 set -- $$line; \ 1326 if [ "$$2 $$3" != "not found" ]; then \ 1327 echo $$2; \ 1328 else \ 1329 echo "Required library $$1 not found." >&2; \ 1330 exit 1; \ 1331 fi; \ 1332 done); \ 1333 cp $$libs $$progs ${INSTALLTMP} 1334 cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale 1335.if defined(NO_ROOT) 1336 -mkdir -p ${METALOG:H} 1337 echo "#${MTREE_MAGIC}" > ${METALOG} 1338.endif 1339.if make(distributeworld) 1340.for dist in ${EXTRA_DISTRIBUTIONS} 1341 -mkdir ${DESTDIR}/${DISTDIR}/${dist} 1342 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.root.dist \ 1343 -p ${DESTDIR}/${DISTDIR}/${dist} >/dev/null 1344 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 1345 -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null 1346 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 1347 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/include >/dev/null 1348.if ${MK_DEBUG_FILES} != "no" 1349 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.debug.dist \ 1350 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib >/dev/null 1351.endif 1352.if defined(_LIBCOMPAT) 1353 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ 1354 -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null 1355.if ${MK_DEBUG_FILES} != "no" 1356 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ 1357 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib/debug/usr >/dev/null 1358.endif 1359.endif 1360.if ${MK_TESTS} != "no" && ${dist} == "tests" 1361 -mkdir -p ${DESTDIR}/${DISTDIR}/${dist}${TESTSBASE} 1362 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.tests.dist \ 1363 -p ${DESTDIR}/${DISTDIR}/${dist}${TESTSBASE} >/dev/null 1364.if ${MK_DEBUG_FILES} != "no" 1365 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.tests.dist \ 1366 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib/debug/${TESTSBASE} >/dev/null 1367.endif 1368.endif 1369.if defined(NO_ROOT) 1370 ${IMAKEENV} ${DISTR_MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \ 1371 sed -e 's#^\./#./${dist}/#' >> ${METALOG} 1372 ${IMAKEENV} ${DISTR_MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.usr.dist | \ 1373 sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG} 1374 ${IMAKEENV} ${DISTR_MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.include.dist | \ 1375 sed -e 's#^\./#./${dist}/usr/include/#' >> ${METALOG} 1376.if defined(_LIBCOMPAT) 1377 ${IMAKEENV} ${DISTR_MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist | \ 1378 sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG} 1379.endif 1380.endif 1381.endfor 1382 -mkdir ${DESTDIR}/${DISTDIR}/base 1383 ${_+_}cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \ 1384 METALOG=${METALOG} ${IMAKE_INSTALL} ${IMAKE_MTREE} \ 1385 DISTBASE=/base DESTDIR=${DESTDIR}/${DISTDIR}/base \ 1386 LOCAL_MTREE=${LOCAL_MTREE:Q} distrib-dirs 1387 ${INSTALL_SYMLINK} ${INSTALLFLAGS} usr/src/sys ${INSTALL_DDIR}/base/sys 1388.endif 1389 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \ 1390 ${IMAKEENV} rm -rf ${INSTALLTMP} 1391.if make(distributeworld) 1392.for dist in ${EXTRA_DISTRIBUTIONS} 1393 find ${DESTDIR}/${DISTDIR}/${dist} -mindepth 1 -type d -empty -delete 1394.endfor 1395.if defined(NO_ROOT) 1396.for dist in base ${EXTRA_DISTRIBUTIONS} 1397 @# For each file that exists in this dist, print the corresponding 1398 @# line from the METALOG. This relies on the fact that 1399 @# a line containing only the filename will sort immediately before 1400 @# the relevant mtree line. 1401 cd ${DESTDIR}/${DISTDIR}; \ 1402 find ./${dist} | sort -u ${METALOG} - | \ 1403 awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \ 1404 ${DESTDIR}/${DISTDIR}/${dist}.meta 1405.endfor 1406.for dist in ${DEBUG_DISTRIBUTIONS} 1407 @# For each file that exists in this dist, print the corresponding 1408 @# line from the METALOG. This relies on the fact that 1409 @# a line containing only the filename will sort immediately before 1410 @# the relevant mtree line. 1411 cd ${DESTDIR}/${DISTDIR}; \ 1412 find ./${dist}/usr/lib/debug | sort -u ${METALOG} - | \ 1413 awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \ 1414 ${DESTDIR}/${DISTDIR}/${dist}.debug.meta 1415.endfor 1416.endif 1417.endif 1418 1419packageworld: .PHONY 1420.for dist in base ${EXTRA_DISTRIBUTIONS} 1421.if defined(NO_ROOT) 1422 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ 1423 tar cvf - --exclude usr/lib/debug \ 1424 @${DESTDIR}/${DISTDIR}/${dist}.meta | \ 1425 ${XZ_CMD} > ${PACKAGEDIR}/${dist}.txz 1426.else 1427 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ 1428 tar cvf - --exclude usr/lib/debug . | \ 1429 ${XZ_CMD} > ${PACKAGEDIR}/${dist}.txz 1430.endif 1431.endfor 1432 1433.for dist in ${DEBUG_DISTRIBUTIONS} 1434. if defined(NO_ROOT) 1435 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ 1436 tar cvf - @${DESTDIR}/${DISTDIR}/${dist}.debug.meta | \ 1437 ${XZ_CMD} > ${PACKAGEDIR}/${dist}-dbg.txz 1438. else 1439 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ 1440 tar cvLf - usr/lib/debug | \ 1441 ${XZ_CMD} > ${PACKAGEDIR}/${dist}-dbg.txz 1442. endif 1443.endfor 1444 1445makeman: .PHONY 1446 ${_+_}cd ${.CURDIR}/tools/build/options; sh makeman > \ 1447 ${.CURDIR}/share/man/man5/src.conf.5 1448 1449# We can't assume here that ${TMPPATH} will include ${PATH} or /usr/libexec 1450# because we may be building with a STRICTTMPPATH, so we explicitly include 1451# /usr/libexec here for flua. ${TMPPATH} still usefully includes anything else 1452# we may need to function. 1453_sysent_PATH= ${TMPPATH}:/usr/libexec 1454_sysent_dirs= sys/kern 1455_sysent_dirs+= sys/compat/freebsd32 1456_sysent_dirs+= sys/compat/cloudabi32 \ 1457 sys/compat/cloudabi64 1458_sysent_dirs+= sys/amd64/linux \ 1459 sys/amd64/linux32 \ 1460 sys/arm/linux \ 1461 sys/arm64/linux \ 1462 sys/i386/linux 1463sysent: .PHONY 1464.for _dir in ${_sysent_dirs} 1465 @echo "${MAKE} -C ${.CURDIR}/${_dir} sysent" 1466 ${_+_}@env PATH=${_sysent_PATH} ${MAKE} -C ${.CURDIR}/${_dir} sysent 1467.endfor 1468 1469# 1470# reinstall 1471# 1472# If you have a build server, you can NFS mount the source and obj directories 1473# and do a 'make reinstall' on the *client* to install new binaries from the 1474# most recent server build. 1475# 1476restage reinstall: .MAKE .PHONY 1477 @echo "--------------------------------------------------------------" 1478 @echo ">>> Making hierarchy" 1479 @echo "--------------------------------------------------------------" 1480 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 \ 1481 LOCAL_MTREE=${LOCAL_MTREE:Q} hierarchy 1482.if make(restage) 1483 @echo "--------------------------------------------------------------" 1484 @echo ">>> Making distribution" 1485 @echo "--------------------------------------------------------------" 1486 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 \ 1487 LOCAL_MTREE=${LOCAL_MTREE:Q} distribution 1488.endif 1489 @echo 1490 @echo "--------------------------------------------------------------" 1491 @echo ">>> Installing everything started on `LC_ALL=C date`" 1492 @echo "--------------------------------------------------------------" 1493 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install 1494.if defined(_LIBCOMPAT) 1495 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install${libcompat} 1496.endif 1497 @echo "--------------------------------------------------------------" 1498 @echo ">>> Installing everything completed on `LC_ALL=C date`" 1499 @echo "--------------------------------------------------------------" 1500 1501redistribute: .MAKE .PHONY 1502 @echo "--------------------------------------------------------------" 1503 @echo ">>> Distributing everything" 1504 @echo "--------------------------------------------------------------" 1505 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute 1506.if defined(_LIBCOMPAT) 1507 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute${libcompat} \ 1508 DISTRIBUTION=lib${libcompat} 1509.endif 1510 1511distrib-dirs distribution: .MAKE .PHONY 1512 ${_+_}cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \ 1513 ${IMAKE_INSTALL} ${IMAKE_MTREE} METALOG=${METALOG} ${.TARGET} 1514.if make(distribution) 1515 ${_+_}cd ${.CURDIR}; ${CROSSENV} PATH=${TMPPATH} \ 1516 ${MAKE} -f Makefile.inc1 ${IMAKE_INSTALL} \ 1517 METALOG=${METALOG} MK_TESTS=no \ 1518 MK_TESTS_SUPPORT=${MK_TESTS_SUPPORT} installconfig 1519.endif 1520 1521# 1522# buildkernel and installkernel 1523# 1524# Which kernels to build and/or install is specified by setting 1525# KERNCONF. If not defined a GENERIC kernel is built/installed. 1526# Only the existing (depending TARGET) config files are used 1527# for building kernels and only the first of these is designated 1528# as the one being installed. 1529# 1530# Note that we have to use TARGET instead of TARGET_ARCH when 1531# we're in kernel-land. Since only TARGET_ARCH is (expected) to 1532# be set to cross-build, we have to make sure TARGET is set 1533# properly. 1534 1535.if defined(KERNFAST) 1536NO_KERNELCLEAN= t 1537NO_KERNELCONFIG= t 1538NO_KERNELOBJ= t 1539# Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah 1540.if !defined(KERNCONF) && ${KERNFAST} != "1" 1541KERNCONF=${KERNFAST} 1542.endif 1543.endif 1544.if ${TARGET_ARCH} == "powerpc64" 1545KERNCONF?= GENERIC64 1546.else 1547KERNCONF?= GENERIC 1548.endif 1549INSTKERNNAME?= kernel 1550 1551KERNSRCDIR?= ${.CURDIR}/sys 1552KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf 1553KRNLOBJDIR= ${OBJTOP}${KERNSRCDIR:C,^${.CURDIR},,} 1554KERNCONFDIR?= ${KRNLCONFDIR} 1555 1556BUILDKERNELS= 1557INSTALLKERNEL= 1558.if defined(NO_INSTALLKERNEL) 1559# All of the BUILDKERNELS loops start at index 1. 1560BUILDKERNELS+= dummy 1561.endif 1562.for _kernel in ${KERNCONF} 1563.if !defined(_MKSHOWCONFIG) && exists(${KERNCONFDIR}/${_kernel}) 1564BUILDKERNELS+= ${_kernel} 1565.if empty(INSTALLKERNEL) && !defined(NO_INSTALLKERNEL) 1566INSTALLKERNEL= ${_kernel} 1567.endif 1568.else 1569.if make(buildkernel) 1570.error Missing KERNCONF ${KERNCONFDIR}/${_kernel} 1571.endif 1572.endif 1573.endfor 1574 1575_cleankernobj_fast_depend_hack: .PHONY 1576# 20191009 r353340 removal of opensolaris_atomic.S (also r353381) 1577.if ${MACHINE} != i386 1578.for f in opensolaris_atomic 1579.for m in opensolaris zfs 1580 @if [ -e "${KRNLOBJDIR}/${KERNCONF}/modules${SRCTOP}/sys/modules/${m}/.depend.${f}.o" ] && \ 1581 grep -q ${f}.S "${KRNLOBJDIR}/${KERNCONF}/modules${SRCTOP}/sys/modules/${m}/.depend.${f}.o"; then \ 1582 echo "Removing stale dependencies for opensolaris_atomic"; \ 1583 rm -f ${KRNLOBJDIR}/${KERNCONF}/modules${SRCTOP}/sys/modules/${m}/.depend.${f}.*; \ 1584 fi 1585.endfor 1586.endfor 1587.endif 1588 1589${WMAKE_TGTS:N_worldtmp:Nbuild${libcompat}} ${.ALLTARGETS:M_*:N_worldtmp}: .MAKE .PHONY 1590 1591# record kernel(s) build time in seconds 1592.if make(buildkernel) 1593_BUILDKERNEL_START!= date '+%s' 1594.endif 1595 1596# 1597# buildkernel 1598# 1599# Builds all kernels defined by BUILDKERNELS. 1600# 1601buildkernel: .MAKE .PHONY 1602.if empty(BUILDKERNELS:Ndummy) 1603 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \ 1604 false 1605.endif 1606 @echo 1607.for _kernel in ${BUILDKERNELS:Ndummy} 1608 @echo "--------------------------------------------------------------" 1609 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`" 1610 @echo "--------------------------------------------------------------" 1611 @echo "===> ${_kernel}" 1612 mkdir -p ${KRNLOBJDIR} 1613.if !defined(NO_KERNELCONFIG) 1614 @echo 1615 @echo "--------------------------------------------------------------" 1616 @echo ">>> stage 1: configuring the kernel" 1617 @echo "--------------------------------------------------------------" 1618 cd ${KRNLCONFDIR}; \ 1619 PATH=${TMPPATH} \ 1620 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \ 1621 -I '${KERNCONFDIR}' -I '${KRNLCONFDIR}' \ 1622 '${KERNCONFDIR}/${_kernel}' 1623.endif 1624.if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN) 1625 @echo 1626 @echo "--------------------------------------------------------------" 1627 @echo ">>> stage 2.1: cleaning up the object tree" 1628 @echo "--------------------------------------------------------------" 1629 ${_+_}cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR} 1630.else 1631 ${_+_}cd ${.CURDIR}; ${WMAKE} _cleankernobj_fast_depend_hack 1632.endif 1633.if !defined(NO_KERNELOBJ) 1634 @echo 1635 @echo "--------------------------------------------------------------" 1636 @echo ">>> stage 2.2: rebuilding the object tree" 1637 @echo "--------------------------------------------------------------" 1638 ${_+_}cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj 1639.endif 1640 @echo 1641 @echo "--------------------------------------------------------------" 1642 @echo ">>> stage 2.3: build tools" 1643 @echo "--------------------------------------------------------------" 1644 ${_+_}cd ${.CURDIR}; ${KTMAKE} kernel-tools 1645 @echo 1646 @echo "--------------------------------------------------------------" 1647 @echo ">>> stage 3.1: building everything" 1648 @echo "--------------------------------------------------------------" 1649 ${_+_}cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ 1650 @echo "--------------------------------------------------------------" 1651 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`" 1652 @echo "--------------------------------------------------------------" 1653 1654.endfor 1655 @seconds=$$(($$(date '+%s') - ${_BUILDKERNEL_START})); \ 1656 echo -n ">>> Kernel(s) ${BUILDKERNELS} built in $$seconds seconds, "; \ 1657 echo "ncpu: $$(sysctl -n hw.ncpu)${.MAKE.JOBS:S/^/, make -j/}" 1658 @echo "--------------------------------------------------------------" 1659 1660NO_INSTALLEXTRAKERNELS?= yes 1661 1662# 1663# installkernel, etc. 1664# 1665# Install the kernel defined by INSTALLKERNEL 1666# 1667installkernel installkernel.debug \ 1668reinstallkernel reinstallkernel.debug: _installcheck_kernel .PHONY 1669.if !defined(NO_INSTALLKERNEL) 1670.if empty(INSTALLKERNEL) 1671 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \ 1672 false 1673.endif 1674 @echo "--------------------------------------------------------------" 1675 @echo ">>> Installing kernel ${INSTALLKERNEL} on $$(LC_ALL=C date)" 1676 @echo "--------------------------------------------------------------" 1677 ${_+_}cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ 1678 ${CROSSENV} PATH=${TMPPATH} \ 1679 ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//} 1680 @echo "--------------------------------------------------------------" 1681 @echo ">>> Installing kernel ${INSTALLKERNEL} completed on $$(LC_ALL=C date)" 1682 @echo "--------------------------------------------------------------" 1683.endif 1684.if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes" 1685.for _kernel in ${BUILDKERNELS:[2..-1]} 1686 @echo "--------------------------------------------------------------" 1687 @echo ">>> Installing kernel ${_kernel} $$(LC_ALL=C date)" 1688 @echo "--------------------------------------------------------------" 1689 ${_+_}cd ${KRNLOBJDIR}/${_kernel}; \ 1690 ${CROSSENV} PATH=${TMPPATH} \ 1691 ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME}.${_kernel} ${.TARGET:S/kernel//} 1692 @echo "--------------------------------------------------------------" 1693 @echo ">>> Installing kernel ${_kernel} completed on $$(LC_ALL=C date)" 1694 @echo "--------------------------------------------------------------" 1695.endfor 1696.endif 1697 1698distributekernel distributekernel.debug: .PHONY 1699.if !defined(NO_INSTALLKERNEL) 1700.if empty(INSTALLKERNEL) 1701 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \ 1702 false 1703.endif 1704 mkdir -p ${DESTDIR}/${DISTDIR} 1705.if defined(NO_ROOT) 1706 @echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.premeta 1707.endif 1708 ${_+_}cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ 1709 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.premeta/} \ 1710 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} KERNEL=${INSTKERNNAME} \ 1711 DESTDIR=${INSTALL_DDIR}/kernel \ 1712 ${.TARGET:S/distributekernel/install/} 1713.if defined(NO_ROOT) 1714 @sed -e 's|^./kernel|.|' ${DESTDIR}/${DISTDIR}/kernel.premeta > \ 1715 ${DESTDIR}/${DISTDIR}/kernel.meta 1716.endif 1717.endif 1718.if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes" 1719.for _kernel in ${BUILDKERNELS:[2..-1]} 1720.if defined(NO_ROOT) 1721 @echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta 1722.endif 1723 ${_+_}cd ${KRNLOBJDIR}/${_kernel}; \ 1724 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.${_kernel}.premeta/} \ 1725 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} \ 1726 KERNEL=${INSTKERNNAME}.${_kernel} \ 1727 DESTDIR=${INSTALL_DDIR}/kernel.${_kernel} \ 1728 ${.TARGET:S/distributekernel/install/} 1729.if defined(NO_ROOT) 1730 @sed -e "s|^./kernel.${_kernel}|.|" \ 1731 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta > \ 1732 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta 1733.endif 1734.endfor 1735.endif 1736 1737packagekernel: .PHONY 1738.if defined(NO_ROOT) 1739.if !defined(NO_INSTALLKERNEL) 1740 cd ${DESTDIR}/${DISTDIR}/kernel; \ 1741 tar cvf - --exclude '*.debug' \ 1742 @${DESTDIR}/${DISTDIR}/kernel.meta | \ 1743 ${XZ_CMD} > ${PACKAGEDIR}/kernel.txz 1744.endif 1745.if ${MK_DEBUG_FILES} != "no" 1746 cd ${DESTDIR}/${DISTDIR}/kernel; \ 1747 tar cvf - --include '*/*/*.debug' \ 1748 @${DESTDIR}/${DISTDIR}/kernel.meta | \ 1749 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel-dbg.txz 1750.endif 1751.if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes" 1752.for _kernel in ${BUILDKERNELS:[2..-1]} 1753 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ 1754 tar cvf - --exclude '*.debug' \ 1755 @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta | \ 1756 ${XZ_CMD} > ${PACKAGEDIR}/kernel.${_kernel}.txz 1757.if ${MK_DEBUG_FILES} != "no" 1758 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ 1759 tar cvf - --include '*/*/*.debug' \ 1760 @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta | \ 1761 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}-dbg.txz 1762.endif 1763.endfor 1764.endif 1765.else 1766.if !defined(NO_INSTALLKERNEL) 1767 cd ${DESTDIR}/${DISTDIR}/kernel; \ 1768 tar cvf - --exclude '*.debug' . | \ 1769 ${XZ_CMD} > ${PACKAGEDIR}/kernel.txz 1770.endif 1771.if ${MK_DEBUG_FILES} != "no" 1772 cd ${DESTDIR}/${DISTDIR}/kernel; \ 1773 tar cvf - --include '*/*/*.debug' $$(eval find .) | \ 1774 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel-dbg.txz 1775.endif 1776.if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes" 1777.for _kernel in ${BUILDKERNELS:[2..-1]} 1778 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ 1779 tar cvf - --exclude '*.debug' . | \ 1780 ${XZ_CMD} > ${PACKAGEDIR}/kernel.${_kernel}.txz 1781.if ${MK_DEBUG_FILES} != "no" 1782 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ 1783 tar cvf - --include '*/*/*.debug' $$(eval find .) | \ 1784 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}-dbg.txz 1785.endif 1786.endfor 1787.endif 1788.endif 1789 1790stagekernel: .PHONY 1791 ${_+_}${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} distributekernel 1792 1793PORTSDIR?= /usr/ports 1794WSTAGEDIR?= ${OBJTOP}/worldstage 1795KSTAGEDIR?= ${OBJTOP}/kernelstage 1796REPODIR?= ${OBJROOT}repo 1797PKG_FORMAT?= txz 1798PKGSIGNKEY?= # empty 1799PKG_OUTPUT_DIR?= ${PKG_VERSION} 1800 1801.ORDER: stage-packages create-packages 1802.ORDER: create-packages create-world-packages 1803.ORDER: create-packages create-kernel-packages 1804.ORDER: create-packages sign-packages 1805 1806_pkgbootstrap: .PHONY 1807.if make(*package*) && !exists(${LOCALBASE}/sbin/pkg) 1808 @env ASSUME_ALWAYS_YES=YES pkg bootstrap 1809.endif 1810 1811packages: .PHONY 1812 ${_+_}${MAKE} -C ${.CURDIR} PKG_VERSION=${PKG_VERSION} real-packages 1813 1814package-pkg: .PHONY 1815 rm -rf /tmp/ports.${TARGET} || : 1816 env ${WMAKEENV:Q} SRCDIR=${.CURDIR} PORTSDIR=${PORTSDIR} REVISION=${_REVISION} \ 1817 PKG_CMD=${PKG_CMD} PKG_VERSION=${PKG_VERSION} REPODIR=${REPODIR} \ 1818 WSTAGEDIR=${WSTAGEDIR} \ 1819 sh ${.CURDIR}/release/scripts/make-pkg-package.sh 1820 1821real-packages: stage-packages create-packages sign-packages .PHONY 1822 1823stage-packages-world: .PHONY 1824 @mkdir -p ${WSTAGEDIR} 1825 ${_+_}@cd ${.CURDIR}; \ 1826 ${MAKE} DESTDIR=${WSTAGEDIR} -DNO_ROOT stageworld 1827 1828stage-packages-kernel: .PHONY 1829 @mkdir -p ${KSTAGEDIR} 1830 ${_+_}@cd ${.CURDIR}; \ 1831 ${MAKE} DESTDIR=${KSTAGEDIR} -DNO_ROOT stagekernel 1832 1833stage-packages: .PHONY stage-packages-world stage-packages-kernel 1834 1835_repodir: .PHONY 1836 @mkdir -p ${REPODIR} 1837 1838create-packages-world: _pkgbootstrap _repodir .PHONY 1839 ${_+_}@cd ${.CURDIR}; \ 1840 ${MAKE} -f Makefile.inc1 \ 1841 DESTDIR=${WSTAGEDIR} \ 1842 PKG_VERSION=${PKG_VERSION} create-world-packages 1843 1844create-packages-kernel: _pkgbootstrap _repodir .PHONY 1845 ${_+_}@cd ${.CURDIR}; \ 1846 ${MAKE} -f Makefile.inc1 \ 1847 DESTDIR=${KSTAGEDIR} \ 1848 PKG_VERSION=${PKG_VERSION} DISTDIR=kernel \ 1849 SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \ 1850 create-kernel-packages 1851 1852create-packages: .PHONY create-packages-world create-packages-kernel 1853 1854create-world-packages: _pkgbootstrap .PHONY 1855 @rm -f ${WSTAGEDIR}/*.plist 2>/dev/null || : 1856 @cd ${WSTAGEDIR} ; \ 1857 env -i LC_COLLATE=C sort ${WSTAGEDIR}/${DISTDIR}/METALOG | \ 1858 awk -f ${SRCDIR}/release/scripts/mtree-to-plist.awk 1859 @for plist in ${WSTAGEDIR}/*.plist; do \ 1860 plist=$${plist##*/} ; \ 1861 pkgname=$${plist%.plist} ; \ 1862 echo "_PKGS+= $${pkgname}" ; \ 1863 done > ${WSTAGEDIR}/packages.mk 1864 ${_+_}@cd ${.CURDIR}; \ 1865 ${MAKE} -f Makefile.inc1 create-world-packages-jobs \ 1866 SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \ 1867 .MAKE.JOB.PREFIX= 1868 1869.if make(create-world-packages-jobs) 1870.include "${WSTAGEDIR}/packages.mk" 1871.endif 1872 1873.if make(create-world-packages-jobs) || make(create-kernel-packages*) 1874PKG_ABI!=${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname config ABI 1875.endif 1876 1877create-world-packages-jobs: .PHONY 1878.for pkgname in ${_PKGS} 1879create-world-packages-jobs: create-world-package-${pkgname} 1880create-world-package-${pkgname}: .PHONY 1881 @sh ${SRCDIR}/release/packages/generate-ucl.sh -o ${pkgname} \ 1882 -s ${SRCDIR} -u ${WSTAGEDIR}/${pkgname}.ucl 1883 @awk -F\" ' \ 1884 /^name/ { printf("===> Creating %s-", $$2); next } \ 1885 /^version/ { print $$2; next } \ 1886 ' ${WSTAGEDIR}/${pkgname}.ucl 1887 @if [ "${pkgname}" == "runtime" ]; then \ 1888 sed -i '' -e "s/%VCS_REVISION%/${VCS_REVISION}/" ${WSTAGEDIR}/${pkgname}.ucl ; \ 1889 fi 1890 ${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname -o ALLOW_BASE_SHLIBS=yes \ 1891 create -f ${PKG_FORMAT} -M ${WSTAGEDIR}/${pkgname}.ucl \ 1892 -p ${WSTAGEDIR}/${pkgname}.plist \ 1893 -r ${WSTAGEDIR} \ 1894 -o ${REPODIR}/${PKG_ABI}/${PKG_OUTPUT_DIR} 1895.endfor 1896 1897_default_flavor= -default 1898.if make(*package*) && exists(${KSTAGEDIR}/kernel.meta) 1899. if ${MK_DEBUG_FILES} != "no" 1900_debug=-dbg 1901. endif 1902create-kernel-packages: .PHONY 1903. for flavor in "" ${_debug} 1904create-kernel-packages: create-kernel-packages-flavor${flavor:C,^""$,${_default_flavor},} 1905create-kernel-packages-flavor${flavor:C,^""$,${_default_flavor},}: _pkgbootstrap .PHONY 1906 @cd ${KSTAGEDIR}/${DISTDIR} ; \ 1907 env -i LC_COLLATE=C sort ${KSTAGEDIR}/kernel.meta | \ 1908 awk -f ${SRCDIR}/release/scripts/mtree-to-plist.awk \ 1909 -v kernel=yes -v _kernconf=${INSTALLKERNEL} ; \ 1910 sed -e "s/%VERSION%/${PKG_VERSION}/" \ 1911 -e "s/%PKGNAME%/kernel-${INSTALLKERNEL:tl}${flavor}/" \ 1912 -e "s/%KERNELDIR%/kernel/" \ 1913 -e "s/%COMMENT%/FreeBSD ${INSTALLKERNEL} kernel ${flavor}/" \ 1914 -e "s/%DESC%/FreeBSD ${INSTALLKERNEL} kernel ${flavor}/" \ 1915 -e "s/ %VCS_REVISION%/${VCS_REVISION}/" \ 1916 -e "s/%PKG_NAME_PREFIX%/${PKG_NAME_PREFIX}/" \ 1917 -e "s/%PKG_MAINTAINER%/${PKG_MAINTAINER}/" \ 1918 -e "s|%PKG_WWW%|${PKG_WWW}|" \ 1919 ${SRCDIR}/release/packages/kernel.ucl \ 1920 > ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl ; \ 1921 awk -F\" ' \ 1922 /name/ { printf("===> Creating %s-", $$2); next } \ 1923 /version/ {print $$2; next } ' \ 1924 ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl ; \ 1925 ${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname -o ALLOW_BASE_SHLIBS=yes \ 1926 create -f ${PKG_FORMAT} \ 1927 -M ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl \ 1928 -p ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.plist \ 1929 -r ${KSTAGEDIR}/${DISTDIR} \ 1930 -o ${REPODIR}/${PKG_ABI}/${PKG_OUTPUT_DIR} 1931. endfor 1932.endif 1933.if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes" 1934. for _kernel in ${BUILDKERNELS:[2..-1]} 1935. if exists(${KSTAGEDIR}/kernel.${_kernel}.meta) 1936. if ${MK_DEBUG_FILES} != "no" 1937_debug=-dbg 1938. endif 1939. for flavor in "" ${_debug} 1940create-kernel-packages: create-kernel-packages-extra-flavor${flavor:C,^""$,${_default_flavor},}-${_kernel} 1941create-kernel-packages-extra-flavor${flavor:C,^""$,${_default_flavor},}-${_kernel}: _pkgbootstrap .PHONY 1942 @cd ${KSTAGEDIR}/kernel.${_kernel} ; \ 1943 env -i LC_COLLATE=C sort ${KSTAGEDIR}/kernel.${_kernel}.meta | \ 1944 awk -f ${SRCDIR}/release/scripts/mtree-to-plist.awk \ 1945 -v kernel=yes -v _kernconf=${_kernel} ; \ 1946 sed -e "s/%VERSION%/${PKG_VERSION}/" \ 1947 -e "s/%PKGNAME%/kernel-${_kernel:tl}${flavor}/" \ 1948 -e "s/%KERNELDIR%/kernel.${_kernel}/" \ 1949 -e "s/%COMMENT%/FreeBSD ${_kernel} kernel ${flavor}/" \ 1950 -e "s/%DESC%/FreeBSD ${_kernel} kernel ${flavor}/" \ 1951 -e "s/ %VCS_REVISION%/${VCS_REVISION}/" \ 1952 -e "s/%PKG_NAME_PREFIX%/${PKG_NAME_PREFIX}/" \ 1953 -e "s/%PKG_MAINTAINER%/${PKG_MAINTAINER}/" \ 1954 -e "s|%PKG_WWW%|${PKG_WWW}|" \ 1955 ${SRCDIR}/release/packages/kernel.ucl \ 1956 > ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.ucl ; \ 1957 awk -F\" ' \ 1958 /name/ { printf("===> Creating %s-", $$2); next } \ 1959 /version/ {print $$2; next } ' \ 1960 ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.ucl ; \ 1961 ${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname -o ALLOW_BASE_SHLIBS=yes \ 1962 create -f ${PKG_FORMAT} \ 1963 -M ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.ucl \ 1964 -p ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.plist \ 1965 -r ${KSTAGEDIR}/kernel.${_kernel} \ 1966 -o ${REPODIR}/${PKG_ABI}/${PKG_OUTPUT_DIR} 1967. endfor 1968. endif 1969. endfor 1970.endif 1971 1972sign-packages: _pkgbootstrap .PHONY 1973 printf "version = 2;\npacking_format = \"${PKG_FORMAT}\";\n" > ${WSTAGEDIR}/meta 1974 @[ -L "${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname config ABI)/latest" ] && \ 1975 unlink ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname config ABI)/latest ; \ 1976 ${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname repo \ 1977 -m ${WSTAGEDIR}/meta \ 1978 -o ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname config ABI)/${PKG_VERSION} \ 1979 ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname config ABI)/${PKG_VERSION} \ 1980 ${PKGSIGNKEY} ; \ 1981 cd ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname config ABI); \ 1982 ln -s ${PKG_OUTPUT_DIR} latest 1983 1984# 1985# 1986# checkworld 1987# 1988# Run test suite on installed world. 1989# 1990checkworld: .PHONY 1991 @if [ ! -x "${LOCALBASE}/bin/kyua" ] && [ ! -x "/usr/bin/kyua" ]; then \ 1992 echo "You need kyua (devel/kyua) to run the test suite." | /usr/bin/fmt; \ 1993 exit 1; \ 1994 fi 1995 ${_+_}PATH="$$PATH:${LOCALBASE}/bin" kyua test -k ${TESTSBASE}/Kyuafile 1996 1997# 1998# 1999# doxygen 2000# 2001# Build the API documentation with doxygen 2002# 2003doxygen: .PHONY 2004 @if [ ! -x "${LOCALBASE}/bin/doxygen" ]; then \ 2005 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \ 2006 exit 1; \ 2007 fi 2008 ${_+_}cd ${.CURDIR}/tools/kerneldoc/subsys; ${MAKE} obj all 2009 2010# 2011# update 2012# 2013# Update the source tree(s), by running svn/svnup to update to the 2014# latest copy. 2015# 2016update: .PHONY 2017.if defined(SVN_UPDATE) 2018 @echo "--------------------------------------------------------------" 2019 @echo ">>> Updating ${.CURDIR} using Subversion" 2020 @echo "--------------------------------------------------------------" 2021 @(cd ${.CURDIR}; ${SVN_CMD} update ${SVNFLAGS}) 2022.endif 2023 2024# 2025# ------------------------------------------------------------------------ 2026# 2027# From here onwards are utility targets used by the 'make world' and 2028# related targets. If your 'world' breaks, you may like to try to fix 2029# the problem and manually run the following targets to attempt to 2030# complete the build. Beware, this is *not* guaranteed to work, you 2031# need to have a pretty good grip on the current state of the system 2032# to attempt to manually finish it. If in doubt, 'make world' again. 2033# 2034 2035# 2036# legacy: Build compatibility shims for the next three targets. This is a 2037# minimal set of tools and shims necessary to compensate for older systems 2038# which don't have the APIs required by the targets built in bootstrap-tools, 2039# build-tools or cross-tools. 2040# 2041 2042 2043# libnv is a requirement for config(8), which is an unconditional 2044# bootstrap-tool. 2045_config_deps= lib/libnv 2046 2047legacy: .PHONY 2048.if ${BOOTSTRAPPING} < ${MINIMUM_SUPPORTED_OSREL} && ${BOOTSTRAPPING} != 0 2049 @echo "ERROR: Source upgrades from versions prior to ${MINIMUM_SUPPORTED_REL} are not supported."; \ 2050 false 2051.endif 2052 2053.for _tool in tools/build ${_config_deps} 2054 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,all,install)"; \ 2055 cd ${.CURDIR}/${_tool}; \ 2056 if [ -z "${NO_OBJWALK}" ]; then ${MAKE} DIRPRFX=${_tool}/ obj; fi; \ 2057 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${WORLDTMP}/legacy includes; \ 2058 ${MAKE} DIRPRFX=${_tool}/ MK_INCLUDES=no all; \ 2059 ${MAKE} DIRPRFX=${_tool}/ MK_INCLUDES=no \ 2060 DESTDIR=${WORLDTMP}/legacy install 2061.endfor 2062 2063# 2064# bootstrap-tools: Build tools needed for compatibility. These are binaries that 2065# are built to build other binaries in the system. However, the focus of these 2066# binaries is usually quite narrow. Bootstrap tools use the host's compiler and 2067# libraries, augmented by -legacy, in addition to the libraries built during 2068# bootstrap-tools. 2069# 2070_bt= _bootstrap-tools 2071 2072# We want to run the build with only ${WORLDTMP} in $PATH to ensure we don't 2073# accidentally run tools that are incompatible but happen to be in $PATH. 2074# This is especially important when building on Linux/MacOS where many of the 2075# programs used during the build accept different flags or generate different 2076# output. On those platforms we only symlink the tools known to be compatible 2077# (e.g. basic utilities such as mkdir) into ${WORLDTMP} and build all others 2078# from the FreeBSD sources during the bootstrap-tools stage. 2079# We want to build without the user's $PATH starting in the bootstrap-tools 2080# phase so the tools used in that phase (ln, cp, etc) must have already been 2081# linked to $WORLDTMP. The tools are listed in the _host_tools_to_symlink 2082# variable in tools/build/Makefile and are linked during the legacy phase. 2083# Since they could be Linux or MacOS binaries, too we must only use flags that 2084# are portable across operating systems. 2085 2086# If BOOTSTRAP_ALL_TOOLS is set we will build all the required tools from the 2087# current source tree. Otherwise we create a symlink to the version found in 2088# $PATH during the bootstrap-tools stage. 2089.if defined(BOOTSTRAP_ALL_TOOLS) 2090# BOOTSTRAPPING will be set on the command line so we can't override it here. 2091# Instead set BOOTSTRAPPING_OSRELDATE so that the value 0 is set ${BSARGS} 2092BOOTSTRAPPING_OSRELDATE:= 0 2093.endif 2094 2095.if ${MK_GAMES} != "no" 2096_strfile= usr.bin/fortune/strfile 2097.endif 2098 2099.if ${MK_VT} != "no" 2100_vtfontcvt= usr.bin/vtfontcvt 2101.endif 2102 2103# If we are not building the bootstrap because BOOTSTRAPPING is sufficient 2104# we symlink the host version to $WORLDTMP instead. By doing this we can also 2105# detect when a bootstrap tool is being used without the required MK_FOO. 2106# If you add a new bootstrap tool where we could also use the host version, 2107# please ensure that you also add a .else case where you add the tool to the 2108# _bootstrap_tools_links variable. 2109.if ${BOOTSTRAPPING} < 1000033 2110_m4= usr.bin/m4 2111_lex= usr.bin/lex 2112# Note: lex needs m4 to build but m4 also depends on lex. However, lex can be 2113# bootstrapped so we build lex first. 2114${_bt}-usr.bin/m4: ${_bt}-lib/libopenbsd ${_bt}-usr.bin/yacc ${_bt}-${_lex} 2115_bt_m4_depend=${_bt}-${_m4} 2116_bt_lex_depend=${_bt}-${_lex} ${_bt_m4_depend} 2117.else 2118_bootstrap_tools_links+=m4 lex 2119.endif 2120 2121# ELF Tool Chain libraries are needed for ELF tools and dtrace tools. 2122# r296685 fix cross-endian objcopy 2123# r310724 fixed PR 215350, a crash in libdwarf with objects built by GCC 6.2. 2124# r334881 added libdwarf constants used by ctfconvert. 2125# r338478 fixed a crash in objcopy for mips64el objects 2126# r339083 libelf: correct mips64el test to use ELF header 2127# r348347 Add missing powerpc64 relocation support to libdwarf 2128.if ${BOOTSTRAPPING} < 1300030 2129_elftoolchain_libs= lib/libelf lib/libdwarf lib/libzstd 2130${_bt}-lib/libelf: ${_bt_m4_depend} 2131${_bt}-lib/libdwarf: ${_bt_m4_depend} 2132.endif 2133 2134# flua is required to regenerate syscall files. It first appeared during the 2135# 13.0-CURRENT cycle, thus needs to be built on -older releases and stable 2136# branches. 2137.if ${BOOTSTRAPPING} < 1300059 2138${_bt}-libexec/flua: ${_bt}-lib/liblua ${_bt}-lib/libucl 2139_flua= lib/liblua lib/libucl libexec/flua 2140.endif 2141 2142# r245440 mtree -N support added 2143# r313404 requires sha384.h for libnetbsd, added to libmd in r292782 2144.if ${BOOTSTRAPPING} < 1100093 2145_nmtree= lib/libmd \ 2146 lib/libnetbsd \ 2147 usr.sbin/nmtree 2148 2149${_bt}-lib/libnetbsd: ${_bt}-lib/libmd 2150${_bt}-usr.sbin/nmtree: ${_bt}-lib/libnetbsd 2151.else 2152_bootstrap_tools_links+=mtree 2153.endif 2154 2155# r246097: log addition login.conf.db, passwd, pwd.db, and spwd.db with cat -l 2156.if ${BOOTSTRAPPING} < 1000027 2157_cat= bin/cat 2158.else 2159_bootstrap_tools_links+=cat 2160.endif 2161 2162# r277259 crunchide: Correct 64-bit section header offset 2163# r281674 crunchide: always include both 32- and 64-bit ELF support 2164.if ${BOOTSTRAPPING} < 1100078 2165_crunchide= usr.sbin/crunch/crunchide 2166.else 2167_bootstrap_tools_links+=crunchide 2168.endif 2169 2170# r285986 crunchen: use STRIPBIN rather than STRIP 2171# 1100113: Support MK_AUTO_OBJ 2172# 1200006: META_MODE fixes 2173.if ${BOOTSTRAPPING} < 1100078 || \ 2174 (${MK_AUTO_OBJ} == "yes" && ${BOOTSTRAPPING} < 1100114) || \ 2175 (${MK_META_MODE} == "yes" && ${BOOTSTRAPPING} < 1200006) 2176_crunchgen= usr.sbin/crunch/crunchgen 2177.else 2178_bootstrap_tools_links+=crunchgen 2179.endif 2180 2181# r296926 -P keymap search path, MFC to stable/10 in r298297 2182.if ${BOOTSTRAPPING} < 1003501 || \ 2183 (${BOOTSTRAPPING} >= 1100000 && ${BOOTSTRAPPING} < 1100103) 2184_kbdcontrol= usr.sbin/kbdcontrol 2185.else 2186_bootstrap_tools_links+=kbdcontrol 2187.endif 2188 2189_yacc= usr.bin/yacc 2190 2191.if ${MK_BSNMP} != "no" 2192_gensnmptree= usr.sbin/bsnmpd/gensnmptree 2193.endif 2194 2195 2196# We need to build tblgen when we're building clang or lld, either as 2197# bootstrap tools, or as the part of the normal build. 2198.if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_CLANG} != "no" || \ 2199 ${MK_LLD_BOOTSTRAP} != "no" || ${MK_LLD} != "no" 2200_clang_tblgen= \ 2201 lib/clang/libllvmminimal \ 2202 usr.bin/clang/llvm-tblgen \ 2203 usr.bin/clang/clang-tblgen \ 2204 usr.bin/clang/lldb-tblgen 2205# XXX: lldb-tblgen is not needed, if top-level MK_LLDB=no 2206 2207${_bt}-usr.bin/clang/clang-tblgen: ${_bt}-lib/clang/libllvmminimal 2208${_bt}-usr.bin/clang/llvm-tblgen: ${_bt}-lib/clang/libllvmminimal 2209${_bt}-usr.bin/clang/lldb-tblgen: ${_bt}-lib/clang/libllvmminimal 2210.endif 2211 2212.if ${MK_LOCALES} != "no" 2213_localedef= usr.bin/localedef 2214.endif 2215 2216.if ${MK_KERBEROS} != "no" 2217_kerberos5_bootstrap_tools= \ 2218 kerberos5/tools/make-roken \ 2219 kerberos5/lib/libroken \ 2220 kerberos5/lib/libvers \ 2221 kerberos5/tools/asn1_compile \ 2222 kerberos5/tools/slc \ 2223 usr.bin/compile_et 2224 2225.ORDER: ${_kerberos5_bootstrap_tools:C/^/${_bt}-/g} 2226.for _tool in ${_kerberos5_bootstrap_tools} 2227${_bt}-${_tool}: ${_bt}-usr.bin/yacc ${_bt_lex_depend} 2228.endfor 2229.endif 2230 2231${_bt}-usr.bin/mandoc: ${_bt}-lib/libopenbsd 2232 2233# The tools listed in _basic_bootstrap_tools will generally not be 2234# bootstrapped unless BOOTSTRAP_ALL_TOOL is set. However, when building on a 2235# Linux or MacOS host the host versions are incompatible so we need to build 2236# them from the source tree. Usually the link name will be the same as the subdir, 2237# but some directories such as grep or test install multiple binaries. In that 2238# case we use the _basic_bootstrap_tools_multilink variable which is a list of 2239# subdirectory and comma-separated list of files. 2240_basic_bootstrap_tools_multilink=usr.bin/grep grep,egrep,fgrep 2241_basic_bootstrap_tools_multilink+=bin/test test,[ 2242# bootstrap tools needed by buildworld: 2243_basic_bootstrap_tools=usr.bin/cut bin/expr usr.bin/gencat \ 2244 usr.bin/join usr.bin/mktemp bin/rmdir usr.bin/sed usr.bin/sort \ 2245 usr.bin/truncate usr.bin/tsort 2246# Some build scripts use nawk instead of awk (this happens at least in 2247# cddl/contrib/opensolaris/lib/libdtrace/common/mknames.sh) so we need both awk 2248# and nawk in ${WORLDTMP}/legacy/bin. 2249_basic_bootstrap_tools_multilink+=usr.bin/awk awk,nawk 2250# file2c is required for building usr.sbin/config: 2251_basic_bootstrap_tools+=usr.bin/file2c 2252# uuencode/uudecode required for share/tabset 2253_basic_bootstrap_tools+=usr.bin/uuencode usr.bin/uudecode 2254# xargs is required by mkioctls 2255_basic_bootstrap_tools+=usr.bin/xargs 2256# cap_mkdb is required for share/termcap: 2257_basic_bootstrap_tools+=usr.bin/cap_mkdb 2258# ldd is required for installcheck (TODO: just always use /usr/bin/ldd instead?) 2259_basic_bootstrap_tools+=usr.bin/ldd 2260# services_mkdb/pwd_mkdb are required for installworld: 2261_basic_bootstrap_tools+=usr.sbin/services_mkdb usr.sbin/pwd_mkdb 2262# sysctl/chflags are required for installkernel: 2263_basic_bootstrap_tools+=sbin/sysctl bin/chflags 2264# mkfifo is used by sys/conf/newvers.sh 2265_basic_bootstrap_tools+=usr.bin/mkfifo 2266 2267.if ${MK_BOOT} != "no" 2268_basic_bootstrap_tools+=bin/dd 2269# xz/unxz is used by EFI 2270_basic_bootstrap_tools_multilink+=usr.bin/xz xz,unxz 2271# md5 is used by boot/beri (and possibly others) 2272_basic_bootstrap_tools+=sbin/md5 2273.if defined(BOOTSTRAP_ALL_TOOLS) 2274${_bt}-sbin/md5: ${_bt}-lib/libmd 2275.endif 2276.endif 2277 2278.if ${MK_ZONEINFO} != "no" 2279_basic_bootstrap_tools+=usr.sbin/zic usr.sbin/tzsetup 2280.endif 2281 2282.if defined(BOOTSTRAP_ALL_TOOLS) 2283_other_bootstrap_tools+=${_basic_bootstrap_tools} 2284.for _subdir _links in ${_basic_bootstrap_tools_multilink} 2285_other_bootstrap_tools+=${_subdir} 2286.endfor 2287${_bt}-usr.bin/awk: ${_bt_lex_depend} ${_bt}-usr.bin/yacc 2288${_bt}-bin/expr: ${_bt_lex_depend} ${_bt}-usr.bin/yacc 2289# If we are bootstrapping file2c, we have to build it before config: 2290${_bt}-usr.sbin/config: ${_bt}-usr.bin/file2c ${_bt_lex_depend} 2291# Note: no symlink to make/bmake in the !BOOTSTRAP_ALL_TOOLS case here since 2292# the links to make/bmake make links will have already have been created in the 2293# `make legacy` step. Not adding a link to make is important on non-FreeBSD 2294# since "make" will usually point to GNU make there. 2295_other_bootstrap_tools+=usr.bin/bmake 2296.else 2297# All tools in _basic_bootstrap_tools have the same name as the subdirectory 2298# so we can use :T to get the name of the symlinks that we need to create. 2299_bootstrap_tools_links+=${_basic_bootstrap_tools:T} 2300.for _subdir _links in ${_basic_bootstrap_tools_multilink} 2301_bootstrap_tools_links+=${_links:S/,/ /g} 2302.endfor 2303.endif # defined(BOOTSTRAP_ALL_TOOLS) 2304 2305# Link the tools that we need for building but don't need to bootstrap because 2306# the host version is known to be compatible into ${WORLDTMP}/legacy 2307# We do this before building any of the bootstrap tools in case they depend on 2308# the presence of any of the links (e.g. as m4/lex/awk) 2309${_bt}-links: .PHONY 2310 2311.for _tool in ${_bootstrap_tools_links} 2312${_bt}-link-${_tool}: .PHONY .MAKE 2313 @rm -f "${WORLDTMP}/legacy/bin/${_tool}"; \ 2314 source_path=`which ${_tool}`; \ 2315 if [ ! -e "$${source_path}" ] ; then \ 2316 echo "Cannot find host tool '${_tool}'"; false; \ 2317 fi; \ 2318 cp -f "$${source_path}" "${WORLDTMP}/legacy/bin/${_tool}" 2319${_bt}-links: ${_bt}-link-${_tool} 2320.endfor 2321 2322bootstrap-tools: ${_bt}-links .PHONY 2323 2324# Please document (add comment) why something is in 'bootstrap-tools'. 2325# Try to bound the building of the bootstrap-tool to just the 2326# FreeBSD versions that need the tool built at this stage of the build. 2327.for _tool in \ 2328 ${_clang_tblgen} \ 2329 ${_kerberos5_bootstrap_tools} \ 2330 ${_strfile} \ 2331 usr.bin/dtc \ 2332 ${_cat} \ 2333 ${_kbdcontrol} \ 2334 ${_elftoolchain_libs} \ 2335 usr.bin/lorder \ 2336 lib/libopenbsd \ 2337 usr.bin/mandoc \ 2338 usr.bin/rpcgen \ 2339 ${_yacc} \ 2340 ${_m4} \ 2341 ${_lex} \ 2342 ${_other_bootstrap_tools} \ 2343 usr.bin/xinstall \ 2344 ${_gensnmptree} \ 2345 usr.sbin/config \ 2346 ${_flua} \ 2347 ${_crunchide} \ 2348 ${_crunchgen} \ 2349 ${_nmtree} \ 2350 ${_vtfontcvt} \ 2351 ${_localedef} 2352${_bt}-${_tool}: ${_bt}-links .PHONY .MAKE 2353 ${_+_}@${ECHODIR} "===> ${_tool} (obj,all,install)"; \ 2354 cd ${.CURDIR}/${_tool}; \ 2355 if [ -z "${NO_OBJWALK}" ]; then ${MAKE} DIRPRFX=${_tool}/ obj; fi; \ 2356 if [ "${_tool}" = "usr.bin/lex" ]; then \ 2357 ${MAKE} DIRPRFX=${_tool}/ bootstrap; \ 2358 fi; \ 2359 ${MAKE} DIRPRFX=${_tool}/ all; \ 2360 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${WORLDTMP}/legacy install 2361 2362bootstrap-tools: ${_bt}-${_tool} 2363.endfor 2364 2365# 2366# build-tools: Build special purpose build tools 2367# 2368.if !defined(NO_SHARE) && ${MK_SYSCONS} != "no" 2369_share= share/syscons/scrnmaps 2370.endif 2371 2372.if ${MK_RESCUE} != "no" 2373# rescue includes programs that have build-tools targets 2374_rescue=rescue/rescue 2375.endif 2376 2377.if ${MK_TCSH} != "no" 2378_tcsh=bin/csh 2379.endif 2380.if ${MK_FILE} != "no" 2381_libmagic=lib/libmagic 2382.endif 2383 2384.if ${MK_PMC} != "no" && \ 2385 (${TARGET_ARCH} == "aarch64" || ${TARGET_ARCH} == "amd64" || \ 2386 ${TARGET_ARCH} == "i386") 2387_jevents=lib/libpmc/pmu-events 2388.endif 2389 2390# kernel-toolchain skips _cleanobj, so handle cleaning up previous 2391# build-tools directories if needed. 2392.if !defined(NO_CLEAN) && make(kernel-toolchain) 2393_bt_clean= ${CLEANDIR} 2394.endif 2395 2396.for _tool in \ 2397 ${_tcsh} \ 2398 bin/sh \ 2399 ${LOCAL_TOOL_DIRS} \ 2400 ${_jevents} \ 2401 lib/ncurses/ncurses \ 2402 lib/ncurses/ncursesw \ 2403 ${_rescue} \ 2404 ${_share} \ 2405 usr.bin/awk \ 2406 ${_libmagic} \ 2407 usr.bin/mkesdb_static \ 2408 usr.bin/mkcsmapper_static \ 2409 usr.bin/vi/catalog 2410build-tools_${_tool}: .PHONY 2411 ${_+_}@${ECHODIR} "===> ${_tool} (${_bt_clean:D${_bt_clean},}obj,build-tools)"; \ 2412 cd ${.CURDIR}/${_tool}; \ 2413 if [ -n "${_bt_clean}" ]; then ${MAKE} DIRPRFX=${_tool}/ ${_bt_clean}; fi; \ 2414 if [ -z "${NO_OBJWALK}" ]; then ${MAKE} DIRPRFX=${_tool}/ obj; fi; \ 2415 ${MAKE} DIRPRFX=${_tool}/ build-tools 2416build-tools: build-tools_${_tool} 2417.endfor 2418 2419# 2420# kernel-tools: Build kernel-building tools 2421# 2422kernel-tools: .PHONY 2423 mkdir -p ${WORLDTMP}/usr 2424 ${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 2425 -p ${WORLDTMP}/usr >/dev/null 2426 2427# 2428# cross-tools: All the tools needed to build the rest of the system after 2429# we get done with the earlier stages. It is the last set of tools needed 2430# to begin building the target binaries. 2431# 2432.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${BUILD_WITH_STRICT_TMPPATH} != 0 2433.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386" 2434_btxld= usr.sbin/btxld 2435.endif 2436.endif 2437 2438# Rebuild ctfconvert and ctfmerge to avoid difficult-to-diagnose failures 2439# resulting from missing bug fixes or ELF Toolchain updates. 2440.if ${MK_CDDL} != "no" 2441_dtrace_tools= cddl/lib/libctf cddl/usr.bin/ctfconvert \ 2442 cddl/usr.bin/ctfmerge 2443.endif 2444 2445# If we're given an XAS, don't build binutils. 2446.if ${XAS:M/*} == "" 2447.if ${MK_ELFTOOLCHAIN_BOOTSTRAP} != "no" 2448_elftctools= lib/libelftc \ 2449 lib/libpe \ 2450 usr.bin/objcopy \ 2451 usr.bin/nm \ 2452 usr.bin/size \ 2453 usr.bin/strings 2454# These are not required by the build, but can be useful for developers who 2455# cross-build on a FreeBSD 10 host: 2456_elftctools+= usr.bin/addr2line 2457.endif 2458.elif ${TARGET_ARCH} != ${MACHINE_ARCH} && ${MK_ELFTOOLCHAIN_BOOTSTRAP} != "no" 2459# If cross-building with an external binutils we still need to build strip for 2460# the target (for at least crunchide). 2461_elftctools= lib/libelftc \ 2462 lib/libpe \ 2463 usr.bin/objcopy 2464.endif 2465 2466.if ${MK_CLANG_BOOTSTRAP} != "no" 2467_clang= usr.bin/clang 2468.endif 2469.if ${MK_LLD_BOOTSTRAP} != "no" 2470_lld= usr.bin/clang/lld 2471.endif 2472.if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_LLD_BOOTSTRAP} != "no" 2473_clang_libs= lib/clang 2474.endif 2475.if ${MK_USB} != "no" 2476_usb_tools= stand/usb/tools 2477.endif 2478 2479.if ${BUILD_WITH_STRICT_TMPPATH} != 0 || defined(BOOTSTRAP_ALL_TOOLS) 2480_ar=usr.bin/ar 2481.endif 2482 2483cross-tools: .MAKE .PHONY 2484.for _tool in \ 2485 ${LOCAL_XTOOL_DIRS} \ 2486 ${_ar} \ 2487 ${_clang_libs} \ 2488 ${_clang} \ 2489 ${_lld} \ 2490 ${_elftctools} \ 2491 ${_dtrace_tools} \ 2492 ${_btxld} \ 2493 ${_usb_tools} 2494 ${_+_}@${ECHODIR} "===> ${_tool} (obj,all,install)"; \ 2495 cd ${.CURDIR}/${_tool}; \ 2496 if [ -z "${NO_OBJWALK}" ]; then ${MAKE} DIRPRFX=${_tool}/ obj; fi; \ 2497 ${MAKE} DIRPRFX=${_tool}/ all; \ 2498 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${WORLDTMP} install 2499.endfor 2500 2501# 2502# native-xtools is the current target for qemu-user cross builds of ports 2503# via poudriere and the imgact_binmisc kernel module. 2504# This target merely builds a toolchan/sysroot, then builds the tools it wants 2505# with the options it wants in a special MAKEOBJDIRPREFIX, using the toolchain 2506# already built. It then installs the static tools to NXBDESTDIR for Poudriere 2507# to pickup. 2508# 2509NXBOBJROOT= ${OBJROOT}${MACHINE}.${MACHINE_ARCH}/nxb/ 2510NXBOBJTOP= ${NXBOBJROOT}${NXB_TARGET}.${NXB_TARGET_ARCH} 2511NXTP?= /nxb-bin 2512.if ${NXTP:N/*} 2513.error NXTP variable should be an absolute path 2514.endif 2515NXBDESTDIR?= ${DESTDIR}${NXTP} 2516 2517# This is the list of tools to be built/installed as static and where 2518# appropriate to build for the given TARGET.TARGET_ARCH. 2519NXBDIRS+= \ 2520 bin/cat \ 2521 bin/chmod \ 2522 bin/cp \ 2523 ${_tcsh} \ 2524 bin/echo \ 2525 bin/expr \ 2526 bin/hostname \ 2527 bin/ln \ 2528 bin/ls \ 2529 bin/mkdir \ 2530 bin/mv \ 2531 bin/ps \ 2532 bin/realpath \ 2533 bin/rm \ 2534 bin/rmdir \ 2535 bin/sh \ 2536 bin/sleep \ 2537 sbin/md5 \ 2538 sbin/sysctl \ 2539 usr.bin/addr2line \ 2540 usr.bin/ar \ 2541 usr.bin/awk \ 2542 usr.bin/basename \ 2543 usr.bin/bmake \ 2544 usr.bin/bzip2 \ 2545 usr.bin/cmp \ 2546 usr.bin/diff \ 2547 usr.bin/dirname \ 2548 usr.bin/objcopy \ 2549 usr.bin/env \ 2550 usr.bin/fetch \ 2551 usr.bin/find \ 2552 usr.bin/grep \ 2553 usr.bin/gzip \ 2554 usr.bin/head \ 2555 usr.bin/id \ 2556 usr.bin/lex \ 2557 usr.bin/limits \ 2558 usr.bin/lorder \ 2559 usr.bin/mandoc \ 2560 usr.bin/mktemp \ 2561 usr.bin/mt \ 2562 usr.bin/nm \ 2563 usr.bin/patch \ 2564 usr.bin/readelf \ 2565 usr.bin/sed \ 2566 usr.bin/size \ 2567 usr.bin/sort \ 2568 usr.bin/strings \ 2569 usr.bin/tar \ 2570 usr.bin/touch \ 2571 usr.bin/tr \ 2572 usr.bin/true \ 2573 usr.bin/uniq \ 2574 usr.bin/unzip \ 2575 usr.bin/wc \ 2576 usr.bin/xargs \ 2577 usr.bin/xinstall \ 2578 usr.bin/xz \ 2579 usr.bin/yacc \ 2580 usr.sbin/chown 2581 2582SUBDIR_DEPEND_usr.bin/clang= lib/clang 2583.if ${MK_CLANG} != "no" 2584NXBDIRS+= lib/clang 2585NXBDIRS+= usr.bin/clang 2586.endif 2587# XXX: native-xtools passes along ${NXBDIRS} in SUBDIR_OVERRIDE that needs 2588# to be evaluated after NXBDIRS is set. 2589.if make(install) && !empty(SUBDIR_OVERRIDE) 2590SUBDIR= ${SUBDIR_OVERRIDE} 2591.endif 2592 2593NXBMAKEARGS+= \ 2594 OBJTOP=${NXBOBJTOP:Q} \ 2595 OBJROOT=${NXBOBJROOT:Q} \ 2596 MAKEOBJDIRPREFIX= \ 2597 -DNO_SHARED \ 2598 -DNO_CPU_CFLAGS \ 2599 -DNO_PIC \ 2600 SSP_CFLAGS= \ 2601 MK_CASPER=no \ 2602 MK_CLANG_EXTRAS=no \ 2603 MK_CLANG_FORMAT=no \ 2604 MK_CLANG_FULL=no \ 2605 MK_CTF=no \ 2606 MK_DEBUG_FILES=no \ 2607 MK_GDB=no \ 2608 MK_HTML=no \ 2609 MK_LLDB=no \ 2610 MK_MAN=no \ 2611 MK_MAN_UTILS=yes \ 2612 MK_OFED=no \ 2613 MK_OPENSSH=no \ 2614 MK_PROFILE=no \ 2615 MK_RETPOLINE=no \ 2616 MK_SENDMAIL=no \ 2617 MK_SVNLITE=no \ 2618 MK_TESTS=no \ 2619 MK_WARNS=no \ 2620 MK_ZFS=no 2621 2622.if make(native-xtools*) && \ 2623 (!defined(NXB_TARGET) || !defined(NXB_TARGET_ARCH)) 2624.error Missing NXB_TARGET / NXB_TARGET_ARCH 2625.endif 2626# For 'toolchain' we want to produce native binaries that themselves generate 2627# native binaries. 2628NXBTMAKE= ${NXBMAKEENV} ${MAKE} ${NXBMAKEARGS:N-DNO_PIC:N-DNO_SHARED} \ 2629 TARGET=${MACHINE} TARGET_ARCH=${MACHINE_ARCH} 2630# For 'everything' we want to produce native binaries (hence -target to 2631# be MACHINE) that themselves generate TARGET.TARGET_ARCH binaries. 2632# TARGET/TARGET_ARCH are still passed along from user. 2633# 2634# Use the toolchain we create as an external toolchain. 2635.if ${USING_SYSTEM_COMPILER} == "yes" || ${XCC:N${CCACHE_BIN}:M/*} 2636NXBMAKE+= XCC="${XCC}" \ 2637 XCXX="${XCXX}" \ 2638 XCPP="${XCPP}" 2639.else 2640NXBMAKE+= XCC="${NXBOBJTOP}/tmp/usr/bin/cc" \ 2641 XCXX="${NXBOBJTOP}/tmp/usr/bin/c++" \ 2642 XCPP="${NXBOBJTOP}/tmp/usr/bin/cpp" 2643.endif 2644NXBMAKE+= ${NXBMAKEENV} ${MAKE} -f Makefile.inc1 ${NXBMAKEARGS} \ 2645 MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH} \ 2646 TARGET=${NXB_TARGET} TARGET_ARCH=${NXB_TARGET_ARCH} \ 2647 TARGET_TRIPLE=${MACHINE_TRIPLE:Q} 2648# NXBDIRS is improperly based on MACHINE rather than NXB_TARGET. Need to 2649# invoke a sub-make to reevaluate MK_CLANG, etc, for NXBDIRS. 2650NXBMAKE+= SUBDIR_OVERRIDE='$${NXBDIRS:M*}' 2651# Need to avoid the -isystem logic when using clang as an external toolchain 2652# even if the TARGET being built for wants GCC. 2653NXBMAKE+= WANT_COMPILER_TYPE='$${X_COMPILER_TYPE}' 2654native-xtools: .PHONY 2655 ${_+_}cd ${.CURDIR}; ${NXBTMAKE} _cleanobj 2656 # Build the bootstrap/host/cross tools that produce native binaries 2657 ${_+_}cd ${.CURDIR}; ${NXBTMAKE} kernel-toolchain 2658 # Populate includes/libraries sysroot that produce native binaries. 2659 # This is split out from 'toolchain' above mostly so that target LLVM 2660 # libraries have a proper LLVM_DEFAULT_TARGET_TRIPLE without 2661 # polluting the cross-compiler build. The LLVM/GCC libs are skipped 2662 # here to avoid the problem but are kept in 'toolchain' so that 2663 # needed build tools are built. 2664 ${_+_}cd ${.CURDIR}; ${NXBTMAKE} _includes MK_CLANG=no 2665 ${_+_}cd ${.CURDIR}; ${NXBTMAKE} _libraries MK_CLANG=no 2666.if !defined(NO_OBJWALK) 2667 ${_+_}cd ${.CURDIR}; ${NXBMAKE} _obj 2668.endif 2669 ${_+_}cd ${.CURDIR}; ${NXBMAKE} everything 2670 @echo ">> native-xtools done. Use 'make native-xtools-install' to install to a given DESTDIR" 2671 2672native-xtools-install: .PHONY 2673 mkdir -p ${NXBDESTDIR}/bin ${NXBDESTDIR}/sbin ${NXBDESTDIR}/usr 2674 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 2675 -p ${NXBDESTDIR}/usr >/dev/null 2676 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 2677 -p ${NXBDESTDIR}/usr/include >/dev/null 2678 ${_+_}cd ${.CURDIR}; ${NXBMAKE} \ 2679 DESTDIR=${NXBDESTDIR} \ 2680 -DNO_ROOT \ 2681 install 2682 2683# 2684# hierarchy - ensure that all the needed directories are present 2685# 2686hierarchy hier: .MAKE .PHONY 2687 ${_+_}cd ${.CURDIR}/etc; ${HMAKE} distrib-dirs 2688 2689# 2690# libraries - build all libraries, and install them under ${DESTDIR}. 2691# 2692# The list of libraries with dependents (${_prebuild_libs}) and their 2693# interdependencies (__L) are built automatically by the 2694# ${.CURDIR}/tools/make_libdeps.sh script. 2695# 2696libraries: .MAKE .PHONY 2697 ${_+_}cd ${.CURDIR}; \ 2698 ${MAKE} -f Makefile.inc1 _prereq_libs; \ 2699 ${MAKE} -f Makefile.inc1 _startup_libs; \ 2700 ${MAKE} -f Makefile.inc1 _prebuild_libs; \ 2701 ${MAKE} -f Makefile.inc1 _generic_libs 2702 2703# 2704# static libgcc.a prerequisite for shared libc 2705# 2706_prereq_libs= lib/libcompiler_rt 2707.if ${MK_SSP} != "no" 2708_prereq_libs+= lib/libssp_nonshared 2709.endif 2710 2711# These dependencies are not automatically generated: 2712# 2713# lib/csu and lib/libc must be built before 2714# all shared libraries for ELF. 2715# 2716_startup_libs= lib/csu 2717_startup_libs+= lib/libc 2718_startup_libs+= lib/libc_nonshared 2719.if ${MK_LIBCPLUSPLUS} != "no" 2720_startup_libs+= lib/libcxxrt 2721.endif 2722 2723_prereq_libs+= lib/libgcc_eh lib/libgcc_s 2724_startup_libs+= lib/libgcc_eh lib/libgcc_s 2725 2726lib/libgcc_s__L: lib/libc__L 2727lib/libgcc_s__L: lib/libc_nonshared__L 2728.if ${MK_LIBCPLUSPLUS} != "no" 2729lib/libcxxrt__L: lib/libgcc_s__L 2730.endif 2731 2732_prebuild_libs= ${_kerberos5_lib_libasn1} \ 2733 ${_kerberos5_lib_libhdb} \ 2734 ${_kerberos5_lib_libheimbase} \ 2735 ${_kerberos5_lib_libheimntlm} \ 2736 ${_libsqlite3} \ 2737 ${_kerberos5_lib_libheimipcc} \ 2738 ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \ 2739 ${_kerberos5_lib_libroken} \ 2740 ${_kerberos5_lib_libwind} \ 2741 lib/libbz2 ${_libcom_err} lib/libcrypt \ 2742 lib/libelf lib/libexpat \ 2743 lib/libfigpar \ 2744 ${_lib_libgssapi} \ 2745 lib/libkiconv lib/libkvm lib/liblzma lib/libmd lib/libnv \ 2746 lib/libzstd \ 2747 ${_lib_casper} \ 2748 lib/ncurses/ncurses lib/ncurses/ncursesw \ 2749 lib/libopie lib/libpam/libpam ${_lib_libthr} \ 2750 ${_lib_libradius} lib/libsbuf lib/libtacplus \ 2751 lib/libgeom \ 2752 ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \ 2753 ${_cddl_lib_libuutil} \ 2754 ${_cddl_lib_libavl} \ 2755 ${_cddl_lib_libzfs_core} ${_cddl_lib_libzfs} \ 2756 ${_cddl_lib_libctf} \ 2757 lib/libufs \ 2758 lib/libutil lib/libpjdlog ${_lib_libypclnt} lib/libz lib/msun \ 2759 ${_secure_lib_libcrypto} ${_secure_lib_libssl} \ 2760 ${_lib_libldns} ${_secure_lib_libssh} 2761 2762.if ${MK_DIALOG} != "no" 2763_prebuild_libs+= gnu/lib/libdialog 2764gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncursesw__L 2765.endif 2766 2767.if ${MK_GOOGLETEST} != "no" 2768_prebuild_libs+= lib/libregex 2769.endif 2770 2771.if ${MK_LIBCPLUSPLUS} != "no" 2772_prebuild_libs+= lib/libc++ 2773.endif 2774 2775lib/libgeom__L: lib/libexpat__L lib/libsbuf__L 2776lib/libkvm__L: lib/libelf__L 2777 2778.if ${MK_LIBTHR} != "no" 2779_lib_libthr= lib/libthr 2780.endif 2781 2782.if ${MK_RADIUS_SUPPORT} != "no" 2783_lib_libradius= lib/libradius 2784.endif 2785 2786.if ${MK_OFED} != "no" 2787_prebuild_libs+= \ 2788 lib/ofed/libibverbs \ 2789 lib/ofed/libibmad \ 2790 lib/ofed/libibumad \ 2791 lib/ofed/complib \ 2792 lib/ofed/libmlx5 2793 2794lib/ofed/libibmad__L: lib/ofed/libibumad__L 2795lib/ofed/complib__L: lib/libthr__L 2796lib/ofed/libmlx5__L: lib/ofed/libibverbs__L lib/libthr__L 2797.endif 2798 2799.if ${MK_CASPER} != "no" 2800_lib_casper= lib/libcasper 2801.endif 2802 2803lib/libpjdlog__L: lib/libutil__L 2804lib/libcasper__L: lib/libnv__L 2805lib/liblzma__L: lib/libmd__L lib/libthr__L 2806lib/libzstd__L: lib/libthr__L 2807 2808_generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} 2809.if ${MK_IPFILTER} != "no" 2810_generic_libs+= sbin/ipf/libipf 2811.endif 2812.for _DIR in ${LOCAL_LIB_DIRS} 2813.if ${_DIR} == ".WAIT" || (empty(_generic_libs:M${_DIR}) && exists(${.CURDIR}/${_DIR}/Makefile)) 2814_generic_libs+= ${_DIR} 2815.endif 2816.endfor 2817 2818lib/libopie__L lib/libtacplus__L: lib/libmd__L 2819 2820.if ${MK_CDDL} != "no" 2821_cddl_lib_libumem= cddl/lib/libumem 2822_cddl_lib_libnvpair= cddl/lib/libnvpair 2823_cddl_lib_libavl= cddl/lib/libavl 2824_cddl_lib_libuutil= cddl/lib/libuutil 2825.if ${MK_ZFS} != "no" 2826_cddl_lib_libzfs_core= cddl/lib/libzfs_core 2827_cddl_lib_libzfs= cddl/lib/libzfs 2828 2829cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L 2830 2831cddl/lib/libzfs__L: cddl/lib/libzfs_core__L lib/msun__L lib/libutil__L 2832cddl/lib/libzfs__L: lib/libthr__L lib/libmd__L lib/libz__L cddl/lib/libumem__L 2833cddl/lib/libzfs__L: cddl/lib/libuutil__L cddl/lib/libavl__L lib/libgeom__L 2834 2835lib/libbe__L: cddl/lib/libzfs__L 2836.endif 2837_cddl_lib_libctf= cddl/lib/libctf 2838_cddl_lib= cddl/lib 2839cddl/lib/libctf__L: lib/libz__L 2840.endif 2841# cddl/lib/libdtrace requires lib/libproc and lib/librtld_db 2842_prebuild_libs+= lib/libprocstat lib/libproc lib/librtld_db 2843lib/libprocstat__L: lib/libelf__L lib/libkvm__L lib/libutil__L 2844lib/libproc__L: lib/libprocstat__L 2845lib/librtld_db__L: lib/libprocstat__L 2846 2847.if ${MK_CRYPT} != "no" 2848.if ${MK_OPENSSL} != "no" 2849_secure_lib_libcrypto= secure/lib/libcrypto 2850_secure_lib_libssl= secure/lib/libssl 2851lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L 2852secure/lib/libcrypto__L: lib/libthr__L 2853.if ${MK_LDNS} != "no" 2854_lib_libldns= lib/libldns 2855lib/libldns__L: secure/lib/libssl__L 2856.endif 2857.if ${MK_OPENSSH} != "no" 2858_secure_lib_libssh= secure/lib/libssh 2859secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L 2860.if ${MK_LDNS} != "no" 2861secure/lib/libssh__L: lib/libldns__L 2862.endif 2863.if ${MK_GSSAPI} != "no" && ${MK_KERBEROS_SUPPORT} != "no" 2864secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \ 2865 kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \ 2866 lib/libmd__L kerberos5/lib/libroken__L 2867.endif 2868.endif 2869.endif 2870_secure_lib= secure/lib 2871.endif 2872 2873.if ${MK_KERBEROS} != "no" 2874kerberos5/lib/libasn1__L: lib/libcom_err__L kerberos5/lib/libroken__L 2875kerberos5/lib/libhdb__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ 2876 kerberos5/lib/libkrb5__L kerberos5/lib/libroken__L \ 2877 kerberos5/lib/libwind__L lib/libsqlite3__L 2878kerberos5/lib/libheimntlm__L: secure/lib/libcrypto__L kerberos5/lib/libkrb5__L \ 2879 kerberos5/lib/libroken__L lib/libcom_err__L 2880kerberos5/lib/libhx509__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ 2881 secure/lib/libcrypto__L kerberos5/lib/libroken__L kerberos5/lib/libwind__L 2882kerberos5/lib/libkrb5__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ 2883 lib/libcrypt__L secure/lib/libcrypto__L kerberos5/lib/libhx509__L \ 2884 kerberos5/lib/libroken__L kerberos5/lib/libwind__L \ 2885 kerberos5/lib/libheimbase__L kerberos5/lib/libheimipcc__L 2886kerberos5/lib/libroken__L: lib/libcrypt__L 2887kerberos5/lib/libwind__L: kerberos5/lib/libroken__L lib/libcom_err__L 2888kerberos5/lib/libheimbase__L: lib/libthr__L 2889kerberos5/lib/libheimipcc__L: kerberos5/lib/libroken__L kerberos5/lib/libheimbase__L lib/libthr__L 2890.endif 2891 2892lib/libsqlite3__L: lib/libthr__L 2893 2894.if ${MK_GSSAPI} != "no" 2895_lib_libgssapi= lib/libgssapi 2896.endif 2897 2898.if ${MK_KERBEROS} != "no" 2899_kerberos5_lib= kerberos5/lib 2900_kerberos5_lib_libasn1= kerberos5/lib/libasn1 2901_kerberos5_lib_libhdb= kerberos5/lib/libhdb 2902_kerberos5_lib_libheimbase= kerberos5/lib/libheimbase 2903_kerberos5_lib_libkrb5= kerberos5/lib/libkrb5 2904_kerberos5_lib_libhx509= kerberos5/lib/libhx509 2905_kerberos5_lib_libroken= kerberos5/lib/libroken 2906_kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm 2907_libsqlite3= lib/libsqlite3 2908_kerberos5_lib_libheimipcc= kerberos5/lib/libheimipcc 2909_kerberos5_lib_libwind= kerberos5/lib/libwind 2910_libcom_err= lib/libcom_err 2911.endif 2912 2913.if ${MK_NIS} != "no" 2914_lib_libypclnt= lib/libypclnt 2915.endif 2916 2917.if ${MK_OPENSSL} == "no" 2918lib/libradius__L: lib/libmd__L 2919.endif 2920 2921lib/libproc__L: \ 2922 ${_cddl_lib_libctf:D${_cddl_lib_libctf}__L} lib/libelf__L lib/librtld_db__L lib/libutil__L 2923.if ${MK_CXX} != "no" && ${MK_LIBCPLUSPLUS} != "no" 2924lib/libproc__L: lib/libcxxrt__L 2925.endif 2926 2927.for _lib in ${_prereq_libs} 2928${_lib}__PL: .PHONY .MAKE 2929.if !defined(_MKSHOWCONFIG) && exists(${.CURDIR}/${_lib}) 2930 ${_+_}@${ECHODIR} "===> ${_lib} (obj,all,install)"; \ 2931 cd ${.CURDIR}/${_lib}; \ 2932 if [ -z "${NO_OBJWALK}" ]; then ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj; fi; \ 2933 ${MAKE} MK_TESTS=no MK_PROFILE=no -DNO_PIC \ 2934 DIRPRFX=${_lib}/ all; \ 2935 ${MAKE} MK_TESTS=no MK_PROFILE=no -DNO_PIC \ 2936 DIRPRFX=${_lib}/ install 2937.endif 2938.endfor 2939 2940.for _lib in ${_startup_libs} ${_prebuild_libs} ${_generic_libs} 2941${_lib}__L: .PHONY .MAKE 2942.if !defined(_MKSHOWCONFIG) && exists(${.CURDIR}/${_lib}) 2943 ${_+_}@${ECHODIR} "===> ${_lib} (obj,all,install)"; \ 2944 cd ${.CURDIR}/${_lib}; \ 2945 if [ -z "${NO_OBJWALK}" ]; then ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj; fi; \ 2946 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ all; \ 2947 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ install 2948.endif 2949.endfor 2950 2951_prereq_libs: ${_prereq_libs:S/$/__PL/} 2952_startup_libs: ${_startup_libs:S/$/__L/} 2953_prebuild_libs: ${_prebuild_libs:S/$/__L/} 2954_generic_libs: ${_generic_libs:S/$/__L/} 2955 2956# Enable SUBDIR_PARALLEL when not calling 'make all', unless called from 2957# 'everything' with _PARALLEL_SUBDIR_OK set. This is because it is unlikely 2958# that running 'make all' from the top-level, especially with a SUBDIR_OVERRIDE 2959# or LOCAL_DIRS set, will have a reliable build if SUBDIRs are built in 2960# parallel. This is safe for the world stage of buildworld though since it has 2961# already built libraries in a proper order and installed includes into 2962# WORLDTMP. Special handling is done for SUBDIR ordering for 'install*' to 2963# avoid trashing a system if it crashes mid-install. 2964.if !make(all) || defined(_PARALLEL_SUBDIR_OK) 2965SUBDIR_PARALLEL= 2966.endif 2967 2968.include <bsd.subdir.mk> 2969 2970.if make(check-old) || make(check-old-dirs) || \ 2971 make(check-old-files) || make(check-old-libs) || \ 2972 make(delete-old) || make(delete-old-dirs) || \ 2973 make(delete-old-files) || make(delete-old-libs) 2974 2975# 2976# check for / delete old files section 2977# 2978 2979.include "ObsoleteFiles.inc" 2980 2981OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \ 2982else you can not start such an application. Consult UPDATING for more \ 2983information regarding how to cope with the removal/revision bump of a \ 2984specific library." 2985 2986.if !defined(BATCH_DELETE_OLD_FILES) 2987RM_I=-i 2988.else 2989RM_I=-v 2990.endif 2991 2992delete-old-files: .PHONY 2993 @echo ">>> Removing old files (only deletes safe to delete libs)" 2994# Ask for every old file if the user really wants to remove it. 2995# It's annoying, but better safe than sorry. 2996# NB: We cannot pass the list of OLD_FILES as a parameter because the 2997# argument list will get too long. Using .for/.endfor make "loops" will make 2998# the Makefile parser segfault. 2999 @exec 3<&0; \ 3000 cd ${.CURDIR}; \ 3001 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 3002 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | sort | \ 3003 while read file; do \ 3004 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 3005 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \ 3006 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \ 3007 fi; \ 3008 for ext in debug symbols; do \ 3009 if ! [ -e "${DESTDIR}/$${file}" ] && [ -f \ 3010 "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \ 3011 rm ${RM_I} "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" \ 3012 <&3; \ 3013 fi; \ 3014 done; \ 3015 done 3016# Remove catpages without corresponding manpages. 3017 @exec 3<&0; \ 3018 find ${DESTDIR}/usr/share/man/cat* ! -type d 2>/dev/null | sort | \ 3019 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \ 3020 while read catpage; do \ 3021 read manpage; \ 3022 if [ ! -e "$${manpage}" ]; then \ 3023 rm ${RM_I} $${catpage} <&3; \ 3024 fi; \ 3025 done 3026 @echo ">>> Old files removed" 3027 3028check-old-files: .PHONY 3029 @echo ">>> Checking for old files" 3030 @cd ${.CURDIR}; \ 3031 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 3032 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \ 3033 while read file; do \ 3034 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 3035 echo "${DESTDIR}/$${file}"; \ 3036 fi; \ 3037 for ext in debug symbols; do \ 3038 if [ -f "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \ 3039 echo "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}"; \ 3040 fi; \ 3041 done; \ 3042 done | sort 3043# Check for catpages without corresponding manpages. 3044 @find ${DESTDIR}/usr/share/man/cat* ! -type d 2>/dev/null | \ 3045 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \ 3046 while read catpage; do \ 3047 read manpage; \ 3048 if [ ! -e "$${manpage}" ]; then \ 3049 echo $${catpage}; \ 3050 fi; \ 3051 done | sort 3052 3053delete-old-libs: .PHONY 3054 @echo ">>> Removing old libraries" 3055 @echo "${OLD_LIBS_MESSAGE}" | fmt 3056 @exec 3<&0; \ 3057 cd ${.CURDIR}; \ 3058 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 3059 -V OLD_LIBS | xargs -n1 | sort | \ 3060 while read file; do \ 3061 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 3062 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \ 3063 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \ 3064 fi; \ 3065 for ext in debug symbols; do \ 3066 if ! [ -e "${DESTDIR}/$${file}" ] && [ -f \ 3067 "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \ 3068 rm ${RM_I} "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" \ 3069 <&3; \ 3070 fi; \ 3071 done; \ 3072 done 3073 @echo ">>> Old libraries removed" 3074 3075check-old-libs: .PHONY 3076 @echo ">>> Checking for old libraries" 3077 @cd ${.CURDIR}; \ 3078 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 3079 -V OLD_LIBS | xargs -n1 | \ 3080 while read file; do \ 3081 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 3082 echo "${DESTDIR}/$${file}"; \ 3083 fi; \ 3084 for ext in debug symbols; do \ 3085 if [ -f "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \ 3086 echo "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}"; \ 3087 fi; \ 3088 done; \ 3089 done | sort 3090 3091delete-old-dirs: .PHONY 3092 @echo ">>> Removing old directories" 3093 @cd ${.CURDIR}; \ 3094 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 3095 -V OLD_DIRS | xargs -n1 | sort -r | \ 3096 while read dir; do \ 3097 if [ -d "${DESTDIR}/$${dir}" ]; then \ 3098 rmdir -v "${DESTDIR}/$${dir}" || true; \ 3099 elif [ -L "${DESTDIR}/$${dir}" ]; then \ 3100 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \ 3101 fi; \ 3102 if [ -d "${DESTDIR}${DEBUGDIR}/$${dir}" ]; then \ 3103 rmdir -v "${DESTDIR}${DEBUGDIR}/$${dir}" || true; \ 3104 elif [ -L "${DESTDIR}${DEBUGDIR}/$${dir}" ]; then \ 3105 echo "${DESTDIR}${DEBUGDIR}/$${dir} is a link, please remove everything manually."; \ 3106 fi; \ 3107 done 3108 @echo ">>> Old directories removed" 3109 3110check-old-dirs: .PHONY 3111 @echo ">>> Checking for old directories" 3112 @cd ${.CURDIR}; \ 3113 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 3114 -V OLD_DIRS | xargs -n1 | sort -r | \ 3115 while read dir; do \ 3116 if [ -d "${DESTDIR}/$${dir}" ]; then \ 3117 echo "${DESTDIR}/$${dir}"; \ 3118 elif [ -L "${DESTDIR}/$${dir}" ]; then \ 3119 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \ 3120 fi; \ 3121 if [ -d "${DESTDIR}${DEBUGDIR}/$${dir}" ]; then \ 3122 echo "${DESTDIR}${DEBUGDIR}/$${dir}"; \ 3123 elif [ -L "${DESTDIR}${DEBUGDIR}/$${dir}" ]; then \ 3124 echo "${DESTDIR}${DEBUGDIR}/$${dir} is a link, please remove everything manually."; \ 3125 fi; \ 3126 done 3127 3128delete-old: delete-old-files delete-old-dirs .PHONY 3129 @echo "To remove old libraries run '${MAKE_CMD} delete-old-libs'." 3130 3131check-old: check-old-files check-old-libs check-old-dirs .PHONY 3132 @echo "To remove old files and directories run '${MAKE_CMD} delete-old'." 3133 @echo "To remove old libraries run '${MAKE_CMD} delete-old-libs'." 3134 3135.endif 3136 3137# 3138# showconfig - show build configuration. 3139# 3140showconfig: .PHONY 3141 @(${MAKE} -n -f ${.CURDIR}/sys/conf/kern.opts.mk -V dummy -dg1 UPDATE_DEPENDFILE=no NO_OBJ=yes; \ 3142 ${MAKE} -n -f ${.CURDIR}/share/mk/src.opts.mk -V dummy -dg1 UPDATE_DEPENDFILE=no NO_OBJ=yes) 2>&1 | grep ^MK_ | sort -u 3143 3144.if !empty(KRNLOBJDIR) && !empty(KERNCONF) 3145DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/ 3146 3147.if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE) 3148.if !defined(_MKSHOWCONFIG) && exists(${KERNCONFDIR}/${KERNCONF}) 3149FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \ 3150 '${KERNCONFDIR}/${KERNCONF}' ; echo 3151.endif 3152.endif 3153 3154.endif 3155 3156.if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH}) 3157DTBOUTPUTPATH= ${.CURDIR} 3158.endif 3159 3160# 3161# Build 'standalone' Device Tree Blob 3162# 3163builddtb: .PHONY 3164 @PATH=${TMPPATH} MACHINE=${TARGET} \ 3165 ${.CURDIR}/sys/tools/fdt/make_dtb.sh ${.CURDIR}/sys \ 3166 "${FDT_DTS_FILE}" ${DTBOUTPUTPATH} 3167 3168############### 3169 3170# cleanworld 3171# In the following, the first 'rm' in a series will usually remove all 3172# files and directories. If it does not, then there are probably some 3173# files with file flags set, so this unsets them and tries the 'rm' a 3174# second time. There are situations where this target will be cleaning 3175# some directories via more than one method, but that duplication is 3176# needed to correctly handle all the possible situations. Removing all 3177# files without file flags set in the first 'rm' instance saves time, 3178# because 'chflags' will need to operate on fewer files afterwards. 3179# 3180# It is expected that BW_CANONICALOBJDIR == the CANONICALOBJDIR as would be 3181# created by bsd.obj.mk, except that we don't want to .include that file 3182# in this makefile. We don't do a cleandir walk if MK_AUTO_OBJ is yes 3183# since it is not possible for files to land in the wrong place. 3184# 3185.if make(cleanworld) 3186BW_CANONICALOBJDIR:=${OBJTOP}/ 3187.elif make(cleanuniverse) 3188BW_CANONICALOBJDIR:=${OBJROOT} 3189.if ${MK_UNIFIED_OBJDIR} == "no" 3190.error ${.TARGETS} only supported with WITH_UNIFIED_OBJDIR enabled. 3191.endif 3192.endif 3193cleanworld cleanuniverse: .PHONY 3194.if !empty(BW_CANONICALOBJDIR) && exists(${BW_CANONICALOBJDIR}) && \ 3195 ${.CURDIR:tA} != ${BW_CANONICALOBJDIR:tA} 3196 -rm -rf ${BW_CANONICALOBJDIR}* 3197 -chflags -R 0 ${BW_CANONICALOBJDIR} 3198 rm -rf ${BW_CANONICALOBJDIR}* 3199.endif 3200.if make(cleanworld) && ${MK_AUTO_OBJ} == "no" && \ 3201 (empty(BW_CANONICALOBJDIR) || ${.CURDIR:tA} == ${BW_CANONICALOBJDIR:tA}) 3202.if ${.CURDIR} == ${.OBJDIR} || ${.CURDIR}/obj == ${.OBJDIR} 3203 # To be safe in this case, fall back to a 'make cleandir' 3204 ${_+_}@cd ${.CURDIR}; ${MAKE} cleandir 3205.endif 3206.endif 3207 3208.if ${TARGET} == ${MACHINE} && ${TARGET_ARCH} == ${MACHINE_ARCH} 3209XDEV_CPUTYPE?=${CPUTYPE} 3210.else 3211XDEV_CPUTYPE?=${TARGET_CPUTYPE} 3212.endif 3213 3214NOFUN=-DNO_FSCHG MK_HTML=no -DNO_LINT \ 3215 MK_MAN=no MK_NLS=no MK_PROFILE=no \ 3216 MK_KERBEROS=no MK_RESCUE=no MK_TESTS=no MK_WARNS=no \ 3217 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ 3218 CPUTYPE=${XDEV_CPUTYPE} 3219 3220XDDIR=${TARGET_ARCH}-freebsd 3221XDTP?=/usr/${XDDIR} 3222.if ${XDTP:N/*} 3223.error XDTP variable should be an absolute path 3224.endif 3225 3226CDBOBJROOT= ${OBJROOT}${MACHINE}.${MACHINE_ARCH}/xdev/ 3227CDBOBJTOP= ${CDBOBJROOT}${XDDIR} 3228CDBENV= \ 3229 INSTALL="sh ${.CURDIR}/tools/install.sh" 3230CDENV= ${CDBENV} \ 3231 TOOLS_PREFIX=${XDTP} 3232CDMAKEARGS= \ 3233 OBJTOP=${CDBOBJTOP:Q} \ 3234 OBJROOT=${CDBOBJROOT:Q} 3235CD2MAKEARGS= ${CDMAKEARGS} 3236 3237.if ${WANT_COMPILER_TYPE} == gcc || \ 3238 (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc) 3239# GCC requires -isystem and -L when using a cross-compiler. --sysroot 3240# won't set header path and -L is used to ensure the base library path 3241# is added before the port PREFIX library path. 3242CD2CFLAGS+= -isystem ${XDDESTDIR}/usr/include -L${XDDESTDIR}/usr/lib 3243# GCC requires -B to find /usr/lib/crti.o when using a cross-compiler 3244# combined with --sysroot. 3245CD2CFLAGS+= -B${XDDESTDIR}/usr/lib 3246# Force using libc++ for external GCC. 3247.if defined(X_COMPILER_TYPE) && \ 3248 ${X_COMPILER_TYPE} == gcc && ${X_COMPILER_VERSION} >= 40800 3249CD2CXXFLAGS+= -isystem ${XDDESTDIR}/usr/include/c++/v1 -std=c++11 \ 3250 -nostdinc++ 3251.endif 3252.endif 3253CD2CFLAGS+= --sysroot=${XDDESTDIR}/ 3254CD2ENV=${CDENV} CC="${CC} ${CD2CFLAGS}" CXX="${CXX} ${CD2CXXFLAGS} ${CD2CFLAGS}" \ 3255 CPP="${CPP} ${CD2CFLAGS}" \ 3256 MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH} 3257 3258CDTMP= ${OBJTOP}/${XDDIR}/tmp 3259CDMAKE=${CDENV} PATH=${CDTMP}/usr/bin:${PATH} ${MAKE} ${CDMAKEARGS} ${NOFUN} 3260CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDDESTDIR}/usr/bin:${PATH} \ 3261 ${MAKE} ${CD2MAKEARGS} ${NOFUN} 3262.if ${MK_META_MODE} != "no" 3263# Don't rebuild build-tools targets during normal build. 3264CD2MAKE+= BUILD_TOOLS_META=.NOMETA 3265.endif 3266XDDESTDIR=${DESTDIR}${XDTP} 3267 3268.ORDER: xdev-build xdev-install xdev-links 3269xdev: xdev-build xdev-install .PHONY 3270 3271.ORDER: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools 3272xdev-build: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools .PHONY 3273 3274_xb-worldtmp: .PHONY 3275 mkdir -p ${CDTMP}/usr 3276 ${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 3277 -p ${CDTMP}/usr >/dev/null 3278 3279_xb-bootstrap-tools: .PHONY 3280.for _tool in \ 3281 ${_clang_tblgen} \ 3282 ${_yacc} 3283 ${_+_}@${ECHODIR} "===> ${_tool} (obj,all,install)"; \ 3284 cd ${.CURDIR}/${_tool}; \ 3285 if [ -z "${NO_OBJWALK}" ]; then ${CDMAKE} DIRPRFX=${_tool}/ obj; fi; \ 3286 ${CDMAKE} DIRPRFX=${_tool}/ all; \ 3287 ${CDMAKE} DIRPRFX=${_tool}/ DESTDIR=${CDTMP} install 3288.endfor 3289 3290_xb-build-tools: .PHONY 3291 ${_+_}@cd ${.CURDIR}; \ 3292 ${CDBENV} ${MAKE} ${CDMAKEARGS} -f Makefile.inc1 ${NOFUN} build-tools 3293 3294XDEVDIRS= \ 3295 ${_clang_libs} \ 3296 ${_lld} \ 3297 ${_elftctools} \ 3298 usr.bin/ar \ 3299 ${_clang} 3300 3301_xb-cross-tools: .PHONY 3302.for _tool in ${XDEVDIRS} 3303 ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,all)"; \ 3304 cd ${.CURDIR}/${_tool}; \ 3305 if [ -z "${NO_OBJWALK}" ]; then ${CDMAKE} DIRPRFX=${_tool}/ obj; fi; \ 3306 ${CDMAKE} DIRPRFX=${_tool}/ all 3307.endfor 3308 3309_xi-mtree: .PHONY 3310 ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}" 3311 mkdir -p ${XDDESTDIR} 3312 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.root.dist \ 3313 -p ${XDDESTDIR} >/dev/null 3314 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 3315 -p ${XDDESTDIR}/usr >/dev/null 3316 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 3317 -p ${XDDESTDIR}/usr/include >/dev/null 3318.if defined(_LIBCOMPAT) 3319 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ 3320 -p ${XDDESTDIR}/usr >/dev/null 3321.endif 3322.if ${MK_TESTS} != "no" 3323 mkdir -p ${XDDESTDIR}${TESTSBASE} 3324 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.tests.dist \ 3325 -p ${XDDESTDIR}${TESTSBASE} >/dev/null 3326.endif 3327 3328.ORDER: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries 3329xdev-install: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries .PHONY 3330 3331_xi-cross-tools: .PHONY 3332 @echo "_xi-cross-tools" 3333.for _tool in ${XDEVDIRS} 3334 ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \ 3335 cd ${.CURDIR}/${_tool}; \ 3336 ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR} 3337.endfor 3338 3339_xi-includes: .PHONY 3340.if !defined(NO_OBJWALK) 3341 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 _obj \ 3342 DESTDIR=${XDDESTDIR} 3343.endif 3344 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 includes \ 3345 DESTDIR=${XDDESTDIR} 3346 3347_xi-libraries: .PHONY 3348 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \ 3349 DESTDIR=${XDDESTDIR} 3350 3351xdev-links: .PHONY 3352 ${_+_}cd ${XDDESTDIR}/usr/bin; \ 3353 mkdir -p ../../../../usr/bin; \ 3354 for i in *; do \ 3355 ln -sf ../../${XDTP}/usr/bin/$$i \ 3356 ../../../../usr/bin/${XDDIR}-$$i; \ 3357 ln -sf ../../${XDTP}/usr/bin/$$i \ 3358 ../../../../usr/bin/${XDDIR}${_REVISION}-$$i; \ 3359 done 3360