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