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