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