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