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