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