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