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