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 53SRCDIR?= ${.CURDIR} 54LOCALBASE?= /usr/local 55 56# Cross toolchain changes must be in effect before bsd.compiler.mk 57# so that gets the right CC, and pass CROSS_TOOLCHAIN to submakes. 58.if defined(CROSS_TOOLCHAIN) 59.include "${LOCALBASE}/share/toolchains/${CROSS_TOOLCHAIN}.mk" 60CROSSENV+=CROSS_TOOLCHAIN="${CROSS_TOOLCHAIN}" 61.endif 62.if defined(CROSS_TOOLCHAIN_PREFIX) 63CROSS_COMPILER_PREFIX?=${CROSS_TOOLCHAIN_PREFIX} 64.endif 65 66XCOMPILERS= CC CXX CPP 67.for COMPILER in ${XCOMPILERS} 68.if defined(CROSS_COMPILER_PREFIX) 69X${COMPILER}?= ${CROSS_COMPILER_PREFIX}${${COMPILER}} 70.else 71X${COMPILER}?= ${${COMPILER}} 72.endif 73.endfor 74# If a full path to an external cross compiler is given, don't build 75# a cross compiler. 76.if ${XCC:N${CCACHE_BIN}:M/*} 77MK_CLANG_BOOTSTRAP= no 78MK_GCC_BOOTSTRAP= no 79.endif 80 81# Pull in COMPILER_TYPE and COMPILER_FREEBSD_VERSION early. 82.include <bsd.compiler.mk> 83.include "share/mk/src.opts.mk" 84 85# Check if there is a local compiler that can satisfy as an external compiler. 86# Which compiler is expected to be used? 87.if ${MK_CLANG_BOOTSTRAP} == "yes" 88WANT_COMPILER_TYPE= clang 89.elif ${MK_GCC_BOOTSTRAP} == "yes" 90WANT_COMPILER_TYPE= gcc 91.else 92WANT_COMPILER_TYPE= 93.endif 94.if !defined(WANT_COMPILER_FREEBSD_VERSION) 95.if ${WANT_COMPILER_TYPE} == "clang" 96WANT_COMPILER_FREEBSD_VERSION_FILE= lib/clang/freebsd_cc_version.h 97WANT_COMPILER_FREEBSD_VERSION!= \ 98 awk '$$2 == "FREEBSD_CC_VERSION" {printf("%d\n", $$3)}' \ 99 ${SRCDIR}/${WANT_COMPILER_FREEBSD_VERSION_FILE} || echo unknown 100WANT_COMPILER_VERSION_FILE= lib/clang/include/clang/Basic/Version.inc 101WANT_COMPILER_VERSION!= \ 102 awk '$$2 == "CLANG_VERSION" {split($$3, a, "."); print a[1] * 10000 + a[2] * 100 + a[3]}' \ 103 ${SRCDIR}/${WANT_COMPILER_VERSION_FILE} || echo unknown 104.elif ${WANT_COMPILER_TYPE} == "gcc" 105WANT_COMPILER_FREEBSD_VERSION_FILE= gnu/usr.bin/cc/cc_tools/freebsd-native.h 106WANT_COMPILER_FREEBSD_VERSION!= \ 107 awk '$$2 == "FBSD_CC_VER" {printf("%d\n", $$3)}' \ 108 ${SRCDIR}/${WANT_COMPILER_FREEBSD_VERSION_FILE} || echo unknown 109WANT_COMPILER_VERSION_FILE= contrib/gcc/BASE-VER 110WANT_COMPILER_VERSION!= \ 111 awk -F. '{print $$1 * 10000 + $$2 * 100 + $$3}' \ 112 ${SRCDIR}/${WANT_COMPILER_VERSION_FILE} || echo unknown 113.endif 114.export WANT_COMPILER_FREEBSD_VERSION WANT_COMPILER_VERSION 115.endif # !defined(WANT_COMPILER_FREEBSD_VERSION) 116# It needs to be the same revision as we would build for the bootstrap. 117# If the expected vs CC is different then we can't skip. 118# GCC cannot be used for cross-arch yet. For clang we pass -target later if 119# TARGET_ARCH!=MACHINE_ARCH. 120.if ${MK_SYSTEM_COMPILER} == "yes" && \ 121 (${MK_CLANG_BOOTSTRAP} == "yes" || ${MK_GCC_BOOTSTRAP} == "yes") && \ 122 !make(showconfig) && !make(native-xtools) && !make(xdev*) && \ 123 ${WANT_COMPILER_TYPE} == ${COMPILER_TYPE} && \ 124 (${COMPILER_TYPE} == "clang" || ${TARGET_ARCH} == ${MACHINE_ARCH}) && \ 125 ${COMPILER_VERSION} == ${WANT_COMPILER_VERSION} && \ 126 ${COMPILER_FREEBSD_VERSION} == ${WANT_COMPILER_FREEBSD_VERSION} 127# Everything matches, disable the bootstrap compiler. 128MK_CLANG_BOOTSTRAP= no 129MK_GCC_BOOTSTRAP= no 130USING_SYSTEM_COMPILER= yes 131.endif # ${WANT_COMPILER_TYPE} == ${COMPILER_TYPE} 132USING_SYSTEM_COMPILER?= no 133TEST_SYSTEM_COMPILER_VARS= \ 134 USING_SYSTEM_COMPILER MK_SYSTEM_COMPILER \ 135 MK_CROSS_COMPILER MK_CLANG_BOOTSTRAP MK_GCC_BOOTSTRAP \ 136 WANT_COMPILER_TYPE WANT_COMPILER_VERSION WANT_COMPILER_VERSION_FILE \ 137 WANT_COMPILER_FREEBSD_VERSION WANT_COMPILER_FREEBSD_VERSION_FILE \ 138 CC COMPILER_TYPE COMPILER_VERSION COMPILER_FREEBSD_VERSION 139test-system-compiler: .PHONY 140.for v in ${TEST_SYSTEM_COMPILER_VARS} 141 ${_+_}@printf "%-35s= %s\n" "${v}" "${${v}}" 142.endfor 143.if ${USING_SYSTEM_COMPILER} == "yes" && \ 144 (make(buildworld) || make(buildkernel) || make(kernel-toolchain) || \ 145 make(toolchain) || make(_cross-tools)) 146.info SYSTEM_COMPILER: Determined that CC=${CC} matches the source tree. Not bootstrapping a cross-compiler. 147.endif 148 149# For installworld need to ensure that the looked-up compiler metadata is 150# passed along rather than trying to run cc from the restricted 151# STRICTTMPPATH. 152.if ${MK_CLANG_BOOTSTRAP} == "no" && ${MK_GCC_BOOTSTRAP} == "no" 153.if !defined(X_COMPILER_TYPE) 154CROSSENV+= COMPILER_VERSION=${COMPILER_VERSION} \ 155 COMPILER_TYPE=${COMPILER_TYPE} \ 156 COMPILER_FREEBSD_VERSION=${COMPILER_FREEBSD_VERSION} 157.else 158CROSSENV+= COMPILER_VERSION=${X_COMPILER_VERSION} \ 159 COMPILER_TYPE=${X_COMPILER_TYPE} \ 160 COMPILER_FREEBSD_VERSION=${X_COMPILER_FREEBSD_VERSION} 161.endif 162.endif 163 164# Handle external binutils. 165.if defined(CROSS_TOOLCHAIN_PREFIX) 166CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX} 167.endif 168# If we do not have a bootstrap binutils (because the in-tree one does not 169# support the target architecture), provide a default cross-binutils prefix. 170# This allows aarch64 builds, for example, to automatically use the 171# aarch64-binutils port or package. 172.if !make(showconfig) 173.if !empty(BROKEN_OPTIONS:MBINUTILS_BOOTSTRAP) && \ 174 !defined(CROSS_BINUTILS_PREFIX) 175CROSS_BINUTILS_PREFIX=/usr/local/${TARGET_ARCH}-freebsd/bin/ 176.if !exists(${CROSS_BINUTILS_PREFIX}) 177.error In-tree binutils does not support the ${TARGET_ARCH} architecture. Install the ${TARGET_ARCH}-binutils port or package or set CROSS_BINUTILS_PREFIX. 178.endif 179.endif 180.endif 181XBINUTILS= AS AR LD NM OBJCOPY RANLIB SIZE STRINGS 182.for BINUTIL in ${XBINUTILS} 183.if defined(CROSS_BINUTILS_PREFIX) && \ 184 exists(${CROSS_BINUTILS_PREFIX}${${BINUTIL}}) 185X${BINUTIL}?= ${CROSS_BINUTILS_PREFIX}${${BINUTIL}} 186.else 187X${BINUTIL}?= ${${BINUTIL}} 188.endif 189.endfor 190 191 192# We must do lib/ and libexec/ before bin/ in case of a mid-install error to 193# keep the users system reasonably usable. For static->dynamic root upgrades, 194# we don't want to install a dynamic binary without rtld and the needed 195# libraries. More commonly, for dynamic root, we don't want to install a 196# binary that requires a newer library version that hasn't been installed yet. 197# This ordering is not a guarantee though. The only guarantee of a working 198# system here would require fine-grained ordering of all components based 199# on their dependencies. 200.if !empty(SUBDIR_OVERRIDE) 201SUBDIR= ${SUBDIR_OVERRIDE} 202.else 203SUBDIR= lib libexec 204.if !defined(NO_ROOT) && (make(installworld) || make(install)) 205# Ensure libraries are installed before progressing. 206SUBDIR+=.WAIT 207.endif 208SUBDIR+=bin 209.if ${MK_CDDL} != "no" 210SUBDIR+=cddl 211.endif 212SUBDIR+=gnu include 213.if ${MK_KERBEROS} != "no" 214SUBDIR+=kerberos5 215.endif 216.if ${MK_RESCUE} != "no" 217SUBDIR+=rescue 218.endif 219SUBDIR+=sbin 220.if ${MK_CRYPT} != "no" 221SUBDIR+=secure 222.endif 223.if !defined(NO_SHARE) 224SUBDIR+=share 225.endif 226SUBDIR+=sys usr.bin usr.sbin 227.if ${MK_TESTS} != "no" 228SUBDIR+= tests 229.endif 230.if ${MK_OFED} != "no" 231SUBDIR+=contrib/ofed 232.endif 233 234# Local directories are last, since it is nice to at least get the base 235# system rebuilt before you do them. 236.for _DIR in ${LOCAL_DIRS} 237.if exists(${.CURDIR}/${_DIR}/Makefile) 238SUBDIR+= ${_DIR} 239.endif 240.endfor 241# Add LOCAL_LIB_DIRS, but only if they will not be picked up as a SUBDIR 242# of a LOCAL_DIRS directory. This allows LOCAL_DIRS=foo and 243# LOCAL_LIB_DIRS=foo/lib to behave as expected. 244.for _DIR in ${LOCAL_DIRS:M*/} ${LOCAL_DIRS:N*/:S|$|/|} 245_REDUNDENT_LIB_DIRS+= ${LOCAL_LIB_DIRS:M${_DIR}*} 246.endfor 247.for _DIR in ${LOCAL_LIB_DIRS} 248.if empty(_REDUNDENT_LIB_DIRS:M${_DIR}) && exists(${.CURDIR}/${_DIR}/Makefile) 249SUBDIR+= ${_DIR} 250.else 251.warning ${_DIR} not added to SUBDIR list. See UPDATING 20141121. 252.endif 253.endfor 254 255# We must do etc/ last as it hooks into building the man whatis file 256# by calling 'makedb' in share/man. This is only relevant for 257# install/distribute so they build the whatis file after every manpage is 258# installed. 259.if make(installworld) || make(install) 260SUBDIR+=.WAIT 261.endif 262SUBDIR+=etc 263 264.endif # !empty(SUBDIR_OVERRIDE) 265 266.if defined(NOCLEAN) 267.warning NOCLEAN option is deprecated. Use NO_CLEAN instead. 268NO_CLEAN= ${NOCLEAN} 269.endif 270.if defined(NO_CLEANDIR) 271CLEANDIR= clean cleandepend 272.else 273CLEANDIR= cleandir 274.endif 275 276.if ${MK_META_MODE} == "yes" 277# If filemon is used then we can rely on the build being incremental-safe. 278# The .meta files will also track the build command and rebuild should 279# it change. 280.if empty(.MAKE.MODE:Mnofilemon) 281NO_CLEAN= t 282.endif 283.endif 284 285LOCAL_TOOL_DIRS?= 286PACKAGEDIR?= ${DESTDIR}/${DISTDIR} 287 288.if empty(SHELL:M*csh*) 289BUILDENV_SHELL?=${SHELL} 290.else 291BUILDENV_SHELL?=/bin/sh 292.endif 293 294.if !defined(SVN) || empty(SVN) 295. for _P in /usr/bin /usr/local/bin 296. for _S in svn svnlite 297. if exists(${_P}/${_S}) 298SVN= ${_P}/${_S} 299. endif 300. endfor 301. endfor 302.endif 303SVNFLAGS?= -r HEAD 304 305MAKEOBJDIRPREFIX?= /usr/obj 306.if !defined(OSRELDATE) 307.if exists(/usr/include/osreldate.h) 308OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \ 309 /usr/include/osreldate.h 310.else 311OSRELDATE= 0 312.endif 313.export OSRELDATE 314.endif 315 316# Set VERSION for CTFMERGE to use via the default CTFFLAGS=-L VERSION. 317.if !defined(_REVISION) 318_REVISION!= MK_AUTO_OBJ=no ${MAKE} -C ${SRCDIR}/release -V REVISION 319.export _REVISION 320.endif 321.if !defined(_BRANCH) 322_BRANCH!= MK_AUTO_OBJ=no ${MAKE} -C ${SRCDIR}/release -V BRANCH 323.export _BRANCH 324.endif 325.if !defined(SRCRELDATE) 326SRCRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \ 327 ${SRCDIR}/sys/sys/param.h 328.export SRCRELDATE 329.endif 330.if !defined(VERSION) 331VERSION= FreeBSD ${_REVISION}-${_BRANCH:C/-p[0-9]+$//} ${TARGET_ARCH} ${SRCRELDATE} 332.export VERSION 333.endif 334 335.if !defined(PKG_VERSION) 336.if ${_BRANCH:MSTABLE*} || ${_BRANCH:MCURRENT*} || ${_BRANCH:MALPHA*} 337TIMENOW= %Y%m%d%H%M%S 338EXTRA_REVISION= .s${TIMENOW:gmtime} 339.endif 340.if ${_BRANCH:M*-p*} 341EXTRA_REVISION= _${_BRANCH:C/.*-p([0-9]+$)/\1/} 342.endif 343PKG_VERSION= ${_REVISION}${EXTRA_REVISION} 344.endif 345 346KNOWN_ARCHES?= aarch64/arm64 \ 347 amd64 \ 348 arm \ 349 armeb/arm \ 350 armv6/arm \ 351 i386 \ 352 i386/pc98 \ 353 mips \ 354 mipsel/mips \ 355 mips64el/mips \ 356 mipsn32el/mips \ 357 mips64/mips \ 358 mipsn32/mips \ 359 powerpc \ 360 powerpc64/powerpc \ 361 powerpcspe/powerpc \ 362 riscv64/riscv \ 363 sparc64 364 365.if ${TARGET} == ${TARGET_ARCH} 366_t= ${TARGET} 367.else 368_t= ${TARGET_ARCH}/${TARGET} 369.endif 370.for _t in ${_t} 371.if empty(KNOWN_ARCHES:M${_t}) 372.error Unknown target ${TARGET_ARCH}:${TARGET}. 373.endif 374.endfor 375 376.if ${TARGET} == ${MACHINE} 377TARGET_CPUTYPE?=${CPUTYPE} 378.else 379TARGET_CPUTYPE?= 380.endif 381 382.if !empty(TARGET_CPUTYPE) 383_TARGET_CPUTYPE=${TARGET_CPUTYPE} 384.else 385_TARGET_CPUTYPE=dummy 386.endif 387_CPUTYPE!= MK_AUTO_OBJ=no MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} \ 388 -f /dev/null -m ${.CURDIR}/share/mk -V CPUTYPE 389.if ${_CPUTYPE} != ${_TARGET_CPUTYPE} 390.error CPUTYPE global should be set with ?=. 391.endif 392.if make(buildworld) 393BUILD_ARCH!= uname -p 394.if ${MACHINE_ARCH} != ${BUILD_ARCH} 395.error To cross-build, set TARGET_ARCH. 396.endif 397.endif 398.if ${MACHINE} == ${TARGET} && ${MACHINE_ARCH} == ${TARGET_ARCH} && !defined(CROSS_BUILD_TESTING) 399OBJTREE= ${MAKEOBJDIRPREFIX} 400.else 401OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH} 402.endif 403WORLDTMP= ${OBJTREE}${.CURDIR}/tmp 404BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/bin 405XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin 406STRICTTMPPATH= ${BPATH}:${XPATH} 407TMPPATH= ${STRICTTMPPATH}:${PATH} 408 409# 410# Avoid running mktemp(1) unless actually needed. 411# It may not be functional, e.g., due to new ABI 412# when in the middle of installing over this system. 413# 414.if make(distributeworld) || make(installworld) || make(stageworld) 415INSTALLTMP!= /usr/bin/mktemp -d -u -t install 416.endif 417 418.if make(stagekernel) || make(distributekernel) 419TAGS+= kernel 420PACKAGE= kernel 421.endif 422 423# 424# Building a world goes through the following stages 425# 426# 1. legacy stage [BMAKE] 427# This stage is responsible for creating compatibility 428# shims that are needed by the bootstrap-tools, 429# build-tools and cross-tools stages. These are generally 430# APIs that tools from one of those three stages need to 431# build that aren't present on the host. 432# 1. bootstrap-tools stage [BMAKE] 433# This stage is responsible for creating programs that 434# are needed for backward compatibility reasons. They 435# are not built as cross-tools. 436# 2. build-tools stage [TMAKE] 437# This stage is responsible for creating the object 438# tree and building any tools that are needed during 439# the build process. Some programs are listed during 440# this phase because they build binaries to generate 441# files needed to build these programs. This stage also 442# builds the 'build-tools' target rather than 'all'. 443# 3. cross-tools stage [XMAKE] 444# This stage is responsible for creating any tools that 445# are needed for building the system. A cross-compiler is one 446# of them. This differs from build tools in two ways: 447# 1. the 'all' target is built rather than 'build-tools' 448# 2. these tools are installed into TMPPATH for stage 4. 449# 4. world stage [WMAKE] 450# This stage actually builds the world. 451# 5. install stage (optional) [IMAKE] 452# This stage installs a previously built world. 453# 454 455BOOTSTRAPPING?= 0 456# Keep these in sync 457MINIMUM_SUPPORTED_OSREL?= 900044 458MINIMUM_SUPPORTED_REL?= 9.1 459 460# Common environment for world related stages 461CROSSENV+= MAKEOBJDIRPREFIX=${OBJTREE} \ 462 MACHINE_ARCH=${TARGET_ARCH} \ 463 MACHINE=${TARGET} \ 464 CPUTYPE=${TARGET_CPUTYPE} 465.if ${MK_META_MODE} != "no" 466# Don't rebuild build-tools targets during normal build. 467CROSSENV+= BUILD_TOOLS_META=.NOMETA_CMP 468.endif 469.if ${MK_GROFF} != "no" 470CROSSENV+= GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \ 471 GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \ 472 GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac 473.endif 474.if defined(TARGET_CFLAGS) 475CROSSENV+= ${TARGET_CFLAGS} 476.endif 477 478# bootstrap-tools stage 479BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \ 480 TOOLS_PREFIX=${WORLDTMP} \ 481 PATH=${BPATH}:${PATH} \ 482 WORLDTMP=${WORLDTMP} \ 483 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" 484# need to keep this in sync with targets/pseudo/bootstrap-tools/Makefile 485BSARGS= DESTDIR= \ 486 BOOTSTRAPPING=${OSRELDATE} \ 487 SSP_CFLAGS= \ 488 MK_HTML=no NO_LINT=yes MK_MAN=no \ 489 -DNO_PIC MK_PROFILE=no -DNO_SHARED \ 490 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \ 491 MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \ 492 MK_LLDB=no MK_TESTS=no \ 493 MK_INCLUDES=yes 494 495BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \ 496 ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ 497 ${BSARGS} 498 499# build-tools stage 500TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \ 501 ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ 502 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ 503 DESTDIR= \ 504 BOOTSTRAPPING=${OSRELDATE} \ 505 SSP_CFLAGS= \ 506 -DNO_LINT \ 507 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \ 508 MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \ 509 MK_LLDB=no MK_TESTS=no 510 511# cross-tools stage 512XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \ 513 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ 514 MK_GDB=no MK_TESTS=no 515 516# kernel-tools stage 517KTMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \ 518 PATH=${BPATH}:${PATH} \ 519 WORLDTMP=${WORLDTMP} 520KTMAKE= TOOLS_PREFIX=${WORLDTMP} MAKEOBJDIRPREFIX=${WORLDTMP} \ 521 ${KTMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ 522 DESTDIR= \ 523 BOOTSTRAPPING=${OSRELDATE} \ 524 SSP_CFLAGS= \ 525 MK_HTML=no -DNO_LINT MK_MAN=no \ 526 -DNO_PIC MK_PROFILE=no -DNO_SHARED \ 527 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no 528 529# world stage 530WMAKEENV= ${CROSSENV} \ 531 INSTALL="sh ${.CURDIR}/tools/install.sh" \ 532 PATH=${TMPPATH} 533 534# make hierarchy 535HMAKE= PATH=${TMPPATH} ${MAKE} LOCAL_MTREE=${LOCAL_MTREE:Q} 536.if defined(NO_ROOT) 537HMAKE+= PATH=${TMPPATH} METALOG=${METALOG} -DNO_ROOT 538.endif 539 540CROSSENV+= CC="${XCC} ${XCFLAGS}" CXX="${XCXX} ${XCXXFLAGS} ${XCFLAGS}" \ 541 CPP="${XCPP} ${XCFLAGS}" \ 542 AS="${XAS}" AR="${XAR}" LD="${XLD}" NM=${XNM} \ 543 OBJCOPY="${XOBJCOPY}" \ 544 RANLIB=${XRANLIB} STRINGS=${XSTRINGS} \ 545 SIZE="${XSIZE}" 546 547.if defined(CROSS_BINUTILS_PREFIX) && exists(${CROSS_BINUTILS_PREFIX}) 548# In the case of xdev-build tools, CROSS_BINUTILS_PREFIX won't be a 549# directory, but the compiler will look in the right place for its 550# tools so we don't need to tell it where to look. 551BFLAGS+= -B${CROSS_BINUTILS_PREFIX} 552.endif 553 554 555# The internal bootstrap compiler has a default sysroot set by TOOLS_PREFIX 556# and target set by TARGET/TARGET_ARCH. However, there are several needs to 557# always pass an explicit --sysroot and -target. 558# - External compiler needs sysroot and target flags. 559# - External ld needs sysroot. 560# - To be clear about the use of a sysroot when using the internal compiler. 561# - Easier debugging. 562# - Allowing WITH_SYSTEM_COMPILER+WITH_META_MODE to work together due to 563# the flip-flopping build command when sometimes using external and 564# sometimes using internal. 565# - Allow using lld which has no support for default paths. 566.if !defined(CROSS_BINUTILS_PREFIX) || !exists(${CROSS_BINUTILS_PREFIX}) 567BFLAGS+= -B${WORLDTMP}/usr/bin 568.endif 569.if ${TARGET} == "arm" 570.if ${TARGET_ARCH:Marmv6*} != "" && ${TARGET_CPUTYPE:M*soft*} == "" 571TARGET_ABI= gnueabihf 572.else 573TARGET_ABI= gnueabi 574.endif 575.endif 576.if ${WANT_COMPILER_TYPE} == gcc || \ 577 (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc) 578# GCC requires -isystem and -L when using a cross-compiler. --sysroot 579# won't set header path and -L is used to ensure the base library path 580# is added before the port PREFIX library path. 581XCFLAGS+= -isystem ${WORLDTMP}/usr/include -L${WORLDTMP}/usr/lib 582# GCC requires -B to find /usr/lib/crti.o when using a cross-compiler 583# combined with --sysroot. 584XCFLAGS+= -B${WORLDTMP}/usr/lib 585# Force using libc++ for external GCC. 586# XXX: This should be checking MK_GNUCXX == no 587.if ${X_COMPILER_VERSION} >= 40800 588XCXXFLAGS+= -isystem ${WORLDTMP}/usr/include/c++/v1 -std=c++11 \ 589 -nostdinc++ -L${WORLDTMP}/../lib/libc++ 590.endif 591.elif ${WANT_COMPILER_TYPE} == clang || \ 592 (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == clang) 593TARGET_ABI?= unknown 594TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd12.0 595XCFLAGS+= -target ${TARGET_TRIPLE} 596.endif 597XCFLAGS+= --sysroot=${WORLDTMP} 598 599.if !empty(BFLAGS) 600XCFLAGS+= ${BFLAGS} 601.endif 602 603.if ${MK_LIB32} != "no" && (${TARGET_ARCH} == "amd64" || \ 604 ${TARGET_ARCH} == "powerpc64") 605LIBCOMPAT= 32 606.include "Makefile.libcompat" 607.elif ${MK_LIBSOFT} != "no" && ${TARGET_ARCH} == "armv6" 608LIBCOMPAT= SOFT 609.include "Makefile.libcompat" 610.endif 611 612WMAKE= ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 DESTDIR=${WORLDTMP} 613 614IMAKEENV= ${CROSSENV} 615IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 \ 616 ${IMAKE_INSTALL} ${IMAKE_MTREE} 617.if empty(.MAKEFLAGS:M-n) 618IMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMP} \ 619 LD_LIBRARY_PATH=${INSTALLTMP} \ 620 PATH_LOCALE=${INSTALLTMP}/locale 621IMAKE+= __MAKE_SHELL=${INSTALLTMP}/sh 622.else 623IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP} 624.endif 625.if defined(DB_FROM_SRC) 626INSTALLFLAGS+= -N ${.CURDIR}/etc 627MTREEFLAGS+= -N ${.CURDIR}/etc 628.endif 629_INSTALL_DDIR= ${DESTDIR}/${DISTDIR} 630INSTALL_DDIR= ${_INSTALL_DDIR:S://:/:g:C:/$::} 631.if defined(NO_ROOT) 632METALOG?= ${DESTDIR}/${DISTDIR}/METALOG 633IMAKE+= -DNO_ROOT METALOG=${METALOG} 634INSTALLFLAGS+= -U -M ${METALOG} -D ${INSTALL_DDIR} 635MTREEFLAGS+= -W 636.endif 637.if defined(BUILD_PKGS) 638INSTALLFLAGS+= -h sha256 639.endif 640.if defined(DB_FROM_SRC) || defined(NO_ROOT) 641IMAKE_INSTALL= INSTALL="install ${INSTALLFLAGS}" 642IMAKE_MTREE= MTREE_CMD="mtree ${MTREEFLAGS}" 643.endif 644 645# kernel stage 646KMAKEENV= ${WMAKEENV} 647KMAKE= ${KMAKEENV} ${MAKE} ${.MAKEFLAGS} ${KERNEL_FLAGS} KERNEL=${INSTKERNNAME} 648 649# 650# buildworld 651# 652# Attempt to rebuild the entire system, with reasonable chance of 653# success, regardless of how old your existing system is. 654# 655_worldtmp: .PHONY 656.if ${.CURDIR:C/[^,]//g} != "" 657# The m4 build of sendmail files doesn't like it if ',' is used 658# anywhere in the path of it's files. 659 @echo 660 @echo "*** Error: path to source tree contains a comma ','" 661 @echo 662 false 663.endif 664 @echo 665 @echo "--------------------------------------------------------------" 666 @echo ">>> Rebuilding the temporary build tree" 667 @echo "--------------------------------------------------------------" 668.if !defined(NO_CLEAN) 669 rm -rf ${WORLDTMP} 670.if defined(LIBCOMPAT) 671 rm -rf ${LIBCOMPATTMP} 672.endif 673.else 674 rm -rf ${WORLDTMP}/legacy/usr/include 675# XXX - These can depend on any header file. 676 rm -f ${OBJTREE}${.CURDIR}/lib/libsysdecode/ioctl.c 677 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c 678.endif 679.for _dir in \ 680 lib lib/casper usr legacy/bin legacy/usr 681 mkdir -p ${WORLDTMP}/${_dir} 682.endfor 683 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 684 -p ${WORLDTMP}/legacy/usr >/dev/null 685.if ${MK_GROFF} != "no" 686 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.groff.dist \ 687 -p ${WORLDTMP}/legacy/usr >/dev/null 688.endif 689 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 690 -p ${WORLDTMP}/legacy/usr/include >/dev/null 691 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 692 -p ${WORLDTMP}/usr >/dev/null 693 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 694 -p ${WORLDTMP}/usr/include >/dev/null 695 ln -sf ${.CURDIR}/sys ${WORLDTMP} 696.if ${MK_DEBUG_FILES} != "no" 697 # We could instead disable debug files for these build stages 698 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \ 699 -p ${WORLDTMP}/legacy/usr/lib >/dev/null 700 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \ 701 -p ${WORLDTMP}/usr/lib >/dev/null 702.endif 703.if defined(LIBCOMPAT) 704 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ 705 -p ${WORLDTMP}/usr >/dev/null 706.if ${MK_DEBUG_FILES} != "no" 707 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ 708 -p ${WORLDTMP}/legacy/usr/lib/debug/usr >/dev/null 709 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ 710 -p ${WORLDTMP}/usr/lib/debug/usr >/dev/null 711.endif 712.endif 713.if ${MK_TESTS} != "no" 714 mkdir -p ${WORLDTMP}${TESTSBASE} 715 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \ 716 -p ${WORLDTMP}${TESTSBASE} >/dev/null 717.if ${MK_DEBUG_FILES} != "no" 718 mkdir -p ${WORLDTMP}/usr/lib/debug/${TESTSBASE} 719 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \ 720 -p ${WORLDTMP}/usr/lib/debug/${TESTSBASE} >/dev/null 721.endif 722.endif 723.for _mtree in ${LOCAL_MTREE} 724 mtree -deU -f ${.CURDIR}/${_mtree} -p ${WORLDTMP} > /dev/null 725.endfor 726_legacy: 727 @echo 728 @echo "--------------------------------------------------------------" 729 @echo ">>> stage 1.1: legacy release compatibility shims" 730 @echo "--------------------------------------------------------------" 731 ${_+_}cd ${.CURDIR}; ${BMAKE} legacy 732_bootstrap-tools: 733 @echo 734 @echo "--------------------------------------------------------------" 735 @echo ">>> stage 1.2: bootstrap tools" 736 @echo "--------------------------------------------------------------" 737 ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools 738_cleanobj: 739.if !defined(NO_CLEAN) 740 @echo 741 @echo "--------------------------------------------------------------" 742 @echo ">>> stage 2.1: cleaning up the object tree" 743 @echo "--------------------------------------------------------------" 744 ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR} 745.if defined(LIBCOMPAT) 746 ${_+_}cd ${.CURDIR}; ${LIBCOMPATWMAKE} -f Makefile.inc1 ${CLEANDIR} 747.endif 748.endif 749_obj: 750 @echo 751 @echo "--------------------------------------------------------------" 752 @echo ">>> stage 2.2: rebuilding the object tree" 753 @echo "--------------------------------------------------------------" 754 ${_+_}cd ${.CURDIR}; ${WMAKE} obj 755_build-tools: 756 @echo 757 @echo "--------------------------------------------------------------" 758 @echo ">>> stage 2.3: build tools" 759 @echo "--------------------------------------------------------------" 760 ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools 761_cross-tools: 762 @echo 763 @echo "--------------------------------------------------------------" 764 @echo ">>> stage 3: cross tools" 765 @echo "--------------------------------------------------------------" 766 ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools 767 ${_+_}cd ${.CURDIR}; ${XMAKE} kernel-tools 768_includes: 769 @echo 770 @echo "--------------------------------------------------------------" 771 @echo ">>> stage 4.1: building includes" 772 @echo "--------------------------------------------------------------" 773# Special handling for SUBDIR_OVERRIDE in buildworld as they most likely need 774# headers from default SUBDIR. Do SUBDIR_OVERRIDE includes last. 775 ${_+_}cd ${.CURDIR}; ${WMAKE} SUBDIR_OVERRIDE= SHARED=symlinks \ 776 MK_INCLUDES=yes includes 777.if !empty(SUBDIR_OVERRIDE) && make(buildworld) 778 ${_+_}cd ${.CURDIR}; ${WMAKE} MK_INCLUDES=yes SHARED=symlinks includes 779.endif 780_libraries: 781 @echo 782 @echo "--------------------------------------------------------------" 783 @echo ">>> stage 4.2: building libraries" 784 @echo "--------------------------------------------------------------" 785 ${_+_}cd ${.CURDIR}; \ 786 ${WMAKE} -DNO_FSCHG MK_HTML=no -DNO_LINT MK_MAN=no \ 787 MK_PROFILE=no MK_TESTS=no MK_TESTS_SUPPORT=${MK_TESTS} libraries 788everything: .PHONY 789 @echo 790 @echo "--------------------------------------------------------------" 791 @echo ">>> stage 4.3: building everything" 792 @echo "--------------------------------------------------------------" 793 ${_+_}cd ${.CURDIR}; _PARALLEL_SUBDIR_OK=1 ${WMAKE} all 794 795WMAKE_TGTS= 796WMAKE_TGTS+= _worldtmp _legacy 797.if empty(SUBDIR_OVERRIDE) 798WMAKE_TGTS+= _bootstrap-tools 799.endif 800WMAKE_TGTS+= _cleanobj _obj _build-tools _cross-tools 801WMAKE_TGTS+= _includes _libraries 802WMAKE_TGTS+= everything 803.if defined(LIBCOMPAT) && empty(SUBDIR_OVERRIDE) 804WMAKE_TGTS+= build${libcompat} 805.endif 806 807buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue .PHONY 808.ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue 809 810buildworld_prologue: .PHONY 811 @echo "--------------------------------------------------------------" 812 @echo ">>> World build started on `LC_ALL=C date`" 813 @echo "--------------------------------------------------------------" 814 815buildworld_epilogue: .PHONY 816 @echo 817 @echo "--------------------------------------------------------------" 818 @echo ">>> World build completed on `LC_ALL=C date`" 819 @echo "--------------------------------------------------------------" 820 821# 822# We need to have this as a target because the indirection between Makefile 823# and Makefile.inc1 causes the correct PATH to be used, rather than a 824# modification of the current environment's PATH. In addition, we need 825# to quote multiword values. 826# 827buildenvvars: .PHONY 828 @echo ${WMAKEENV:Q} ${.MAKE.EXPORTED:@v@$v=\"${$v}\"@} 829 830.if ${.TARGETS:Mbuildenv} 831.if ${.MAKEFLAGS:M-j} 832.error The buildenv target is incompatible with -j 833.endif 834.endif 835BUILDENV_DIR?= ${.CURDIR} 836buildenv: .PHONY 837 @echo Entering world for ${TARGET_ARCH}:${TARGET} 838.if ${BUILDENV_SHELL:M*zsh*} 839 @echo For ZSH you must run: export CPUTYPE=${TARGET_CPUTYPE} 840.endif 841 @cd ${BUILDENV_DIR} && env ${WMAKEENV} BUILDENV=1 ${BUILDENV_SHELL} \ 842 || true 843 844TOOLCHAIN_TGTS= ${WMAKE_TGTS:Neverything:Nbuild${libcompat}} 845toolchain: ${TOOLCHAIN_TGTS} .PHONY 846kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries} .PHONY 847 848# 849# installcheck 850# 851# Checks to be sure system is ready for installworld/installkernel. 852# 853installcheck: _installcheck_world _installcheck_kernel .PHONY 854_installcheck_world: .PHONY 855_installcheck_kernel: .PHONY 856 857# 858# Require DESTDIR to be set if installing for a different architecture or 859# using the user/group database in the source tree. 860# 861.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE} || \ 862 defined(DB_FROM_SRC) 863.if !make(distributeworld) 864_installcheck_world: __installcheck_DESTDIR 865_installcheck_kernel: __installcheck_DESTDIR 866__installcheck_DESTDIR: .PHONY 867.if !defined(DESTDIR) || empty(DESTDIR) 868 @echo "ERROR: Please set DESTDIR!"; \ 869 false 870.endif 871.endif 872.endif 873 874.if !defined(DB_FROM_SRC) 875# 876# Check for missing UIDs/GIDs. 877# 878CHECK_UIDS= auditdistd 879CHECK_GIDS= audit 880.if ${MK_SENDMAIL} != "no" 881CHECK_UIDS+= smmsp 882CHECK_GIDS+= smmsp 883.endif 884.if ${MK_PF} != "no" 885CHECK_UIDS+= proxy 886CHECK_GIDS+= proxy authpf 887.endif 888.if ${MK_UNBOUND} != "no" 889CHECK_UIDS+= unbound 890CHECK_GIDS+= unbound 891.endif 892_installcheck_world: __installcheck_UGID 893__installcheck_UGID: .PHONY 894.for uid in ${CHECK_UIDS} 895 @if ! `id -u ${uid} >/dev/null 2>&1`; then \ 896 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \ 897 false; \ 898 fi 899.endfor 900.for gid in ${CHECK_GIDS} 901 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \ 902 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \ 903 false; \ 904 fi 905.endfor 906.endif 907 908# 909# Required install tools to be saved in a scratch dir for safety. 910# 911.if ${MK_ZONEINFO} != "no" 912_zoneinfo= zic tzsetup 913.endif 914 915ITOOLS= [ awk cap_mkdb cat chflags chmod chown cmp cp \ 916 date echo egrep find grep id install ${_install-info} \ 917 ln make mkdir mtree mv pwd_mkdb \ 918 rm sed services_mkdb sh strip sysctl test true uname wc ${_zoneinfo} \ 919 ${LOCAL_ITOOLS} 920 921# Needed for share/man 922.if ${MK_MAN_UTILS} != "no" 923ITOOLS+=makewhatis 924.endif 925 926# 927# distributeworld 928# 929# Distributes everything compiled by a `buildworld'. 930# 931# installworld 932# 933# Installs everything compiled by a 'buildworld'. 934# 935 936# Non-base distributions produced by the base system 937EXTRA_DISTRIBUTIONS= doc 938.if defined(LIBCOMPAT) 939EXTRA_DISTRIBUTIONS+= lib${libcompat} 940.endif 941.if ${MK_TESTS} != "no" 942EXTRA_DISTRIBUTIONS+= tests 943.endif 944 945DEBUG_DISTRIBUTIONS= 946.if ${MK_DEBUG_FILES} != "no" 947DEBUG_DISTRIBUTIONS+= base ${EXTRA_DISTRIBUTIONS:S,doc,,:S,tests,,} 948.endif 949 950MTREE_MAGIC?= mtree 2.0 951 952distributeworld installworld stageworld: _installcheck_world .PHONY 953 mkdir -p ${INSTALLTMP} 954 progs=$$(for prog in ${ITOOLS}; do \ 955 if progpath=`which $$prog`; then \ 956 echo $$progpath; \ 957 else \ 958 echo "Required tool $$prog not found in PATH." >&2; \ 959 exit 1; \ 960 fi; \ 961 done); \ 962 libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | \ 963 while read line; do \ 964 set -- $$line; \ 965 if [ "$$2 $$3" != "not found" ]; then \ 966 echo $$2; \ 967 else \ 968 echo "Required library $$1 not found." >&2; \ 969 exit 1; \ 970 fi; \ 971 done); \ 972 cp $$libs $$progs ${INSTALLTMP} 973 cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale 974.if defined(NO_ROOT) 975 -mkdir -p ${METALOG:H} 976 echo "#${MTREE_MAGIC}" > ${METALOG} 977.endif 978.if make(distributeworld) 979.for dist in ${EXTRA_DISTRIBUTIONS} 980 -mkdir ${DESTDIR}/${DISTDIR}/${dist} 981 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \ 982 -p ${DESTDIR}/${DISTDIR}/${dist} >/dev/null 983 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 984 -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null 985 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 986 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/include >/dev/null 987.if ${MK_DEBUG_FILES} != "no" 988 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \ 989 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib >/dev/null 990.endif 991.if defined(LIBCOMPAT) 992 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ 993 -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null 994.if ${MK_DEBUG_FILES} != "no" 995 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ 996 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib/debug/usr >/dev/null 997.endif 998.endif 999.if ${MK_TESTS} != "no" && ${dist} == "tests" 1000 -mkdir -p ${DESTDIR}/${DISTDIR}/${dist}${TESTSBASE} 1001 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \ 1002 -p ${DESTDIR}/${DISTDIR}/${dist}${TESTSBASE} >/dev/null 1003.if ${MK_DEBUG_FILES} != "no" 1004 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \ 1005 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib/debug/${TESTSBASE} >/dev/null 1006.endif 1007.endif 1008.if defined(NO_ROOT) 1009 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \ 1010 sed -e 's#^\./#./${dist}/#' >> ${METALOG} 1011 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.usr.dist | \ 1012 sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG} 1013 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.include.dist | \ 1014 sed -e 's#^\./#./${dist}/usr/include/#' >> ${METALOG} 1015.if defined(LIBCOMPAT) 1016 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist | \ 1017 sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG} 1018.endif 1019.endif 1020.endfor 1021 -mkdir ${DESTDIR}/${DISTDIR}/base 1022 ${_+_}cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \ 1023 METALOG=${METALOG} ${IMAKE_INSTALL} ${IMAKE_MTREE} \ 1024 DISTBASE=/base DESTDIR=${DESTDIR}/${DISTDIR}/base \ 1025 LOCAL_MTREE=${LOCAL_MTREE:Q} distrib-dirs 1026.endif 1027 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \ 1028 ${IMAKEENV} rm -rf ${INSTALLTMP} 1029.if make(distributeworld) 1030.for dist in ${EXTRA_DISTRIBUTIONS} 1031 find ${DESTDIR}/${DISTDIR}/${dist} -mindepth 1 -type d -empty -delete 1032.endfor 1033.if defined(NO_ROOT) 1034.for dist in base ${EXTRA_DISTRIBUTIONS} 1035 @# For each file that exists in this dist, print the corresponding 1036 @# line from the METALOG. This relies on the fact that 1037 @# a line containing only the filename will sort immediately before 1038 @# the relevant mtree line. 1039 cd ${DESTDIR}/${DISTDIR}; \ 1040 find ./${dist} | sort -u ${METALOG} - | \ 1041 awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \ 1042 ${DESTDIR}/${DISTDIR}/${dist}.meta 1043.endfor 1044.for dist in ${DEBUG_DISTRIBUTIONS} 1045 @# For each file that exists in this dist, print the corresponding 1046 @# line from the METALOG. This relies on the fact that 1047 @# a line containing only the filename will sort immediately before 1048 @# the relevant mtree line. 1049 cd ${DESTDIR}/${DISTDIR}; \ 1050 find ./${dist}/usr/lib/debug | sort -u ${METALOG} - | \ 1051 awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \ 1052 ${DESTDIR}/${DISTDIR}/${dist}.debug.meta 1053.endfor 1054.endif 1055.endif 1056 1057packageworld: .PHONY 1058.for dist in base ${EXTRA_DISTRIBUTIONS} 1059.if defined(NO_ROOT) 1060 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ 1061 tar cvf - --exclude usr/lib/debug \ 1062 @${DESTDIR}/${DISTDIR}/${dist}.meta | \ 1063 ${XZ_CMD} > ${PACKAGEDIR}/${dist}.txz 1064.else 1065 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ 1066 tar cvf - --exclude usr/lib/debug . | \ 1067 ${XZ_CMD} > ${PACKAGEDIR}/${dist}.txz 1068.endif 1069.endfor 1070 1071.for dist in ${DEBUG_DISTRIBUTIONS} 1072. if defined(NO_ROOT) 1073 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ 1074 tar cvf - @${DESTDIR}/${DISTDIR}/${dist}.debug.meta | \ 1075 ${XZ_CMD} > ${PACKAGEDIR}/${dist}-dbg.txz 1076. else 1077 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ 1078 tar cvLf - usr/lib/debug | \ 1079 ${XZ_CMD} > ${PACKAGEDIR}/${dist}-dbg.txz 1080. endif 1081.endfor 1082 1083# 1084# reinstall 1085# 1086# If you have a build server, you can NFS mount the source and obj directories 1087# and do a 'make reinstall' on the *client* to install new binaries from the 1088# most recent server build. 1089# 1090restage reinstall: .MAKE .PHONY 1091 @echo "--------------------------------------------------------------" 1092 @echo ">>> Making hierarchy" 1093 @echo "--------------------------------------------------------------" 1094 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 \ 1095 LOCAL_MTREE=${LOCAL_MTREE:Q} hierarchy 1096.if make(restage) 1097 @echo "--------------------------------------------------------------" 1098 @echo ">>> Making distribution" 1099 @echo "--------------------------------------------------------------" 1100 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 \ 1101 LOCAL_MTREE=${LOCAL_MTREE:Q} distribution 1102.endif 1103 @echo 1104 @echo "--------------------------------------------------------------" 1105 @echo ">>> Installing everything" 1106 @echo "--------------------------------------------------------------" 1107 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install 1108.if defined(LIBCOMPAT) 1109 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install${libcompat} 1110.endif 1111 1112redistribute: .MAKE .PHONY 1113 @echo "--------------------------------------------------------------" 1114 @echo ">>> Distributing everything" 1115 @echo "--------------------------------------------------------------" 1116 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute 1117.if defined(LIBCOMPAT) 1118 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute${libcompat} \ 1119 DISTRIBUTION=lib${libcompat} 1120.endif 1121 1122distrib-dirs distribution: .MAKE .PHONY 1123 ${_+_}cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \ 1124 ${IMAKE_INSTALL} ${IMAKE_MTREE} METALOG=${METALOG} ${.TARGET} 1125.if make(distribution) 1126 ${_+_}cd ${.CURDIR}; ${CROSSENV} PATH=${TMPPATH} \ 1127 ${MAKE} -f Makefile.inc1 ${IMAKE_INSTALL} \ 1128 METALOG=${METALOG} MK_TESTS=no installconfig 1129.endif 1130 1131# 1132# buildkernel and installkernel 1133# 1134# Which kernels to build and/or install is specified by setting 1135# KERNCONF. If not defined a GENERIC kernel is built/installed. 1136# Only the existing (depending TARGET) config files are used 1137# for building kernels and only the first of these is designated 1138# as the one being installed. 1139# 1140# Note that we have to use TARGET instead of TARGET_ARCH when 1141# we're in kernel-land. Since only TARGET_ARCH is (expected) to 1142# be set to cross-build, we have to make sure TARGET is set 1143# properly. 1144 1145.if defined(KERNFAST) 1146NO_KERNELCLEAN= t 1147NO_KERNELCONFIG= t 1148NO_KERNELOBJ= t 1149# Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah 1150.if !defined(KERNCONF) && ${KERNFAST} != "1" 1151KERNCONF=${KERNFAST} 1152.endif 1153.endif 1154.if ${TARGET_ARCH} == "powerpc64" 1155KERNCONF?= GENERIC64 1156.else 1157KERNCONF?= GENERIC 1158.endif 1159INSTKERNNAME?= kernel 1160 1161KERNSRCDIR?= ${.CURDIR}/sys 1162KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf 1163KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR} 1164KERNCONFDIR?= ${KRNLCONFDIR} 1165 1166BUILDKERNELS= 1167INSTALLKERNEL= 1168.if defined(NO_INSTALLKERNEL) 1169# All of the BUILDKERNELS loops start at index 1. 1170BUILDKERNELS+= dummy 1171.endif 1172.for _kernel in ${KERNCONF} 1173.if exists(${KERNCONFDIR}/${_kernel}) 1174BUILDKERNELS+= ${_kernel} 1175.if empty(INSTALLKERNEL) && !defined(NO_INSTALLKERNEL) 1176INSTALLKERNEL= ${_kernel} 1177.endif 1178.endif 1179.endfor 1180 1181${WMAKE_TGTS:N_worldtmp:Nbuild${libcompat}} ${.ALLTARGETS:M_*:N_worldtmp}: .MAKE .PHONY 1182 1183# 1184# buildkernel 1185# 1186# Builds all kernels defined by BUILDKERNELS. 1187# 1188buildkernel: .MAKE .PHONY 1189.if empty(BUILDKERNELS:Ndummy) 1190 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \ 1191 false 1192.endif 1193 @echo 1194.for _kernel in ${BUILDKERNELS:Ndummy} 1195 @echo "--------------------------------------------------------------" 1196 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`" 1197 @echo "--------------------------------------------------------------" 1198 @echo "===> ${_kernel}" 1199 mkdir -p ${KRNLOBJDIR} 1200.if !defined(NO_KERNELCONFIG) 1201 @echo 1202 @echo "--------------------------------------------------------------" 1203 @echo ">>> stage 1: configuring the kernel" 1204 @echo "--------------------------------------------------------------" 1205 cd ${KRNLCONFDIR}; \ 1206 PATH=${TMPPATH} \ 1207 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \ 1208 -I '${KERNCONFDIR}' '${KERNCONFDIR}/${_kernel}' 1209.endif 1210.if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN) 1211 @echo 1212 @echo "--------------------------------------------------------------" 1213 @echo ">>> stage 2.1: cleaning up the object tree" 1214 @echo "--------------------------------------------------------------" 1215 ${_+_}cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR} 1216.endif 1217.if !defined(NO_KERNELOBJ) 1218 @echo 1219 @echo "--------------------------------------------------------------" 1220 @echo ">>> stage 2.2: rebuilding the object tree" 1221 @echo "--------------------------------------------------------------" 1222 ${_+_}cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj 1223.endif 1224 @echo 1225 @echo "--------------------------------------------------------------" 1226 @echo ">>> stage 2.3: build tools" 1227 @echo "--------------------------------------------------------------" 1228 ${_+_}cd ${.CURDIR}; ${KTMAKE} kernel-tools 1229 @echo 1230 @echo "--------------------------------------------------------------" 1231 @echo ">>> stage 3.1: building everything" 1232 @echo "--------------------------------------------------------------" 1233 ${_+_}cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ 1234 @echo "--------------------------------------------------------------" 1235 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`" 1236 @echo "--------------------------------------------------------------" 1237.endfor 1238 1239NO_INSTALLEXTRAKERNELS?= yes 1240 1241# 1242# installkernel, etc. 1243# 1244# Install the kernel defined by INSTALLKERNEL 1245# 1246installkernel installkernel.debug \ 1247reinstallkernel reinstallkernel.debug: _installcheck_kernel .PHONY 1248.if !defined(NO_INSTALLKERNEL) 1249.if empty(INSTALLKERNEL) 1250 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \ 1251 false 1252.endif 1253 @echo "--------------------------------------------------------------" 1254 @echo ">>> Installing kernel ${INSTALLKERNEL}" 1255 @echo "--------------------------------------------------------------" 1256 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ 1257 ${CROSSENV} PATH=${TMPPATH} \ 1258 ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//} 1259.endif 1260.if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes" 1261.for _kernel in ${BUILDKERNELS:[2..-1]} 1262 @echo "--------------------------------------------------------------" 1263 @echo ">>> Installing kernel ${_kernel}" 1264 @echo "--------------------------------------------------------------" 1265 cd ${KRNLOBJDIR}/${_kernel}; \ 1266 ${CROSSENV} PATH=${TMPPATH} \ 1267 ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME}.${_kernel} ${.TARGET:S/kernel//} 1268.endfor 1269.endif 1270 1271distributekernel distributekernel.debug: .PHONY 1272.if !defined(NO_INSTALLKERNEL) 1273.if empty(INSTALLKERNEL) 1274 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \ 1275 false 1276.endif 1277 mkdir -p ${DESTDIR}/${DISTDIR} 1278.if defined(NO_ROOT) 1279 @echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.premeta 1280.endif 1281 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ 1282 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.premeta/} \ 1283 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} KERNEL=${INSTKERNNAME} \ 1284 DESTDIR=${INSTALL_DDIR}/kernel \ 1285 ${.TARGET:S/distributekernel/install/} 1286.if defined(NO_ROOT) 1287 @sed -e 's|^./kernel|.|' ${DESTDIR}/${DISTDIR}/kernel.premeta > \ 1288 ${DESTDIR}/${DISTDIR}/kernel.meta 1289.endif 1290.endif 1291.if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes" 1292.for _kernel in ${BUILDKERNELS:[2..-1]} 1293.if defined(NO_ROOT) 1294 @echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta 1295.endif 1296 cd ${KRNLOBJDIR}/${_kernel}; \ 1297 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.${_kernel}.premeta/} \ 1298 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} \ 1299 KERNEL=${INSTKERNNAME}.${_kernel} \ 1300 DESTDIR=${INSTALL_DDIR}/kernel.${_kernel} \ 1301 ${.TARGET:S/distributekernel/install/} 1302.if defined(NO_ROOT) 1303 @sed -e "s|^./kernel.${_kernel}|.|" \ 1304 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta > \ 1305 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta 1306.endif 1307.endfor 1308.endif 1309 1310packagekernel: .PHONY 1311.if defined(NO_ROOT) 1312.if !defined(NO_INSTALLKERNEL) 1313 cd ${DESTDIR}/${DISTDIR}/kernel; \ 1314 tar cvf - --exclude '*.debug' \ 1315 @${DESTDIR}/${DISTDIR}/kernel.meta | \ 1316 ${XZ_CMD} > ${PACKAGEDIR}/kernel.txz 1317.endif 1318 cd ${DESTDIR}/${DISTDIR}/kernel; \ 1319 tar cvf - --include '*/*/*.debug' \ 1320 @${DESTDIR}/${DISTDIR}/kernel.meta | \ 1321 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel-dbg.txz 1322.if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes" 1323.for _kernel in ${BUILDKERNELS:[2..-1]} 1324 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ 1325 tar cvf - --exclude '*.debug' \ 1326 @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta | \ 1327 ${XZ_CMD} > ${PACKAGEDIR}/kernel.${_kernel}.txz 1328 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ 1329 tar cvf - --include '*/*/*.debug' \ 1330 @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta | \ 1331 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}-dbg.txz 1332.endfor 1333.endif 1334.else 1335.if !defined(NO_INSTALLKERNEL) 1336 cd ${DESTDIR}/${DISTDIR}/kernel; \ 1337 tar cvf - --exclude '*.debug' . | \ 1338 ${XZ_CMD} > ${PACKAGEDIR}/kernel.txz 1339.endif 1340 cd ${DESTDIR}/${DISTDIR}/kernel; \ 1341 tar cvf - --include '*/*/*.debug' $$(eval find .) | \ 1342 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel-dbg.txz 1343.if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes" 1344.for _kernel in ${BUILDKERNELS:[2..-1]} 1345 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ 1346 tar cvf - --exclude '*.debug' . | \ 1347 ${XZ_CMD} > ${PACKAGEDIR}/kernel.${_kernel}.txz 1348 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ 1349 tar cvf - --include '*/*/*.debug' $$(eval find .) | \ 1350 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}-dbg.txz 1351.endfor 1352.endif 1353.endif 1354 1355stagekernel: .PHONY 1356 ${_+_}${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} distributekernel 1357 1358PORTSDIR?= /usr/ports 1359WSTAGEDIR?= ${MAKEOBJDIRPREFIX}${.CURDIR}/${TARGET}.${TARGET_ARCH}/worldstage 1360KSTAGEDIR?= ${MAKEOBJDIRPREFIX}${.CURDIR}/${TARGET}.${TARGET_ARCH}/kernelstage 1361REPODIR?= ${MAKEOBJDIRPREFIX}${.CURDIR}/repo 1362PKGSIGNKEY?= # empty 1363 1364.ORDER: stage-packages create-packages 1365.ORDER: create-packages create-world-packages 1366.ORDER: create-packages create-kernel-packages 1367.ORDER: create-packages sign-packages 1368 1369_pkgbootstrap: .PHONY 1370.if !exists(${LOCALBASE}/sbin/pkg) 1371 @env ASSUME_ALWAYS_YES=YES pkg bootstrap 1372.endif 1373 1374packages: .PHONY 1375 ${_+_}${MAKE} -C ${.CURDIR} PKG_VERSION=${PKG_VERSION} real-packages 1376 1377package-pkg: .PHONY 1378 rm -rf /tmp/ports.${TARGET} || : 1379 env ${WMAKEENV:Q} SRCDIR=${.CURDIR} PORTSDIR=${PORTSDIR} REVISION=${_REVISION} \ 1380 PKG_VERSION=${PKG_VERSION} REPODIR=${REPODIR} WSTAGEDIR=${WSTAGEDIR} \ 1381 sh ${.CURDIR}/release/scripts/make-pkg-package.sh 1382 1383real-packages: stage-packages create-packages sign-packages .PHONY 1384 1385stage-packages: .PHONY 1386 @mkdir -p ${REPODIR} ${WSTAGEDIR} ${KSTAGEDIR} 1387 ${_+_}@cd ${.CURDIR}; \ 1388 ${MAKE} DESTDIR=${WSTAGEDIR} -DNO_ROOT -B stageworld ; \ 1389 ${MAKE} DESTDIR=${KSTAGEDIR} -DNO_ROOT -B stagekernel 1390 1391create-packages: _pkgbootstrap .PHONY 1392 @mkdir -p ${REPODIR} 1393 ${_+_}@cd ${.CURDIR}; \ 1394 ${MAKE} DESTDIR=${WSTAGEDIR} \ 1395 PKG_VERSION=${PKG_VERSION} create-world-packages ; \ 1396 ${MAKE} DESTDIR=${KSTAGEDIR} \ 1397 PKG_VERSION=${PKG_VERSION} DISTDIR=kernel \ 1398 create-kernel-packages 1399 1400create-world-packages: _pkgbootstrap .PHONY 1401 @rm -f ${WSTAGEDIR}/*.plist 2>/dev/null || : 1402 @cd ${WSTAGEDIR} ; \ 1403 awk -f ${SRCDIR}/release/scripts/mtree-to-plist.awk \ 1404 ${WSTAGEDIR}/METALOG 1405 @for plist in ${WSTAGEDIR}/*.plist; do \ 1406 plist=$${plist##*/} ; \ 1407 pkgname=$${plist%.plist} ; \ 1408 sh ${SRCDIR}/release/packages/generate-ucl.sh -o $${pkgname} \ 1409 -s ${SRCDIR} -u ${WSTAGEDIR}/$${pkgname}.ucl ; \ 1410 done 1411 @for plist in ${WSTAGEDIR}/*.plist; do \ 1412 plist=$${plist##*/} ; \ 1413 pkgname=$${plist%.plist} ; \ 1414 awk -F\" ' \ 1415 /^name/ { printf("===> Creating %s-", $$2); next } \ 1416 /^version/ { print $$2; next } \ 1417 ' ${WSTAGEDIR}/$${pkgname}.ucl ; \ 1418 pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh -o ALLOW_BASE_SHLIBS=yes \ 1419 create -M ${WSTAGEDIR}/$${pkgname}.ucl \ 1420 -p ${WSTAGEDIR}/$${pkgname}.plist \ 1421 -r ${WSTAGEDIR} \ 1422 -o ${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION} ; \ 1423 done 1424 1425create-kernel-packages: _pkgbootstrap .PHONY 1426.if exists(${KSTAGEDIR}/kernel.meta) 1427.for flavor in "" -debug 1428 @cd ${KSTAGEDIR}/${DISTDIR} ; \ 1429 awk -f ${SRCDIR}/release/scripts/mtree-to-plist.awk \ 1430 -v kernel=yes -v _kernconf=${INSTALLKERNEL} \ 1431 ${KSTAGEDIR}/kernel.meta ; \ 1432 cap_arg=`cd ${SRCDIR}/etc ; ${MAKE} -VCAP_MKDB_ENDIAN` ; \ 1433 pwd_arg=`cd ${SRCDIR}/etc ; ${MAKE} -VPWD_MKDB_ENDIAN` ; \ 1434 sed -e "s/%VERSION%/${PKG_VERSION}/" \ 1435 -e "s/%PKGNAME%/kernel-${INSTALLKERNEL:tl}${flavor}/" \ 1436 -e "s/%COMMENT%/FreeBSD ${INSTALLKERNEL} kernel ${flavor}/" \ 1437 -e "s/%DESC%/FreeBSD ${INSTALLKERNEL} kernel ${flavor}/" \ 1438 -e "s/%CAP_MKDB_ENDIAN%/$${cap_arg}/g" \ 1439 -e "s/%PWD_MKDB_ENDIAN%/$${pwd_arg}/g" \ 1440 ${SRCDIR}/release/packages/kernel.ucl \ 1441 > ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl ; \ 1442 awk -F\" ' \ 1443 /name/ { printf("===> Creating %s-", $$2); next } \ 1444 /version/ {print $$2; next } ' \ 1445 ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl ; \ 1446 pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh -o ALLOW_BASE_SHLIBS=yes \ 1447 create -M ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl \ 1448 -p ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.plist \ 1449 -r ${KSTAGEDIR}/${DISTDIR} \ 1450 -o ${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION} 1451.endfor 1452.endif 1453.if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes" 1454.for _kernel in ${BUILDKERNELS:[2..-1]} 1455.if exists(${KSTAGEDIR}/kernel.${_kernel}.meta) 1456.for flavor in "" -debug 1457 @cd ${KSTAGEDIR}/kernel.${_kernel} ; \ 1458 awk -f ${SRCDIR}/release/scripts/mtree-to-plist.awk \ 1459 -v kernel=yes -v _kernconf=${_kernel} \ 1460 ${KSTAGEDIR}/kernel.${_kernel}.meta ; \ 1461 cap_arg=`cd ${SRCDIR}/etc ; ${MAKE} -VCAP_MKDB_ENDIAN` ; \ 1462 pwd_arg=`cd ${SRCDIR}/etc ; ${MAKE} -VPWD_MKDB_ENDIAN` ; \ 1463 sed -e "s/%VERSION%/${PKG_VERSION}/" \ 1464 -e "s/%PKGNAME%/kernel-${_kernel:tl}${flavor}/" \ 1465 -e "s/%COMMENT%/FreeBSD ${_kernel} kernel ${flavor}/" \ 1466 -e "s/%DESC%/FreeBSD ${_kernel} kernel ${flavor}/" \ 1467 -e "s/%CAP_MKDB_ENDIAN%/$${cap_arg}/g" \ 1468 -e "s/%PWD_MKDB_ENDIAN%/$${pwd_arg}/g" \ 1469 ${SRCDIR}/release/packages/kernel.ucl \ 1470 > ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.ucl ; \ 1471 awk -F\" ' \ 1472 /name/ { printf("===> Creating %s-", $$2); next } \ 1473 /version/ {print $$2; next } ' \ 1474 ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.ucl ; \ 1475 pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh -o ALLOW_BASE_SHLIBS=yes \ 1476 create -M ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.ucl \ 1477 -p ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.plist \ 1478 -r ${KSTAGEDIR}/kernel.${_kernel} \ 1479 -o ${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION} 1480.endfor 1481.endif 1482.endfor 1483.endif 1484 1485sign-packages: _pkgbootstrap .PHONY 1486 @[ -L "${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/latest" ] && \ 1487 unlink ${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/latest ; \ 1488 pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh repo \ 1489 -o ${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION} \ 1490 ${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION} \ 1491 ${PKGSIGNKEY} ; \ 1492 ln -s ${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION} \ 1493 ${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/latest 1494 1495# 1496# 1497# checkworld 1498# 1499# Run test suite on installed world. 1500# 1501checkworld: .PHONY 1502 @if [ ! -x ${LOCALBASE}/bin/kyua ]; then \ 1503 echo "You need kyua (devel/kyua) to run the test suite." | /usr/bin/fmt; \ 1504 exit 1; \ 1505 fi 1506 ${_+_}${LOCALBASE}/bin/kyua test -k ${TESTSBASE}/Kyuafile 1507 1508# 1509# 1510# doxygen 1511# 1512# Build the API documentation with doxygen 1513# 1514doxygen: .PHONY 1515 @if [ ! -x ${LOCALBASE}/bin/doxygen ]; then \ 1516 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \ 1517 exit 1; \ 1518 fi 1519 ${_+_}cd ${.CURDIR}/tools/kerneldoc/subsys; ${MAKE} obj all 1520 1521# 1522# update 1523# 1524# Update the source tree(s), by running svn/svnup to update to the 1525# latest copy. 1526# 1527update: .PHONY 1528.if defined(SVN_UPDATE) 1529 @echo "--------------------------------------------------------------" 1530 @echo ">>> Updating ${.CURDIR} using Subversion" 1531 @echo "--------------------------------------------------------------" 1532 @(cd ${.CURDIR}; ${SVN} update ${SVNFLAGS}) 1533.endif 1534 1535# 1536# ------------------------------------------------------------------------ 1537# 1538# From here onwards are utility targets used by the 'make world' and 1539# related targets. If your 'world' breaks, you may like to try to fix 1540# the problem and manually run the following targets to attempt to 1541# complete the build. Beware, this is *not* guaranteed to work, you 1542# need to have a pretty good grip on the current state of the system 1543# to attempt to manually finish it. If in doubt, 'make world' again. 1544# 1545 1546# 1547# legacy: Build compatibility shims for the next three targets. This is a 1548# minimal set of tools and shims necessary to compensate for older systems 1549# which don't have the APIs required by the targets built in bootstrap-tools, 1550# build-tools or cross-tools. 1551# 1552 1553# ELF Tool Chain libraries are needed for ELF tools and dtrace tools. 1554# r296685 fix cross-endian objcopy 1555.if ${BOOTSTRAPPING} < 1100102 1556_elftoolchain_libs= lib/libelf lib/libdwarf 1557.endif 1558 1559legacy: .PHONY 1560.if ${BOOTSTRAPPING} < ${MINIMUM_SUPPORTED_OSREL} && ${BOOTSTRAPPING} != 0 1561 @echo "ERROR: Source upgrades from versions prior to ${MINIMUM_SUPPORTED_REL} are not supported."; \ 1562 false 1563.endif 1564.for _tool in tools/build ${_elftoolchain_libs} 1565 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,all,install)"; \ 1566 cd ${.CURDIR}/${_tool}; \ 1567 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1568 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \ 1569 ${MAKE} DIRPRFX=${_tool}/ MK_INCLUDES=no all; \ 1570 ${MAKE} DIRPRFX=${_tool}/ MK_INCLUDES=no \ 1571 DESTDIR=${MAKEOBJDIRPREFIX}/legacy install 1572.endfor 1573 1574# 1575# bootstrap-tools: Build tools needed for compatibility. These are binaries that 1576# are built to build other binaries in the system. However, the focus of these 1577# binaries is usually quite narrow. Bootstrap tools use the host's compiler and 1578# libraries, augmented by -legacy. 1579# 1580_bt= _bootstrap-tools 1581 1582.if ${MK_GAMES} != "no" 1583_strfile= usr.bin/fortune/strfile 1584.endif 1585 1586.if ${MK_GCC} != "no" && ${MK_CXX} != "no" 1587_gperf= gnu/usr.bin/gperf 1588.endif 1589 1590.if ${MK_SHAREDOCS} != "no" && ${MK_GROFF} != "no" 1591_groff= gnu/usr.bin/groff \ 1592 usr.bin/soelim 1593.endif 1594 1595.if ${MK_VT} != "no" 1596_vtfontcvt= usr.bin/vtfontcvt 1597.endif 1598 1599.if ${BOOTSTRAPPING} < 1000033 1600_libopenbsd= lib/libopenbsd 1601_m4= usr.bin/m4 1602_lex= usr.bin/lex 1603 1604${_bt}-usr.bin/m4: ${_bt}-lib/libopenbsd 1605${_bt}-usr.bin/lex: ${_bt}-usr.bin/m4 1606.endif 1607 1608.if ${BOOTSTRAPPING} < 1000026 1609_nmtree= lib/libnetbsd \ 1610 usr.sbin/nmtree 1611 1612${_bt}-usr.sbin/nmtree: ${_bt}-lib/libnetbsd 1613.endif 1614 1615.if ${BOOTSTRAPPING} < 1000027 1616_cat= bin/cat 1617.endif 1618 1619# r264059 support for status= 1620.if ${BOOTSTRAPPING} < 1100017 1621_dd= bin/dd 1622.endif 1623 1624# r277259 crunchide: Correct 64-bit section header offset 1625# r281674 crunchide: always include both 32- and 64-bit ELF support 1626.if ${BOOTSTRAPPING} < 1100078 1627_crunchide= usr.sbin/crunch/crunchide 1628.endif 1629 1630# r285986 crunchen: use STRIPBIN rather than STRIP 1631# 1100113: Support MK_AUTO_OBJ 1632# 1200006: META_MODE fixes 1633.if ${BOOTSTRAPPING} < 1100078 || \ 1634 (${MK_AUTO_OBJ} == "yes" && ${BOOTSTRAPPING} < 1100114) || \ 1635 (${MK_META_MODE} == "yes" && ${BOOTSTRAPPING} < 1200006) 1636_crunchgen= usr.sbin/crunch/crunchgen 1637.endif 1638 1639# r296926 -P keymap search path, MFC to stable/10 in r298297 1640.if ${BOOTSTRAPPING} < 1003501 || \ 1641 (${BOOTSTRAPPING} >= 1100000 && ${BOOTSTRAPPING} < 1100103) 1642_kbdcontrol= usr.sbin/kbdcontrol 1643.endif 1644 1645_yacc= lib/liby \ 1646 usr.bin/yacc 1647 1648${_bt}-usr.bin/yacc: ${_bt}-lib/liby 1649 1650.if ${MK_BSNMP} != "no" 1651_gensnmptree= usr.sbin/bsnmpd/gensnmptree 1652.endif 1653 1654# We need to build tblgen when we're building clang either as 1655# the bootstrap compiler, or as the part of the normal build. 1656.if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_CLANG} != "no" 1657_clang_tblgen= \ 1658 lib/clang/libllvmsupport \ 1659 lib/clang/libllvmtablegen \ 1660 usr.bin/clang/llvm-tblgen \ 1661 usr.bin/clang/clang-tblgen 1662 1663${_bt}-usr.bin/clang/clang-tblgen: ${_bt}-lib/clang/libllvmtablegen ${_bt}-lib/clang/libllvmsupport 1664${_bt}-usr.bin/clang/llvm-tblgen: ${_bt}-lib/clang/libllvmtablegen ${_bt}-lib/clang/libllvmsupport 1665.endif 1666 1667# Default to building the GPL DTC, but build the BSDL one if users explicitly 1668# request it. 1669_dtc= usr.bin/dtc 1670.if ${MK_GPL_DTC} != "no" 1671_dtc= gnu/usr.bin/dtc 1672.endif 1673 1674.if ${MK_KERBEROS} != "no" 1675_kerberos5_bootstrap_tools= \ 1676 kerberos5/tools/make-roken \ 1677 kerberos5/lib/libroken \ 1678 kerberos5/lib/libvers \ 1679 kerberos5/tools/asn1_compile \ 1680 kerberos5/tools/slc \ 1681 usr.bin/compile_et 1682 1683.ORDER: ${_kerberos5_bootstrap_tools:C/^/${_bt}-/g} 1684.endif 1685 1686# r283777 makewhatis(1) replaced with mandoc version which builds a database. 1687.if ${MK_MANDOCDB} != "no" && ${BOOTSTRAPPING} < 1100075 1688_libopenbsd?= lib/libopenbsd 1689_makewhatis= lib/libsqlite3 \ 1690 usr.bin/mandoc 1691${_bt}-usr.bin/mandoc: ${_bt}-lib/libopenbsd ${_bt}-lib/libsqlite3 1692.endif 1693 1694bootstrap-tools: .PHONY 1695 1696# Please document (add comment) why something is in 'bootstrap-tools'. 1697# Try to bound the building of the bootstrap-tool to just the 1698# FreeBSD versions that need the tool built at this stage of the build. 1699.for _tool in \ 1700 ${_clang_tblgen} \ 1701 ${_kerberos5_bootstrap_tools} \ 1702 ${_strfile} \ 1703 ${_gperf} \ 1704 ${_groff} \ 1705 ${_dtc} \ 1706 ${_cat} \ 1707 ${_dd} \ 1708 ${_kbdcontrol} \ 1709 usr.bin/lorder \ 1710 ${_libopenbsd} \ 1711 ${_makewhatis} \ 1712 usr.bin/rpcgen \ 1713 ${_yacc} \ 1714 ${_m4} \ 1715 ${_lex} \ 1716 usr.bin/xinstall \ 1717 ${_gensnmptree} \ 1718 usr.sbin/config \ 1719 ${_crunchide} \ 1720 ${_crunchgen} \ 1721 ${_nmtree} \ 1722 ${_vtfontcvt} \ 1723 usr.bin/localedef 1724${_bt}-${_tool}: .PHONY .MAKE 1725 ${_+_}@${ECHODIR} "===> ${_tool} (obj,all,install)"; \ 1726 cd ${.CURDIR}/${_tool}; \ 1727 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1728 ${MAKE} DIRPRFX=${_tool}/ all; \ 1729 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install 1730 1731bootstrap-tools: ${_bt}-${_tool} 1732.endfor 1733 1734# 1735# build-tools: Build special purpose build tools 1736# 1737.if !defined(NO_SHARE) 1738_share= share/syscons/scrnmaps 1739.endif 1740 1741.if ${MK_GCC} != "no" 1742_gcc_tools= gnu/usr.bin/cc/cc_tools 1743.endif 1744 1745.if ${MK_RESCUE} != "no" 1746# rescue includes programs that have build-tools targets 1747_rescue=rescue/rescue 1748.endif 1749 1750.for _tool in \ 1751 bin/csh \ 1752 bin/sh \ 1753 ${LOCAL_TOOL_DIRS} \ 1754 lib/ncurses/ncurses \ 1755 lib/ncurses/ncursesw \ 1756 ${_rescue} \ 1757 ${_share} \ 1758 usr.bin/awk \ 1759 lib/libmagic \ 1760 usr.bin/mkesdb_static \ 1761 usr.bin/mkcsmapper_static \ 1762 usr.bin/vi/catalog 1763build-tools_${_tool}: .PHONY 1764 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \ 1765 cd ${.CURDIR}/${_tool}; \ 1766 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1767 ${MAKE} DIRPRFX=${_tool}/ build-tools 1768build-tools: build-tools_${_tool} 1769.endfor 1770.for _tool in \ 1771 ${_gcc_tools} 1772build-tools_${_tool}: .PHONY 1773 ${_+_}@${ECHODIR} "===> ${_tool} (obj,all)"; \ 1774 cd ${.CURDIR}/${_tool}; \ 1775 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1776 ${MAKE} DIRPRFX=${_tool}/ all 1777build-tools: build-tools_${_tool} 1778.endfor 1779 1780# 1781# kernel-tools: Build kernel-building tools 1782# 1783kernel-tools: .PHONY 1784 mkdir -p ${MAKEOBJDIRPREFIX}/usr 1785 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 1786 -p ${MAKEOBJDIRPREFIX}/usr >/dev/null 1787 1788# 1789# cross-tools: All the tools needed to build the rest of the system after 1790# we get done with the earlier stages. It is the last set of tools needed 1791# to begin building the target binaries. 1792# 1793.if ${TARGET_ARCH} != ${MACHINE_ARCH} 1794.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386" 1795_btxld= usr.sbin/btxld 1796.endif 1797.endif 1798 1799# Rebuild ctfconvert and ctfmerge to avoid difficult-to-diagnose failures 1800# resulting from missing bug fixes or ELF Toolchain updates. 1801.if ${MK_CDDL} != "no" 1802_dtrace_tools= cddl/lib/libctf cddl/usr.bin/ctfconvert \ 1803 cddl/usr.bin/ctfmerge 1804.endif 1805 1806# If we're given an XAS, don't build binutils. 1807.if ${XAS:M/*} == "" 1808.if ${MK_BINUTILS_BOOTSTRAP} != "no" 1809_binutils= gnu/usr.bin/binutils 1810.endif 1811.if ${MK_ELFTOOLCHAIN_BOOTSTRAP} != "no" 1812_elftctools= lib/libelftc \ 1813 lib/libpe \ 1814 usr.bin/elfcopy \ 1815 usr.bin/nm \ 1816 usr.bin/size \ 1817 usr.bin/strings 1818# These are not required by the build, but can be useful for developers who 1819# cross-build on a FreeBSD 10 host: 1820_elftctools+= usr.bin/addr2line 1821.endif 1822.elif ${TARGET_ARCH} != ${MACHINE_ARCH} && ${MK_ELFTOOLCHAIN_BOOTSTRAP} != "no" 1823# If cross-building with an external binutils we still need to build strip for 1824# the target (for at least crunchide). 1825_elftctools= lib/libelftc \ 1826 lib/libpe \ 1827 usr.bin/elfcopy 1828.endif 1829 1830.if ${MK_CLANG_BOOTSTRAP} != "no" 1831_clang= usr.bin/clang 1832_clang_libs= lib/clang 1833.endif 1834.if ${MK_GCC_BOOTSTRAP} != "no" 1835_cc= gnu/usr.bin/cc 1836.endif 1837.if ${MK_USB} != "no" 1838_usb_tools= sys/boot/usb/tools 1839.endif 1840 1841cross-tools: .MAKE .PHONY 1842.for _tool in \ 1843 ${LOCAL_XTOOL_DIRS} \ 1844 ${_clang_libs} \ 1845 ${_clang} \ 1846 ${_binutils} \ 1847 ${_elftctools} \ 1848 ${_dtrace_tools} \ 1849 ${_cc} \ 1850 ${_btxld} \ 1851 ${_usb_tools} 1852 ${_+_}@${ECHODIR} "===> ${_tool} (obj,all,install)"; \ 1853 cd ${.CURDIR}/${_tool}; \ 1854 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1855 ${MAKE} DIRPRFX=${_tool}/ all; \ 1856 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install 1857.endfor 1858 1859NXBDESTDIR= ${OBJTREE}/nxb-bin 1860NXBENV= MAKEOBJDIRPREFIX=${OBJTREE}/nxb \ 1861 INSTALL="sh ${.CURDIR}/tools/install.sh" \ 1862 PATH=${PATH}:${OBJTREE}/gperf_for_gcc/usr/bin 1863NXBMAKE= ${NXBENV} ${MAKE} \ 1864 LLVM_TBLGEN=${NXBDESTDIR}/usr/bin/llvm-tblgen \ 1865 CLANG_TBLGEN=${NXBDESTDIR}/usr/bin/clang-tblgen \ 1866 MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH} \ 1867 MK_GDB=no MK_TESTS=no \ 1868 SSP_CFLAGS= \ 1869 MK_HTML=no NO_LINT=yes MK_MAN=no \ 1870 -DNO_PIC MK_PROFILE=no -DNO_SHARED \ 1871 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \ 1872 MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \ 1873 MK_LLDB=no MK_DEBUG_FILES=no 1874 1875# native-xtools is the current target for qemu-user cross builds of ports 1876# via poudriere and the imgact_binmisc kernel module. 1877# For non-clang enabled targets that are still using the in tree gcc 1878# we must build a gperf binary for one instance of its Makefiles. On 1879# clang-enabled systems, the gperf binary is obsolete. 1880native-xtools: .PHONY 1881.if ${MK_GCC_BOOTSTRAP} != "no" 1882 mkdir -p ${OBJTREE}/gperf_for_gcc/usr/bin 1883 ${_+_}@${ECHODIR} "===> ${_gperf} (obj,all,install)"; \ 1884 cd ${.CURDIR}/${_gperf}; \ 1885 ${NXBMAKE} DIRPRFX=${_gperf}/ obj; \ 1886 ${NXBMAKE} DIRPRFX=${_gperf}/ all; \ 1887 ${NXBMAKE} DIRPRFX=${_gperf}/ DESTDIR=${OBJTREE}/gperf_for_gcc install 1888.endif 1889 mkdir -p ${NXBDESTDIR}/bin ${NXBDESTDIR}/sbin ${NXBDESTDIR}/usr 1890 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 1891 -p ${NXBDESTDIR}/usr >/dev/null 1892 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 1893 -p ${NXBDESTDIR}/usr/include >/dev/null 1894.if ${MK_DEBUG_FILES} != "no" 1895 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \ 1896 -p ${NXBDESTDIR}/usr/lib >/dev/null 1897.endif 1898.for _tool in \ 1899 bin/cat \ 1900 bin/chmod \ 1901 bin/cp \ 1902 bin/csh \ 1903 bin/echo \ 1904 bin/expr \ 1905 bin/hostname \ 1906 bin/ln \ 1907 bin/ls \ 1908 bin/mkdir \ 1909 bin/mv \ 1910 bin/ps \ 1911 bin/realpath \ 1912 bin/rm \ 1913 bin/rmdir \ 1914 bin/sh \ 1915 bin/sleep \ 1916 ${_clang_tblgen} \ 1917 usr.bin/ar \ 1918 ${_binutils} \ 1919 ${_elftctools} \ 1920 ${_cc} \ 1921 ${_gcc_tools} \ 1922 ${_clang_libs} \ 1923 ${_clang} \ 1924 sbin/md5 \ 1925 sbin/sysctl \ 1926 gnu/usr.bin/diff \ 1927 usr.bin/awk \ 1928 usr.bin/basename \ 1929 usr.bin/bmake \ 1930 usr.bin/bzip2 \ 1931 usr.bin/cmp \ 1932 usr.bin/dirname \ 1933 usr.bin/env \ 1934 usr.bin/fetch \ 1935 usr.bin/find \ 1936 usr.bin/grep \ 1937 usr.bin/gzip \ 1938 usr.bin/id \ 1939 usr.bin/lex \ 1940 usr.bin/lorder \ 1941 usr.bin/mktemp \ 1942 usr.bin/mt \ 1943 usr.bin/patch \ 1944 usr.bin/sed \ 1945 usr.bin/sort \ 1946 usr.bin/tar \ 1947 usr.bin/touch \ 1948 usr.bin/tr \ 1949 usr.bin/true \ 1950 usr.bin/uniq \ 1951 usr.bin/unzip \ 1952 usr.bin/xargs \ 1953 usr.bin/xinstall \ 1954 usr.bin/xz \ 1955 usr.bin/yacc \ 1956 usr.sbin/chown 1957 ${_+_}@${ECHODIR} "===> ${_tool} (obj,all,install)"; \ 1958 cd ${.CURDIR}/${_tool}; \ 1959 ${NXBMAKE} DIRPRFX=${_tool}/ obj; \ 1960 ${NXBMAKE} DIRPRFX=${_tool}/ all; \ 1961 ${NXBMAKE} DIRPRFX=${_tool}/ DESTDIR=${NXBDESTDIR} install 1962.endfor 1963 1964# 1965# hierarchy - ensure that all the needed directories are present 1966# 1967hierarchy hier: .MAKE .PHONY 1968 ${_+_}cd ${.CURDIR}/etc; ${HMAKE} distrib-dirs 1969 1970# 1971# libraries - build all libraries, and install them under ${DESTDIR}. 1972# 1973# The list of libraries with dependents (${_prebuild_libs}) and their 1974# interdependencies (__L) are built automatically by the 1975# ${.CURDIR}/tools/make_libdeps.sh script. 1976# 1977libraries: .MAKE .PHONY 1978 ${_+_}cd ${.CURDIR}; \ 1979 ${MAKE} -f Makefile.inc1 _prereq_libs; \ 1980 ${MAKE} -f Makefile.inc1 _startup_libs; \ 1981 ${MAKE} -f Makefile.inc1 _prebuild_libs; \ 1982 ${MAKE} -f Makefile.inc1 _generic_libs 1983 1984# 1985# static libgcc.a prerequisite for shared libc 1986# 1987_prereq_libs= gnu/lib/libgcc lib/libcompiler_rt 1988.if ${MK_SSP} != "no" 1989_prereq_libs+= gnu/lib/libssp/libssp_nonshared 1990.endif 1991 1992# These dependencies are not automatically generated: 1993# 1994# gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before 1995# all shared libraries for ELF. 1996# 1997_startup_libs= gnu/lib/csu 1998_startup_libs+= lib/csu 1999_startup_libs+= gnu/lib/libgcc 2000_startup_libs+= lib/libcompiler_rt 2001_startup_libs+= lib/libc 2002_startup_libs+= lib/libc_nonshared 2003.if ${MK_LIBCPLUSPLUS} != "no" 2004_startup_libs+= lib/libcxxrt 2005.endif 2006 2007gnu/lib/libgcc__L: lib/libc__L 2008gnu/lib/libgcc__L: lib/libc_nonshared__L 2009.if ${MK_LIBCPLUSPLUS} != "no" 2010lib/libcxxrt__L: gnu/lib/libgcc__L 2011.endif 2012 2013_prebuild_libs= ${_kerberos5_lib_libasn1} \ 2014 ${_kerberos5_lib_libhdb} \ 2015 ${_kerberos5_lib_libheimbase} \ 2016 ${_kerberos5_lib_libheimntlm} \ 2017 ${_libsqlite3} \ 2018 ${_kerberos5_lib_libheimipcc} \ 2019 ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \ 2020 ${_kerberos5_lib_libroken} \ 2021 ${_kerberos5_lib_libwind} \ 2022 lib/libbz2 ${_libcom_err} lib/libcrypt \ 2023 lib/libelf lib/libexpat \ 2024 lib/libfigpar \ 2025 ${_lib_libgssapi} \ 2026 lib/libkiconv lib/libkvm lib/liblzma lib/libmd lib/libnv \ 2027 ${_lib_casper} \ 2028 lib/ncurses/ncurses lib/ncurses/ncursesw \ 2029 lib/libopie lib/libpam/libpam ${_lib_libthr} \ 2030 ${_lib_libradius} lib/libsbuf lib/libtacplus \ 2031 lib/libgeom \ 2032 ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \ 2033 ${_cddl_lib_libuutil} \ 2034 ${_cddl_lib_libavl} \ 2035 ${_cddl_lib_libzfs_core} \ 2036 ${_cddl_lib_libctf} \ 2037 lib/libutil lib/libpjdlog ${_lib_libypclnt} lib/libz lib/msun \ 2038 ${_secure_lib_libcrypto} ${_lib_libldns} \ 2039 ${_secure_lib_libssh} ${_secure_lib_libssl} 2040 2041.if ${MK_GNUCXX} != "no" 2042_prebuild_libs+= gnu/lib/libstdc++ gnu/lib/libsupc++ 2043gnu/lib/libstdc++__L: lib/msun__L 2044gnu/lib/libsupc++__L: gnu/lib/libstdc++__L 2045.endif 2046 2047.if ${MK_DIALOG} != "no" 2048_prebuild_libs+= gnu/lib/libdialog 2049gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncursesw__L 2050.endif 2051 2052.if ${MK_LIBCPLUSPLUS} != "no" 2053_prebuild_libs+= lib/libc++ 2054.endif 2055 2056lib/libgeom__L: lib/libexpat__L 2057lib/libkvm__L: lib/libelf__L 2058 2059.if ${MK_LIBTHR} != "no" 2060_lib_libthr= lib/libthr 2061.endif 2062 2063.if ${MK_RADIUS_SUPPORT} != "no" 2064_lib_libradius= lib/libradius 2065.endif 2066 2067.if ${MK_OFED} != "no" 2068_ofed_lib= contrib/ofed/usr.lib 2069_prebuild_libs+= contrib/ofed/usr.lib/libosmcomp 2070_prebuild_libs+= contrib/ofed/usr.lib/libopensm 2071_prebuild_libs+= contrib/ofed/usr.lib/libibcommon 2072_prebuild_libs+= contrib/ofed/usr.lib/libibverbs 2073_prebuild_libs+= contrib/ofed/usr.lib/libibumad 2074 2075contrib/ofed/usr.lib/libopensm__L: lib/libthr__L 2076contrib/ofed/usr.lib/libosmcomp__L: lib/libthr__L 2077contrib/ofed/usr.lib/libibumad__L: contrib/ofed/usr.lib/libibcommon__L 2078.endif 2079 2080.if ${MK_CASPER} != "no" 2081_lib_casper= lib/libcasper 2082.endif 2083 2084lib/libpjdlog__L: lib/libutil__L 2085lib/libcasper__L: lib/libnv__L 2086lib/liblzma__L: lib/libthr__L 2087 2088_generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib} 2089.for _DIR in ${LOCAL_LIB_DIRS} 2090.if exists(${.CURDIR}/${_DIR}/Makefile) && empty(_generic_libs:M${_DIR}) 2091_generic_libs+= ${_DIR} 2092.endif 2093.endfor 2094 2095lib/libopie__L lib/libtacplus__L: lib/libmd__L 2096 2097.if ${MK_CDDL} != "no" 2098_cddl_lib_libumem= cddl/lib/libumem 2099_cddl_lib_libnvpair= cddl/lib/libnvpair 2100_cddl_lib_libavl= cddl/lib/libavl 2101_cddl_lib_libuutil= cddl/lib/libuutil 2102_cddl_lib_libzfs_core= cddl/lib/libzfs_core 2103_cddl_lib_libctf= cddl/lib/libctf 2104_cddl_lib= cddl/lib 2105cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L 2106cddl/lib/libzfs__L: lib/libgeom__L 2107cddl/lib/libctf__L: lib/libz__L 2108.endif 2109# cddl/lib/libdtrace requires lib/libproc and lib/librtld_db; it's only built 2110# on select architectures though (see cddl/lib/Makefile) 2111.if ${MACHINE_CPUARCH} != "sparc64" 2112_prebuild_libs+= lib/libprocstat lib/libproc lib/librtld_db 2113lib/libprocstat__L: lib/libelf__L lib/libkvm__L lib/libutil__L 2114lib/libproc__L: lib/libprocstat__L 2115lib/librtld_db__L: lib/libprocstat__L 2116.endif 2117 2118.if ${MK_CRYPT} != "no" 2119.if ${MK_OPENSSL} != "no" 2120_secure_lib_libcrypto= secure/lib/libcrypto 2121_secure_lib_libssl= secure/lib/libssl 2122lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L 2123.if ${MK_LDNS} != "no" 2124_lib_libldns= lib/libldns 2125lib/libldns__L: secure/lib/libcrypto__L 2126.endif 2127.if ${MK_OPENSSH} != "no" 2128_secure_lib_libssh= secure/lib/libssh 2129secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L 2130.if ${MK_LDNS} != "no" 2131secure/lib/libssh__L: lib/libldns__L 2132.endif 2133.if ${MK_KERBEROS_SUPPORT} != "no" 2134secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \ 2135 kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \ 2136 lib/libmd__L kerberos5/lib/libroken__L 2137.endif 2138.endif 2139.endif 2140_secure_lib= secure/lib 2141.endif 2142 2143.if ${MK_KERBEROS} != "no" 2144kerberos5/lib/libasn1__L: lib/libcom_err__L kerberos5/lib/libroken__L 2145kerberos5/lib/libhdb__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ 2146 kerberos5/lib/libkrb5__L kerberos5/lib/libroken__L \ 2147 kerberos5/lib/libwind__L lib/libsqlite3__L 2148kerberos5/lib/libheimntlm__L: secure/lib/libcrypto__L kerberos5/lib/libkrb5__L \ 2149 kerberos5/lib/libroken__L lib/libcom_err__L 2150kerberos5/lib/libhx509__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ 2151 secure/lib/libcrypto__L kerberos5/lib/libroken__L kerberos5/lib/libwind__L 2152kerberos5/lib/libkrb5__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ 2153 lib/libcrypt__L secure/lib/libcrypto__L kerberos5/lib/libhx509__L \ 2154 kerberos5/lib/libroken__L kerberos5/lib/libwind__L \ 2155 kerberos5/lib/libheimbase__L kerberos5/lib/libheimipcc__L 2156kerberos5/lib/libroken__L: lib/libcrypt__L 2157kerberos5/lib/libwind__L: kerberos5/lib/libroken__L lib/libcom_err__L 2158kerberos5/lib/libheimbase__L: lib/libthr__L 2159kerberos5/lib/libheimipcc__L: kerberos5/lib/libroken__L kerberos5/lib/libheimbase__L lib/libthr__L 2160.endif 2161 2162lib/libsqlite3__L: lib/libthr__L 2163 2164.if ${MK_GSSAPI} != "no" 2165_lib_libgssapi= lib/libgssapi 2166.endif 2167 2168.if ${MK_KERBEROS} != "no" 2169_kerberos5_lib= kerberos5/lib 2170_kerberos5_lib_libasn1= kerberos5/lib/libasn1 2171_kerberos5_lib_libhdb= kerberos5/lib/libhdb 2172_kerberos5_lib_libheimbase= kerberos5/lib/libheimbase 2173_kerberos5_lib_libkrb5= kerberos5/lib/libkrb5 2174_kerberos5_lib_libhx509= kerberos5/lib/libhx509 2175_kerberos5_lib_libroken= kerberos5/lib/libroken 2176_kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm 2177_libsqlite3= lib/libsqlite3 2178_kerberos5_lib_libheimipcc= kerberos5/lib/libheimipcc 2179_kerberos5_lib_libwind= kerberos5/lib/libwind 2180_libcom_err= lib/libcom_err 2181.endif 2182 2183.if ${MK_NIS} != "no" 2184_lib_libypclnt= lib/libypclnt 2185.endif 2186 2187.if ${MK_OPENSSL} == "no" 2188lib/libradius__L: lib/libmd__L 2189.endif 2190 2191lib/libproc__L: \ 2192 ${_cddl_lib_libctf:D${_cddl_lib_libctf}__L} lib/libelf__L lib/librtld_db__L lib/libutil__L 2193.if ${MK_CXX} != "no" 2194.if ${MK_LIBCPLUSPLUS} != "no" 2195lib/libproc__L: lib/libcxxrt__L 2196.else # This implies MK_GNUCXX != "no"; see lib/libproc 2197lib/libproc__L: gnu/lib/libsupc++__L 2198.endif 2199.endif 2200 2201.for _lib in ${_prereq_libs} 2202${_lib}__PL: .PHONY .MAKE 2203.if exists(${.CURDIR}/${_lib}) 2204 ${_+_}@${ECHODIR} "===> ${_lib} (obj,all,install)"; \ 2205 cd ${.CURDIR}/${_lib}; \ 2206 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj; \ 2207 ${MAKE} MK_TESTS=no MK_PROFILE=no -DNO_PIC \ 2208 DIRPRFX=${_lib}/ all; \ 2209 ${MAKE} MK_TESTS=no MK_PROFILE=no -DNO_PIC \ 2210 DIRPRFX=${_lib}/ install 2211.endif 2212.endfor 2213 2214.for _lib in ${_startup_libs} ${_prebuild_libs} ${_generic_libs} 2215${_lib}__L: .PHONY .MAKE 2216.if exists(${.CURDIR}/${_lib}) 2217 ${_+_}@${ECHODIR} "===> ${_lib} (obj,all,install)"; \ 2218 cd ${.CURDIR}/${_lib}; \ 2219 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj; \ 2220 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ all; \ 2221 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ install 2222.endif 2223.endfor 2224 2225_prereq_libs: ${_prereq_libs:S/$/__PL/} 2226_startup_libs: ${_startup_libs:S/$/__L/} 2227_prebuild_libs: ${_prebuild_libs:S/$/__L/} 2228_generic_libs: ${_generic_libs:S/$/__L/} 2229 2230# Enable SUBDIR_PARALLEL when not calling 'make all', unless called from 2231# 'everything' with _PARALLEL_SUBDIR_OK set. This is because it is unlikely 2232# that running 'make all' from the top-level, especially with a SUBDIR_OVERRIDE 2233# or LOCAL_DIRS set, will have a reliable build if SUBDIRs are built in 2234# parallel. This is safe for the world stage of buildworld though since it has 2235# already built libraries in a proper order and installed includes into 2236# WORLDTMP. Special handling is done for SUBDIR ordering for 'install*' to 2237# avoid trashing a system if it crashes mid-install. 2238.if !make(all) || defined(_PARALLEL_SUBDIR_OK) 2239SUBDIR_PARALLEL= 2240.endif 2241 2242.include <bsd.subdir.mk> 2243 2244.if make(check-old) || make(check-old-dirs) || \ 2245 make(check-old-files) || make(check-old-libs) || \ 2246 make(delete-old) || make(delete-old-dirs) || \ 2247 make(delete-old-files) || make(delete-old-libs) 2248 2249# 2250# check for / delete old files section 2251# 2252 2253.include "ObsoleteFiles.inc" 2254 2255OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \ 2256else you can not start such an application. Consult UPDATING for more \ 2257information regarding how to cope with the removal/revision bump of a \ 2258specific library." 2259 2260.if !defined(BATCH_DELETE_OLD_FILES) 2261RM_I=-i 2262.else 2263RM_I=-v 2264.endif 2265 2266delete-old-files: .PHONY 2267 @echo ">>> Removing old files (only deletes safe to delete libs)" 2268# Ask for every old file if the user really wants to remove it. 2269# It's annoying, but better safe than sorry. 2270# NB: We cannot pass the list of OLD_FILES as a parameter because the 2271# argument list will get too long. Using .for/.endfor make "loops" will make 2272# the Makefile parser segfault. 2273 @exec 3<&0; \ 2274 cd ${.CURDIR}; \ 2275 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 2276 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \ 2277 while read file; do \ 2278 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 2279 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \ 2280 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \ 2281 fi; \ 2282 for ext in debug symbols; do \ 2283 if ! [ -e "${DESTDIR}/$${file}" ] && [ -f \ 2284 "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \ 2285 rm ${RM_I} "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" \ 2286 <&3; \ 2287 fi; \ 2288 done; \ 2289 done 2290# Remove catpages without corresponding manpages. 2291 @exec 3<&0; \ 2292 find ${DESTDIR}/usr/share/man/cat* ! -type d | \ 2293 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \ 2294 while read catpage; do \ 2295 read manpage; \ 2296 if [ ! -e "$${manpage}" ]; then \ 2297 rm ${RM_I} $${catpage} <&3; \ 2298 fi; \ 2299 done 2300 @echo ">>> Old files removed" 2301 2302check-old-files: .PHONY 2303 @echo ">>> Checking for old files" 2304 @cd ${.CURDIR}; \ 2305 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 2306 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \ 2307 while read file; do \ 2308 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 2309 echo "${DESTDIR}/$${file}"; \ 2310 fi; \ 2311 for ext in debug symbols; do \ 2312 if [ -f "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \ 2313 echo "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}"; \ 2314 fi; \ 2315 done; \ 2316 done 2317# Check for catpages without corresponding manpages. 2318 @find ${DESTDIR}/usr/share/man/cat* ! -type d | \ 2319 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \ 2320 while read catpage; do \ 2321 read manpage; \ 2322 if [ ! -e "$${manpage}" ]; then \ 2323 echo $${catpage}; \ 2324 fi; \ 2325 done 2326 2327delete-old-libs: .PHONY 2328 @echo ">>> Removing old libraries" 2329 @echo "${OLD_LIBS_MESSAGE}" | fmt 2330 @exec 3<&0; \ 2331 cd ${.CURDIR}; \ 2332 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 2333 -V OLD_LIBS | xargs -n1 | \ 2334 while read file; do \ 2335 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 2336 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \ 2337 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \ 2338 fi; \ 2339 for ext in debug symbols; do \ 2340 if ! [ -e "${DESTDIR}/$${file}" ] && [ -f \ 2341 "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \ 2342 rm ${RM_I} "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" \ 2343 <&3; \ 2344 fi; \ 2345 done; \ 2346 done 2347 @echo ">>> Old libraries removed" 2348 2349check-old-libs: .PHONY 2350 @echo ">>> Checking for old libraries" 2351 @cd ${.CURDIR}; \ 2352 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 2353 -V OLD_LIBS | xargs -n1 | \ 2354 while read file; do \ 2355 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 2356 echo "${DESTDIR}/$${file}"; \ 2357 fi; \ 2358 for ext in debug symbols; do \ 2359 if [ -f "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \ 2360 echo "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}"; \ 2361 fi; \ 2362 done; \ 2363 done 2364 2365delete-old-dirs: .PHONY 2366 @echo ">>> Removing old directories" 2367 @cd ${.CURDIR}; \ 2368 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 2369 -V OLD_DIRS | xargs -n1 | sort -r | \ 2370 while read dir; do \ 2371 if [ -d "${DESTDIR}/$${dir}" ]; then \ 2372 rmdir -v "${DESTDIR}/$${dir}" || true; \ 2373 elif [ -L "${DESTDIR}/$${dir}" ]; then \ 2374 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \ 2375 fi; \ 2376 done 2377 @echo ">>> Old directories removed" 2378 2379check-old-dirs: .PHONY 2380 @echo ">>> Checking for old directories" 2381 @cd ${.CURDIR}; \ 2382 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 2383 -V OLD_DIRS | xargs -n1 | \ 2384 while read dir; do \ 2385 if [ -d "${DESTDIR}/$${dir}" ]; then \ 2386 echo "${DESTDIR}/$${dir}"; \ 2387 elif [ -L "${DESTDIR}/$${dir}" ]; then \ 2388 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \ 2389 fi; \ 2390 done 2391 2392delete-old: delete-old-files delete-old-dirs .PHONY 2393 @echo "To remove old libraries run '${MAKE_CMD} delete-old-libs'." 2394 2395check-old: check-old-files check-old-libs check-old-dirs .PHONY 2396 @echo "To remove old files and directories run '${MAKE_CMD} delete-old'." 2397 @echo "To remove old libraries run '${MAKE_CMD} delete-old-libs'." 2398 2399.endif 2400 2401# 2402# showconfig - show build configuration. 2403# 2404showconfig: .PHONY 2405 @(${MAKE} -n -f ${.CURDIR}/sys/conf/kern.opts.mk -V dummy -dg1; \ 2406 ${MAKE} -n -f ${.CURDIR}/share/mk/src.opts.mk -V dummy -dg1) 2>&1 | grep ^MK_ | sort -u 2407 2408.if !empty(KRNLOBJDIR) && !empty(KERNCONF) 2409DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/ 2410 2411.if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE) 2412.if exists(${KERNCONFDIR}/${KERNCONF}) 2413FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \ 2414 '${KERNCONFDIR}/${KERNCONF}' ; echo 2415.endif 2416.endif 2417 2418.endif 2419 2420.if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH}) 2421DTBOUTPUTPATH= ${.CURDIR} 2422.endif 2423 2424# 2425# Build 'standalone' Device Tree Blob 2426# 2427builddtb: .PHONY 2428 @PATH=${TMPPATH} MACHINE=${TARGET} \ 2429 ${.CURDIR}/sys/tools/fdt/make_dtb.sh ${.CURDIR}/sys \ 2430 "${FDT_DTS_FILE}" ${DTBOUTPUTPATH} 2431 2432############### 2433 2434# cleanworld 2435# In the following, the first 'rm' in a series will usually remove all 2436# files and directories. If it does not, then there are probably some 2437# files with file flags set, so this unsets them and tries the 'rm' a 2438# second time. There are situations where this target will be cleaning 2439# some directories via more than one method, but that duplication is 2440# needed to correctly handle all the possible situations. Removing all 2441# files without file flags set in the first 'rm' instance saves time, 2442# because 'chflags' will need to operate on fewer files afterwards. 2443# 2444# It is expected that BW_CANONICALOBJDIR == the CANONICALOBJDIR as would be 2445# created by bsd.obj.mk, except that we don't want to .include that file 2446# in this makefile. 2447# 2448BW_CANONICALOBJDIR:=${OBJTREE}${.CURDIR} 2449cleanworld: .PHONY 2450.if exists(${BW_CANONICALOBJDIR}/) 2451 -rm -rf ${BW_CANONICALOBJDIR}/* 2452 -chflags -R 0 ${BW_CANONICALOBJDIR} 2453 rm -rf ${BW_CANONICALOBJDIR}/* 2454.endif 2455.if ${.CURDIR} == ${.OBJDIR} || ${.CURDIR}/obj == ${.OBJDIR} 2456 # To be safe in this case, fall back to a 'make cleandir' 2457 ${_+_}@cd ${.CURDIR}; ${MAKE} cleandir 2458.endif 2459 2460.if defined(TARGET) && defined(TARGET_ARCH) 2461 2462.if ${TARGET} == ${MACHINE} && ${TARGET_ARCH} == ${MACHINE_ARCH} 2463XDEV_CPUTYPE?=${CPUTYPE} 2464.else 2465XDEV_CPUTYPE?=${TARGET_CPUTYPE} 2466.endif 2467 2468NOFUN=-DNO_FSCHG MK_HTML=no -DNO_LINT \ 2469 MK_MAN=no MK_NLS=no MK_PROFILE=no \ 2470 MK_KERBEROS=no MK_RESCUE=no MK_TESTS=no MK_WARNS=no \ 2471 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ 2472 CPUTYPE=${XDEV_CPUTYPE} 2473 2474XDDIR=${TARGET_ARCH}-freebsd 2475XDTP?=/usr/${XDDIR} 2476.if ${XDTP:N/*} 2477.error XDTP variable should be an absolute path 2478.endif 2479 2480CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \ 2481 INSTALL="sh ${.CURDIR}/tools/install.sh" 2482CDENV= ${CDBENV} \ 2483 TOOLS_PREFIX=${XDTP} 2484CD2CFLAGS=-isystem ${XDDESTDIR}/usr/include -L${XDDESTDIR}/usr/lib \ 2485 --sysroot=${XDDESTDIR}/ -B${XDDESTDIR}/usr/libexec \ 2486 -B${XDDESTDIR}/usr/bin -B${XDDESTDIR}/usr/lib 2487CD2ENV=${CDENV} CC="${CC} ${CD2CFLAGS}" CXX="${CXX} ${CD2CFLAGS}" \ 2488 CPP="${CPP} ${CD2CFLAGS}" \ 2489 MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH} 2490 2491CDTMP= ${MAKEOBJDIRPREFIX}/${XDDIR}/${.CURDIR}/tmp 2492CDMAKE=${CDENV} PATH=${CDTMP}/usr/bin:${PATH} ${MAKE} ${NOFUN} 2493CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDDESTDIR}/usr/bin:${PATH} ${MAKE} ${NOFUN} 2494XDDESTDIR=${DESTDIR}/${XDTP} 2495.if !defined(OSREL) 2496OSREL!= uname -r | sed -e 's/[-(].*//' 2497.endif 2498 2499.ORDER: xdev-build xdev-install xdev-links 2500xdev: xdev-build xdev-install .PHONY 2501 2502.ORDER: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools 2503xdev-build: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools .PHONY 2504 2505_xb-worldtmp: .PHONY 2506 mkdir -p ${CDTMP}/usr 2507 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 2508 -p ${CDTMP}/usr >/dev/null 2509 2510_xb-bootstrap-tools: .PHONY 2511.for _tool in \ 2512 ${_clang_tblgen} \ 2513 ${_gperf} 2514 ${_+_}@${ECHODIR} "===> ${_tool} (obj,all,install)"; \ 2515 cd ${.CURDIR}/${_tool}; \ 2516 ${CDMAKE} DIRPRFX=${_tool}/ obj; \ 2517 ${CDMAKE} DIRPRFX=${_tool}/ all; \ 2518 ${CDMAKE} DIRPRFX=${_tool}/ DESTDIR=${CDTMP} install 2519.endfor 2520 2521_xb-build-tools: .PHONY 2522 ${_+_}@cd ${.CURDIR}; \ 2523 ${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools 2524 2525_xb-cross-tools: .PHONY 2526.for _tool in \ 2527 ${_binutils} \ 2528 ${_elftctools} \ 2529 usr.bin/ar \ 2530 ${_clang_libs} \ 2531 ${_clang} \ 2532 ${_cc} 2533 ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,all)"; \ 2534 cd ${.CURDIR}/${_tool}; \ 2535 ${CDMAKE} DIRPRFX=${_tool}/ obj; \ 2536 ${CDMAKE} DIRPRFX=${_tool}/ all 2537.endfor 2538 2539_xi-mtree: .PHONY 2540 ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}" 2541 mkdir -p ${XDDESTDIR} 2542 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \ 2543 -p ${XDDESTDIR} >/dev/null 2544 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 2545 -p ${XDDESTDIR}/usr >/dev/null 2546 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 2547 -p ${XDDESTDIR}/usr/include >/dev/null 2548.if defined(LIBCOMPAT) 2549 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ 2550 -p ${XDDESTDIR}/usr >/dev/null 2551.endif 2552.if ${MK_TESTS} != "no" 2553 mkdir -p ${XDDESTDIR}${TESTSBASE} 2554 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \ 2555 -p ${XDDESTDIR}${TESTSBASE} >/dev/null 2556.endif 2557 2558.ORDER: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries 2559xdev-install: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries .PHONY 2560 2561_xi-cross-tools: .PHONY 2562 @echo "_xi-cross-tools" 2563.for _tool in \ 2564 ${_binutils} \ 2565 ${_elftctools} \ 2566 usr.bin/ar \ 2567 ${_clang_libs} \ 2568 ${_clang} \ 2569 ${_cc} 2570 ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \ 2571 cd ${.CURDIR}/${_tool}; \ 2572 ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR} 2573.endfor 2574 2575_xi-includes: .PHONY 2576 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 includes \ 2577 DESTDIR=${XDDESTDIR} 2578 2579_xi-libraries: .PHONY 2580 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \ 2581 DESTDIR=${XDDESTDIR} 2582 2583xdev-links: .PHONY 2584 ${_+_}cd ${XDDESTDIR}/usr/bin; \ 2585 mkdir -p ../../../../usr/bin; \ 2586 for i in *; do \ 2587 ln -sf ../../${XDTP}/usr/bin/$$i \ 2588 ../../../../usr/bin/${XDDIR}-$$i; \ 2589 ln -sf ../../${XDTP}/usr/bin/$$i \ 2590 ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \ 2591 done 2592.else 2593xdev xdev-build xdev-install xdev-links: .PHONY 2594 @echo "*** Error: Both TARGET and TARGET_ARCH must be defined for \"${.TARGET}\" target" 2595.endif 2596