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