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