Lines Matching +full:hfs +full:- +full:boot +full:. +full:bz2

4 #	-DNO_CLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
5 # -DNO_CLEAN do not clean at all
6 # -DDB_FROM_SRC use the user/group databases in src/etc instead of
7 # the system database when installing.
8 # -DNO_SHARE do not go into share subdir
9 # -DKERNFAST define NO_KERNEL{CONFIG,CLEAN,OBJ}
10 # -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel
11 # -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel
12 # -DNO_KERNELOBJ do not run ${MAKE} obj in ${MAKE} buildkernel
13 # -DNO_ROOT install without using root privilege
14 # -DWITHOUT_CTF do not run the DTrace CTF conversion tools on built objects
23 # bootstrap-tools target
24 # LOCAL_TOOL_DIRS="list of dirs" to add additional dirs to the build-tools
27 # cross-tools target
29 # when NO_ROOT is set. (default: ${DESTDIR}/${DISTDIR}/METALOG,
30 # check /etc/make.conf for DISTDIR)
36 # SUBDIR_OVERRIDE="list of dirs" to build rather than everything.
37 # All libraries and includes, and some build tools will still build.
40 # The intended user-driven targets are:
41 # buildworld - rebuild *everything*, including glue to help do upgrades
42 # installworld- install everything built by "buildworld"
43 # checkworld - run test suite on installed world
44 # doxygen - build API documentation of the kernel
47 # /usr/share/mk. These include:
50 .if !defined(TARGET) || !defined(TARGET_ARCH)
51 .error Both TARGET and TARGET_ARCH must be defined.
52 .endif
54 .if make(showconfig) || make(test-system-*)
56 .endif
58 SRCDIR?= ${.CURDIR}
62 .include "share/mk/src.tools.mk"
64 # Cross toolchain changes must be in effect before bsd.compiler.mk
65 # so that gets the right CC, and pass CROSS_TOOLCHAIN to submakes.
66 .if defined(CROSS_TOOLCHAIN)
67 .if exists(${LOCALBASE}/share/toolchains/${CROSS_TOOLCHAIN}.mk)
68 .include "${LOCALBASE}/share/toolchains/${CROSS_TOOLCHAIN}.mk"
69 .elif exists(${CROSS_TOOLCHAIN})
70 .include "${CROSS_TOOLCHAIN}"
71 .else
72 .error CROSS_TOOLCHAIN ${CROSS_TOOLCHAIN} not found
73 .endif
75 .elif defined(UNIVERSE_TOOLCHAIN)
81 .endif
82 .if defined(CROSS_TOOLCHAIN_PREFIX)
84 .endif
87 .for COMPILER in ${XCOMPILERS}
88 .if defined(CROSS_COMPILER_PREFIX)
90 .else
92 .endif
93 .endfor
95 # a cross compiler.
96 .if ${XCC:N${CCACHE_BIN}:M/*}
98 # Make sure sub-makes see the option as disabled so the hack in bsd.sys.mk to
99 # work around incompatible headers in Clang's resource directory is enabled.
100 .MAKEOVERRIDES+= MK_CLANG_BOOTSTRAP
101 .endif
104 # running CC from bsd.compiler.mk.
105 .if make(installworld) || make(install) || make(distributeworld) || \
107 .-include "${OBJTOP}/toolchain-metadata.mk"
108 .if !defined(_LOADED_TOOLCHAIN_METADATA)
109 .error A build is required first. You may have the wrong MAKEOBJDIRPREFIX set.
110 .endif
111 .endif
113 # Pull in COMPILER_TYPE and COMPILER_FREEBSD_VERSION early. Pull it from the
114 # tree to be friendlier to foreign OS builds. It's safe to do so unconditionally
116 # Don't include bsd.linker.mk yet until XBINUTILS is handled (after src.opts.mk)
118 # We also want the X_COMPILER* variables if we are using an external toolchain.
120 .include "share/mk/bsd.compiler.mk"
121 .undef _NO_INCLUDE_LINKERMK
122 .undef _WANT_TOOLCHAIN_CROSS_VARS
123 # src.opts.mk depends on COMPILER_FEATURES
124 .include "share/mk/src.opts.mk"
126 .if ${TARGET} == ${MACHINE}
128 .else
130 .endif
131 .if !empty(TARGET_CPUTYPE)
133 .else
135 .endif
136 .if ${TARGET} == "arm"
137 .if ${TARGET_CPUTYPE:M*soft*} == ""
139 .else
141 .endif
142 .endif
144 MACHINE_TRIPLE?=${MACHINE_ARCH:S/amd64/x86_64/}-${MACHINE_TRIPLE_ABI}-freebsd${OS_REVISION}
146 TARGET_TRIPLE?= ${TARGET_ARCH:S/amd64/x86_64/}-${TARGET_TRIPLE_ABI}-freebsd${OS_REVISION}
157 .if ${TARGET} == ${TARGET_ARCH}
159 .else
161 .endif
162 .for _t in ${_t}
163 .if empty(KNOWN_ARCHES:M${_t})
164 .error Unknown target ${TARGET_ARCH}:${TARGET}.
165 .endif
166 .endfor
168 .if ${TARGET_ARCH} == "amd64"
170 .elif ${TARGET_ARCH} == "aarch64"
172 .endif
174 .if !defined(_MKSHOWCONFIG)
175 .if ((defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == "gcc") || \
177 .if ${TARGET} == "arm"
178 _GCC_BROKEN="https://reviews.freebsd.org/D36754"
179 .endif
180 .if ${TARGET_ARCH} == "powerpc"
181 _GCC_BROKEN=Missing atomic builtins in libc++.
182 .endif
183 .if ${TARGET_ARCH:Mpowerpc64*}
184 _GCC_BROKEN=libsys.so.7.full has a LOAD segment with RWX permissions.
185 .endif
186 .if ${TARGET} == "riscv"
187 _GCC_BROKEN=boot code linker script issues.
188 .endif
189 .if defined(_GCC_BROKEN)
190 .warning Target ${TARGET} is broken with GCC: ${_GCC_BROKEN}
191 .if defined(TRY_GCC_BROKEN)
192 .warning Trying build anyway.
193 .else
194 .error Avoiding broken build. Define TRY_GCC_BROKEN to try anyway.
195 .endif
196 .endif
197 .endif
198 .endif
200 .if ${.MAKE.OS} != "FreeBSD"
201 CROSSBUILD_HOST=${.MAKE.OS}
202 .if ${.MAKE.OS} != "Linux" && ${.MAKE.OS} != "Darwin"
203 .warning Unsupported crossbuild system: ${.MAKE.OS}. Build will probably fail!
204 .endif
206 # systems since the BSD.foo.dist specs contain users and groups that do not
207 # exist by default on a Linux/MacOS system.
210 .export NO_ROOT
211 .endif
214 # for cross-builds.
215 .if !defined(TOOLS_PREFIX) && ${MK_LLVM_TARGET_ALL} == "no" && \
220 .endif
222 # Handle external binutils.
223 .if defined(CROSS_TOOLCHAIN_PREFIX)
225 .endif
227 .for BINUTIL in ${XBINUTILS}
228 .if defined(CROSS_BINUTILS_PREFIX) && \
231 .else
233 .endif
234 .endfor
236 # If a full path to an external linker is given, don't build lld.
237 .if ${XLD:M/*}
239 .endif
241 # We also want the X_LINKER* variables if we are using an external toolchain.
243 .include "share/mk/bsd.linker.mk"
244 .undef _WANT_TOOLCHAIN_CROSS_VARS
248 # WITH_SYSTEM_COMPILER - Pull in needed values and make a decision.
250 # Check if there is a local compiler that can satisfy as an external compiler.
252 .if ${MK_CLANG_BOOTSTRAP} == "yes"
254 .else
256 .endif
258 .if !defined(WANT_COMPILER_FREEBSD_VERSION) && !make(showconfig) && \
259 !make(test-system-linker)
260 .if ${WANT_COMPILER_TYPE} == "clang"
261 WANT_COMPILER_FREEBSD_VERSION_FILE= lib/clang/freebsd_cc_version.h
265 WANT_COMPILER_VERSION_FILE= lib/clang/include/clang/Basic/Version.inc
267 awk '$$2 == "CLANG_VERSION" {split($$3, a, "."); print a[1] * 10000 + a[2] * 100 + a[3]}' \
269 .endif
270 .export WANT_COMPILER_FREEBSD_VERSION WANT_COMPILER_VERSION
271 .endif # !defined(WANT_COMPILER_FREEBSD_VERSION)
273 # It needs to be the same revision as we would build for the bootstrap.
274 # If the expected vs CC is different then we can't skip.
275 # GCC cannot be used for cross-arch yet. For clang we pass -target later if
276 # TARGET_ARCH!=MACHINE_ARCH.
277 .if ${MK_SYSTEM_COMPILER} == "yes" && \
285 # Everything matches, disable the bootstrap compiler.
288 .endif # ${WANT_COMPILER_TYPE} == ${COMPILER_TYPE}
290 # WITH_SYSTEM_LD - Pull in needed values and make a decision.
292 # Check if there is a local linker that can satisfy as an external linker.
294 .if ${MK_LLD_BOOTSTRAP} == "yes"
296 .else
298 .endif
300 .if !defined(WANT_LINKER_FREEBSD_VERSION) && !make(showconfig) && \
301 !make(test-system-compiler)
302 .if ${WANT_LINKER_TYPE} == "lld"
303 WANT_LINKER_FREEBSD_VERSION_FILE= lib/clang/include/lld/Common/Version.inc
307 WANT_LINKER_VERSION_FILE= lib/clang/include/lld/Common/Version.inc
309 …awk '$$2 == "LLD_VERSION_STRING" {gsub("\"", "", $$3); split($$3, a, "."); print a[1] * 10000 + a[…
311 .else
314 .endif
315 .export WANT_LINKER_FREEBSD_VERSION WANT_LINKER_VERSION
316 .endif # !defined(WANT_LINKER_FREEBSD_VERSION)
318 .if ${MK_SYSTEM_LINKER} == "yes" && \
325 # Everything matches, disable the bootstrap linker.
328 .endif # ${WANT_LINKER_TYPE} == ${LINKER_TYPE}
330 # WITH_SYSTEM_COMPILER / WITH_SYSTEM_LINKER - Handle defaults and debug.
353 .for _t in compiler linker
354 test-system-${_t}: .PHONY
355 .for v in ${TEST_SYSTEM_${_t:tu}_VARS}
356 ${_+_}@printf "%-35s= %s\n" "${v}" "${${v}}"
357 .endfor
358 .endfor
359 .if (make(buildworld) || make(buildkernel) || make(kernel-toolchain) || \
360 make(toolchain) || make(_cross-tools))
361 .if ${USING_SYSTEM_COMPILER} == "yes"
362 .info SYSTEM_COMPILER: Determined that CC=${CC} matches the source tree. Not bootstrapping a cross
363 .elif ${MK_CLANG_BOOTSTRAP} == "yes"
364 .info SYSTEM_COMPILER: libclang will be built for bootstrapping a cross-compiler.
365 .endif
366 .if ${USING_SYSTEM_LINKER} == "yes"
367 .info SYSTEM_LINKER: Determined that LD=${LD} matches the source tree. Not bootstrapping a cross-l…
368 .elif ${MK_LLD_BOOTSTRAP} == "yes"
369 .info SYSTEM_LINKER: libclang will be built for bootstrapping a cross-linker.
370 .endif
371 .endif
376 # want to invoke CC at all.
386 toolchain-metadata.mk: .PHONY .META
387 @: > ${.TARGET}
388 @echo ".info Using cached toolchain metadata from build at $$(hostname) on $$(date)" \
389 > ${.TARGET}
390 @echo "_LOADED_TOOLCHAIN_METADATA=t" >> ${.TARGET}
391 .for v in ${_TOOLCHAIN_METADATA_VARS}
392 @echo "${v}=${${v}}" >> ${.TARGET}
393 @echo "X_${v}=${X_${v}}" >> ${.TARGET}
394 .endfor
395 @echo ".export ${_TOOLCHAIN_METADATA_VARS}" >> ${.TARGET}
396 @echo ".export ${_TOOLCHAIN_METADATA_VARS:C,^,X_,}" >> ${.TARGET}
399 # We must do lib/ and libexec/ before bin/ in case of a mid-install error to
400 # keep the users system reasonably usable. For static->dynamic root upgrades,
402 # libraries. More commonly, for dynamic root, we don't want to install a
403 # binary that requires a newer library version that hasn't been installed yet.
404 # This ordering is not a guarantee though. The only guarantee of a working
405 # system here would require fine-grained ordering of all components based
406 # on their dependencies.
407 .if !empty(SUBDIR_OVERRIDE)
409 .else
412 # of a LOCAL_DIRS directory. This allows LOCAL_DIRS=foo and
413 # LOCAL_LIB_DIRS=foo/lib to behave as expected.
414 .for _DIR in ${LOCAL_DIRS:M*/} ${LOCAL_DIRS:N*/:S|$|/|}
416 .endfor
417 .for _DIR in ${LOCAL_LIB_DIRS}
418 .if ${_DIR} == ".WAIT" || (empty(_REDUNDANT_LIB_DIRS:M${_DIR}) && exists(${.CURDIR}/${_DIR}/Makefil…
420 .endif
421 .endfor
422 .if !defined(NO_ROOT) && (make(installworld) || make(install))
423 # Ensure libraries are installed before progressing.
424 SUBDIR+=.WAIT
425 .endif
427 .if ${MK_CDDL} != "no"
429 .endif
431 .if ${MK_KERBEROS} != "no"
433 .endif
434 .if ${MK_RESCUE} != "no"
436 .endif
438 .if ${MK_CRYPT} != "no"
440 .endif
441 .if !defined(NO_SHARE)
443 .endif
444 .if ${MK_BOOT} != "no"
446 .endif
447 SUBDIR+=sys usr.bin usr.sbin
448 .if ${MK_TESTS} != "no"
450 .endif
452 # Local directories are built in parallel with the base system directories.
453 # Users may insert a .WAIT directive at the beginning or elsewhere within
454 # the LOCAL_DIRS and LOCAL_LIB_DIRS lists as needed.
455 .for _DIR in ${LOCAL_DIRS}
456 .if ${_DIR} == ".WAIT" || exists(${.CURDIR}/${_DIR}/Makefile)
458 .endif
459 .endfor
462 # by calling 'makedb' in share/man. This is only relevant for
464 # installed.
465 .if make(installworld) || make(install)
466 SUBDIR+=.WAIT
467 .endif
470 .endif # !empty(SUBDIR_OVERRIDE)
472 .if defined(NOCLEAN)
473 .warning The src.conf WITHOUT_CLEAN option can now be used instead of NOCLEAN.
475 .endif
476 .if defined(NO_CLEAN)
477 .info The src.conf WITHOUT_CLEAN option can now be used instead of NO_CLEAN.
479 .endif
480 .if defined(NO_CLEANDIR)
482 .else
484 .endif
486 .if defined(WORLDFAST)
489 .endif
491 .if ${MK_META_MODE} == "yes"
492 # If filemon is used then we can rely on the build being incremental-safe.
493 # The .meta files will also track the build command and rebuild should
494 # it change.
495 .if empty(.MAKE.MODE:Mnofilemon)
497 .endif
498 .endif
499 .if defined(NO_OBJWALK) || ${MK_AUTO_OBJ} == "yes"
502 .endif
503 .if !defined(NO_OBJWALK)
505 .endif
510 .if empty(SHELL:M*csh*)
512 .else
514 .endif
516 .if !defined(_MKSHOWCONFIG)
517 .if !defined(VCS_REVISION) || empty(VCS_REVISION)
518 .if !defined(SVNVERSION_CMD) || empty(SVNVERSION_CMD)
519 . for _D in ${PATH:S,:, ,g}
520 . if exists(${_D}/svnversion)
522 . endif
523 . if exists(${_D}/svnliteversion)
525 . endif
526 . endfor
527 .endif
528 .if defined(SVNVERSION_CMD) && !empty(SVNVERSION_CMD)
530 . if !empty(_VCS_REVISION)
532 .export VCS_REVISION
533 . endif
534 .endif
535 .endif
537 .if !defined(GIT_CMD) || empty(GIT_CMD)
538 . for _P in /usr/bin /usr/local/bin
539 . if exists(${_P}/git)
541 . endif
542 . endfor
543 .export GIT_CMD
544 .endif
546 .if !defined(OSRELDATE)
547 .if exists(/usr/include/osreldate.h)
549 /usr/include/osreldate.h
550 .else
552 .endif
553 .export OSRELDATE
554 .endif
556 # Set VERSION for CTFMERGE to use via the default CTFFLAGS=-L VERSION.
557 .for _V in BRANCH REVISION TYPE
558 .if !defined(_${_V})
559 _${_V}!= eval $$(awk '/^${_V}=/{print}' ${SRCTOP}/sys/conf/newvers.sh); echo $$${_V}
560 .export _${_V}
561 .endif
562 .endfor
563 .if !defined(SRCRELDATE)
565 ${SRCDIR}/sys/sys/param.h
566 .export SRCRELDATE
567 .endif
568 .if !defined(VERSION)
569 VERSION= FreeBSD ${_REVISION}-${_BRANCH:C/-p[0-9]+$//} ${TARGET_ARCH} ${SRCRELDATE}
570 .export VERSION
571 .endif
578 .if ${_BRANCH:MCURRENT*} || ${_BRANCH:MSTABLE*} || ${_BRANCH:MPRERELEASE*}
580 BRANCH_EXT= ${MAJOR_REVISION}.snap
581 EXTRA_REVISION= .snap${_TIMENOW}
582 .elif ${_BRANCH:MALPHA*}
584 EXTRA_REVISION= .${_BRANCH:C/ALPHA([0-9]+).*/\1/}.${_TIMENOW}
585 .elif ${_BRANCH:MBETA*}
587 EXTRA_REVISION= .${_BRANCH:C/BETA([0-9]+).*/\1/}.${_TIMENOW}
588 .elif ${_BRANCH:MRC*}
590 EXTRA_REVISION= .rc${_BRANCH:C/RC([0-9]+).*/\1/}.${_TIMENOW}
591 .elif ${_BRANCH:M*-p*}
592 EXTRA_REVISION= p${_BRANCH:C/.*-p([0-9]+$)/\1/}
593 .endif
594 .if !defined(PKG_VERSION)
596 .endif
597 .endif # !defined(PKG_VERSION)
599 .if !defined(PKG_TIMESTAMP)
602 .else
604 .endif
607 PKG_MAINTAINER?= re@FreeBSD.org
608 PKG_WWW?= https://www.FreeBSD.org
609 .export PKG_NAME_PREFIX
610 .export PKG_MAINTAINER
611 .export PKG_WWW
613 .if !defined(_MKSHOWCONFIG)
614 _CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} -f /dev/null \
615 -m ${.CURDIR}/share/mk MK_AUTO_OBJ=no -V CPUTYPE
616 .if ${_CPUTYPE} != ${_TARGET_CPUTYPE}
617 .error CPUTYPE global should be set with ?=.
618 .endif
619 .endif
620 .if make(buildworld)
621 BUILD_ARCH!= uname -p
622 # On some Linux systems uname -p returns "unknown" so skip this check there.
624 # MACHINE_ARCH so skipping it when crossbuilding on non-FreeBSD should be fine.
625 .if ${MACHINE_ARCH} != ${BUILD_ARCH} && ${.MAKE.OS} == "FreeBSD"
626 .error To cross-build, set TARGET_ARCH.
627 .endif
628 .endif
633 # When building we want to find the cross tools before the host tools in ${BPATH}.
635 # toolchain files (clang, lld, etc.) during make universe/tinderbox
638 # the build to break on other systems that don't have that tool. For now we
640 # BUILD_WITH_STRICT_TMPPATH is set to 0 but this will eventually be removed.
642 # Currently strict $PATH can cause build failures. Once the remaining issues
643 # have been resolved it will be turned on by default.
645 .if defined(CROSSBUILD_HOST)
646 # When building on non-FreeBSD we can't rely on the tools in /usr/bin being compatible
647 # with what FreeBSD expects. Therefore we only use tools from STRICTTMPPATH
648 # during the world build stage. We build most tools during the bootstrap-tools
651 .endif
652 .if ${BUILD_WITH_STRICT_TMPPATH} != 0
654 .else
656 .endif
659 # Avoid running mktemp(1) unless actually needed.
660 # It may not be functional, e.g., due to new ABI
661 # when in the middle of installing over this system.
663 .if make(distributeworld) || make(installworld) || make(stageworld)
664 .if ${BUILD_WITH_STRICT_TMPPATH} != 0
666 .if !exists(${MKTEMP})
667 .error mktemp binary doesn't exist in expected location: ${MKTEMP}
668 .endif
669 .else
671 .endif
672 INSTALLTMP!= ${MKTEMP} -d -u -t install
674 .if ${.MAKE.OS} == "FreeBSD"
676 # into INSTALLTMP to avoid issues with incompatible libraries (see r364030).
677 # Note: we could create links if we don't intend to update the current machine.
679 .else
680 # However, this is not necessary on Linux/macOS. Additionally, copying the host
682 # Violations on macOS Ventura as part of its System Integrity Protection.
683 INSTALLTMP_COPY_HOST_TOOL=ln -s
684 .endif
685 .endif
687 .if make(stagekernel) || make(distributekernel)
690 .endif
695 # 1. legacy stage [BMAKE]
697 # shims that are needed by the bootstrap-tools,
698 # build-tools and cross-tools stages. These are generally
700 # build that aren't present on the host.
701 # 1. bootstrap-tools stage [BMAKE]
703 # are needed for backward compatibility reasons. They
704 # are not built as cross-tools.
705 # 2. build-tools stage [TMAKE]
708 # the build process. Some programs are listed during
710 # files needed to build these programs. This stage also
711 # builds the 'build-tools' target rather than 'all'.
712 # 3. cross-tools stage [XMAKE]
714 # are needed for building the system. A cross-compiler is one
715 # of them. This differs from build tools in two ways:
716 # 1. the 'all' target is built rather than 'build-tools'
717 # 2. these tools are installed into TMPPATH for stage 4.
718 # 4. world stage [WMAKE]
719 # This stage actually builds the world.
720 # 5. install stage (optional) [IMAKE]
721 # This stage installs a previously built world.
734 .if ${MK_META_MODE} != "no"
735 # Don't rebuild build-tools targets during normal build.
736 CROSSENV+= BUILD_TOOLS_META=.NOMETA
737 .endif
738 .if defined(TARGET_CFLAGS)
740 .endif
741 .if (${TARGET} != ${MACHINE} && !defined(WITH_LOCAL_MODULES)) || \
744 .endif
748 # bootstrap-tools stage
749 BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
753 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}"
754 # need to keep this in sync with targets/pseudo/bootstrap-tools/Makefile
756 OBJTOP='${WORLDTMP}/obj-tools' \
761 BWPHASE=${.TARGET:C,^_,,} \
762 -DNO_CPU_CFLAGS \
763 -DNO_LINT \
764 -DNO_PIC \
765 -DNO_SHARED \
782 ${TIME_ENV} ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
784 .if empty(.MAKEOVERRIDES:MMK_LLVM_TARGET_ALL)
786 .endif
788 # build-tools stage
790 ${TIME_ENV} ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
794 BWPHASE=${.TARGET:C,^_,,} \
795 -DNO_CPU_CFLAGS \
796 -DNO_LINT \
809 # cross-tools stage
817 # kernel-tools stage
818 KTMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
821 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}"
825 ${KTMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
827 OBJTOP='${WORLDTMP}/obj-kernel-tools' \
832 -DNO_CPU_CFLAGS \
833 -DNO_LINT \
834 -DNO_PIC \
835 -DNO_SHARED \
845 INSTALL="${INSTALL_CMD} -U" \
851 .if defined(NO_ROOT)
852 HMAKE+= PATH=${TMPPATH:Q} METALOG=${METALOG} -DNO_ROOT
853 .endif
862 .if defined(CROSS_BINUTILS_PREFIX) && exists(${CROSS_BINUTILS_PREFIX})
863 # In the case of xdev-build tools, CROSS_BINUTILS_PREFIX won't be a
865 # tools so we don't need to tell it where to look.
866 BFLAGS+= -B${CROSS_BINUTILS_PREFIX}
867 .endif
871 # and target set by TARGET/TARGET_ARCH. However, there are several needs to
872 # always pass an explicit --sysroot and -target.
873 # - External compiler needs sysroot and target flags.
874 # - External ld needs sysroot.
875 # - To be clear about the use of a sysroot when using the internal compiler.
876 # - Easier debugging.
877 # - Allowing WITH_SYSTEM_COMPILER+WITH_META_MODE to work together due to
878 # the flip-flopping build command when sometimes using external and
879 # sometimes using internal.
880 # - Allow using lld which has no support for default paths.
881 .if !defined(CROSS_BINUTILS_PREFIX) || !exists(${CROSS_BINUTILS_PREFIX})
882 BFLAGS+= -B${WORLDTMP}/usr/bin
883 .endif
884 .if ${WANT_COMPILER_TYPE} == gcc || \
886 .elif ${WANT_COMPILER_TYPE} == clang || \
888 XCFLAGS+= -target ${TARGET_TRIPLE}
889 .endif
890 XCFLAGS+= --sysroot=${WORLDTMP}
892 .if !empty(BFLAGS)
894 .endif
896 .include "share/mk/bsd.compat.pre.mk"
897 .for LIBCOMPAT in ${_ALL_LIBCOMPATS}
898 .if ${MK_LIB${LIBCOMPAT}} == "yes"
900 .endif
901 .endfor
902 .include "Makefile.libcompat"
905 # timestamps (see NO_META_IGNORE_HOST in sys.mk). There are known times
907 # to get updated host tools.
908 .if ${MK_META_MODE} == "yes" && ${MK_CLEAN} == "no" && \
911 # r318736 - ino64 major ABI breakage
914 .if !defined(OBJDIR_HOST_OSRELDATE)
915 .if exists(${OBJTOP}/host-osreldate.h)
918 ${OBJTOP}/host-osreldate.h
919 .elif exists(${WORLDTMP}/usr/include/osreldate.h)
921 .endif
922 .export OBJDIR_HOST_OSRELDATE
923 .endif
925 # Note that this logic is the opposite of normal BOOTSTRAP handling. We want
926 # to compare the WORLDTMP's OSRELDATE to the host's OSRELDATE. If the WORLDTMP
927 # is older than the ABI-breakage OSRELDATE of the HOST then we rebuild.
928 .if defined(OBJDIR_HOST_OSRELDATE)
929 .for _ver in ${META_MODE_BAD_ABI_VERS}
930 .if ${OSRELDATE} >= ${_ver} && ${OBJDIR_HOST_OSRELDATE} < ${_ver}
932 .endif
933 .endfor
934 .if defined(_meta_mode_need_rebuild)
935 .info META_MODE: Rebuilding host tools due to ABI breakage in __FreeBSD_version ${_meta_mode_need_r…
937 .export NO_META_IGNORE_HOST_HEADERS
938 .endif # defined(_meta_mode_need_rebuild)
939 .endif # defined(OBJDIR_HOST_OSRELDATE)
940 .endif # ${MK_META_MODE} == "yes" && ${MK_CLEAN} == "no" ...
942 # __FreeBSD_version is in WORLDTMP. This purposely does NOT have
943 # a make dependency on /usr/include/osreldate.h as the file should
944 # only be copied when it is missing or meta mode determines it has changed.
946 # the file will never be updated unless that flag is specified. This
948 # META_MODE_BADABI_REVS above.
949 host-osreldate.h: # DO NOT ADD /usr/include/osreldate.h here
950 .if !defined(CROSSBUILD_HOST)
951 @cp -f /usr/include/osreldate.h ${.TARGET}
952 .else
953 @echo "#ifndef __FreeBSD_version" > ${.TARGET}
954 @echo "#define __FreeBSD_version ${OSRELDATE}" >> ${.TARGET}
955 @echo "#endif" >> ${.TARGET}
956 .endif
958 WMAKE= ${TIME_ENV} ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
959 BWPHASE=${.TARGET:C,^_,,} \
963 IMAKE= ${TIME_ENV} ${IMAKEENV} ${MAKE} -f Makefile.inc1 \
965 .if empty(.MAKEFLAGS:M-n)
970 .else
972 .endif
975 # the build host to affect the contents of the distribution.
976 .if make(distributeworld) || make(distrib-dirs) || make(distribution) || \
979 .endif
981 .if defined(DB_FROM_SRC)
982 INSTALLFLAGS+= -N ${.CURDIR}/etc
983 MTREEFLAGS+= -N ${.CURDIR}/etc
984 .endif
987 .if defined(NO_ROOT)
990 IMAKE+= -DNO_ROOT METALOG=${METALOG}
991 METALOG_INSTALLFLAGS= -U -M ${METALOG} -D ${INSTALL_DDIR}
994 MTREEFLAGS+= -W
995 .endif
996 .if defined(BUILD_PKGS)
997 INSTALLFLAGS+= -h sha256
998 .endif
999 .if defined(DB_FROM_SRC) || defined(NO_ROOT)
1002 .endif
1004 .if make(distributeworld) || make(packageworld) || make(distributekernel) || \
1006 .if ${DISTDIR:U/} == /
1007 .error DISTDIR must be set for make distribute* and make package*, and may not be the root director…
1008 .endif
1009 .if !defined(NO_ROOT) || !defined(METALOG)
1010 .error NO_ROOT and METALOG must be set for make distribute* and make package*.
1011 .endif
1012 .endif
1014 .if make(distributeworld)
1016 CERTCTLFLAGS+= -d /base
1017 .else
1019 .endif
1020 CERTCTLFLAGS+= -D "${CERTCTLDESTDIR}"
1022 DESTDIR_MTREEFLAGS= -deU
1024 # so we also pass -W
1025 WORLDTMP_MTREEFLAGS= -deUW
1026 .if defined(NO_ROOT)
1027 # When building with -DNO_ROOT we shouldn't be changing the directories
1028 # that are created by mtree to be owned by root/wheel.
1029 DESTDIR_MTREEFLAGS+= -W
1030 .endif
1031 .if defined(DB_FROM_SRC)
1032 DISTR_MTREEFLAGS= -N ${.CURDIR}/etc
1033 .endif
1035 .if ${BUILD_WITH_STRICT_TMPPATH} != 0
1037 .endif
1042 METALOG_SORT_CMD= env -i LC_COLLATE=C sort
1046 KMAKE= ${TIME_ENV} ${KMAKEENV} ${MAKE} ${.MAKEFLAGS} ${KERNEL_FLAGS} KERNEL=${INSTKERNNAME}
1052 # success, regardless of how old your existing system is.
1054 _sanity_check: .PHONY .MAKE
1055 .if ${.CURDIR:C/[^,]//g} != ""
1057 # anywhere in the path of it's files.
1062 .elif ${.CURDIR:M*\:*} != ""
1063 # Using ':' leaks into PATH and breaks finding cross-tools.
1068 .endif
1072 # replacing generated files. Handle these cases here in an ad-hoc fashion.
1073 _cleanobj_fast_depend_hack: .PHONY
1074 @echo ">>> Deleting stale dependencies...";
1077 sh ${.CURDIR}/tools/build/depend-cleanup.sh ${OBJTOP}
1079 _cleanworldtmp: .PHONY
1080 .if ${MK_CLEAN} == "yes"
1082 @echo "--------------------------------------------------------------"
1084 @echo "--------------------------------------------------------------"
1085 rm -rf ${WORLDTMP}
1086 .else
1087 # Note: for delete-old we need to set $PATH to also include the host $PATH
1089 # will fail to run due to missing binaries. $WMAKE sets PATH to only ${TMPPATH}
1091 ${_+_}@if [ -e "${WORLDTMP}" ]; then \
1092 echo ">>> Deleting stale files in build tree..."; \
1093 cd ${.CURDIR}; env PATH=${TMPPATH:Q}:${PATH:Q} ${WMAKE:NPATH=*} \
1094 _NO_INCLUDE_COMPILERMK=t -DBATCH_DELETE_OLD_FILES delete-old \
1095 delete-old-libs >/dev/null; \
1097 rm -rf ${WORLDTMP}/legacy/usr/include
1098 .if ${USING_SYSTEM_COMPILER} == "yes"
1099 .for cc in cc c++
1100 if [ -x ${WORLDTMP}/usr/bin/${cc} ]; then \
1101 inum=$$(ls -i ${WORLDTMP}/usr/bin/${cc}); \
1102 find ${WORLDTMP}/usr/bin -inum $${inum%% *} -delete; \
1104 .endfor
1105 .endif # ${USING_SYSTEM_COMPILER} == "yes"
1106 .if ${USING_SYSTEM_LINKER} == "yes"
1107 @rm -f ${WORLDTMP}/usr/bin/ld ${WORLDTMP}/usr/bin/ld.lld
1108 .endif # ${USING_SYSTEM_LINKER} == "yes"
1109 .endif # ${MK_CLEAN} == "yes"
1110 _worldtmp: .PHONY
1112 @echo "--------------------------------------------------------------"
1114 @echo "--------------------------------------------------------------"
1115 @mkdir -p ${WORLDTMP}
1116 @touch ${WORLDTMP}/${.TARGET}
1118 # available on the target system (this happens e.g. when building on non-FreeBSD)
1119 ${_+_}cd ${.CURDIR}/tools/build; \
1122 # tools in $WORLDTMP for the tools that we don't build during bootstrap-tools
1123 ${_+_}cd ${.CURDIR}/tools/build; \
1124 ${MAKE} DIRPRFX=tools/build/ DESTDIR=${WORLDTMP}/legacy host-symlinks
1128 @echo "--------------------------------------------------------------"
1130 @echo "--------------------------------------------------------------"
1131 ${_+_}cd ${.CURDIR}; ${BMAKE} legacy
1132 _bootstrap-tools:
1134 @echo "--------------------------------------------------------------"
1136 @echo "--------------------------------------------------------------"
1137 .if ${MK_CLEAN} != "yes"
1138 ${_+_}cd ${.CURDIR}; ${BMAKE} _NO_INCLUDE_COMPILERMK=t _cleanobj_fast_depend_hack
1139 .endif
1140 ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools
1141 mkdir -p ${WORLDTMP}/usr ${WORLDTMP}/lib/geom ${WORLDTMP}/bin
1142 ${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1143 -p ${WORLDTMP}/usr >/dev/null
1144 ${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.include.dist \
1145 -p ${WORLDTMP}/usr/include >/dev/null
1146 .for d in ${LIBCOMPAT_INCLUDE_DIRS}
1147 mkdir -p ${WORLDTMP}/usr/include/${d}
1148 .endfor
1149 ln -sf ${.CURDIR}/sys ${WORLDTMP}
1150 .if ${MK_DEBUG_FILES} != "no"
1151 ${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
1152 -p ${WORLDTMP}/usr/lib >/dev/null
1153 .endif
1154 .for _mtree in ${LOCAL_MTREE}
1155 ${WORLDTMP_MTREE} -f ${.CURDIR}/${_mtree} -p ${WORLDTMP} > /dev/null
1156 .endfor
1158 .if ${MK_CLEAN} == "yes"
1160 @echo "--------------------------------------------------------------"
1162 @echo "--------------------------------------------------------------"
1163 # Avoid including bsd.compiler.mk in clean and obj with _NO_INCLUDE_COMPILERMK
1165 ${_+_}cd ${.CURDIR}; ${WMAKE} _NO_INCLUDE_COMPILERMK=t ${CLEANDIR}
1166 .for LIBCOMPAT in ${_LIBCOMPATS}
1167 ${_+_}cd ${.CURDIR}; ${LIB${LIBCOMPAT}WMAKE} _NO_INCLUDE_COMPILERMK=t -f Makefile.inc1 ${CLEANDIR}
1168 .endfor
1169 .else
1170 ${_+_}cd ${.CURDIR}; ${WMAKE} _NO_INCLUDE_COMPILERMK=t _cleanobj_fast_depend_hack
1171 .endif # ${MK_CLEAN} == "yes"
1174 @echo "--------------------------------------------------------------"
1176 @echo "--------------------------------------------------------------"
1177 ${_+_}cd ${.CURDIR}; ${WMAKE} _NO_INCLUDE_COMPILERMK=t obj
1178 _build-tools:
1180 @echo "--------------------------------------------------------------"
1182 @echo "--------------------------------------------------------------"
1183 ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools
1184 _cross-tools:
1186 @echo "--------------------------------------------------------------"
1188 @echo "--------------------------------------------------------------"
1189 @rm -f ${OBJTOP}/toolchain-metadata.mk
1190 ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools
1191 ${_+_}cd ${.CURDIR}; ${XMAKE} kernel-tools
1192 _build-metadata:
1194 @echo "--------------------------------------------------------------"
1196 @echo "--------------------------------------------------------------"
1197 ${_+_}cd ${.CURDIR}; ${WMAKE} toolchain-metadata.mk
1198 ${_+_}cd ${.CURDIR}; ${WMAKE} host-osreldate.h
1201 @echo "--------------------------------------------------------------"
1203 @echo "--------------------------------------------------------------"
1205 # headers from default SUBDIR. Do SUBDIR_OVERRIDE includes last.
1206 ${_+_}cd ${.CURDIR}; ${WMAKE} SUBDIR_OVERRIDE= SHARED=symlinks \
1208 .if !empty(SUBDIR_OVERRIDE) && make(buildworld)
1209 ${_+_}cd ${.CURDIR}; ${WMAKE} MK_INCLUDES=yes SHARED=symlinks includes
1210 .endif
1211 ${_+_}cd ${.CURDIR}; ${WMAKE} test-includes
1214 @echo "--------------------------------------------------------------"
1216 @echo "--------------------------------------------------------------"
1217 ${_+_}cd ${.CURDIR}; \
1218 ${WMAKE} -DNO_FSCHG MK_HTML=no -DNO_LINT MK_MAN=no \
1221 everything: .PHONY
1223 @echo "--------------------------------------------------------------"
1225 @echo "--------------------------------------------------------------"
1226 ${_+_}cd ${.CURDIR}; _PARALLEL_SUBDIR_OK=1 ${WMAKE} all
1229 .if !defined(WORLDFAST)
1231 .if empty(SUBDIR_OVERRIDE)
1232 WMAKE_TGTS+= _bootstrap-tools
1233 .endif
1235 .if !defined(NO_OBJWALK)
1237 .endif
1238 WMAKE_TGTS+= _build-tools _cross-tools
1239 WMAKE_TGTS+= _build-metadata
1241 .endif
1242 .if !defined(NO_LIBS)
1244 .endif
1245 .if empty(SUBDIR_OVERRIDE)
1246 .for libcompat in ${libcompats}
1248 .endfor
1249 .endif
1253 .if make(buildworld)
1255 .export _BUILDWORLD_START
1256 .endif
1257 .if make(reinstall) || make(restage)
1259 .export _INSTALLWORLD_START
1260 .endif
1261 .if make(*installkernel*)
1263 .export _INSTALLKERNEL_START
1264 .endif
1266 buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue .PHONY
1267 .ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
1269 _ncpu_cmd=sysctl -n hw.ncpu 2>/dev/null || nproc 2>/dev/null || echo unknown
1271 buildworld_prologue: .PHONY
1272 @echo "--------------------------------------------------------------"
1274 @echo "--------------------------------------------------------------"
1276 buildworld_epilogue: .PHONY
1278 @echo "--------------------------------------------------------------"
1280 @seconds=$$(($$(date '+%s') - ${_BUILDWORLD_START})); \
1281 echo ">>> World built in $$seconds seconds, ncpu: $$(${_ncpu_cmd})${.MAKE.JOBS:S/^/, make -j/}"
1282 @echo "--------------------------------------------------------------"
1286 # and Makefile.inc1 causes the correct PATH to be used, rather than a
1287 # modification of the current environment's PATH. In addition, we need
1288 # to quote multiword values.
1290 buildenvvars: .PHONY
1291 @echo ${WMAKEENV:Q} ${.MAKE.EXPORTED:@v@$v=\"${$v}\"@}
1293 .if ${.TARGETS:Mbuildenv}
1294 .if ${.MAKEFLAGS:M-j}
1295 .error The buildenv target is incompatible with -j
1296 .endif
1297 .endif
1298 BUILDENV_DIR?= ${.CURDIR}
1300 # Note: make will report any errors the shell reports. This can
1302 # error or is terminated by SIGINT. These reported errors look bad,
1303 # but are harmless. Allowing them also allows BUILDENV_SHELL to
1304 # be a complex command whose status will be returned to the caller.
1305 # Some scripts in tools rely on this behavior to report build errors.
1307 buildenv: .PHONY
1309 .if ${BUILDENV_SHELL:M*zsh*}
1311 .endif
1317 toolchain: ${TOOLCHAIN_TGTS} .PHONY
1319 .if make(kernel-toolchain)
1320 .ORDER: ${KERNEL_TOOLCHAIN_TGTS}
1321 .endif
1322 kernel-toolchain: ${KERNEL_TOOLCHAIN_TGTS} .PHONY
1327 # Checks to be sure system is ready for installworld/installkernel.
1329 installcheck: _installcheck_world _installcheck_kernel .PHONY
1330 _installcheck_world: .PHONY
1331 @echo "--------------------------------------------------------------"
1333 @echo "--------------------------------------------------------------"
1334 _installcheck_kernel: .PHONY
1335 @echo "--------------------------------------------------------------"
1337 @echo "--------------------------------------------------------------"
1341 # using the user/group database in the source tree.
1343 .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE} || \
1345 .if !make(distributeworld)
1348 __installcheck_DESTDIR: .PHONY
1349 .if !defined(DESTDIR) || empty(DESTDIR)
1352 .endif
1353 .endif
1354 .endif
1356 .if !defined(DB_FROM_SRC)
1358 # Check for missing UIDs/GIDs.
1371 __installcheck_UGID: .PHONY
1372 .for uid in ${CHECK_UIDS}
1373 @if ! `id -u ${uid} >/dev/null 2>&1`; then \
1374 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \
1377 .endfor
1378 .for gid in ${CHECK_GIDS}
1379 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \
1380 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \
1383 .endfor
1384 .endif
1387 # includes rescue, try running rescue from the objdir as a sanity check. If
1388 # rescue is not functional (e.g., because it depends on a system call not
1389 # supported by the currently running kernel), abort the installation.
1391 .if !make(distributeworld) && ${MK_RESCUE} != "no" && \
1394 __installcheck_sh_check: .PHONY
1395 @if [ "`${OBJTOP}/rescue/rescue/rescue sh -c 'echo OK'`" != \
1400 .endif
1403 # Required install tools to be saved in a scratch dir for safety.
1405 .if !defined(CROSSBUILD_HOST)
1407 .endif
1410 date echo egrep find grep id install ${_install-info} \
1414 .if ${MK_ZONEINFO} != "no"
1416 .endif
1419 .if ${MK_MAN_UTILS} != "no"
1421 .endif
1428 # Distributes everything compiled by a `buildworld'.
1432 # Installs everything compiled by a 'buildworld'.
1435 # Non-base distributions produced by the base system
1437 .for libcompat in ${libcompats}
1439 .endfor
1440 .if ${MK_TESTS} != "no"
1442 .endif
1445 .if ${MK_DEBUG_FILES} != "no"
1447 .endif
1451 distributeworld installworld stageworld: _installcheck_world .PHONY
1452 mkdir -p ${INSTALLTMP}
1457 echo "Required tool $$prog not found in PATH ("${TMPPATH:Q}")." >&2; \
1461 if [ -z "${CROSSBUILD_HOST}" ] ; then \
1462 libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | grep -Ev '\[.*]' | \
1464 set -- $$line; \
1468 echo "Required library $$1 not found." >&2; \
1474 cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale
1475 .if defined(NO_ROOT)
1476 -mkdir -p ${METALOG:H}
1478 .endif
1479 .if make(distributeworld)
1480 .for dist in ${EXTRA_DISTRIBUTIONS}
1481 -mkdir ${DESTDIR}/${DISTDIR}/${dist}
1482 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.root.dist \
1483 -p ${DESTDIR}/${DISTDIR}/${dist} >/dev/null
1484 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1485 -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null
1486 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.include.dist \
1487 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/include >/dev/null
1488 .for d in ${LIBCOMPAT_INCLUDE_DIRS}
1489 -mkdir ${DESTDIR}/${DISTDIR}/${dist}/usr/include/${d}
1490 .endfor
1491 .if ${MK_DEBUG_FILES} != "no"
1492 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
1493 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib >/dev/null
1494 .endif
1495 .for libcompat in ${libcompats}
1496 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \
1497 -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null
1498 .if ${MK_DEBUG_FILES} != "no"
1499 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \
1500 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib/debug/usr >/dev/null
1501 .endif
1502 .endfor
1503 .if ${MK_TESTS} != "no" && ${dist} == "tests"
1504 -mkdir -p ${DESTDIR}/${DISTDIR}/${dist}${TESTSBASE}
1505 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
1506 -p ${DESTDIR}/${DISTDIR}/${dist}${TESTSBASE} >/dev/null
1507 .if ${MK_DEBUG_FILES} != "no"
1508 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
1509 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib/debug${TESTSBASE} >/dev/null
1510 .endif
1511 .endif
1512 ${IMAKEENV} ${DISTR_MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \
1513 sed -e 's#^\./#./${dist}/#' >> ${METALOG}
1514 ${IMAKEENV} ${DISTR_MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.usr.dist | \
1515 sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG}
1516 ${IMAKEENV} ${DISTR_MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.include.dist | \
1517 sed -e 's#^\./#./${dist}/usr/include/#' >> ${METALOG}
1518 .for d in ${LIBCOMPAT_INCLUDE_DIRS}
1519 echo "./${dist}/usr/include/${d} type=dir uname=root gname=wheel mode=0755" >> ${METALOG}
1520 .endfor
1521 .for libcompat in ${libcompats}
1522 ${IMAKEENV} ${DISTR_MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist | \
1523 sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG}
1524 .endfor
1525 .endfor
1526 -mkdir ${DESTDIR}/${DISTDIR}/base
1527 ${_+_}cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH:Q} ${MAKE} \
1530 LOCAL_MTREE=${LOCAL_MTREE:Q} distrib-dirs
1532 .endif # make(distributeworld)
1533 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \
1534 ${IMAKEENV} rm -rf ${INSTALLTMP}
1535 .if !make(packageworld) && ${MK_CAROOT} != "no"
1539 sh ${SRCTOP}/usr.sbin/certctl/certctl.sh ${CERTCTLFLAGS} rehash; \
1541 …echo "No openssl on the host, not rehashing certificates target -- /etc/ssl may not be populated."…
1543 .endif
1544 .if make(distributeworld)
1545 .for dist in ${EXTRA_DISTRIBUTIONS}
1546 find ${DESTDIR}/${DISTDIR}/${dist} -mindepth 1 -type d -empty -delete
1547 .endfor
1548 .for dist in base ${EXTRA_DISTRIBUTIONS}
1549 .for path suffix in "" .meta /usr/lib/debug .debug.meta
1551 @# line from the METALOG. This relies on the fact that
1553 @# the relevant mtree line.
1555 find ./${dist}${path} | ${METALOG_SORT_CMD} -u ${METALOG} - | \
1556 …IC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}/, "."); print } }'…
1558 .endfor
1559 .endfor
1560 .endif # make(distributeworld)
1562 packageworld: .PHONY
1563 .for dist in base ${EXTRA_DISTRIBUTIONS}
1564 .if defined(NO_ROOT)
1566 ${TAR_CMD} cvf - --exclude usr/lib/debug \
1567 @${DESTDIR}/${DISTDIR}/${dist}.meta | \
1568 ${XZ_CMD} > ${PACKAGEDIR}/${dist}.txz
1569 .else
1571 ${TAR_CMD} cvf - --exclude usr/lib/debug . | \
1572 ${XZ_CMD} > ${PACKAGEDIR}/${dist}.txz
1573 .endif
1574 .endfor
1576 .for dist in ${DEBUG_DISTRIBUTIONS}
1577 . if defined(NO_ROOT)
1579 ${TAR_CMD} cvf - @${DESTDIR}/${DISTDIR}/${dist}.debug.meta | \
1580 ${XZ_CMD} > ${PACKAGEDIR}/${dist}-dbg.txz
1581 . else
1583 ${TAR_CMD} cvLf - usr/lib/debug | \
1584 ${XZ_CMD} > ${PACKAGEDIR}/${dist}-dbg.txz
1585 . endif
1586 .endfor
1588 makeman: .PHONY
1589 ${_+_}cd ${.CURDIR}/tools/build/options; sh makeman > \
1590 ${.CURDIR}/share/man/man5/src.conf.5
1592 # Ensure no regressions in self-includeability of sys/*.h and net*/*.h
1593 test-includes: .PHONY
1594 ${_+_}cd ${.CURDIR}/tools/build/test-includes; \
1595 ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} DESTDIR=${WORLDTMP} test-includes
1599 # /usr/libexec here for flua. ${TMPPATH} still usefully includes anything else
1600 # we may need to function.
1610 sysent: .PHONY
1611 .for _dir in ${_sysent_dirs}
1612 sysent-${_dir}: .PHONY
1613 @echo "${MAKE} -C ${.CURDIR}/${_dir} sysent"
1614 ${_+_}@env PATH=${_sysent_PATH:Q} ${MAKE} -C ${.CURDIR}/${_dir} sysent
1616 sysent: sysent-${_dir}
1617 .endfor
1624 # most recent server build.
1626 restage reinstall: .MAKE .PHONY
1627 @echo "--------------------------------------------------------------"
1629 @echo "--------------------------------------------------------------"
1630 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 \
1632 .if make(restage)
1633 @echo "--------------------------------------------------------------"
1635 @echo "--------------------------------------------------------------"
1636 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 \
1638 .endif
1640 @echo "--------------------------------------------------------------"
1642 @echo "--------------------------------------------------------------"
1643 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
1644 .for libcompat in ${libcompats}
1645 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install${libcompat}
1646 .endfor
1647 @echo "--------------------------------------------------------------"
1649 @seconds=$$(($$(date '+%s') - ${_INSTALLWORLD_START})); \
1650 …> Install world completed in $$seconds seconds, ncpu: $$(${_ncpu_cmd})${.MAKE.JOBS:S/^/, make -j/}"
1651 @echo "--------------------------------------------------------------"
1653 redistribute: .MAKE .PHONY
1654 @echo "--------------------------------------------------------------"
1656 @echo "--------------------------------------------------------------"
1657 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
1658 .for libcompat in ${libcompats}
1659 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute${libcompat} \
1661 .endfor
1663 distrib-dirs distribution: .MAKE .PHONY
1664 ${_+_}cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH:Q} ${MAKE} \
1665 ${IMAKE_INSTALL} ${IMAKE_MTREE} METALOG=${METALOG} ${.TARGET}
1666 .if make(distribution)
1667 ${_+_}cd ${.CURDIR}; ${CROSSENV} PATH=${TMPPATH:Q} \
1668 ${MAKE} -f Makefile.inc1 ${IMAKE_INSTALL} \
1671 .endif
1676 buildetc: .MAKE .PHONY
1677 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 _worldtmp
1678 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 _legacy
1679 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 _bootstrap-tools \
1681 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 _obj \
1683 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 everything \
1686 installetc: .MAKE .PHONY
1687 @echo "--------------------------------------------------------------"
1689 @echo "--------------------------------------------------------------"
1690 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distrib-dirs
1691 @echo "--------------------------------------------------------------"
1693 @echo "--------------------------------------------------------------"
1694 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribution
1700 # KERNCONF. If not defined a GENERIC kernel is built/installed.
1703 # as the one being installed.
1706 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
1707 # be set to cross-build, we have to make sure TARGET is set
1708 # properly.
1710 .if defined(KERNFAST)
1714 # Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah
1715 .if !defined(KERNCONF) && ${KERNFAST} != "1"
1717 .endif
1718 .endif
1725 KERNSRCDIR?= ${.CURDIR}/sys
1727 KRNLOBJDIR= ${OBJTOP}${KERNSRCDIR:C,^${.CURDIR},,}
1730 .for _k in ${GENERIC_KERNCONF} MINIMAL${GENERIC_KERNCONF_SUFX_${TARGET_ARCH}} ${GENERIC_KERNCONF}-M…
1731 .if exists(${KERNCONFDIR}/${_k})
1733 .for _dbg in NODEBUG DEBUG
1734 .if exists(${KERNCONFDIR}/${_k}-${_dbg})
1735 PKG_KERNCONF+= ${_k}-${_dbg}
1736 .endif
1737 .endfor
1738 .endif
1739 .endfor
1741 .if defined(PACKAGE_BUILDING)
1743 .else
1745 .endif
1749 .if defined(NO_INSTALLKERNEL)
1750 # All of the BUILDKERNELS loops start at index 1.
1752 .endif
1753 .for _kernel in ${KERNCONF}
1754 .if !defined(_MKSHOWCONFIG) && exists(${KERNCONFDIR}/${_kernel})
1756 .if empty(INSTALLKERNEL) && !defined(NO_INSTALLKERNEL)
1758 .endif
1759 .else
1760 .if make(buildkernel)
1761 .error Missing KERNCONF ${KERNCONFDIR}/${_kernel}
1762 .endif
1763 .endif
1764 .endfor
1766 _cleankernobj_fast_depend_hack: .PHONY
1767 # 20191009 r353340 removal of opensolaris_atomic.S (also r353381)
1768 .if ${MACHINE} != i386
1769 .for f in opensolaris_atomic
1770 .for m in opensolaris zfs
1771 @if [ -e "${KRNLOBJDIR}/${KERNCONF}/modules${SRCTOP}/sys/modules/${m}/.depend.${f}.o" ] && \
1772 …grep -q ${f}.S "${KRNLOBJDIR}/${KERNCONF}/modules${SRCTOP}/sys/modules/${m}/.depend.${f}.o"; then \
1774 rm -f ${KRNLOBJDIR}/${KERNCONF}/modules${SRCTOP}/sys/modules/${m}/.depend.${f}.*; \
1776 .endfor
1777 .endfor
1778 .endif
1780 ${WMAKE_TGTS:N_cleanworldtmp:N_worldtmp:${libcompats:@v@Nbuild${v}@:ts:}}: .MAKE .PHONY
1781 ${.ALLTARGETS:M_*:N_cleanworldtmp:N_worldtmp}: .MAKE .PHONY
1784 .if make(buildkernel)
1786 .endif
1791 # Builds all kernels defined by BUILDKERNELS.
1793 buildkernel: .MAKE .PHONY
1794 .if empty(BUILDKERNELS:Ndummy)
1795 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \
1797 .endif
1799 .for _kernel in ${BUILDKERNELS:Ndummy}
1800 @echo "--------------------------------------------------------------"
1802 @echo "--------------------------------------------------------------"
1804 mkdir -p ${KRNLOBJDIR}
1805 .if !defined(NO_KERNELCONFIG)
1807 @echo "--------------------------------------------------------------"
1809 @echo "--------------------------------------------------------------"
1812 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
1813 -I '${KERNCONFDIR}' -I '${KRNLCONFDIR}' \
1815 .endif
1816 .if ${MK_CLEAN} == "yes" && !defined(NO_KERNELCLEAN)
1818 @echo "--------------------------------------------------------------"
1820 @echo "--------------------------------------------------------------"
1822 .else
1823 ${_+_}cd ${.CURDIR}; ${WMAKE} _cleankernobj_fast_depend_hack
1824 .endif
1825 .if !defined(NO_KERNELOBJ)
1827 @echo "--------------------------------------------------------------"
1829 @echo "--------------------------------------------------------------"
1831 .endif
1833 @echo "--------------------------------------------------------------"
1835 @echo "--------------------------------------------------------------"
1836 ${_+_}cd ${.CURDIR}; ${KTMAKE} kernel-tools
1838 @echo "--------------------------------------------------------------"
1840 @echo "--------------------------------------------------------------"
1841 ${_+_}cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ
1842 @echo "--------------------------------------------------------------"
1844 @echo "--------------------------------------------------------------"
1846 .endfor
1847 @seconds=$$(($$(date '+%s') - ${_BUILDKERNEL_START})); \
1848 …(s) ${BUILDKERNELS} built in $$seconds seconds, ncpu: $$(${_ncpu_cmd})${.MAKE.JOBS:S/^/, make -j/}"
1849 @echo "--------------------------------------------------------------"
1851 .if !make(packages) && !make(update-packages)
1853 .else
1854 # packages/update-packages installs kernels to a staging directory then builds
1855 # packages from the result to be installed, typically to other systems. It is
1857 # specified.
1859 .endif
1862 # installkernel, etc.
1866 installkernel installkernel.debug \
1867 reinstallkernel reinstallkernel.debug: _installcheck_kernel .PHONY
1868 .if !defined(NO_INSTALLKERNEL)
1869 .if empty(INSTALLKERNEL)
1870 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
1872 .endif
1873 @echo "--------------------------------------------------------------"
1875 @echo "--------------------------------------------------------------"
1879 ${.TARGET:S/kernel//}
1880 @echo "--------------------------------------------------------------"
1882 @echo "--------------------------------------------------------------"
1883 @seconds=$$(($$(date '+%s') - ${_INSTALLKERNEL_START})); \
1884 …{INSTALLKERNEL} completed in $$seconds seconds, ncpu: $$(${_ncpu_cmd})${.MAKE.JOBS:S/^/, make -j/}"
1885 @echo "--------------------------------------------------------------"
1886 .endif
1887 .if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes"
1888 .for _kernel in ${BUILDKERNELS:[2..-1]}
1889 @echo "--------------------------------------------------------------"
1891 @echo "--------------------------------------------------------------"
1894 ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME}.${_kernel} METALOG=${METALOG} \
1895 ${.TARGET:S/kernel//}
1896 @echo "--------------------------------------------------------------"
1898 @echo "--------------------------------------------------------------"
1899 .endfor
1900 @seconds=$$(($$(date '+%s') - ${_INSTALLKERNEL_START})); \
1901 …${BUILDKERNELS} completed in $$seconds seconds, ncpu: $$(${_ncpu_cmd})${.MAKE.JOBS:S/^/, make -j/}"
1902 @echo "--------------------------------------------------------------"
1903 .endif
1905 distributekernel distributekernel.debug: .PHONY
1906 .if !defined(NO_INSTALLKERNEL)
1907 .if empty(INSTALLKERNEL)
1908 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
1910 .endif
1911 mkdir -p ${DESTDIR}/${DISTDIR}
1912 rm -f ${DESTDIR}/${DISTDIR}/kernel.premeta
1914 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.premeta/} \
1917 METALOG=${METALOG:S/METALOG/kernel.premeta/} \
1918 ${.TARGET:S/distributekernel/install/}
1919 .if defined(NO_ROOT)
1920 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.meta
1921 sed -e 's|^./kernel|.|' ${DESTDIR}/${DISTDIR}/kernel.premeta | \
1922 ${METALOG_SORT_CMD} >> ${DESTDIR}/${DISTDIR}/kernel.meta
1923 .endif
1924 .endif
1925 .if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes"
1926 .for _kernel in ${BUILDKERNELS:[2..-1]}
1927 rm -f ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta
1929 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.${_kernel}.premeta/} \
1931 KERNEL=${INSTKERNNAME}.${_kernel} \
1932 DISTBASE=/kernel.${_kernel} DESTDIR=${INSTALL_DDIR}/kernel.${_kernel} \
1933 METALOG=${METALOG:S/METALOG/kernel.${_kernel}.premeta/} \
1934 ${.TARGET:S/distributekernel/install/}
1935 .if defined(NO_ROOT)
1936 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta
1937 sed -e "s|^./kernel.${_kernel}|.|" \
1938 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta | \
1939 ${METALOG_SORT_CMD} >> ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta
1940 .endif
1941 .endfor
1942 .endif
1944 packagekernel: .PHONY
1945 .if defined(NO_ROOT)
1946 .if !defined(NO_INSTALLKERNEL)
1948 ${TAR_CMD} cvf - --exclude '*.debug' \
1949 @${DESTDIR}/${DISTDIR}/kernel.meta | \
1950 ${XZ_CMD} > ${PACKAGEDIR}/kernel.txz
1951 .endif
1952 .if ${MK_DEBUG_FILES} != "no"
1954 ${TAR_CMD} cvf - --include '*/*/*.debug' \
1955 @${DESTDIR}/${DISTDIR}/kernel.meta | \
1956 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel-dbg.txz
1957 .endif
1958 .if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes"
1959 .for _kernel in ${BUILDKERNELS:[2..-1]}
1960 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
1961 ${TAR_CMD} cvf - --exclude '*.debug' \
1962 @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta | \
1963 ${XZ_CMD} > ${PACKAGEDIR}/kernel.${_kernel}.txz
1964 .if ${MK_DEBUG_FILES} != "no"
1965 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
1966 ${TAR_CMD} cvf - --include '*/*/*.debug' \
1967 @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta | \
1968 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}-dbg.txz
1969 .endif
1970 .endfor
1971 .endif
1972 .else
1973 .if !defined(NO_INSTALLKERNEL)
1975 ${TAR_CMD} cvf - --exclude '*.debug' . | \
1976 ${XZ_CMD} > ${PACKAGEDIR}/kernel.txz
1977 .endif
1978 .if ${MK_DEBUG_FILES} != "no"
1980 ${TAR_CMD} cvf - --include '*/*/*.debug' $$(eval find .) | \
1981 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel-dbg.txz
1982 .endif
1983 .if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes"
1984 .for _kernel in ${BUILDKERNELS:[2..-1]}
1985 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
1986 ${TAR_CMD} cvf - --exclude '*.debug' . | \
1987 ${XZ_CMD} > ${PACKAGEDIR}/kernel.${_kernel}.txz
1988 .if ${MK_DEBUG_FILES} != "no"
1989 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
1990 ${TAR_CMD} cvf - --include '*/*/*.debug' $$(eval find .) | \
1991 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}-dbg.txz
1992 .endif
1993 .endfor
1994 .endif
1995 .endif
1997 stagekernel: .PHONY
1998 ${_+_}${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} DISTDIR=. distributekernel
2006 PKG_LEVEL?= -1
2007 PKG_CLEVEL?= ${"${PKG_FORMAT:Mtar}" != "":?:-l ${PKG_LEVEL}}
2011 .if make(create-*-packages*) || make(real-update-packages) || make(real-sign-packages)
2012 PKG_ABI!= ${PKG_CMD} -o ABI_FILE=${PKG_ABI_FILE} config ABI
2013 .endif
2015 .ORDER: stage-packages create-packages
2016 .ORDER: create-packages create-world-packages
2017 .ORDER: create-packages create-source-packages
2018 .ORDER: create-packages create-kernel-packages
2019 .ORDER: create-packages sign-packages
2021 _pkgbootstrap: .PHONY
2022 .if make(*package*) && !exists(${LOCALBASE}/sbin/pkg)
2024 .endif
2026 PKG_BIN_VERSION!=${PKG_CMD} --version </dev/null 2>/dev/null |\
2027 awk -F. '/^[0-9.]+$$/ {print $$1 * 10000 + $$2 * 100 + $$3}'
2028 .if ${PKG_BIN_VERSION} < 11700
2030 .else
2032 .endif
2034 .if !defined(PKG_VERSION_FROM) && make(real-update-packages)
2035 .if exists(${PKG_ABI_FILE}) && exists(${REPODIR}/${PKG_ABI})
2039 # X.bY => beta
2040 # X.aY => alpha
2041 # X.rcY => rc
2042 # X.snap => snap
2049 .if ${PKG_VERSION_FROM:M*.snap*}
2050 BRANCH_EXT_FROM= ${PKG_VERSION_FROM:C/.snap.*$//}.snap
2051 .elif ${PKG_VERSION_FROM:M*.b*}
2053 .elif ${PKG_VERSION_FROM:M*.rc*}
2055 .elif ${PKG_VERSION_FROM:M*.a*}
2057 .endif
2058 .else
2062 .endif
2063 .endif
2068 packages: .PHONY
2069 ${_+_}${MAKE} -C ${.CURDIR} ${PKGMAKEARGS} real-packages
2071 update-packages: .PHONY
2072 ${_+_}${MAKE} -C ${.CURDIR} ${PKGMAKEARGS} real-update-packages
2074 package-pkg: .PHONY
2075 rm -rf /tmp/ports.${TARGET} || :
2076 env ${WMAKEENV:Q} SRCDIR=${.CURDIR} PORTSDIR=${PORTSDIR} REVISION=${_REVISION} \
2080 sh ${.CURDIR}/release/scripts/make-pkg-package.sh
2082 real-packages: stage-packages create-packages sign-packages .PHONY
2084 real-update-packages: stage-packages .PHONY
2085 ${_+_}${MAKE} -C ${.CURDIR} PKG_VERSION=${PKG_VERSION} create-packages
2086 .if empty(PKG_VERSION_FROM_DIR)
2088 .else
2090 @for pkg in ${PKG_VERSION_FROM_DIR}/${PKG_NAME_PREFIX}-*; do \
2091 pkgname=$$(pkg query -F $${pkg} '%n' | sed 's/${PKG_NAME_PREFIX}-\(.*\)/\1/') ; \
2092 newpkgname=${PKG_NAME_PREFIX}-$${pkgname}-${PKG_VERSION}.${PKG_EXT} ; \
2093 oldsum=$$(pkg query -F $${pkg} '%X') ; \
2094 if [ ! -f ${REPODIR}/${PKG_ABI}/${PKG_VERSION}/$${newpkgname} ]; then \
2097 newsum=$$(pkg query -F ${REPODIR}/${PKG_ABI}/${PKG_VERSION}/$${newpkgname} '%X') ; \
2098 if [ "${BRANCH_EXT_FROM}" = "${BRANCH_EXT}" -a "$${oldsum}" = "$${newsum}" ]; then \
2099 echo "==> Keeping old ${PKG_NAME_PREFIX}-$${pkgname}-${PKG_VERSION_FROM}.${PKG_EXT}" ; \
2106 .endif
2107 ${_+_}@cd ${.CURDIR}; \
2108 ${MAKE} -f Makefile.inc1 PKG_VERSION=${PKG_VERSION} sign-packages
2110 stage-packages-world: .PHONY
2111 @mkdir -p ${WSTAGEDIR}
2112 ${_+_}@cd ${.CURDIR}; \
2113 ${MAKE} DESTDIR=${WSTAGEDIR} -DNO_ROOT stageworld
2115 stage-packages-kernel: .PHONY
2116 @mkdir -p ${KSTAGEDIR}
2117 ${_+_}@cd ${.CURDIR}; \
2118 ${MAKE} DESTDIR=${KSTAGEDIR} -DNO_ROOT stagekernel
2120 stage-packages-source: .PHONY
2121 @mkdir -p ${SSTAGEDIR};
2123 stage-packages: .PHONY stage-packages-world stage-packages-kernel stage-packages-source
2125 _repodir: .PHONY
2126 @mkdir -p ${REPODIR}
2128 create-packages-world: _pkgbootstrap _repodir .PHONY
2129 ${_+_}@cd ${.CURDIR}; \
2130 ${MAKE} -f Makefile.inc1 \
2132 PKG_VERSION=${PKG_VERSION} create-world-packages
2134 create-packages-kernel: _pkgbootstrap _repodir .PHONY
2135 ${_+_}@cd ${.CURDIR}; \
2136 ${MAKE} -f Makefile.inc1 \
2140 create-kernel-packages
2142 create-packages-kernel-repo: .PHONY create-packages-kernel sign-packages
2144 create-packages-world-repo: .PHONY create-packages-world sign-packages
2146 create-packages-source: _pkgbootstrap _repodir .PHONY
2147 ${_+_}@cd ${.CURDIR}; \
2148 ${MAKE} -f Makefile.inc1 \
2150 PKG_VERSION=${PKG_VERSION} create-source-packages
2152 create-packages: .PHONY create-packages-world create-packages-kernel create-packages-source
2154 create-source-src-package: _pkgbootstrap .PHONY
2155 rm -f ${SSTAGEDIR}/src.plist 2>/dev/null || :
2156 .if !empty(GIT_CMD) && exists(${GIT_CMD}) && exists(${SRCDIR}/.git)
2159 ${GIT_CMD} ls-files --recurse-submodules ":!:sys/" ) \
2160 > ${SSTAGEDIR}/src.plist
2161 ${SRCDIR}/release/packages/generate-ucl.lua \
2170 ${SRCDIR}/release/packages/template.ucl \
2171 ${SSTAGEDIR}/src.ucl
2172 ${PKG_CMD} -o ABI=${PKG_ABI} \
2173 -o OSVERSION="${SRCRELDATE}" \
2174 create -f ${PKG_FORMAT} ${PKG_CLEVEL} \
2175 -M ${SSTAGEDIR}/src.ucl \
2176 -p ${SSTAGEDIR}/src.plist \
2177 -r ${SRCDIR} \
2178 -o ${REPODIR}/${PKG_ABI}/${PKG_OUTPUT_DIR}
2179 .endif
2181 create-source-src-sys-package: _pkgbootstrap .PHONY
2182 rm -f ${SSTAGEDIR}/src-sys.plist 2>/dev/null || :
2183 .if !empty(GIT_CMD) && exists(${GIT_CMD}) && exists(${SRCDIR}/.git)
2186 ${GIT_CMD} ls-files --recurse-submodules "sys/" ) \
2187 > ${SSTAGEDIR}/src-sys.plist
2188 ${SRCDIR}/release/packages/generate-ucl.lua \
2189 PKGNAME "src-sys" \
2197 ${SRCDIR}/release/packages/template.ucl \
2198 ${SSTAGEDIR}/src-sys.ucl
2199 ${PKG_CMD} -o ABI=${PKG_ABI} \
2200 -o OSVERSION="${SRCRELDATE}" \
2201 create -f ${PKG_FORMAT} ${PKG_CLEVEL} \
2202 -M ${SSTAGEDIR}/src-sys.ucl \
2203 -p ${SSTAGEDIR}/src-sys.plist \
2204 -r ${SRCDIR} \
2205 -o ${REPODIR}/${PKG_ABI}/${PKG_OUTPUT_DIR}
2206 .endif
2208 create-source-packages: .PHONY _pkgbootstrap create-source-src-package create-source-src-sys-package
2210 create-world-packages: _pkgbootstrap .PHONY
2211 @rm -f ${WSTAGEDIR}/*.plist 2>/dev/null || :
2214 awk -f ${SRCDIR}/release/scripts/mtree-to-plist.awk
2215 @for plist in ${WSTAGEDIR}/*.plist; do \
2217 pkgname=$${plist%.plist} ; \
2219 done > ${WSTAGEDIR}/packages.mk
2220 ${_+_}@cd ${.CURDIR}; \
2221 ${MAKE} -f Makefile.inc1 create-world-packages-jobs \
2223 .MAKE.JOB.PREFIX=
2225 .if make(create-world-packages-jobs)
2226 .include "${WSTAGEDIR}/packages.mk"
2227 .endif
2229 create-world-packages-jobs: .PHONY
2230 .for pkgname in ${_PKGS}
2231 create-world-packages-jobs: create-world-package-${pkgname}
2232 create-world-package-${pkgname}: .PHONY
2233 @sh ${SRCDIR}/release/packages/generate-ucl.sh -o ${pkgname} \
2234 -s ${SRCDIR} -u ${WSTAGEDIR}/${pkgname}.ucl
2235 @awk -F\" ' \
2236 /^name/ { printf("===> Creating %s-", $$2); next } \
2238 ' ${WSTAGEDIR}/${pkgname}.ucl
2240 sed -i '' -e "s/%VCS_REVISION%/${VCS_REVISION}/" ${WSTAGEDIR}/${pkgname}.ucl ; \
2242 ${PKG_CMD} -o ABI=${PKG_ABI} -o ALLOW_BASE_SHLIBS=yes \
2243 -o OSVERSION="${SRCRELDATE}" \
2244 create -f ${PKG_FORMAT} ${PKG_CLEVEL} \
2245 -M ${WSTAGEDIR}/${pkgname}.ucl \
2246 -p ${WSTAGEDIR}/${pkgname}.plist \
2247 -r ${WSTAGEDIR} \
2248 -o ${REPODIR}/${PKG_ABI}/${PKG_OUTPUT_DIR}
2249 .endfor
2251 _default_flavor= -default
2252 .if make(*package*) && exists(${KSTAGEDIR}/kernel.meta)
2253 . if ${MK_DEBUG_FILES} != "no"
2254 _debug=-dbg
2255 . endif
2257 create-dtb-package:
2258 @if [ -f ${KSTAGEDIR}/${DISTDIR}/dtb.plist ]; then \
2259 ${SRCDIR}/release/packages/generate-ucl.lua \
2267 ${SRCDIR}/release/packages/template.ucl \
2268 ${KSTAGEDIR}/${DISTDIR}/dtb.ucl ; \
2269 awk -F\" ' \
2270 /name/ { printf("===> Creating %s-", $$2); next } \
2272 ${KSTAGEDIR}/${DISTDIR}/dtb.ucl ; \
2273 ${PKG_CMD} -o ABI=${PKG_ABI} -o ALLOW_BASE_SHLIBS=yes \
2274 -o OSVERSION="${SRCRELDATE}" \
2275 create -f ${PKG_FORMAT} ${PKG_CLEVEL} \
2276 -M ${KSTAGEDIR}/${DISTDIR}/dtb.ucl \
2277 -p ${KSTAGEDIR}/${DISTDIR}/dtb.plist \
2278 -r ${KSTAGEDIR}/${DISTDIR} \
2279 -o ${REPODIR}/${PKG_ABI}/${PKG_OUTPUT_DIR} ; \
2282 create-kernel-packages: .PHONY
2283 . for flavor in "" ${_debug}
2284 create-kernel-packages: create-kernel-packages-flavor${flavor:C,^""$,${_default_flavor},} create-dt…
2285 create-kernel-packages-flavor${flavor:C,^""$,${_default_flavor},}: _pkgbootstrap .PHONY
2287 ${METALOG_SORT_CMD} ${KSTAGEDIR}/kernel.meta | \
2288 awk -f ${SRCDIR}/release/scripts/mtree-to-plist.awk \
2289 -v kernel=yes -v _kernconf=${INSTALLKERNEL} ; \
2290 ${SRCDIR}/release/packages/generate-ucl.lua \
2291 PKGNAME "kernel-${INSTALLKERNEL:tl}${flavor}" \
2299 ${SRCDIR}/release/packages/template.ucl \
2300 ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl ; \
2301 awk -F\" ' \
2302 /name/ { printf("===> Creating %s-", $$2); next } \
2304 ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl ; \
2305 ${PKG_CMD} -o ABI=${PKG_ABI} -o ALLOW_BASE_SHLIBS=yes \
2306 -o OSVERSION="${SRCRELDATE}" \
2307 create -f ${PKG_FORMAT} ${PKG_CLEVEL} \
2308 -M ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl \
2309 -p ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.plist \
2310 -r ${KSTAGEDIR}/${DISTDIR} \
2311 -o ${REPODIR}/${PKG_ABI}/${PKG_OUTPUT_DIR}
2312 . endfor
2313 .endif
2314 .if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes"
2315 . for _kernel in ${BUILDKERNELS:[2..-1]}
2316 . if exists(${KSTAGEDIR}/kernel.${_kernel}.meta)
2317 . if ${MK_DEBUG_FILES} != "no"
2318 _debug=-dbg
2319 . endif
2320 . for flavor in "" ${_debug}
2321 create-kernel-packages: create-kernel-packages-extra-flavor${flavor:C,^""$,${_default_flavor},}-${_…
2322 create-kernel-packages-extra-flavor${flavor:C,^""$,${_default_flavor},}-${_kernel}: _pkgbootstrap .
2323 @cd ${KSTAGEDIR}/kernel.${_kernel} ; \
2324 ${METALOG_SORT_CMD} ${KSTAGEDIR}/kernel.${_kernel}.meta | \
2325 awk -f ${SRCDIR}/release/scripts/mtree-to-plist.awk \
2326 -v kernel=yes -v _kernconf=${_kernel} ; \
2327 ${SRCDIR}/release/packages/generate-ucl.lua \
2328 PKGNAME "kernel-${_kernel:tl}${flavor}" \
2333 KERNELDIR "kernel.${_kernel}" \
2339 ${SRCDIR}/release/packages/template.ucl \
2340 ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.ucl ; \
2341 awk -F\" ' \
2342 /name/ { printf("===> Creating %s-", $$2); next } \
2344 ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.ucl ; \
2345 ${PKG_CMD} -o ABI=${PKG_ABI} -o ALLOW_BASE_SHLIBS=yes \
2346 -o OSVERSION="${SRCRELDATE}" \
2347 create -f ${PKG_FORMAT} ${PKG_CLEVEL} \
2348 -M ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.ucl \
2349 -p ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.plist \
2350 -r ${KSTAGEDIR}/kernel.${_kernel} \
2351 -o ${REPODIR}/${PKG_ABI}/${PKG_OUTPUT_DIR}
2352 . endfor
2353 . endif
2354 . endfor
2355 .endif
2357 sign-packages: .PHONY
2358 ${_+_}@cd ${.CURDIR}; \
2359 ${MAKE} -f Makefile.inc1 PKG_VERSION=${PKG_VERSION} real-sign-packages
2361 real-sign-packages: _pkgbootstrap .PHONY
2363 .if ${PKG_BIN_VERSION} < 11700
2365 .endif
2366 @${PKG_CMD} -o ABI=${PKG_ABI} -o OSVERSION="${SRCRELDATE}" repo \
2367 -m ${WSTAGEDIR}/meta \
2368 -o ${REPODIR}/${PKG_ABI}/${PKG_VERSION} \
2372 ln -hfs ${PKG_OUTPUT_DIR} latest
2378 # Run test suite on installed world.
2380 checkworld: .PHONY
2381 @if [ ! -x "${LOCALBASE}/bin/kyua" ] && [ ! -x "/usr/bin/kyua" ]; then \
2382 echo "You need kyua (devel/kyua) to run the test suite." | /usr/bin/fmt; \
2385 ${_+_}PATH="$$PATH:${LOCALBASE}/bin" kyua test -k ${TESTSBASE}/Kyuafile
2393 doxygen: .PHONY
2394 @if [ ! -x "${LOCALBASE}/bin/doxygen" ]; then \
2395 …echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bi…
2398 ${_+_}cd ${.CURDIR}/tools/kerneldoc/subsys; ${MAKE} obj all
2401 # ------------------------------------------------------------------------
2404 # related targets. If your 'world' breaks, you may like to try to fix
2406 # complete the build. Beware, this is *not* guaranteed to work, you
2408 # to attempt to manually finish it. If in doubt, 'make world' again.
2412 # legacy: Build compatibility shims for the next three targets. This is a
2414 # which don't have the APIs required by the targets built in bootstrap-tools,
2415 # build-tools or cross-tools.
2417 legacy: .PHONY
2418 .if ${BOOTSTRAPPING} < ${MINIMUM_SUPPORTED_OSREL} && ${BOOTSTRAPPING} != 0
2419 …@echo "ERROR: Source upgrades from versions prior to ${MINIMUM_SUPPORTED_REL} are not supported.";…
2421 .endif
2423 .for _tool in \
2427 cd ${.CURDIR}/${_tool}; \
2428 if [ -z "${NO_OBJWALK}" ]; then ${MAKE} DIRPRFX=${_tool}/ obj; fi; \
2433 .endfor
2436 # bootstrap-tools: Build tools needed for compatibility. These are binaries that
2437 # are built to build other binaries in the system. However, the focus of these
2438 # binaries is usually quite narrow. Bootstrap tools use the host's compiler and
2439 # libraries, augmented by -legacy, in addition to the libraries built during
2440 # bootstrap-tools.
2442 _bt= _bootstrap-tools
2445 # accidentally run tools that are incompatible but happen to be in $PATH.
2448 # output. On those platforms we only symlink the tools known to be compatible
2449 # (e.g. basic utilities such as mkdir) into ${WORLDTMP} and build all others
2450 # from the FreeBSD sources during the bootstrap-tools stage.
2451 # We want to build without the user's $PATH starting in the bootstrap-tools
2453 # linked to $WORLDTMP. The tools are listed in the _host_tools_to_symlink
2454 # variable in tools/build/Makefile and are linked during the legacy phase.
2456 # are portable across operating systems.
2459 # current source tree. Otherwise we create a symlink to the version found in
2460 # $PATH during the bootstrap-tools stage.
2461 # When building on non-FreeBSD systems we can't assume that the host binaries
2462 # accept compatible flags or produce compatible output. Therefore we force
2463 # BOOTSTRAP_ALL_TOOLS and just build the FreeBSD version of the binary.
2464 .if defined(CROSSBUILD_HOST)
2466 .endif
2467 .if defined(BOOTSTRAP_ALL_TOOLS)
2468 # BOOTSTRAPPING will be set on the command line so we can't override it here.
2471 .endif
2473 .if ${MK_GAMES} != "no"
2474 _strfile= usr.bin/fortune/strfile
2475 .endif
2478 # C source for loader built in font (8x16.c).
2479 _vtfontcvt= usr.bin/vtfontcvt
2482 .if ${MK_ZONEINFO} != "no"
2483 _zic= usr.sbin/zic
2484 .endif
2487 # we symlink the host version to $WORLDTMP instead. By doing this we can also
2488 # detect when a bootstrap tool is being used without the required MK_FOO.
2490 # please ensure that you also add a .else case where you add the tool to the
2491 # _bootstrap_tools_links variable.
2492 .if ${BOOTSTRAPPING} < 1000033
2494 # generate any files). To fix this cyclic dependency we can build a bootstrap
2495 # version of m4 (with pre-generated files) then use that to build the real m4.
2496 # We can't simply use the host m4 since e.g. the macOS version does not accept
2497 # the flags that are passed by lex.
2498 # For lex we also use the pre-gerated files since we would otherwise need to
2501 _lex= usr.bin/lex
2502 _m4= tools/build/bootstrap-m4 usr.bin/m4
2503 ${_bt}-tools/build/bootstrap-m4: ${_bt}-usr.bin/lex ${_bt}-lib/libopenbsd ${_bt}-usr.bin/yacc
2504 ${_bt}-usr.bin/m4: ${_bt}-lib/libopenbsd ${_bt}-usr.bin/yacc ${_bt}-usr.bin/lex ${_bt}-tools/build/…
2505 _bt_m4_depend=${_bt}-usr.bin/m4
2506 _bt_lex_depend=${_bt}-usr.bin/lex ${_bt_m4_depend}
2507 .else
2509 .endif
2511 # ELF Tool Chain libraries are needed for ELF tools and dtrace tools.
2512 # r296685 fix cross-endian objcopy
2513 # r310724 fixed PR 215350, a crash in libdwarf with objects built by GCC 6.2.
2514 # r334881 added libdwarf constants used by ctfconvert.
2518 .if ${BOOTSTRAPPING} < 1300030
2520 ${_bt}-lib/libelf: ${_bt_m4_depend}
2521 ${_bt}-lib/libdwarf: ${_bt_m4_depend}
2522 _bt_libelf_depend=${_bt}-lib/libelf
2523 .endif
2526 ${_bt}-lib/libkldelf: ${_bt_libelf_depend}
2527 _bt_libkldelf_depend=${_bt}-lib/libkldelf
2529 _kldxref= usr.sbin/kldxref
2530 ${_bt}-usr.sbin/kldxref: ${_bt_libelf_depend} ${_bt_libkldelf_depend}
2532 # flua is required to regenerate syscall files. It first appeared during the
2533 # 13.0-CURRENT cycle, thus needs to be built on -older releases and stable
2534 # branches.
2535 .if ${BOOTSTRAPPING} < 1300059
2536 ${_bt}-libexec/flua: ${_bt}-lib/liblua
2538 .endif
2540 # r245440 mtree -N support added
2541 # r313404 requires sha384.h for libnetbsd, added to libmd in r292782
2542 .if ${BOOTSTRAPPING} < 1100093
2545 usr.sbin/nmtree
2547 ${_bt}-lib/libnetbsd: ${_bt}-lib/libmd
2548 ${_bt}-usr.sbin/nmtree: ${_bt}-lib/libnetbsd
2549 .else
2551 .endif
2553 # r246097: log addition login.conf.db, passwd, pwd.db, and spwd.db with cat -l
2554 .if ${BOOTSTRAPPING} < 1000027
2556 .else
2558 .endif
2560 # r277259 crunchide: Correct 64-bit section header offset
2561 # r281674 crunchide: always include both 32- and 64-bit ELF support
2562 .if ${BOOTSTRAPPING} < 1100078
2563 _crunchide= usr.sbin/crunch/crunchide
2564 .else
2566 .endif
2568 # 1400052, 1300526, 1203507: Removed -dc from linker invocation
2569 .if ${BOOTSTRAPPING} < 1203507 || \
2572 _crunchgen= usr.sbin/crunch/crunchgen
2573 .else
2575 .endif
2578 # require kbdcontrol. Note that, even on FreeBSD, the host will lack kbdcontrol
2579 # if built with WITHOUT_LEGACY_CONSOLE.
2580 .if defined(BOOTSTRAP_ALL_TOOLS) || !exists(/usr/sbin/kbdcontrol)
2581 _kbdcontrol= usr.sbin/kbdcontrol
2582 .else
2584 .endif
2586 .if ${MK_DISK_IMAGE_TOOLS_BOOTSTRAP} != "no"
2587 _etdump= usr.bin/etdump
2588 _makefs= usr.sbin/makefs
2591 ${_bt}-usr.sbin/makefs: ${_bt}-lib/libnetbsd
2593 .if defined(BOOTSTRAP_ALL_TOOLS)
2595 ${_bt}-usr.sbin/makefs: ${_bt}-lib/libsbuf
2596 .endif
2597 .endif
2600 .if ${BOOTSTRAPPING} < 1201520 || \
2603 _mkimg= usr.bin/mkimg
2604 .else
2606 .endif
2608 _yacc= usr.bin/yacc
2610 .if ${MK_BSNMP} != "no"
2611 _gensnmptree= usr.sbin/bsnmpd/gensnmptree
2612 .endif
2616 # bootstrap tools, or as the part of the normal build.
2617 # llvm-tblgen is also needed for various llvm binutils (e.g. objcopy).
2618 .if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_CLANG} != "no" || \
2623 usr.bin/clang/llvm-min-tblgen \
2624 usr.bin/clang/llvm-tblgen
2625 .if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_CLANG} != "no" || \
2628 _clang_tblgen+= usr.bin/clang/clang-tblgen
2629 .endif
2630 .if ${MK_LLDB} != "no"
2631 _clang_tblgen+= usr.bin/clang/lldb-tblgen
2632 .endif
2633 ${_bt}-usr.bin/clang/clang-tblgen: ${_bt}-lib/clang/libllvmminimal
2634 ${_bt}-usr.bin/clang/lldb-tblgen: ${_bt}-lib/clang/libllvmminimal
2635 ${_bt}-usr.bin/clang/llvm-min-tblgen: ${_bt}-lib/clang/libllvmminimal
2636 ${_bt}-usr.bin/clang/llvm-tblgen: ${_bt}-lib/clang/libllvmminimal
2637 ${_bt}-usr.bin/clang/llvm-tblgen: ${_bt}-usr.bin/clang/llvm-min-tblgen
2638 .endif
2640 # C.UTF-8 is always built in share/ctypes and we need localedef for that.
2641 _localedef= usr.bin/localedef
2642 ${_bt}-usr.bin/localedef: ${_bt}-usr.bin/yacc ${_bt_lex_depend}
2644 .if ${MK_ICONV} != "no"
2645 _mkesdb= usr.bin/mkesdb
2646 _mkcsmapper= usr.bin/mkcsmapper
2647 ${_bt}-usr.bin/mkesdb: ${_bt}-usr.bin/yacc ${_bt_lex_depend}
2648 ${_bt}-usr.bin/mkcsmapper: ${_bt}-usr.bin/yacc ${_bt_lex_depend}
2649 .endif
2651 .if ${MK_KERBEROS} != "no"
2653 kerberos5/tools/make-roken \
2658 usr.bin/compile_et
2660 .ORDER: ${_kerberos5_bootstrap_tools:C/^/${_bt}-/g}
2661 .for _tool in ${_kerberos5_bootstrap_tools}
2662 ${_bt}-${_tool}: ${_bt}-usr.bin/yacc ${_bt_lex_depend}
2663 .endfor
2664 .endif
2666 ${_bt}-usr.bin/mandoc: ${_bt}-lib/libopenbsd
2669 # bootstrapped unless BOOTSTRAP_ALL_TOOL is set. However, when building on a
2671 # them from the source tree. Usually the link name will be the same as the subdir,
2672 # but some directories such as grep or test install multiple binaries. In that
2674 # subdirectory and comma-separated list of files.
2675 _basic_bootstrap_tools_multilink=usr.bin/grep grep,egrep,fgrep
2678 _basic_bootstrap_tools+=usr.bin/cut bin/expr usr.bin/gencat usr.bin/join \
2679 usr.bin/mktemp bin/realpath bin/rmdir usr.bin/sed usr.bin/sort \
2680 usr.bin/truncate usr.bin/tsort
2682 # cddl/contrib/opensolaris/lib/libdtrace/common/mknames.sh) so we need both awk
2683 # and nawk in ${WORLDTMP}/legacy/bin.
2684 _basic_bootstrap_tools_multilink+=usr.bin/awk awk,nawk
2685 # file2c is required for building usr.sbin/config:
2686 _basic_bootstrap_tools+=usr.bin/file2c
2688 _basic_bootstrap_tools_multilink+=usr.bin/bintrans uuencode,uudecode
2690 _basic_bootstrap_tools+=usr.bin/xargs
2692 _basic_bootstrap_tools+=usr.bin/cap_mkdb
2694 _basic_bootstrap_tools+=usr.sbin/services_mkdb usr.sbin/pwd_mkdb
2696 .if !defined(CROSSBUILD_HOST)
2698 # bootstrap ldd on non-FreeBSD systems
2699 _basic_bootstrap_tools+=usr.bin/ldd
2700 .endif
2702 .if !defined(CROSSBUILD_HOST)
2705 # matter since we don't need any of the new features for the build.
2707 .else
2708 # When building on non-FreeBSD, install a fake chflags instead since the
2709 # version from the source tree cannot work. We also don't need sysctl since we
2710 # are install with -DNO_ROOT.
2711 _other_bootstrap_tools+=tools/build/cross-build/fake_chflags
2712 .endif
2713 # mkfifo is used by sys/conf/newvers.sh
2714 _basic_bootstrap_tools+=usr.bin/mkfifo
2716 _basic_bootstrap_tools+=usr.bin/jot
2718 .if defined(BOOTSTRAP_ALL_TOOLS)
2721 .endif
2724 .if ${MK_ZONEINFO} != "no"
2725 _basic_bootstrap_tools+=usr.sbin/tzsetup
2726 .endif
2728 .if defined(BOOTSTRAP_ALL_TOOLS)
2730 .for _subdir _links in ${_basic_bootstrap_tools_multilink}
2732 .endfor
2733 ${_bt}-usr.bin/awk: ${_bt_lex_depend} ${_bt}-usr.bin/yacc
2734 ${_bt}-bin/expr: ${_bt_lex_depend} ${_bt}-usr.bin/yacc
2736 ${_bt}-usr.sbin/config: ${_bt}-usr.bin/file2c ${_bt_lex_depend}
2739 # `make legacy` step. Not adding a link to make is important on non-FreeBSD
2740 # since "make" will usually point to GNU make there.
2741 _other_bootstrap_tools+=usr.bin/bmake
2743 # Avoid dependency on host bz2 headers:
2745 ${_bt}-usr.bin/grep: ${_bt}-lib/libbz2
2749 ${_bt}-lib/libdwarf: ${_bt}-lib/libz
2753 ${_bt}-lib/libroken: ${_bt}-lib/libcrypt
2754 .else
2756 # so we can use :T to get the name of the symlinks that we need to create.
2758 .for _subdir _links in ${_basic_bootstrap_tools_multilink}
2760 .endfor
2761 .endif # defined(BOOTSTRAP_ALL_TOOLS)
2766 # the presence of any of the links (e.g. as m4/lex/awk)
2767 ${_bt}-links: .PHONY
2769 .for _tool in ${_bootstrap_tools_links}
2770 ${_bt}-link-${_tool}: .PHONY
2771 @rm -f "${WORLDTMP}/legacy/bin/${_tool}"; \
2773 if [ ! -e "$${source_path}" ] ; then \
2776 cp -pf "$${source_path}" "${WORLDTMP}/legacy/bin/${_tool}"
2777 ${_bt}-links: ${_bt}-link-${_tool}
2778 .endfor
2780 bootstrap-tools: ${_bt}-links .PHONY
2782 # Please document (add comment) why something is in 'bootstrap-tools'.
2783 # Try to bound the building of the bootstrap-tool to just the
2784 # FreeBSD versions that need the tool built at this stage of the build.
2785 .for _tool in \
2789 usr.bin/dtc \
2796 usr.bin/mandoc \
2797 usr.bin/rpcgen \
2802 usr.bin/xinstall \
2804 usr.sbin/config \
2820 ${_bt}-${_tool}: ${_bt}-links .PHONY .MAKE
2822 cd ${.CURDIR}/${_tool}; \
2823 if [ -z "${NO_OBJWALK}" ]; then ${MAKE} DIRPRFX=${_tool}/ obj; fi; \
2824 if [ "${_tool}" = "usr.bin/lex" ]; then \
2830 bootstrap-tools: ${_bt}-${_tool}
2831 .endfor
2832 .if target(${_bt}-lib/libmd)
2833 # If we are bootstrapping libmd (e.g. when building on macOS/Linux) add the
2835 ${_bt}-usr.bin/sort: ${_bt}-lib/libmd
2836 ${_bt}-usr.bin/xinstall: ${_bt}-lib/libmd
2837 ${_bt}-sbin/md5: ${_bt}-lib/libmd
2838 .endif
2842 # build-tools: Build special purpose build tools
2844 .if !defined(NO_SHARE) && ${MK_SYSCONS} != "no"
2846 .endif
2848 .if ${MK_RESCUE} != "no"
2849 # rescue includes programs that have build-tools targets
2851 .endif
2853 .if ${MK_TCSH} != "no"
2855 .endif
2856 .if ${MK_FILE} != "no"
2858 .endif
2860 .if ${MK_PMC} != "no"
2861 _jevents=lib/libpmc/pmu-events
2862 .endif
2864 # kernel-toolchain skips _cleanobj, so handle cleaning up previous
2865 # build-tools directories if needed.
2866 .if ${MK_CLEAN} == "yes" && make(kernel-toolchain)
2868 .endif
2870 .for _tool in \
2878 usr.bin/awk \
2880 usr.bin/vi/catalog
2881 build-tools_${_tool}: .PHONY
2882 ${_+_}@${ECHODIR} "===> ${_tool} (${_bt_clean:D${_bt_clean},}obj,build-tools)"; \
2883 cd ${.CURDIR}/${_tool}; \
2884 if [ -n "${_bt_clean}" ]; then ${MAKE} DIRPRFX=${_tool}/ ${_bt_clean}; fi; \
2885 if [ -z "${NO_OBJWALK}" ]; then ${MAKE} DIRPRFX=${_tool}/ obj; fi; \
2886 ${MAKE} DIRPRFX=${_tool}/ build-tools
2887 build-tools: build-tools_${_tool}
2888 .endfor
2891 # kernel-tools: Build kernel-building tools
2893 kernel-tools: .PHONY
2894 mkdir -p ${WORLDTMP}/usr
2895 ${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
2896 -p ${WORLDTMP}/usr >/dev/null
2899 # cross-tools: All the tools needed to build the rest of the system after
2900 # we get done with the earlier stages. It is the last set of tools needed
2901 # to begin building the target binaries.
2903 .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${BUILD_WITH_STRICT_TMPPATH} != 0
2904 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386"
2905 _btxld= usr.sbin/btxld
2906 .endif
2907 .endif
2909 # Rebuild ctfconvert and ctfmerge to avoid difficult-to-diagnose failures
2910 # resulting from missing bug fixes or ELF Toolchain updates.
2911 .if ${MK_CDDL} != "no"
2912 _dtrace_tools= cddl/lib/libctf cddl/lib/libspl cddl/usr.bin/ctfconvert \
2913 cddl/usr.bin/ctfmerge
2914 .endif
2916 # If we're given an XAS, don't build binutils.
2917 .if ${XAS:M/*} == ""
2918 .if ${MK_ELFTOOLCHAIN_BOOTSTRAP} != "no"
2921 usr.bin/elfctl \
2922 usr.bin/elfdump \
2923 usr.bin/objcopy \
2924 usr.bin/nm \
2925 usr.bin/size \
2926 usr.bin/strings
2928 # cross-build on a FreeBSD 10 host:
2929 _elftctools+= usr.bin/addr2line
2930 .endif
2931 .elif ${TARGET_ARCH} != ${MACHINE_ARCH} && ${MK_ELFTOOLCHAIN_BOOTSTRAP} != "no"
2932 # If cross-building with an external binutils we still need to build strip for
2933 # the target (for at least crunchide).
2936 usr.bin/elfctl \
2937 usr.bin/elfdump \
2938 usr.bin/objcopy
2939 .endif
2941 .if ${MK_CLANG_BOOTSTRAP} != "no"
2942 _clang= usr.bin/clang
2943 .endif
2944 .if ${MK_LLD_BOOTSTRAP} != "no"
2945 _lld= usr.bin/clang/lld
2946 .endif
2947 .if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_LLD_BOOTSTRAP} != "no"
2949 .endif
2950 .if ${MK_USB} != "no"
2952 .endif
2954 .if ${BUILD_WITH_STRICT_TMPPATH} != 0 || defined(BOOTSTRAP_ALL_TOOLS)
2955 _ar=usr.bin/ar
2956 .endif
2958 cross-tools: .MAKE .PHONY
2959 .for _tool in \
2970 cd ${.CURDIR}/${_tool}; \
2971 if [ -z "${NO_OBJWALK}" ]; then ${MAKE} DIRPRFX=${_tool}/ obj; fi; \
2974 .endfor
2977 # native-xtools is the current target for qemu-user cross builds of ports
2978 # via poudriere and the imgact_binmisc kernel module.
2981 # already built. It then installs the static tools to NXBDESTDIR for Poudriere
2982 # to pickup.
2984 NXBOBJROOT= ${OBJROOT}${MACHINE}.${MACHINE_ARCH}/nxb/
2985 NXBOBJTOP= ${NXBOBJROOT}${NXB_TARGET}.${NXB_TARGET_ARCH}
2986 NXTP?= /nxb-bin
2987 .if ${NXTP:N/*}
2988 .error NXTP variable should be an absolute path
2989 .endif
2993 # appropriate to build for the given TARGET.TARGET_ARCH.
3014 usr.bin/addr2line \
3015 usr.bin/ar \
3016 usr.bin/awk \
3017 usr.bin/basename \
3018 usr.bin/bmake \
3019 usr.bin/bzip2 \
3020 usr.bin/cmp \
3021 usr.bin/diff \
3022 usr.bin/dirname \
3023 usr.bin/objcopy \
3024 usr.bin/env \
3025 usr.bin/fetch \
3026 usr.bin/find \
3027 usr.bin/grep \
3028 usr.bin/gzip \
3029 usr.bin/head \
3030 usr.bin/id \
3031 usr.bin/lex \
3032 usr.bin/limits \
3033 usr.bin/mandoc \
3034 usr.bin/mktemp \
3035 usr.bin/mt \
3036 usr.bin/nm \
3037 usr.bin/patch \
3038 usr.bin/readelf \
3039 usr.bin/sed \
3040 usr.bin/size \
3041 usr.bin/sort \
3042 usr.bin/strings \
3043 usr.bin/tar \
3044 usr.bin/touch \
3045 usr.bin/tr \
3046 usr.bin/true \
3047 usr.bin/uniq \
3048 usr.bin/unzip \
3049 usr.bin/wc \
3050 usr.bin/xargs \
3051 usr.bin/xinstall \
3052 usr.bin/xz \
3053 usr.bin/yacc \
3054 usr.sbin/chown
3056 SUBDIR_DEPEND_usr.bin/clang= lib/clang
3057 .if ${MK_CLANG} != "no"
3059 NXBDIRS+= usr.bin/clang
3060 .endif
3061 # XXX: native-xtools passes along ${NXBDIRS} in SUBDIR_OVERRIDE that needs
3062 # to be evaluated after NXBDIRS is set.
3063 .if make(install) && !empty(SUBDIR_OVERRIDE)
3065 .endif
3070 -DNO_SHARED \
3071 -DNO_CPU_CFLAGS \
3072 -DNO_PIC \
3099 .if make(native-xtools*) && \
3101 .error Missing NXB_TARGET / NXB_TARGET_ARCH
3102 .endif
3104 # native binaries.
3105 NXBTMAKE= ${NXBMAKEENV} ${MAKE} ${NXBMAKEARGS:N-DNO_PIC:N-DNO_SHARED} \
3107 # For 'everything' we want to produce native binaries (hence -target to
3108 # be MACHINE) that themselves generate TARGET.TARGET_ARCH binaries.
3109 # TARGET/TARGET_ARCH are still passed along from user.
3111 # Use the toolchain we create as an external toolchain.
3112 .if ${USING_SYSTEM_COMPILER} == "yes" || ${XCC:N${CCACHE_BIN}:M/*}
3116 .else
3120 .endif
3121 NXBMAKE+= ${NXBMAKEENV} ${MAKE} -f Makefile.inc1 ${NXBMAKEARGS} \
3125 # NXBDIRS is improperly based on MACHINE rather than NXB_TARGET. Need to
3126 # invoke a sub-make to reevaluate MK_CLANG, etc, for NXBDIRS.
3128 # Need to avoid the -isystem logic when using clang as an external toolchain
3129 # even if the TARGET being built for wants GCC.
3131 native-xtools: .PHONY
3132 ${_+_}cd ${.CURDIR}; ${NXBTMAKE} _cleanobj
3134 ${_+_}cd ${.CURDIR}; ${NXBTMAKE} kernel-toolchain
3135 # Populate includes/libraries sysroot that produce native binaries.
3138 # polluting the cross-compiler build. The LLVM libs are skipped
3140 # needed build tools are built.
3141 ${_+_}cd ${.CURDIR}; ${NXBTMAKE} _includes ${NXBTNOTOOLS}
3142 ${_+_}cd ${.CURDIR}; ${NXBTMAKE} _libraries ${NXBTNOTOOLS}
3143 .if !defined(NO_OBJWALK)
3144 ${_+_}cd ${.CURDIR}; ${NXBMAKE} _obj
3145 .endif
3146 ${_+_}cd ${.CURDIR}; ${NXBMAKE} everything
3147 @echo ">> native-xtools done. Use 'make native-xtools-install' to install to a given DESTDIR"
3149 native-xtools-install: .PHONY
3150 mkdir -p ${NXBDESTDIR}/bin ${NXBDESTDIR}/sbin ${NXBDESTDIR}/usr
3151 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
3152 -p ${NXBDESTDIR}/usr >/dev/null
3153 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.include.dist \
3154 -p ${NXBDESTDIR}/usr/include >/dev/null
3155 .for d in ${LIBCOMPAT_INCLUDE_DIRS}
3156 mkdir -p ${NXBDESTDIR}/usr/include/${d}
3157 .endfor
3158 ${_+_}cd ${.CURDIR}; ${NXBMAKE} \
3160 -DNO_ROOT \
3164 # hierarchy - ensure that all the needed directories are present
3166 hierarchy hier: .MAKE .PHONY
3167 ${_+_}cd ${.CURDIR}/etc; ${HMAKE} distrib-dirs
3170 # libraries - build all libraries, and install them under ${DESTDIR}.
3174 # ${.CURDIR}/tools/make_libdeps.sh script.
3176 libraries: .MAKE .PHONY
3177 ${_+_}cd ${.CURDIR}; \
3178 ${MAKE} -f Makefile.inc1 _prereq_libs; \
3179 ${MAKE} -f Makefile.inc1 _startup_libs; \
3180 ${MAKE} -f Makefile.inc1 _prebuild_libs -DLIBCRYPTO_WITHOUT_SUBDIRS; \
3181 ${MAKE} -f Makefile.inc1 _generic_libs
3184 # static libgcc.a prerequisite for shared libc
3187 .if ${MK_SSP} != "no"
3189 .endif
3190 .if ${MK_ASAN} != "no"
3192 _prereq_libs+= lib/libclang_rt/asan-preinit
3195 .endif
3196 .if ${MK_UBSAN} != "no"
3200 .endif
3205 # all shared libraries for ELF.
3263 .if ${MK_DIALOG} != "no"
3266 .endif
3268 .if ${MK_GOOGLETEST} != "no"
3270 .endif
3276 .if ${MK_RADIUS_SUPPORT} != "no"
3278 .endif
3282 .if ${MK_OFED} != "no"
3293 .endif
3295 .if ${MK_CASPER} != "no"
3297 .endif
3306 .if ${MK_IPFILTER} != "no"
3308 .endif
3309 .for _DIR in ${LOCAL_LIB_DIRS}
3310 .if ${_DIR} == ".WAIT" || (empty(_generic_libs:M${_DIR}) && exists(${.CURDIR}/${_DIR}/Makefile))
3312 .endif
3313 .endfor
3318 .if ${MK_CDDL} != "no"
3329 .if ${MK_ZFS} != "no"
3353 .endif
3358 .endif
3365 .if ${MK_CRYPT} != "no"
3366 .if ${MK_OPENSSL} != "no"
3371 .if ${MK_LDNS} != "no"
3374 .endif
3375 .if ${MK_OPENSSH} != "no"
3378 .if ${MK_LDNS} != "no"
3380 .endif
3381 .if ${MK_GSSAPI} != "no" && ${MK_KERBEROS_SUPPORT} != "no"
3385 .endif
3386 .endif
3387 .endif
3389 .endif
3391 .if ${MK_KERBEROS} != "no"
3408 .endif
3412 .if ${MK_GSSAPI} != "no"
3414 .endif
3416 .if ${MK_KERBEROS} != "no"
3429 .endif
3431 .if ${MK_NIS} != "no"
3433 .endif
3435 .if ${MK_OPENSSL} == "no"
3437 .endif
3443 .for _lib in ${_prereq_libs}
3444 ${_lib}__PL: .PHONY .MAKE
3445 .if !defined(_MKSHOWCONFIG) && exists(${.CURDIR}/${_lib})
3447 cd ${.CURDIR}/${_lib}; \
3448 if [ -z "${NO_OBJWALK}" ]; then ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj; fi; \
3449 ${MAKE} MK_TESTS=no -DNO_PIC \
3451 ${MAKE} MK_TESTS=no -DNO_PIC \
3453 .endif
3454 .endfor
3456 .for _lib in ${_startup_libs} ${_prebuild_libs} ${_generic_libs}
3457 ${_lib}__L: .PHONY .MAKE
3458 .if !defined(_MKSHOWCONFIG) && exists(${.CURDIR}/${_lib})
3460 cd ${.CURDIR}/${_lib}; \
3461 if [ -z "${NO_OBJWALK}" ]; then ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj; fi; \
3464 .endif
3465 .endfor
3473 # 'everything' with _PARALLEL_SUBDIR_OK set. This is because it is unlikely
3474 # that running 'make all' from the top-level, especially with a SUBDIR_OVERRIDE
3476 # parallel. This is safe for the world stage of buildworld though since it has
3478 # WORLDTMP. Special handling is done for SUBDIR ordering for 'install*' to
3479 # avoid trashing a system if it crashes mid-install.
3480 .if !make(all) || defined(_PARALLEL_SUBDIR_OK)
3482 .endif
3484 .include <bsd.subdir.mk>
3486 .if make(check-old) || make(check-old-dirs) || \
3487 make(check-old-files) || make(check-old-libs) || \
3488 make(delete-old) || make(delete-old-dirs) || \
3489 make(delete-old-files) || make(delete-old-libs) || \
3490 make(list-old-dirs) || make(list-old-files) || make(list-old-libs)
3496 .include "ObsoleteFiles.inc"
3499 else you can not start such an application. Consult UPDATING for more \
3501 specific library."
3503 .if !defined(BATCH_DELETE_OLD_FILES)
3504 RM_I=-i
3505 .else
3506 RM_I=-fv
3507 .endif
3509 list-old-files: .PHONY
3510 @cd ${.CURDIR}; \
3511 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
3512 -V "OLD_FILES:ts\n" -V "OLD_FILES:Musr/share/*.gz:R:ts\n" \
3513 -V "MOVED_LIBS:ts\n" \
3514 ${_ALL_libcompats:@v@-V "OLD_FILES:Mlib/*.so.*:S,^lib,usr/lib$v,:ts\n"@} \
3515 ${_ALL_libcompats:@v@-V "OLD_FILES:Musr/lib/*:S,^usr/lib,usr/lib$v,:ts\n"@} | \
3518 delete-old-files: .PHONY
3520 # Ask for every old file if the user really wants to remove it.
3521 # It's annoying, but better safe than sorry.
3523 # argument list will get too long. Using .for/.endfor make "loops" will make
3524 # the Makefile parser segfault.
3526 cd ${.CURDIR}; \
3527 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} list-old-files | \
3529 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
3534 if ! [ -e "${DESTDIR}/$${file}" ] && [ -f \
3535 "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \
3536 rm ${RM_I} "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" \
3541 # Remove catpages without corresponding manpages.
3543 find ${DESTDIR}/usr/share/man/cat* ! -type d 2>/dev/null | sort | \
3544 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
3547 if [ ! -e "$${manpage}" ]; then \
3553 check-old-files: .PHONY
3555 @cd ${.CURDIR}; \
3556 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} list-old-files | \
3558 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
3562 if [ -f "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \
3563 echo "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}"; \
3567 # Check for catpages without corresponding manpages.
3568 @find ${DESTDIR}/usr/share/man/cat* ! -type d 2>/dev/null | \
3569 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
3572 if [ ! -e "$${manpage}" ]; then \
3577 list-old-libs: .PHONY
3578 @cd ${.CURDIR}; \
3579 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
3580 -V "OLD_LIBS:ts\n" \
3581 ${_ALL_libcompats:@v@-V "OLD_LIBS:Mlib/*:S,^lib,usr/lib$v,:ts\n"@} \
3582 ${_ALL_libcompats:@v@-V "OLD_LIBS:Musr/lib/*:S,^usr/lib,usr/lib$v,:ts\n"@} \
3583 ${_ALL_libcompats:@v@-V "OLD_LIBS:Mlib/casper/*:S,^lib/casper,usr/lib$v,:ts\n"@} | \
3586 delete-old-libs: .PHONY
3590 cd ${.CURDIR}; \
3591 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} list-old-libs | \
3593 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
3598 if ! [ -e "${DESTDIR}/$${file}" ] && [ -f \
3599 "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \
3600 rm ${RM_I} "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" \
3607 check-old-libs: .PHONY
3609 @cd ${.CURDIR}; \
3610 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} list-old-libs | \
3612 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
3616 if [ -f "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \
3617 echo "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}"; \
3622 list-old-dirs: .PHONY
3623 @cd ${.CURDIR}; \
3624 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
3625 -V OLD_DIRS | sed -E 's/[[:space:]]+/\n/g' | sort -r
3627 delete-old-dirs: .PHONY
3629 @cd ${.CURDIR}; \
3630 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} list-old-dirs | \
3632 if [ -d "${DESTDIR}/$${dir}" ]; then \
3633 rmdir -v "${DESTDIR}/$${dir}" || true; \
3634 elif [ -L "${DESTDIR}/$${dir}" ]; then \
3635 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
3637 if [ -d "${DESTDIR}${DEBUGDIR}/$${dir}" ]; then \
3638 rmdir -v "${DESTDIR}${DEBUGDIR}/$${dir}" || true; \
3639 elif [ -L "${DESTDIR}${DEBUGDIR}/$${dir}" ]; then \
3640 echo "${DESTDIR}${DEBUGDIR}/$${dir} is a link, please remove everything manually."; \
3645 check-old-dirs: .PHONY
3647 @cd ${.CURDIR}; \
3648 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} list-old-dirs | \
3650 if [ -d "${DESTDIR}/$${dir}" ]; then \
3652 elif [ -L "${DESTDIR}/$${dir}" ]; then \
3653 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
3655 if [ -d "${DESTDIR}${DEBUGDIR}/$${dir}" ]; then \
3657 elif [ -L "${DESTDIR}${DEBUGDIR}/$${dir}" ]; then \
3658 echo "${DESTDIR}${DEBUGDIR}/$${dir} is a link, please remove everything manually."; \
3662 delete-old: delete-old-files delete-old-dirs .PHONY
3663 @echo "To remove old libraries run '${MAKE_CMD} delete-old-libs'."
3665 check-old: check-old-files check-old-libs check-old-dirs .PHONY
3666 @echo "To remove old files and directories run '${MAKE_CMD} delete-old'."
3667 @echo "To remove old libraries run '${MAKE_CMD} delete-old-libs'."
3669 .endif
3672 # showconfig - show build configuration.
3676 showconfig: .PHONY
3677 …@(${MAKE} -n -f ${.CURDIR}/sys/conf/kern.opts.mk -V dummy -dg1 UPDATE_DEPENDFILE=no NO_OBJ=yes MAC…
3678 …${MAKE} -n -f ${.CURDIR}/share/mk/src.opts.mk -V dummy -dg1 UPDATE_DEPENDFILE=no NO_OBJ=yes MACHIN…
3679 grep -E '^(MK|OPT)_[A-Z]' | sort -u
3681 .if !empty(KRNLOBJDIR) && !empty(KERNCONF)
3684 .if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE)
3685 .if !defined(_MKSHOWCONFIG) && exists(${KERNCONFDIR}/${KERNCONF})
3688 .endif
3689 .endif
3691 .endif
3693 .if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH})
3694 DTBOUTPUTPATH= ${.CURDIR}
3695 .endif
3700 builddtb: .PHONY
3702 sh ${.CURDIR}/sys/tools/fdt/make_dtb.sh ${.CURDIR}/sys \
3709 # files and directories. If it does not, then there are probably some
3711 # second time. There are situations where this target will be cleaning
3713 # needed to correctly handle all the possible situations. Removing all
3715 # because 'chflags' will need to operate on fewer files afterwards.
3718 # created by bsd.obj.mk, except that we don't want to .include that file
3719 # in this makefile. We don't do a cleandir walk if MK_AUTO_OBJ is yes
3720 # since it is not possible for files to land in the wrong place.
3722 .if make(cleanworld)
3724 .elif make(cleankernel)
3726 .elif make(cleanuniverse)
3728 .if ${MK_UNIFIED_OBJDIR} == "no"
3729 .error ${.TARGETS} only supported with WITH_UNIFIED_OBJDIR enabled.
3730 .endif
3731 .endif
3732 cleanworld cleanuniverse cleankernel: .PHONY
3733 .if !empty(BW_CANONICALOBJDIR) && exists(${BW_CANONICALOBJDIR}) && \
3734 ${.CURDIR:tA} != ${BW_CANONICALOBJDIR:tA}
3735 -(cd ${BW_CANONICALOBJDIR} && rm -rf *)
3736 -chflags -R 0 ${BW_CANONICALOBJDIR}
3737 -(cd ${BW_CANONICALOBJDIR} && rm -rf *)
3738 .endif
3739 .if make(cleanworld) && ${MK_AUTO_OBJ} == "no" && \
3740 (empty(BW_CANONICALOBJDIR) || ${.CURDIR:tA} == ${BW_CANONICALOBJDIR:tA})
3741 .if ${.CURDIR} == ${.OBJDIR} || ${.CURDIR}/obj == ${.OBJDIR}
3743 ${_+_}@cd ${.CURDIR}; ${MAKE} cleandir
3744 .endif
3745 .endif
3747 .if ${TARGET} == ${MACHINE} && ${TARGET_ARCH} == ${MACHINE_ARCH}
3749 .else
3751 .endif
3753 NOFUN=-DNO_FSCHG MK_HTML=no -DNO_LINT \
3759 XDDIR=${TARGET_ARCH}-freebsd
3761 .if ${XDTP:N/*}
3762 .error XDTP variable should be an absolute path
3763 .endif
3765 CDBOBJROOT= ${OBJROOT}${MACHINE}.${MACHINE_ARCH}/xdev/
3768 INSTALL="sh ${.CURDIR}/tools/install.sh"
3776 .if ${WANT_COMPILER_TYPE} == gcc || \
3778 # GCC requires -isystem and -L when using a cross-compiler. --sysroot
3779 # won't set header path and -L is used to ensure the base library path
3780 # is added before the port PREFIX library path.
3781 CD2CFLAGS+= -isystem ${XDDESTDIR}/usr/include -L${XDDESTDIR}/usr/lib
3782 # GCC requires -B to find /usr/lib/crti.o when using a cross-compiler
3783 # combined with --sysroot.
3784 CD2CFLAGS+= -B${XDDESTDIR}/usr/lib
3785 # Force using libc++ for external GCC.
3786 .if defined(X_COMPILER_TYPE) && \
3788 CD2CXXFLAGS+= -isystem ${XDDESTDIR}/usr/include/c++/v1 -std=c++11 \
3789 -nostdinc++
3790 .endif
3791 .endif
3792 CD2CFLAGS+= --sysroot=${XDDESTDIR}/
3801 .if ${MK_META_MODE} != "no"
3802 # Don't rebuild build-tools targets during normal build.
3803 CD2MAKE+= BUILD_TOOLS_META=.NOMETA
3804 .endif
3807 .ORDER: xdev-build xdev-install xdev-links
3808 xdev: xdev-build xdev-install .PHONY
3810 .ORDER: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools
3811 xdev-build: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools .PHONY
3813 _xb-worldtmp: .PHONY
3814 mkdir -p ${CDTMP}/usr
3815 ${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
3816 -p ${CDTMP}/usr >/dev/null
3818 _xb-bootstrap-tools: .PHONY
3819 .for _tool in \
3823 cd ${.CURDIR}/${_tool}; \
3824 if [ -z "${NO_OBJWALK}" ]; then ${CDMAKE} DIRPRFX=${_tool}/ obj; fi; \
3827 .endfor
3829 _xb-build-tools: .PHONY
3830 ${_+_}@cd ${.CURDIR}; \
3831 ${CDBENV} ${MAKE} ${CDMAKEARGS} -f Makefile.inc1 ${NOFUN} build-tools
3837 usr.bin/ar \
3840 _xb-cross-tools: .PHONY
3841 .for _tool in ${XDEVDIRS}
3843 cd ${.CURDIR}/${_tool}; \
3844 if [ -z "${NO_OBJWALK}" ]; then ${CDMAKE} DIRPRFX=${_tool}/ obj; fi; \
3846 .endfor
3848 _xi-mtree: .PHONY
3850 mkdir -p ${XDDESTDIR}
3851 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.root.dist \
3852 -p ${XDDESTDIR} >/dev/null
3853 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
3854 -p ${XDDESTDIR}/usr >/dev/null
3855 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.include.dist \
3856 -p ${XDDESTDIR}/usr/include >/dev/null
3857 .for d in ${LIBCOMPAT_INCLUDE_DIRS}
3858 mkdir -p ${XDDESTDIR}/usr/include/${d}
3859 .endfor
3860 .for libcompat in ${libcompats}
3861 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \
3862 -p ${XDDESTDIR}/usr >/dev/null
3863 .endfor
3864 .if ${MK_TESTS} != "no"
3865 mkdir -p ${XDDESTDIR}${TESTSBASE}
3866 ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
3867 -p ${XDDESTDIR}${TESTSBASE} >/dev/null
3868 .endif
3870 .ORDER: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries
3871 xdev-install: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries .PHONY
3873 _xi-cross-tools: .PHONY
3874 @echo "_xi-cross-tools"
3875 .for _tool in ${XDEVDIRS}
3877 cd ${.CURDIR}/${_tool}; \
3879 .endfor
3881 _xi-includes: .PHONY
3882 .if !defined(NO_OBJWALK)
3883 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 _obj \
3885 .endif
3886 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 includes \
3889 _xi-libraries: .PHONY
3890 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \
3893 xdev-links: .PHONY
3895 mkdir -p ../../../../usr/bin; \
3897 ln -sf ../../${XDTP}/usr/bin/$$i \
3898 ../../../../usr/bin/${XDDIR}-$$i; \
3899 ln -sf ../../${XDTP}/usr/bin/$$i \
3900 ../../../../usr/bin/${XDDIR}${_REVISION}-$$i; \