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