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