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