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