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