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