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