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