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