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