Makefile.inc1 revision 263952
1# 2# $FreeBSD: head/Makefile.inc1 263952 2014-03-30 22:25:01Z imp $ 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 MK_HTML=no MK_INFO=no NO_LINT=yes MK_MAN=no \ 251 -DNO_PIC -DNO_PROFILE -DNO_SHARED \ 252 -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD 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 -DNO_WARNS -DNO_CTF -DEARLY_BUILD 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}" \ 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 MK_HTML=no MK_INFO=no -DNO_LINT MK_MAN=no \ 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 MK_TESTS=no 424 425LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} ${LIB32WMAKEFLAGS} \ 426 MK_MAN=no MK_INFO=no MK_HTML=no 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 MK_HTML=no MK_INFO=no -DNO_LINT MK_MAN=no \ 578 -DNO_PROFILE MK_TESTS=no 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 995buildkernel ${WMAKE_TGTS} ${.ALLTARGETS:M_*}: .MAKE 996 997# 998# buildkernel 999# 1000# Builds all kernels defined by BUILDKERNELS. 1001# 1002buildkernel: 1003.if empty(BUILDKERNELS) 1004 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \ 1005 false 1006.endif 1007 @echo 1008.for _kernel in ${BUILDKERNELS} 1009 @echo "--------------------------------------------------------------" 1010 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`" 1011 @echo "--------------------------------------------------------------" 1012 @echo "===> ${_kernel}" 1013 mkdir -p ${KRNLOBJDIR} 1014.if !defined(NO_KERNELCONFIG) 1015 @echo 1016 @echo "--------------------------------------------------------------" 1017 @echo ">>> stage 1: configuring the kernel" 1018 @echo "--------------------------------------------------------------" 1019 cd ${KRNLCONFDIR}; \ 1020 PATH=${TMPPATH} \ 1021 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \ 1022 -I ${KERNCONFDIR} ${KERNCONFDIR}/${_kernel} 1023.endif 1024.if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN) 1025 @echo 1026 @echo "--------------------------------------------------------------" 1027 @echo ">>> stage 2.1: cleaning up the object tree" 1028 @echo "--------------------------------------------------------------" 1029 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR} 1030.endif 1031.if !defined(NO_KERNELOBJ) 1032 @echo 1033 @echo "--------------------------------------------------------------" 1034 @echo ">>> stage 2.2: rebuilding the object tree" 1035 @echo "--------------------------------------------------------------" 1036 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj 1037.endif 1038 @echo 1039 @echo "--------------------------------------------------------------" 1040 @echo ">>> stage 2.3: build tools" 1041 @echo "--------------------------------------------------------------" 1042 ${_+_}cd ${.CURDIR}; ${KTMAKE} kernel-tools 1043.if !defined(NO_KERNELDEPEND) 1044 @echo 1045 @echo "--------------------------------------------------------------" 1046 @echo ">>> stage 3.1: making dependencies" 1047 @echo "--------------------------------------------------------------" 1048 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ 1049.endif 1050 @echo 1051 @echo "--------------------------------------------------------------" 1052 @echo ">>> stage 3.2: building everything" 1053 @echo "--------------------------------------------------------------" 1054 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ 1055 @echo "--------------------------------------------------------------" 1056 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`" 1057 @echo "--------------------------------------------------------------" 1058.endfor 1059 1060# 1061# installkernel, etc. 1062# 1063# Install the kernel defined by INSTALLKERNEL 1064# 1065installkernel installkernel.debug \ 1066reinstallkernel reinstallkernel.debug: _installcheck_kernel 1067.if empty(INSTALLKERNEL) 1068 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \ 1069 false 1070.endif 1071 @echo "--------------------------------------------------------------" 1072 @echo ">>> Installing kernel ${INSTALLKERNEL}" 1073 @echo "--------------------------------------------------------------" 1074 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ 1075 ${CROSSENV} PATH=${TMPPATH} \ 1076 ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//} 1077 1078distributekernel distributekernel.debug: 1079.if empty(INSTALLKERNEL) 1080 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \ 1081 false 1082.endif 1083 mkdir -p ${DESTDIR}/${DISTDIR} 1084.if defined(NO_ROOT) 1085 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.premeta 1086.endif 1087 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ 1088 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.premeta/} \ 1089 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} KERNEL=${INSTKERNNAME} \ 1090 DESTDIR=${INSTALL_DDIR}/kernel \ 1091 ${.TARGET:S/distributekernel/install/} 1092.if defined(NO_ROOT) 1093 sed -e 's|^./kernel|.|' ${DESTDIR}/${DISTDIR}/kernel.premeta > \ 1094 ${DESTDIR}/${DISTDIR}/kernel.meta 1095.endif 1096.for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//} 1097.if defined(NO_ROOT) 1098 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta 1099.endif 1100 cd ${KRNLOBJDIR}/${_kernel}; \ 1101 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.${_kernel}.premeta/} \ 1102 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} \ 1103 KERNEL=${INSTKERNNAME}.${_kernel} \ 1104 DESTDIR=${INSTALL_DDIR}/kernel.${_kernel} \ 1105 ${.TARGET:S/distributekernel/install/} 1106.if defined(NO_ROOT) 1107 sed -e 's|^./kernel|.|' \ 1108 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta > \ 1109 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta 1110.endif 1111.endfor 1112 1113packagekernel: 1114.if defined(NO_ROOT) 1115 cd ${DESTDIR}/${DISTDIR}/kernel; \ 1116 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz \ 1117 @${DESTDIR}/${DISTDIR}/kernel.meta 1118.for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//} 1119 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ 1120 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz \ 1121 @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta 1122.endfor 1123.else 1124 cd ${DESTDIR}/${DISTDIR}/kernel; \ 1125 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz . 1126.for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//} 1127 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ 1128 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz . 1129.endfor 1130.endif 1131 1132# 1133# doxygen 1134# 1135# Build the API documentation with doxygen 1136# 1137doxygen: 1138 @if [ ! -x `/usr/bin/which doxygen` ]; then \ 1139 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \ 1140 exit 1; \ 1141 fi 1142 cd ${.CURDIR}/tools/kerneldoc/subsys && ${MAKE} obj all 1143 1144# 1145# update 1146# 1147# Update the source tree(s), by running svn/svnup to update to the 1148# latest copy. 1149# 1150update: 1151.if (defined(CVS_UPDATE) || defined(SUP_UPDATE)) && !defined(SVN_UPDATE) 1152 @echo "--------------------------------------------------------------" 1153 @echo "CVS_UPDATE and SUP_UPDATE are no longer supported." 1154 @echo "Please see: https://wiki.freebsd.org/CvsIsDeprecated" 1155 @echo "--------------------------------------------------------------" 1156 @exit 1 1157.endif 1158.if defined(SVN_UPDATE) 1159 @echo "--------------------------------------------------------------" 1160 @echo ">>> Updating ${.CURDIR} using Subversion" 1161 @echo "--------------------------------------------------------------" 1162 @(cd ${.CURDIR} && ${SVN} update ${SVNFLAGS}) 1163.endif 1164 1165# 1166# ------------------------------------------------------------------------ 1167# 1168# From here onwards are utility targets used by the 'make world' and 1169# related targets. If your 'world' breaks, you may like to try to fix 1170# the problem and manually run the following targets to attempt to 1171# complete the build. Beware, this is *not* guaranteed to work, you 1172# need to have a pretty good grip on the current state of the system 1173# to attempt to manually finish it. If in doubt, 'make world' again. 1174# 1175 1176# 1177# legacy: Build compatibility shims for the next three targets 1178# 1179legacy: 1180.if ${BOOTSTRAPPING} < 700055 && ${BOOTSTRAPPING} != 0 1181 @echo "ERROR: Source upgrades from versions prior to 7.0 not supported."; \ 1182 false 1183.endif 1184.for _tool in tools/build 1185 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \ 1186 cd ${.CURDIR}/${_tool} && \ 1187 ${MAKE} DIRPRFX=${_tool}/ obj && \ 1188 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes && \ 1189 ${MAKE} DIRPRFX=${_tool}/ depend && \ 1190 ${MAKE} DIRPRFX=${_tool}/ all && \ 1191 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install 1192.endfor 1193 1194# 1195# bootstrap-tools: Build tools needed for compatibility 1196# 1197.if ${MK_GAMES} != "no" 1198_strfile= games/fortune/strfile 1199.endif 1200 1201.if ${MK_CXX} != "no" 1202_gperf= gnu/usr.bin/gperf 1203.endif 1204 1205.if ${MK_GROFF} != "no" 1206_groff= gnu/usr.bin/groff 1207.endif 1208 1209.if ${BOOTSTRAPPING} < 800022 1210_ar= usr.bin/ar 1211.endif 1212 1213.if ${BOOTSTRAPPING} < 800013 1214_mklocale= usr.bin/mklocale 1215.endif 1216 1217.if ${BOOTSTRAPPING} < 900002 1218_sed= usr.bin/sed 1219.endif 1220 1221.if ${BOOTSTRAPPING} < 900006 1222_lex= usr.bin/lex 1223.endif 1224 1225.if ${BOOTSTRAPPING} < 1000002 1226_m4= usr.bin/m4 1227.endif 1228 1229.if ${BOOTSTRAPPING} < 1000013 1230_yacc= lib/liby \ 1231 usr.bin/yacc 1232.endif 1233 1234.if ${BOOTSTRAPPING} < 1000014 1235_crunch= usr.sbin/crunch 1236.endif 1237 1238.if ${BOOTSTRAPPING} < 1000026 1239_nmtree= lib/libnetbsd \ 1240 usr.sbin/nmtree 1241.endif 1242 1243.if ${BOOTSTRAPPING} < 1000027 1244_cat= bin/cat 1245.endif 1246 1247.if ${BOOTSTRAPPING} >= 900040 && ${BOOTSTRAPPING} < 900041 1248_awk= usr.bin/awk 1249.endif 1250 1251.if ${MK_BSNMP} != "no" && !exists(/usr/sbin/gensnmptree) 1252_gensnmptree= usr.sbin/bsnmpd/gensnmptree 1253.endif 1254 1255.if ${MK_CLANG} != "no" 1256_clang_tblgen= \ 1257 lib/clang/libllvmsupport \ 1258 lib/clang/libllvmtablegen \ 1259 usr.bin/clang/tblgen \ 1260 usr.bin/clang/clang-tblgen 1261.endif 1262 1263# dtrace tools are required for older bootstrap env and cross-build 1264.if ${MK_CDDL} != "no" && \ 1265 ((${BOOTSTRAPPING} < 1000034 && \ 1266 !(${BOOTSTRAPPING} >= 901505 && ${BOOTSTRAPPING} < 999999)) \ 1267 || (${MACHINE} != ${TARGET} || ${MACHINE_ARCH} != ${TARGET_ARCH})) 1268_dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \ 1269 lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge 1270.endif 1271 1272# Default to building the GPL DTC, but build the BSDL one if users explicitly 1273# request it. 1274_dtc= usr.bin/dtc 1275.if ${MK_GPL_DTC} != "no" 1276_dtc= gnu/usr.bin/dtc 1277.endif 1278 1279.if ${MK_KERBEROS} != "no" 1280_kerberos5_bootstrap_tools= \ 1281 kerberos5/tools/make-roken \ 1282 kerberos5/lib/libroken \ 1283 kerberos5/lib/libvers \ 1284 kerberos5/tools/asn1_compile \ 1285 kerberos5/tools/slc \ 1286 usr.bin/compile_et 1287.endif 1288 1289# Please document (add comment) why something is in 'bootstrap-tools'. 1290# Try to bound the building of the bootstrap-tool to just the 1291# FreeBSD versions that need the tool built at this stage of the build. 1292bootstrap-tools: .MAKE 1293.for _tool in \ 1294 ${_clang_tblgen} \ 1295 ${_kerberos5_bootstrap_tools} \ 1296 ${_dtrace_tools} \ 1297 ${_strfile} \ 1298 ${_gperf} \ 1299 ${_groff} \ 1300 ${_ar} \ 1301 ${_dtc} \ 1302 ${_awk} \ 1303 ${_cat} \ 1304 usr.bin/lorder \ 1305 usr.bin/makewhatis \ 1306 ${_mklocale} \ 1307 usr.bin/rpcgen \ 1308 ${_sed} \ 1309 ${_yacc} \ 1310 ${_m4} \ 1311 ${_lex} \ 1312 lib/libmd \ 1313 usr.bin/xinstall \ 1314 ${_gensnmptree} \ 1315 usr.sbin/config \ 1316 ${_crunch} \ 1317 ${_nmtree} 1318 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ 1319 cd ${.CURDIR}/${_tool} && \ 1320 ${MAKE} DIRPRFX=${_tool}/ obj && \ 1321 ${MAKE} DIRPRFX=${_tool}/ depend && \ 1322 ${MAKE} DIRPRFX=${_tool}/ all && \ 1323 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install 1324.endfor 1325 1326# 1327# build-tools: Build special purpose build tools 1328# 1329.if !defined(NO_SHARE) 1330_share= share/syscons/scrnmaps 1331.endif 1332 1333.if ${MK_GCC} != "no" 1334_gcc_tools= gnu/usr.bin/cc/cc_tools 1335.endif 1336 1337.if ${MK_RESCUE} != "no" 1338_rescue= rescue/rescue 1339.endif 1340 1341build-tools: .MAKE 1342.for _tool in \ 1343 bin/csh \ 1344 bin/sh \ 1345 ${_rescue} \ 1346 ${LOCAL_TOOL_DIRS} \ 1347 lib/ncurses/ncurses \ 1348 lib/ncurses/ncursesw \ 1349 ${_share} \ 1350 usr.bin/awk \ 1351 lib/libmagic \ 1352 usr.bin/mkesdb_static \ 1353 usr.bin/mkcsmapper_static \ 1354 usr.bin/vi/catalog 1355 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \ 1356 cd ${.CURDIR}/${_tool} && \ 1357 ${MAKE} DIRPRFX=${_tool}/ obj && \ 1358 ${MAKE} DIRPRFX=${_tool}/ build-tools 1359.endfor 1360.for _tool in \ 1361 ${_gcc_tools} 1362 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \ 1363 cd ${.CURDIR}/${_tool} && \ 1364 ${MAKE} DIRPRFX=${_tool}/ obj && \ 1365 ${MAKE} DIRPRFX=${_tool}/ depend && \ 1366 ${MAKE} DIRPRFX=${_tool}/ all 1367.endfor 1368 1369# 1370# kernel-tools: Build kernel-building tools 1371# 1372kernel-tools: .MAKE 1373 mkdir -p ${MAKEOBJDIRPREFIX}/usr 1374 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 1375 -p ${MAKEOBJDIRPREFIX}/usr >/dev/null 1376 1377# 1378# cross-tools: Build cross-building tools 1379# 1380.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 800035 1381.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386" 1382_btxld= usr.sbin/btxld 1383.endif 1384.endif 1385.if ${TARGET_ARCH} != ${MACHINE_ARCH} 1386.if ${MK_RESCUE} != "no" || defined(RELEASEDIR) 1387_crunchide= usr.sbin/crunch/crunchide 1388.endif 1389.if ${TARGET_ARCH} == "i386" && defined(RELEASEDIR) 1390_kgzip= usr.sbin/kgzip 1391.endif 1392.endif 1393 1394.if ${XAS:M/*} == "" && ${MK_BINUTILS} != "no" 1395_binutils= gnu/usr.bin/binutils 1396.endif 1397 1398# If an full path to an external cross compiler is given, don't build 1399# a cross compiler. 1400.if ${XCC:M/*} == "" && ${MK_CROSS_COMPILER} != "no" 1401.if ${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang" 1402_clang= usr.bin/clang 1403_clang_libs= lib/clang 1404.else 1405_cc= gnu/usr.bin/cc 1406.endif 1407 1408# The boot2 for pc98 requires gcc. 1409.if ${TARGET} == "pc98" 1410_cc= gnu/usr.bin/cc 1411.endif 1412.endif 1413 1414cross-tools: .MAKE 1415.for _tool in \ 1416 ${_clang_libs} \ 1417 ${_clang} \ 1418 ${_binutils} \ 1419 ${_cc} \ 1420 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \ 1421 ${_btxld} \ 1422 ${_crunchide} \ 1423 ${_kgzip} 1424 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ 1425 cd ${.CURDIR}/${_tool} && \ 1426 ${MAKE} DIRPRFX=${_tool}/ obj && \ 1427 ${MAKE} DIRPRFX=${_tool}/ depend && \ 1428 ${MAKE} DIRPRFX=${_tool}/ all && \ 1429 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install 1430.endfor 1431 1432# 1433# hierarchy - ensure that all the needed directories are present 1434# 1435hierarchy hier: 1436 cd ${.CURDIR}/etc && ${HMAKE} distrib-dirs 1437 1438# 1439# libraries - build all libraries, and install them under ${DESTDIR}. 1440# 1441# The list of libraries with dependents (${_prebuild_libs}) and their 1442# interdependencies (__L) are built automatically by the 1443# ${.CURDIR}/tools/make_libdeps.sh script. 1444# 1445libraries: .MAKE 1446 cd ${.CURDIR} && \ 1447 ${MAKE} -f Makefile.inc1 _prereq_libs && \ 1448 ${MAKE} -f Makefile.inc1 _startup_libs && \ 1449 ${MAKE} -f Makefile.inc1 _prebuild_libs && \ 1450 ${MAKE} -f Makefile.inc1 _generic_libs 1451 1452# 1453# static libgcc.a prerequisite for shared libc 1454# 1455_prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc lib/libcompiler_rt 1456 1457# These dependencies are not automatically generated: 1458# 1459# gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before 1460# all shared libraries for ELF. 1461# 1462_startup_libs= gnu/lib/csu 1463.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf) 1464_startup_libs+= lib/csu/${MACHINE_ARCH}-elf 1465.elif exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}) 1466_startup_libs+= lib/csu/${MACHINE_ARCH} 1467.else 1468_startup_libs+= lib/csu/${MACHINE_CPUARCH} 1469.endif 1470_startup_libs+= gnu/lib/libgcc 1471_startup_libs+= lib/libcompiler_rt 1472_startup_libs+= lib/libc 1473_startup_libs+= lib/libc_nonshared 1474.if ${MK_LIBCPLUSPLUS} != "no" 1475_startup_libs+= lib/libcxxrt 1476.endif 1477 1478gnu/lib/libgcc__L: lib/libc__L 1479gnu/lib/libgcc__L: lib/libc_nonshared__L 1480.if ${MK_LIBCPLUSPLUS} != "no" 1481lib/libcxxrt__L: gnu/lib/libgcc__L 1482.endif 1483 1484_prebuild_libs= ${_kerberos5_lib_libasn1} \ 1485 ${_kerberos5_lib_libhdb} \ 1486 ${_kerberos5_lib_libheimbase} \ 1487 ${_kerberos5_lib_libheimntlm} \ 1488 ${_kerberos5_lib_libheimsqlite} \ 1489 ${_kerberos5_lib_libheimipcc} \ 1490 ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \ 1491 ${_kerberos5_lib_libroken} \ 1492 ${_kerberos5_lib_libwind} \ 1493 ${_lib_atf} \ 1494 lib/libbz2 ${_libcom_err} lib/libcrypt \ 1495 lib/libelf lib/libexpat \ 1496 ${_lib_libgssapi} \ 1497 lib/libkiconv lib/libkvm lib/liblzma lib/libmd lib/libnv \ 1498 ${_lib_libcapsicum} \ 1499 lib/ncurses/ncurses lib/ncurses/ncursesw \ 1500 lib/libopie lib/libpam ${_lib_libthr} \ 1501 lib/libradius lib/libsbuf lib/libtacplus \ 1502 ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \ 1503 ${_cddl_lib_libzfs_core} \ 1504 lib/libutil lib/libpjdlog ${_lib_libypclnt} lib/libz lib/msun \ 1505 ${_secure_lib_libcrypto} ${_lib_libldns} \ 1506 ${_secure_lib_libssh} ${_secure_lib_libssl} 1507.if ${MK_GNUCXX} != no 1508_prebuild_libs+= gnu/lib/libstdc++ gnu/lib/libsupc++ 1509.endif 1510 1511.if defined(WITH_ATF) || ${MK_TESTS} != "no" 1512.if !defined(WITH_ATF) 1513# Ensure that the ATF libraries will be built during make libraries, even 1514# though they will have WITHOUT_TESTS 1515MAKE+= -DWITH_ATF 1516.endif 1517_lib_atf= lib/atf 1518.endif 1519 1520.if ${MK_LIBTHR} != "no" 1521_lib_libthr= lib/libthr 1522.endif 1523 1524.if ${MK_OFED} != "no" 1525_ofed_lib= contrib/ofed/usr.lib/ 1526.endif 1527 1528.if ${MK_CASPER} != "no" 1529_lib_libcapsicum=lib/libcapsicum 1530.endif 1531 1532lib/libcapsicum__L: lib/libnv__L 1533lib/libpjdlog__L: lib/libutil__L 1534 1535_generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib} 1536.for _DIR in ${LOCAL_LIB_DIRS} 1537.if exists(${.CURDIR}/${_DIR}/Makefile) 1538_generic_libs+= ${_DIR} 1539.endif 1540.endfor 1541 1542lib/libopie__L lib/libtacplus__L: lib/libmd__L 1543 1544.if ${MK_CDDL} != "no" 1545_cddl_lib_libumem= cddl/lib/libumem 1546_cddl_lib_libnvpair= cddl/lib/libnvpair 1547_cddl_lib_libzfs_core= cddl/lib/libzfs_core 1548_cddl_lib= cddl/lib 1549cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L 1550.endif 1551 1552.if ${MK_CRYPT} != "no" 1553.if ${MK_OPENSSL} != "no" 1554_secure_lib_libcrypto= secure/lib/libcrypto 1555_secure_lib_libssl= secure/lib/libssl 1556lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L 1557.if ${MK_LDNS} != "no" 1558_lib_libldns= lib/libldns 1559lib/libldns__L: secure/lib/libcrypto__L 1560.endif 1561.if ${MK_OPENSSH} != "no" 1562_secure_lib_libssh= secure/lib/libssh 1563secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L 1564.if ${MK_LDNS} != "no" 1565secure/lib/libssh__L: lib/libldns__L 1566.endif 1567.if ${MK_KERBEROS_SUPPORT} != "no" 1568secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \ 1569 kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \ 1570 lib/libmd__L kerberos5/lib/libroken__L 1571.endif 1572.endif 1573.endif 1574_secure_lib= secure/lib 1575.endif 1576 1577.if ${MK_KERBEROS} != "no" 1578kerberos5/lib/libasn1__L: lib/libcom_err__L kerberos5/lib/libroken__L 1579kerberos5/lib/libhdb__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ 1580 kerberos5/lib/libkrb5__L kerberos5/lib/libroken__L \ 1581 kerberos5/lib/libwind__L kerberos5/lib/libheimsqlite__L 1582kerberos5/lib/libheimntlm__L: secure/lib/libcrypto__L kerberos5/lib/libkrb5__L \ 1583 kerberos5/lib/libroken__L lib/libcom_err__L 1584kerberos5/lib/libhx509__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ 1585 secure/lib/libcrypto__L kerberos5/lib/libroken__L kerberos5/lib/libwind__L 1586kerberos5/lib/libkrb5__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ 1587 lib/libcrypt__L secure/lib/libcrypto__L kerberos5/lib/libhx509__L \ 1588 kerberos5/lib/libroken__L kerberos5/lib/libwind__L \ 1589 kerberos5/lib/libheimbase__L kerberos5/lib/libheimipcc__L 1590kerberos5/lib/libroken__L: lib/libcrypt__L 1591kerberos5/lib/libwind__L: kerberos5/lib/libroken__L lib/libcom_err__L 1592kerberos5/lib/libheimbase__L: lib/libthr__L 1593kerberos5/lib/libheimipcc__L: kerberos5/lib/libroken__L kerberos5/lib/libheimbase__L lib/libthr__L 1594kerberos5/lib/libheimsqlite__L: lib/libthr__L 1595.endif 1596 1597.if ${MK_GSSAPI} != "no" 1598_lib_libgssapi= lib/libgssapi 1599.endif 1600 1601.if ${MK_KERBEROS} != "no" 1602_kerberos5_lib= kerberos5/lib 1603_kerberos5_lib_libasn1= kerberos5/lib/libasn1 1604_kerberos5_lib_libhdb= kerberos5/lib/libhdb 1605_kerberos5_lib_libheimbase= kerberos5/lib/libheimbase 1606_kerberos5_lib_libkrb5= kerberos5/lib/libkrb5 1607_kerberos5_lib_libhx509= kerberos5/lib/libhx509 1608_kerberos5_lib_libroken= kerberos5/lib/libroken 1609_kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm 1610_kerberos5_lib_libheimsqlite= kerberos5/lib/libheimsqlite 1611_kerberos5_lib_libheimipcc= kerberos5/lib/libheimipcc 1612_kerberos5_lib_libwind= kerberos5/lib/libwind 1613_libcom_err= lib/libcom_err 1614.endif 1615 1616.if ${MK_NIS} != "no" 1617_lib_libypclnt= lib/libypclnt 1618.endif 1619 1620.if ${MK_OPENSSL} == "no" 1621lib/libradius__L: lib/libmd__L 1622.endif 1623 1624.for _lib in ${_prereq_libs} 1625${_lib}__PL: .PHONY .MAKE 1626.if exists(${.CURDIR}/${_lib}) 1627 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \ 1628 cd ${.CURDIR}/${_lib} && \ 1629 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj && \ 1630 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ depend && \ 1631 ${MAKE} MK_TESTS=no -DNO_PROFILE -DNO_PIC \ 1632 DIRPRFX=${_lib}/ all && \ 1633 ${MAKE} MK_TESTS=no -DNO_PROFILE -DNO_PIC \ 1634 DIRPRFX=${_lib}/ install 1635.endif 1636.endfor 1637 1638.for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs} 1639${_lib}__L: .PHONY .MAKE 1640.if exists(${.CURDIR}/${_lib}) 1641 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \ 1642 cd ${.CURDIR}/${_lib} && \ 1643 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj && \ 1644 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ depend && \ 1645 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ all && \ 1646 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ install 1647.endif 1648.endfor 1649 1650# libpam is special: we need to build static PAM modules before 1651# static PAM library, and dynamic PAM library before dynamic PAM 1652# modules. 1653lib/libpam__L: .PHONY .MAKE 1654 ${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \ 1655 cd ${.CURDIR}/lib/libpam && \ 1656 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ obj && \ 1657 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ depend && \ 1658 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ \ 1659 -D_NO_LIBPAM_SO_YET all && \ 1660 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ \ 1661 -D_NO_LIBPAM_SO_YET install 1662 1663_prereq_libs: ${_prereq_libs:S/$/__PL/} 1664_startup_libs: ${_startup_libs:S/$/__L/} 1665_prebuild_libs: ${_prebuild_libs:S/$/__L/} 1666_generic_libs: ${_generic_libs:S/$/__L/} 1667 1668.for __target in all clean cleandepend cleandir depend includes obj 1669.for entry in ${SUBDIR} 1670${entry}.${__target}__D: .PHONY .MAKE 1671 ${_+_}@set -e; if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \ 1672 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \ 1673 edir=${entry}.${MACHINE_ARCH}; \ 1674 cd ${.CURDIR}/$${edir}; \ 1675 else \ 1676 ${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \ 1677 edir=${entry}; \ 1678 cd ${.CURDIR}/$${edir}; \ 1679 fi; \ 1680 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/ 1681.endfor 1682par-${__target}: ${SUBDIR:S/$/.${__target}__D/} 1683.endfor 1684 1685.include <bsd.subdir.mk> 1686 1687.if make(check-old) || make(check-old-dirs) || \ 1688 make(check-old-files) || make(check-old-libs) || \ 1689 make(delete-old) || make(delete-old-dirs) || \ 1690 make(delete-old-files) || make(delete-old-libs) 1691 1692# 1693# check for / delete old files section 1694# 1695 1696.include "ObsoleteFiles.inc" 1697 1698OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \ 1699else you can not start such an application. Consult UPDATING for more \ 1700information regarding how to cope with the removal/revision bump of a \ 1701specific library." 1702 1703.if !defined(BATCH_DELETE_OLD_FILES) 1704RM_I=-i 1705.else 1706RM_I=-v 1707.endif 1708 1709delete-old-files: 1710 @echo ">>> Removing old files (only deletes safe to delete libs)" 1711# Ask for every old file if the user really wants to remove it. 1712# It's annoying, but better safe than sorry. 1713# NB: We cannot pass the list of OLD_FILES as a parameter because the 1714# argument list will get too long. Using .for/.endfor make "loops" will make 1715# the Makefile parser segfault. 1716 @exec 3<&0; \ 1717 cd ${.CURDIR}; \ 1718 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 1719 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \ 1720 while read file; do \ 1721 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1722 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \ 1723 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \ 1724 fi; \ 1725 done 1726# Remove catpages without corresponding manpages. 1727 @exec 3<&0; \ 1728 find ${DESTDIR}/usr/share/man/cat* ! -type d | \ 1729 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \ 1730 while read catpage; do \ 1731 read manpage; \ 1732 if [ ! -e "$${manpage}" ]; then \ 1733 rm ${RM_I} $${catpage} <&3; \ 1734 fi; \ 1735 done 1736 @echo ">>> Old files removed" 1737 1738check-old-files: 1739 @echo ">>> Checking for old files" 1740 @cd ${.CURDIR}; \ 1741 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 1742 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \ 1743 while read file; do \ 1744 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1745 echo "${DESTDIR}/$${file}"; \ 1746 fi; \ 1747 done 1748# Check for catpages without corresponding manpages. 1749 @find ${DESTDIR}/usr/share/man/cat* ! -type d | \ 1750 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \ 1751 while read catpage; do \ 1752 read manpage; \ 1753 if [ ! -e "$${manpage}" ]; then \ 1754 echo $${catpage}; \ 1755 fi; \ 1756 done 1757 1758delete-old-libs: 1759 @echo ">>> Removing old libraries" 1760 @echo "${OLD_LIBS_MESSAGE}" | fmt 1761 @exec 3<&0; \ 1762 cd ${.CURDIR}; \ 1763 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 1764 -V OLD_LIBS | xargs -n1 | \ 1765 while read file; do \ 1766 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1767 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \ 1768 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \ 1769 fi; \ 1770 for ext in debug symbols; do \ 1771 if ! [ -e "${DESTDIR}/$${file}" ] && [ -f \ 1772 "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \ 1773 rm ${RM_I} "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" \ 1774 <&3; \ 1775 fi; \ 1776 done; \ 1777 done 1778 @echo ">>> Old libraries removed" 1779 1780check-old-libs: 1781 @echo ">>> Checking for old libraries" 1782 @cd ${.CURDIR}; \ 1783 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 1784 -V OLD_LIBS | xargs -n1 | \ 1785 while read file; do \ 1786 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1787 echo "${DESTDIR}/$${file}"; \ 1788 fi; \ 1789 for ext in debug symbols; do \ 1790 if [ -f "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \ 1791 echo "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}"; \ 1792 fi; \ 1793 done; \ 1794 done 1795 1796delete-old-dirs: 1797 @echo ">>> Removing old directories" 1798 @cd ${.CURDIR}; \ 1799 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 1800 -V OLD_DIRS | xargs -n1 | sort -r | \ 1801 while read dir; do \ 1802 if [ -d "${DESTDIR}/$${dir}" ]; then \ 1803 rmdir -v "${DESTDIR}/$${dir}" || true; \ 1804 elif [ -L "${DESTDIR}/$${dir}" ]; then \ 1805 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \ 1806 fi; \ 1807 done 1808 @echo ">>> Old directories removed" 1809 1810check-old-dirs: 1811 @echo ">>> Checking for old directories" 1812 @cd ${.CURDIR}; \ 1813 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 1814 -V OLD_DIRS | xargs -n1 | \ 1815 while read dir; do \ 1816 if [ -d "${DESTDIR}/$${dir}" ]; then \ 1817 echo "${DESTDIR}/$${dir}"; \ 1818 elif [ -L "${DESTDIR}/$${dir}" ]; then \ 1819 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \ 1820 fi; \ 1821 done 1822 1823delete-old: delete-old-files delete-old-dirs 1824 @echo "To remove old libraries run '${MAKE} delete-old-libs'." 1825 1826check-old: check-old-files check-old-libs check-old-dirs 1827 @echo "To remove old files and directories run '${MAKE} delete-old'." 1828 @echo "To remove old libraries run '${MAKE} delete-old-libs'." 1829 1830.endif 1831 1832# 1833# showconfig - show build configuration. 1834# 1835showconfig: 1836 @${MAKE} -n -f bsd.own.mk -V dummy -dg1 2>&1 | grep ^MK_ | sort 1837 1838.if !empty(KRNLOBJDIR) && !empty(KERNCONF) 1839DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/ 1840 1841.if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE) 1842.if exists(${KERNCONFDIR}/${KERNCONF}) 1843FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \ 1844 ${KERNCONFDIR}/${KERNCONF} ; echo 1845.endif 1846.endif 1847 1848.endif 1849 1850.if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH}) 1851DTBOUTPUTPATH= ${.CURDIR} 1852.endif 1853 1854# 1855# Build 'standalone' Device Tree Blob 1856# 1857builddtb: 1858 @if [ "${FDT_DTS_FILE}" = "" ]; then \ 1859 echo "ERROR: FDT_DTS_FILE must be specified!"; \ 1860 exit 1; \ 1861 fi; \ 1862 if [ ! -f ${.CURDIR}/sys/boot/fdt/dts/${MACHINE}/${FDT_DTS_FILE} ]; then \ 1863 echo "ERROR: Specified DTS file (${FDT_DTS_FILE}) does not \ 1864 exist!"; \ 1865 exit 1; \ 1866 fi; \ 1867 if [ "${DTBOUTPUTPATH}" = "${.CURDIR}" ]; then \ 1868 echo "WARNING: DTB will be placed in the current working \ 1869 directory"; \ 1870 fi 1871 @PATH=${TMPPATH} \ 1872 ${.CURDIR}/sys/tools/fdt/make_dtb.sh ${.CURDIR}/sys \ 1873 ${FDT_DTS_FILE} \ 1874 ${DTBOUTPUTPATH}/`basename ${FDT_DTS_FILE} .dts` 1875 1876############### 1877 1878.if defined(XDEV) && defined(XDEV_ARCH) 1879 1880.if ${XDEV} == ${MACHINE} && ${XDEV_ARCH} == ${MACHINE_ARCH} 1881XDEV_CPUTYPE?=${CPUTYPE} 1882.else 1883XDEV_CPUTYPE?=${TARGET_CPUTYPE} 1884.endif 1885 1886NOFUN=-DNO_FSCHG MK_HTML=no MK_INFO=no -DNO_LINT \ 1887 MK_MAN=no MK_NLS=no -DNO_PROFILE \ 1888 MK_KERBEROS=no MK_RESCUE=no MK_TESTS=no -DNO_WARNS \ 1889 TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH} \ 1890 CPUTYPE=${XDEV_CPUTYPE} 1891 1892XDDIR=${XDEV_ARCH}-freebsd 1893XDTP=usr/${XDDIR} 1894CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \ 1895 INSTALL="sh ${.CURDIR}/tools/install.sh" 1896CDENV= ${CDBENV} \ 1897 _SHLIBDIRPREFIX=${XDDESTDIR} \ 1898 TOOLS_PREFIX=${XDDESTDIR} 1899CD2CFLAGS=-isystem ${XDDESTDIR}/usr/include -L${XDDESTDIR}/usr/lib \ 1900 -B${XDDESTDIR}/usr/lib 1901CD2ENV=${CDENV} CC="${CC} ${CD2CFLAGS}" \ 1902 MACHINE=${XDEV} MACHINE_ARCH=${XDEV_ARCH} 1903 1904CDTMP= ${MAKEOBJDIRPREFIX}/${XDDIR}/${.CURDIR}/tmp 1905CDMAKE=${CDENV} PATH=${CDTMP}/usr/bin:${PATH} ${MAKE} ${NOFUN} 1906CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDDESTDIR}/usr/bin:${PATH} ${MAKE} ${NOFUN} 1907XDDESTDIR?=${DESTDIR}/${XDTP} 1908.if !defined(OSREL) 1909OSREL!= uname -r | sed -e 's/[-(].*//' 1910.endif 1911 1912.ORDER: xdev-build xdev-install 1913xdev: xdev-build xdev-install 1914 1915.ORDER: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools 1916xdev-build: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools 1917 1918_xb-worldtmp: 1919 mkdir -p ${CDTMP}/usr 1920 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 1921 -p ${CDTMP}/usr >/dev/null 1922 1923_xb-bootstrap-tools: 1924.for _tool in \ 1925 ${_clang_tblgen} 1926 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ 1927 cd ${.CURDIR}/${_tool} && \ 1928 ${CDMAKE} DIRPRFX=${_tool}/ obj && \ 1929 ${CDMAKE} DIRPRFX=${_tool}/ depend && \ 1930 ${CDMAKE} DIRPRFX=${_tool}/ all && \ 1931 ${CDMAKE} DIRPRFX=${_tool}/ DESTDIR=${CDTMP} install 1932.endfor 1933 1934_xb-build-tools: 1935 ${_+_}@cd ${.CURDIR}; \ 1936 ${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools 1937 1938_xb-cross-tools: 1939.for _tool in \ 1940 gnu/usr.bin/binutils \ 1941 gnu/usr.bin/cc \ 1942 usr.bin/ar \ 1943 ${_clang_libs} \ 1944 ${_clang} 1945 ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \ 1946 cd ${.CURDIR}/${_tool} && \ 1947 ${CDMAKE} DIRPRFX=${_tool}/ obj && \ 1948 ${CDMAKE} DIRPRFX=${_tool}/ depend && \ 1949 ${CDMAKE} DIRPRFX=${_tool}/ all 1950.endfor 1951 1952_xi-mtree: 1953 ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}" 1954 mkdir -p ${XDDESTDIR} 1955 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \ 1956 -p ${XDDESTDIR} >/dev/null 1957 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 1958 -p ${XDDESTDIR}/usr >/dev/null 1959 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 1960 -p ${XDDESTDIR}/usr/include >/dev/null 1961 1962.ORDER: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links 1963xdev-install: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links 1964 1965_xi-cross-tools: 1966 @echo "_xi-cross-tools" 1967.for _tool in \ 1968 gnu/usr.bin/binutils \ 1969 gnu/usr.bin/cc \ 1970 usr.bin/ar \ 1971 ${_clang} 1972 ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \ 1973 cd ${.CURDIR}/${_tool}; \ 1974 ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR} 1975.endfor 1976 1977_xi-includes: 1978 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 par-includes \ 1979 DESTDIR=${XDDESTDIR} 1980 1981_xi-libraries: 1982 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \ 1983 DESTDIR=${XDDESTDIR} 1984 1985_xi-links: 1986 ${_+_}cd ${XDDESTDIR}/usr/bin; \ 1987 mkdir -p ../../../../usr/bin; \ 1988 for i in *; do \ 1989 ln -sf ../../${XDTP}/usr/bin/$$i \ 1990 ../../../../usr/bin/${XDDIR}-$$i; \ 1991 ln -sf ../../${XDTP}/usr/bin/$$i \ 1992 ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \ 1993 done 1994.else 1995xdev xdev-build xdev-install: 1996 @echo "*** Error: Both XDEV and XDEV_ARCH must be defined for \"${.TARGET}\" target" 1997.endif 1998