4 # Make command line options:
5 # -DNO_CLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
6 # -DNO_CLEAN do not clean at all
7 # -DDB_FROM_SRC use the user/group databases in src/etc instead of
8 # the system database when installing.
9 # -DNO_SHARE do not go into share subdir
10 # -DKERNFAST define NO_KERNEL{CONFIG,CLEAN,DEPEND,OBJ}
11 # -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel
12 # -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel
13 # -DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel
14 # -DNO_KERNELOBJ do not run ${MAKE} obj in ${MAKE} buildkernel
15 # -DNO_PORTSUPDATE do not update ports in ${MAKE} update
16 # -DNO_ROOT install without using root privilege
17 # -DNO_DOCUPDATE do not update doc in ${MAKE} update
18 # -DWITHOUT_CTF do not run the DTrace CTF conversion tools on built objects
19 # LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
20 # LOCAL_ITOOLS="list of tools" to add additional tools to the ITOOLS list
21 # LOCAL_LIB_DIRS="list of dirs" to add additional dirs to libraries target
22 # LOCAL_MTREE="list of mtree files" to process to allow local directories
23 # to be created before files are installed
24 # LOCAL_TOOL_DIRS="list of dirs" to add additional dirs to the build-tools
26 # METALOG="path to metadata log" to write permission and ownership
27 # when NO_ROOT is set. (default: ${DESTDIR}/METALOG)
28 # TARGET="machine" to crossbuild world for a different machine type
29 # TARGET_ARCH= may be required when a TARGET supports multiple endians
30 # BUILDENV_SHELL= shell to launch for the buildenv target (def:${SHELL})
31 # WORLD_FLAGS= additional flags to pass to make(1) during buildworld
32 # KERNEL_FLAGS= additional flags to pass to make(1) during buildkernel
33 # SUBDIR_OVERRIDE="list of dirs" to build rather than everything.
34 # All libraries and includes, and some build tools will still build.
37 # The intended user-driven targets are:
38 # buildworld - rebuild *everything*, including glue to help do upgrades
39 # installworld- install everything built by "buildworld"
40 # doxygen - build API documentation of the kernel
41 # update - convenient way to update your source tree (eg: svn/svnup)
43 # Standard targets (not defined here) are documented in the makefiles in
44 # /usr/share/mk. These include:
45 # obj depend all install clean cleandepend cleanobj
47 .if !defined(TARGET) || !defined(TARGET_ARCH)
48 .error "Both TARGET and TARGET_ARCH must be defined."
51 LOCALBASE?= /usr/local
53 # Cross toolchain changes must be in effect before bsd.compiler.mk
54 # so that gets the right CC, and pass CROSS_TOOLCHAIN to submakes.
55 .if defined(CROSS_TOOLCHAIN)
56 .include "${LOCALBASE}/share/toolchains/${CROSS_TOOLCHAIN}.mk"
57 CROSSENV+=CROSS_TOOLCHAIN="${CROSS_TOOLCHAIN}"
59 .include <bsd.compiler.mk> # don't depend on src.opts.mk doing it
60 .include "share/mk/src.opts.mk"
62 # We must do lib/ and libexec/ before bin/ in case of a mid-install error to
63 # keep the users system reasonably usable. For static->dynamic root upgrades,
64 # we don't want to install a dynamic binary without rtld and the needed
65 # libraries. More commonly, for dynamic root, we don't want to install a
66 # binary that requires a newer library version that hasn't been installed yet.
67 # This ordering is not a guarantee though. The only guarantee of a working
68 # system here would require fine-grained ordering of all components based
69 # on their dependencies.
71 .if !empty(SUBDIR_OVERRIDE)
72 SUBDIR= ${SUBDIR_OVERRIDE}
76 # Ensure libraries are installed before progressing.
80 .if ${MK_CDDL} != "no"
84 .if ${MK_KERBEROS} != "no"
87 .if ${MK_RESCUE} != "no"
91 .if ${MK_CRYPT} != "no"
94 .if !defined(NO_SHARE)
97 SUBDIR+=sys usr.bin usr.sbin
98 .if ${MK_TESTS} != "no"
101 .if ${MK_OFED} != "no"
105 # Local directories are last, since it is nice to at least get the base
106 # system rebuilt before you do them.
107 .for _DIR in ${LOCAL_DIRS}
108 .if exists(${.CURDIR}/${_DIR}/Makefile)
112 # Add LOCAL_LIB_DIRS, but only if they will not be picked up as a SUBDIR
113 # of a LOCAL_DIRS directory. This allows LOCAL_DIRS=foo and
114 # LOCAL_LIB_DIRS=foo/lib to behave as expected.
115 .for _DIR in ${LOCAL_DIRS:M*/} ${LOCAL_DIRS:N*/:S|$|/|}
116 _REDUNDENT_LIB_DIRS+= ${LOCAL_LIB_DIRS:M${_DIR}*}
118 .for _DIR in ${LOCAL_LIB_DIRS}
119 .if empty(_REDUNDENT_LIB_DIRS:M${_DIR}) && exists(${.CURDIR}/${_DIR}/Makefile)
122 .warning ${_DIR} not added to SUBDIR list. See UPDATING 20141121.
126 # We must do etc/ last as it hooks into building the man whatis file
127 # by calling 'makedb' in share/man. This is only relevant for
128 # install/distribute so they build the whatis file after every manpage is
135 .endif # !empty(SUBDIR_OVERRIDE)
138 .warning NOCLEAN option is deprecated. Use NO_CLEAN instead.
141 .if defined(NO_CLEANDIR)
142 CLEANDIR= clean cleandepend
148 PACKAGEDIR?= ${DESTDIR}/${DISTDIR}
150 .if empty(SHELL:M*csh*)
151 BUILDENV_SHELL?=${SHELL}
153 BUILDENV_SHELL?=/bin/sh
156 SVN?= /usr/local/bin/svn
159 MAKEOBJDIRPREFIX?= /usr/obj
160 .if !defined(OSRELDATE)
161 .if exists(/usr/include/osreldate.h)
162 OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
163 /usr/include/osreldate.h
170 # Set VERSION for CTFMERGE to use via the default CTFFLAGS=-L VERSION.
171 .if !defined(VERSION) && !make(showconfig)
172 REVISION!= ${MAKE} -C ${SRCDIR}/release -V REVISION
173 BRANCH!= ${MAKE} -C ${SRCDIR}/release -V BRANCH
174 SRCRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
175 ${SRCDIR}/sys/sys/param.h
176 VERSION= FreeBSD ${REVISION}-${BRANCH:C/-p[0-9]+$//} ${TARGET_ARCH} ${SRCRELDATE}
180 KNOWN_ARCHES?= aarch64/arm64 \
199 .if ${TARGET} == ${TARGET_ARCH}
202 _t= ${TARGET_ARCH}/${TARGET}
205 .if empty(KNOWN_ARCHES:M${_t})
206 .error Unknown target ${TARGET_ARCH}:${TARGET}.
210 .if ${TARGET} == ${MACHINE}
211 TARGET_CPUTYPE?=${CPUTYPE}
216 .if !empty(TARGET_CPUTYPE)
217 _TARGET_CPUTYPE=${TARGET_CPUTYPE}
219 _TARGET_CPUTYPE=dummy
221 # Skip for showconfig as it is just wasted time and may invoke auto.obj.mk.
222 .if !make(showconfig)
223 _CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} \
224 -f /dev/null -m ${.CURDIR}/share/mk -V CPUTYPE
225 .if ${_CPUTYPE} != ${_TARGET_CPUTYPE}
226 .error CPUTYPE global should be set with ?=.
230 BUILD_ARCH!= uname -p
231 .if ${MACHINE_ARCH} != ${BUILD_ARCH}
232 .error To cross-build, set TARGET_ARCH.
235 .if ${MACHINE} == ${TARGET} && ${MACHINE_ARCH} == ${TARGET_ARCH} && !defined(CROSS_BUILD_TESTING)
236 OBJTREE= ${MAKEOBJDIRPREFIX}
238 OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH}
240 WORLDTMP= ${OBJTREE}${.CURDIR}/tmp
241 BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/bin
242 XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin
243 STRICTTMPPATH= ${BPATH}:${XPATH}
244 TMPPATH= ${STRICTTMPPATH}:${PATH}
247 # Avoid running mktemp(1) unless actually needed.
248 # It may not be functional, e.g., due to new ABI
249 # when in the middle of installing over this system.
251 .if make(distributeworld) || make(installworld)
252 INSTALLTMP!= /usr/bin/mktemp -d -u -t install
256 # Building a world goes through the following stages
258 # 1. legacy stage [BMAKE]
259 # This stage is responsible for creating compatibility
260 # shims that are needed by the bootstrap-tools,
261 # build-tools and cross-tools stages. These are generally
262 # APIs that tools from one of those three stages need to
263 # build that aren't present on the host.
264 # 1. bootstrap-tools stage [BMAKE]
265 # This stage is responsible for creating programs that
266 # are needed for backward compatibility reasons. They
267 # are not built as cross-tools.
268 # 2. build-tools stage [TMAKE]
269 # This stage is responsible for creating the object
270 # tree and building any tools that are needed during
271 # the build process. Some programs are listed during
272 # this phase because they build binaries to generate
273 # files needed to build these programs. This stage also
274 # builds the 'build-tools' target rather than 'all'.
275 # 3. cross-tools stage [XMAKE]
276 # This stage is responsible for creating any tools that
277 # are needed for building the system. A cross-compiler is one
278 # of them. This differs from build tools in two ways:
279 # 1. the 'all' target is built rather than 'build-tools'
280 # 2. these tools are installed into TMPPATH for stage 4.
281 # 4. world stage [WMAKE]
282 # This stage actually builds the world.
283 # 5. install stage (optional) [IMAKE]
284 # This stage installs a previously built world.
289 # Common environment for world related stages
290 CROSSENV+= MAKEOBJDIRPREFIX=${OBJTREE} \
291 MACHINE_ARCH=${TARGET_ARCH} \
293 CPUTYPE=${TARGET_CPUTYPE}
294 .if ${MK_GROFF} != "no"
295 CROSSENV+= GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
296 GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \
297 GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac
299 .if defined(TARGET_CFLAGS)
300 CROSSENV+= ${TARGET_CFLAGS}
303 # bootstrap-tools stage
304 BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
305 PATH=${BPATH}:${PATH} \
306 WORLDTMP=${WORLDTMP} \
307 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}"
308 # need to keep this in sync with targets/pseudo/bootstrap-tools/Makefile
310 BOOTSTRAPPING=${OSRELDATE} \
312 MK_HTML=no NO_LINT=yes MK_MAN=no \
313 -DNO_PIC MK_PROFILE=no -DNO_SHARED \
314 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
315 MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \
316 MK_LLDB=no MK_TESTS=no \
319 BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
320 ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
324 TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
325 ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
326 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
328 BOOTSTRAPPING=${OSRELDATE} \
331 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
332 MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \
333 MK_LLDB=no MK_TESTS=no
336 XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \
337 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
338 MK_GDB=no MK_TESTS=no
341 KTMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
342 PATH=${BPATH}:${PATH} \
344 KTMAKE= TOOLS_PREFIX=${WORLDTMP} MAKEOBJDIRPREFIX=${WORLDTMP} \
345 ${KTMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
347 BOOTSTRAPPING=${OSRELDATE} \
349 MK_HTML=no -DNO_LINT MK_MAN=no \
350 -DNO_PIC MK_PROFILE=no -DNO_SHARED \
351 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no
354 WMAKEENV= ${CROSSENV} \
356 INSTALL="sh ${.CURDIR}/tools/install.sh" \
360 HMAKE= PATH=${TMPPATH} ${MAKE} LOCAL_MTREE=${LOCAL_MTREE:Q}
362 HMAKE+= PATH=${TMPPATH} METALOG=${METALOG} -DNO_ROOT
365 .if defined(CROSS_TOOLCHAIN_PREFIX)
366 CROSS_COMPILER_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
367 CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
370 # If we do not have a bootstrap binutils (because the in-tree one does not
371 # support the target architecture), provide a default cross-binutils prefix.
372 # This allows aarch64 builds, for example, to automatically use the
373 # aarch64-binutils port or package.
374 .if !make(showconfig)
375 .if !empty(BROKEN_OPTIONS:MBINUTILS_BOOTSTRAP) && \
376 !defined(CROSS_BINUTILS_PREFIX)
377 CROSS_BINUTILS_PREFIX=/usr/local/${TARGET_ARCH}-freebsd/bin/
378 .if !exists(${CROSS_BINUTILS_PREFIX})
379 .error In-tree binutils does not support the ${TARGET_ARCH} architecture. Install the ${TARGET_ARCH}-binutils port or package or set CROSS_BINUTILS_PREFIX.
384 XCOMPILERS= CC CXX CPP
385 .for COMPILER in ${XCOMPILERS}
386 .if defined(CROSS_COMPILER_PREFIX)
387 X${COMPILER}?= ${CROSS_COMPILER_PREFIX}${${COMPILER}}
389 X${COMPILER}?= ${${COMPILER}}
392 XBINUTILS= AS AR LD NM OBJCOPY OBJDUMP RANLIB SIZE STRINGS
393 .for BINUTIL in ${XBINUTILS}
394 .if defined(CROSS_BINUTILS_PREFIX) && \
395 exists(${CROSS_BINUTILS_PREFIX}${${BINUTIL}})
396 X${BINUTIL}?= ${CROSS_BINUTILS_PREFIX}${${BINUTIL}}
398 X${BINUTIL}?= ${${BINUTIL}}
401 CROSSENV+= CC="${XCC} ${XCFLAGS}" CXX="${XCXX} ${XCFLAGS} ${XCXXFLAGS}" \
402 DEPFLAGS="${DEPFLAGS}" \
403 CPP="${XCPP} ${XCFLAGS}" \
404 AS="${XAS}" AR="${XAR}" LD="${XLD}" NM=${XNM} \
405 OBJDUMP=${XOBJDUMP} OBJCOPY="${XOBJCOPY}" \
406 RANLIB=${XRANLIB} STRINGS=${XSTRINGS} \
409 .if ${XCC:N${CCACHE_BIN}:M/*}
410 .if defined(CROSS_BINUTILS_PREFIX)
411 # In the case of xdev-build tools, CROSS_BINUTILS_PREFIX won't be a
412 # directory, but the compiler will look in the right place for it's
413 # tools so we don't need to tell it where to look.
414 .if exists(${CROSS_BINUTILS_PREFIX})
415 BFLAGS+= -B${CROSS_BINUTILS_PREFIX}
418 BFLAGS+= -B${WORLDTMP}/usr/bin
420 .if ${TARGET} == "arm"
421 .if ${TARGET_ARCH:M*hf*} != ""
422 TARGET_ABI= gnueabihf
427 .if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc
428 XCFLAGS+= -isystem ${WORLDTMP}/usr/include -L${WORLDTMP}/usr/lib
429 XCXXFLAGS+= -I${WORLDTMP}/usr/include/c++/v1 -std=gnu++11 -L${WORLDTMP}/../lib/libc++
430 # XXX: DEPFLAGS is a workaround for not properly passing CXXFLAGS to sub-makes
431 # due to CXX="${XCXX} ${XCXXFLAGS}". bsd.dep.mk does use CXXFLAGS when
432 # building C++ files so this can come out if passing CXXFLAGS down is fixed.
433 DEPFLAGS+= -I${WORLDTMP}/usr/include/c++/v1
436 TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0
437 XCFLAGS+= -target ${TARGET_TRIPLE}
439 XCFLAGS+= --sysroot=${WORLDTMP} ${BFLAGS}
440 XCXXFLAGS+= --sysroot=${WORLDTMP} ${BFLAGS}
442 .if defined(CROSS_BINUTILS_PREFIX) && exists(${CROSS_BINUTILS_PREFIX})
443 BFLAGS+= -B${CROSS_BINUTILS_PREFIX}
445 XCXXFLAGS+= ${BFLAGS}
449 WMAKE= ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 DESTDIR=${WORLDTMP}
451 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
453 LIB32_OBJTREE= ${OBJTREE}${.CURDIR}/world32
454 LIB32TMP= ${OBJTREE}${.CURDIR}/lib32
456 .if ${TARGET_ARCH} == "amd64"
457 .if empty(TARGET_CPUTYPE)
458 LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2
460 LIB32CPUFLAGS= -march=${TARGET_CPUTYPE}
462 LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \
463 MACHINE_CPU="i686 mmx sse sse2"
466 LD="${XLD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" \
467 OBJCOPY="${XOBJCOPY}"
469 .elif ${TARGET_ARCH} == "powerpc64"
470 .if empty(TARGET_CPUTYPE)
471 LIB32CPUFLAGS= -mcpu=powerpc
473 LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE}
475 LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc
477 LD="${XLD} -m elf32ppc_fbsd" \
478 OBJCOPY="${XOBJCOPY}"
482 LIB32FLAGS= -m32 ${LIB32CPUFLAGS} -DCOMPAT_32BIT \
483 -isystem ${LIB32TMP}/usr/include/ \
484 -L${LIB32TMP}/usr/lib32 \
485 -B${LIB32TMP}/usr/lib32
486 .if ${XCC:N${CCACHE_BIN}:M/*}
487 LIB32FLAGS+= --sysroot=${WORLDTMP}
490 # Yes, the flags are redundant.
491 LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${LIB32_OBJTREE} \
492 _LDSCRIPTROOT=${LIB32TMP} \
493 INSTALL="sh ${.CURDIR}/tools/install.sh" \
496 SHLIBDIR=/usr/lib32 \
497 DTRACE="${DTRACE} -32"
498 LIB32WMAKEFLAGS+= CC="${XCC} ${LIB32FLAGS}" \
499 CXX="${XCXX} ${LIB32FLAGS}" \
500 DESTDIR=${LIB32TMP} \
508 LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} ${LIB32WMAKEFLAGS} \
510 LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} \
511 MK_TOOLCHAIN=no ${IMAKE_INSTALL}
514 IMAKEENV= ${CROSSENV:N_LDSCRIPTROOT=*}
515 IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 \
516 ${IMAKE_INSTALL} ${IMAKE_MTREE}
517 .if empty(.MAKEFLAGS:M-n)
518 IMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMP} \
519 LD_LIBRARY_PATH=${INSTALLTMP} \
520 PATH_LOCALE=${INSTALLTMP}/locale
521 IMAKE+= __MAKE_SHELL=${INSTALLTMP}/sh
523 IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP}
525 .if defined(DB_FROM_SRC)
526 INSTALLFLAGS+= -N ${.CURDIR}/etc
527 MTREEFLAGS+= -N ${.CURDIR}/etc
529 _INSTALL_DDIR= ${DESTDIR}/${DISTDIR}
530 INSTALL_DDIR= ${_INSTALL_DDIR:S://:/:g:C:/$::}
532 METALOG?= ${DESTDIR}/${DISTDIR}/METALOG
533 IMAKE+= -DNO_ROOT METALOG=${METALOG}
534 INSTALLFLAGS+= -U -M ${METALOG} -D ${INSTALL_DDIR}
537 .if defined(DB_FROM_SRC) || defined(NO_ROOT)
538 IMAKE_INSTALL= INSTALL="install ${INSTALLFLAGS}"
539 IMAKE_MTREE= MTREE_CMD="mtree ${MTREEFLAGS}"
543 KMAKEENV= ${WMAKEENV}
544 KMAKE= ${KMAKEENV} ${MAKE} ${.MAKEFLAGS} ${KERNEL_FLAGS} KERNEL=${INSTKERNNAME}
549 # Attempt to rebuild the entire system, with reasonable chance of
550 # success, regardless of how old your existing system is.
553 .if ${.CURDIR:C/[^,]//g} != ""
554 # The m4 build of sendmail files doesn't like it if ',' is used
555 # anywhere in the path of it's files.
557 @echo "*** Error: path to source tree contains a comma ','"
562 @echo "--------------------------------------------------------------"
563 @echo ">>> Rebuilding the temporary build tree"
564 @echo "--------------------------------------------------------------"
565 .if !defined(NO_CLEAN)
567 .if defined(LIB32TMP)
571 rm -rf ${WORLDTMP}/legacy/usr/include
572 # XXX - These three can depend on any header file.
573 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
574 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c
575 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
578 lib usr legacy/bin legacy/usr
579 mkdir -p ${WORLDTMP}/${_dir}
581 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
582 -p ${WORLDTMP}/legacy/usr >/dev/null
583 .if ${MK_GROFF} != "no"
584 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.groff.dist \
585 -p ${WORLDTMP}/legacy/usr >/dev/null
587 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
588 -p ${WORLDTMP}/usr >/dev/null
589 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
590 -p ${WORLDTMP}/usr/include >/dev/null
591 ln -sf ${.CURDIR}/sys ${WORLDTMP}
592 .if ${MK_DEBUG_FILES} != "no"
593 # We could instead disable debug files for these build stages
594 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
595 -p ${WORLDTMP}/legacy/usr/lib >/dev/null
596 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
597 -p ${WORLDTMP}/usr/lib >/dev/null
599 .if ${MK_LIB32} != "no"
600 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib32.dist \
601 -p ${WORLDTMP}/usr >/dev/null
602 .if ${MK_DEBUG_FILES} != "no"
603 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib32.dist \
604 -p ${WORLDTMP}/legacy/usr/lib/debug/usr >/dev/null
605 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib32.dist \
606 -p ${WORLDTMP}/usr/lib/debug/usr >/dev/null
609 .if ${MK_TESTS} != "no"
610 mkdir -p ${WORLDTMP}${TESTSBASE}
611 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
612 -p ${WORLDTMP}${TESTSBASE} >/dev/null
613 .if ${MK_DEBUG_FILES} != "no"
614 mkdir -p ${WORLDTMP}/usr/lib/debug/${TESTSBASE}
615 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
616 -p ${WORLDTMP}/usr/lib/debug/${TESTSBASE} >/dev/null
619 .for _mtree in ${LOCAL_MTREE}
620 mtree -deU -f ${.CURDIR}/${_mtree} -p ${WORLDTMP} > /dev/null
624 @echo "--------------------------------------------------------------"
625 @echo ">>> stage 1.1: legacy release compatibility shims"
626 @echo "--------------------------------------------------------------"
627 ${_+_}cd ${.CURDIR}; ${BMAKE} legacy
630 @echo "--------------------------------------------------------------"
631 @echo ">>> stage 1.2: bootstrap tools"
632 @echo "--------------------------------------------------------------"
633 ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools
635 .if !defined(NO_CLEAN)
637 @echo "--------------------------------------------------------------"
638 @echo ">>> stage 2.1: cleaning up the object tree"
639 @echo "--------------------------------------------------------------"
640 ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR}
641 .if defined(LIB32TMP)
642 ${_+_}cd ${.CURDIR}; ${LIB32WMAKE} -f Makefile.inc1 ${CLEANDIR}
647 @echo "--------------------------------------------------------------"
648 @echo ">>> stage 2.2: rebuilding the object tree"
649 @echo "--------------------------------------------------------------"
650 ${_+_}cd ${.CURDIR}; ${WMAKE} obj
653 @echo "--------------------------------------------------------------"
654 @echo ">>> stage 2.3: build tools"
655 @echo "--------------------------------------------------------------"
656 ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools
659 @echo "--------------------------------------------------------------"
660 @echo ">>> stage 3: cross tools"
661 @echo "--------------------------------------------------------------"
662 ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools
663 ${_+_}cd ${.CURDIR}; ${XMAKE} kernel-tools
666 @echo "--------------------------------------------------------------"
667 @echo ">>> stage 4.1: building includes"
668 @echo "--------------------------------------------------------------"
669 # Special handling for SUBDIR_OVERRIDE in buildworld as they most likely need
670 # headers from default SUBDIR. Do SUBDIR_OVERRIDE includes last.
671 ${_+_}cd ${.CURDIR}; ${WMAKE} SUBDIR_OVERRIDE= SHARED=symlinks \
673 .if !empty(SUBDIR_OVERRIDE) && make(buildworld)
674 ${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks includes
678 @echo "--------------------------------------------------------------"
679 @echo ">>> stage 4.2: building libraries"
680 @echo "--------------------------------------------------------------"
681 ${_+_}cd ${.CURDIR}; \
682 ${WMAKE} -DNO_FSCHG MK_HTML=no -DNO_LINT MK_MAN=no \
683 MK_PROFILE=no MK_TESTS=no MK_TESTS_SUPPORT=${MK_TESTS} libraries
686 @echo "--------------------------------------------------------------"
687 @echo ">>> stage 4.3: make dependencies"
688 @echo "--------------------------------------------------------------"
689 ${_+_}cd ${.CURDIR}; ${WMAKE} depend
692 @echo "--------------------------------------------------------------"
693 @echo ">>> stage 4.4: building everything"
694 @echo "--------------------------------------------------------------"
695 ${_+_}cd ${.CURDIR}; _PARALLEL_SUBDIR_OK=1 ${WMAKE} all
696 .if defined(LIB32TMP)
699 @echo "--------------------------------------------------------------"
700 @echo ">>> stage 5.1: building 32 bit shim libraries"
701 @echo "--------------------------------------------------------------"
702 mkdir -p ${LIB32TMP}/usr/include
703 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
704 -p ${LIB32TMP}/usr >/dev/null
705 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
706 -p ${LIB32TMP}/usr/include >/dev/null
707 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib32.dist \
708 -p ${LIB32TMP}/usr >/dev/null
709 .if ${MK_DEBUG_FILES} != "no"
710 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
711 -p ${LIB32TMP}/usr/lib >/dev/null
712 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib32.dist \
713 -p ${LIB32TMP}/usr/lib/debug/usr >/dev/null
716 ln -sf ${.CURDIR}/sys ${WORLDTMP}
717 .for _t in obj includes
718 ${_+_}cd ${.CURDIR}/include; ${LIB32WMAKE} DIRPRFX=include/ ${_t}
719 ${_+_}cd ${.CURDIR}/lib; ${LIB32WMAKE} DIRPRFX=lib/ ${_t}
720 .if ${MK_CDDL} != "no"
721 ${_+_}cd ${.CURDIR}/cddl/lib; ${LIB32WMAKE} DIRPRFX=cddl/lib/ ${_t}
723 ${_+_}cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} DIRPRFX=gnu/lib/ ${_t}
724 .if ${MK_CRYPT} != "no"
725 ${_+_}cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} DIRPRFX=secure/lib/ ${_t}
727 .if ${MK_KERBEROS} != "no"
728 ${_+_}cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} DIRPRFX=kerberos5/lib ${_t}
731 .for _dir in usr.bin/lex/lib
732 ${_+_}cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} DIRPRFX=${_dir}/ obj
734 .for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic
735 ${_+_}cd ${.CURDIR}/${_dir}; \
736 WORLDTMP=${WORLDTMP} \
737 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
738 MAKEOBJDIRPREFIX=${LIB32_OBJTREE} ${MAKE} SSP_CFLAGS= DESTDIR= \
739 DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
742 ${_+_}cd ${.CURDIR}; \
743 ${LIB32WMAKE} -f Makefile.inc1 -DNO_FSCHG libraries
744 .for _t in obj depend all
745 ${_+_}cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32WMAKE} \
746 -DNO_FSCHG DIRPRFX=libexec/rtld-elf/ ${_t}
747 ${_+_}cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32WMAKE} \
748 DIRPRFX=usr.bin/ldd ${_t}
751 distribute32 install32: .MAKE .PHONY
752 ${_+_}cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
753 .if ${MK_CDDL} != "no"
754 ${_+_}cd ${.CURDIR}/cddl/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
756 ${_+_}cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
757 .if ${MK_CRYPT} != "no"
758 ${_+_}cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
760 .if ${MK_KERBEROS} != "no"
761 ${_+_}cd ${.CURDIR}/kerberos5/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
763 ${_+_}cd ${.CURDIR}/libexec/rtld-elf; \
764 PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//}
765 ${_+_}cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32IMAKE} \
770 WMAKE_TGTS+= _worldtmp _legacy
771 .if empty(SUBDIR_OVERRIDE)
772 WMAKE_TGTS+= _bootstrap-tools
774 WMAKE_TGTS+= _cleanobj _obj _build-tools _cross-tools
775 WMAKE_TGTS+= _includes _libraries _depend everything
776 .if defined(LIB32TMP) && ${MK_LIB32} != "no" && empty(SUBDIR_OVERRIDE)
780 buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
781 .ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
784 @echo "--------------------------------------------------------------"
785 @echo ">>> World build started on `LC_ALL=C date`"
786 @echo "--------------------------------------------------------------"
790 @echo "--------------------------------------------------------------"
791 @echo ">>> World build completed on `LC_ALL=C date`"
792 @echo "--------------------------------------------------------------"
795 # We need to have this as a target because the indirection between Makefile
796 # and Makefile.inc1 causes the correct PATH to be used, rather than a
797 # modification of the current environment's PATH. In addition, we need
798 # to quote multiword values.
801 @echo ${WMAKEENV:Q} ${.MAKE.EXPORTED:@v@$v=\"${$v}\"@}
803 .if ${.TARGETS:Mbuildenv}
804 .if ${.MAKEFLAGS:M-j}
805 .error The buildenv target is incompatible with -j
808 BUILDENV_DIR?= ${.CURDIR}
810 @echo Entering world for ${TARGET_ARCH}:${TARGET}
811 .if ${BUILDENV_SHELL:M*zsh*}
812 @echo For ZSH you must run: export CPUTYPE=${TARGET_CPUTYPE}
814 @cd ${BUILDENV_DIR} && env ${WMAKEENV} BUILDENV=1 ${BUILDENV_SHELL} \
817 TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything:Nbuild32}
818 toolchain: ${TOOLCHAIN_TGTS}
819 kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries}
824 # Checks to be sure system is ready for installworld/installkernel.
826 installcheck: _installcheck_world _installcheck_kernel
828 _installcheck_kernel:
831 # Require DESTDIR to be set if installing for a different architecture or
832 # using the user/group database in the source tree.
834 .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE} || \
836 .if !make(distributeworld)
837 _installcheck_world: __installcheck_DESTDIR
838 _installcheck_kernel: __installcheck_DESTDIR
839 __installcheck_DESTDIR:
840 .if !defined(DESTDIR) || empty(DESTDIR)
841 @echo "ERROR: Please set DESTDIR!"; \
847 .if !defined(DB_FROM_SRC)
849 # Check for missing UIDs/GIDs.
851 CHECK_UIDS= auditdistd
853 .if ${MK_SENDMAIL} != "no"
859 CHECK_GIDS+= proxy authpf
861 .if ${MK_UNBOUND} != "no"
865 _installcheck_world: __installcheck_UGID
867 .for uid in ${CHECK_UIDS}
868 @if ! `id -u ${uid} >/dev/null 2>&1`; then \
869 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \
873 .for gid in ${CHECK_GIDS}
874 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \
875 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \
882 # Required install tools to be saved in a scratch dir for safety.
884 .if ${MK_ZONEINFO} != "no"
885 _zoneinfo= zic tzsetup
888 ITOOLS= [ awk cap_mkdb cat chflags chmod chown cmp cp \
889 date echo egrep find grep id install ${_install-info} \
890 ln make mkdir mtree mv pwd_mkdb \
891 rm sed services_mkdb sh strip sysctl test true uname wc ${_zoneinfo} \
894 # Needed for share/man
895 .if ${MK_MAN} != "no"
902 # Distributes everything compiled by a `buildworld'.
906 # Installs everything compiled by a 'buildworld'.
909 # Non-base distributions produced by the base system
910 EXTRA_DISTRIBUTIONS= doc
911 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
912 EXTRA_DISTRIBUTIONS+= lib32
914 .if ${MK_TESTS} != "no"
915 EXTRA_DISTRIBUTIONS+= tests
919 .if ${MK_DEBUG_FILES} != "no"
920 DEBUG_DISTRIBUTIONS+= base ${EXTRA_DISTRIBUTIONS:S,doc,,:S,tests,,}
923 MTREE_MAGIC?= mtree 2.0
925 distributeworld installworld: _installcheck_world
926 mkdir -p ${INSTALLTMP}
927 progs=$$(for prog in ${ITOOLS}; do \
928 if progpath=`which $$prog`; then \
931 echo "Required tool $$prog not found in PATH." >&2; \
935 libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | \
936 while read line; do \
938 if [ "$$2 $$3" != "not found" ]; then \
941 echo "Required library $$1 not found." >&2; \
945 cp $$libs $$progs ${INSTALLTMP}
946 cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale
948 echo "#${MTREE_MAGIC}" > ${METALOG}
950 .if make(distributeworld)
951 .for dist in ${EXTRA_DISTRIBUTIONS}
952 -mkdir ${DESTDIR}/${DISTDIR}/${dist}
953 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
954 -p ${DESTDIR}/${DISTDIR}/${dist} >/dev/null
955 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
956 -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null
957 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
958 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/include >/dev/null
959 .if ${MK_DEBUG_FILES} != "no"
960 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
961 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib >/dev/null
963 .if ${MK_LIB32} != "no"
964 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib32.dist \
965 -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null
966 .if ${MK_DEBUG_FILES} != "no"
967 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib32.dist \
968 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib/debug/usr >/dev/null
971 .if ${MK_TESTS} != "no" && ${dist} == "tests"
972 -mkdir -p ${DESTDIR}/${DISTDIR}/${dist}${TESTSBASE}
973 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
974 -p ${DESTDIR}/${DISTDIR}/${dist}${TESTSBASE} >/dev/null
975 .if ${MK_DEBUG_FILES} != "no"
976 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
977 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib/debug/${TESTSBASE} >/dev/null
981 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \
982 sed -e 's#^\./#./${dist}/#' >> ${METALOG}
983 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.usr.dist | \
984 sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG}
985 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.include.dist | \
986 sed -e 's#^\./#./${dist}/usr/include/#' >> ${METALOG}
987 .if ${MK_LIB32} != "no"
988 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.lib32.dist | \
989 sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG}
993 -mkdir ${DESTDIR}/${DISTDIR}/base
994 ${_+_}cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
995 METALOG=${METALOG} ${IMAKE_INSTALL} ${IMAKE_MTREE} \
996 DISTBASE=/base DESTDIR=${DESTDIR}/${DISTDIR}/base \
997 LOCAL_MTREE=${LOCAL_MTREE:Q} distrib-dirs
999 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \
1000 ${IMAKEENV} rm -rf ${INSTALLTMP}
1001 .if make(distributeworld)
1002 .for dist in ${EXTRA_DISTRIBUTIONS}
1003 find ${DESTDIR}/${DISTDIR}/${dist} -mindepth 1 -empty -delete
1005 .if defined(NO_ROOT)
1006 .for dist in base ${EXTRA_DISTRIBUTIONS}
1007 @# For each file that exists in this dist, print the corresponding
1008 @# line from the METALOG. This relies on the fact that
1009 @# a line containing only the filename will sort immediatly before
1010 @# the relevant mtree line.
1011 cd ${DESTDIR}/${DISTDIR}; \
1012 find ./${dist} | sort -u ${METALOG} - | \
1013 awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \
1014 ${DESTDIR}/${DISTDIR}/${dist}.meta
1016 .for dist in ${DEBUG_DISTRIBUTIONS}
1017 @# For each file that exists in this dist, print the corresponding
1018 @# line from the METALOG. This relies on the fact that
1019 @# a line containing only the filename will sort immediatly before
1020 @# the relevant mtree line.
1021 cd ${DESTDIR}/${DISTDIR}; \
1022 find ./${dist}/usr/lib/debug | sort -u ${METALOG} - | \
1023 awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \
1024 ${DESTDIR}/${DISTDIR}/${dist}.debug.meta
1030 .for dist in base ${EXTRA_DISTRIBUTIONS}
1031 .if defined(NO_ROOT)
1032 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
1033 tar cvf - --exclude usr/lib/debug \
1034 @${DESTDIR}/${DISTDIR}/${dist}.meta | \
1035 ${XZ_CMD} > ${PACKAGEDIR}/${dist}.txz
1037 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
1038 tar cvf - --exclude usr/lib/debug . | \
1039 ${XZ_CMD} > ${PACKAGEDIR}/${dist}.txz
1043 .for dist in ${DEBUG_DISTRIBUTIONS}
1044 . if defined(NO_ROOT)
1045 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
1046 tar cvf - @${DESTDIR}/${DISTDIR}/${dist}.debug.meta | \
1047 ${XZ_CMD} > ${PACKAGEDIR}/${dist}-dbg.txz
1049 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
1050 tar cvLf - usr/lib/debug | \
1051 ${XZ_CMD} > ${PACKAGEDIR}/${dist}-dbg.txz
1058 # If you have a build server, you can NFS mount the source and obj directories
1059 # and do a 'make reinstall' on the *client* to install new binaries from the
1060 # most recent server build.
1062 reinstall: .MAKE .PHONY
1063 @echo "--------------------------------------------------------------"
1064 @echo ">>> Making hierarchy"
1065 @echo "--------------------------------------------------------------"
1066 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 \
1067 LOCAL_MTREE=${LOCAL_MTREE:Q} hierarchy
1069 @echo "--------------------------------------------------------------"
1070 @echo ">>> Installing everything"
1071 @echo "--------------------------------------------------------------"
1072 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
1073 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
1074 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32
1077 redistribute: .MAKE .PHONY
1078 @echo "--------------------------------------------------------------"
1079 @echo ">>> Distributing everything"
1080 @echo "--------------------------------------------------------------"
1081 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
1082 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
1083 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 \
1087 distrib-dirs: .MAKE .PHONY
1088 ${_+_}cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
1089 ${IMAKE_INSTALL} ${IMAKE_MTREE} METALOG=${METALOG} ${.TARGET}
1091 distribution: .MAKE .PHONY
1092 ${_+_}cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
1093 ${IMAKE_INSTALL} ${IMAKE_MTREE} METALOG=${METALOG} ${.TARGET}
1094 ${_+_}cd ${.CURDIR}; ${CROSSENV} PATH=${TMPPATH} \
1095 ${MAKE} -f Makefile.inc1 ${IMAKE_INSTALL} \
1096 METALOG=${METALOG} installconfig
1099 # buildkernel and installkernel
1101 # Which kernels to build and/or install is specified by setting
1102 # KERNCONF. If not defined a GENERIC kernel is built/installed.
1103 # Only the existing (depending TARGET) config files are used
1104 # for building kernels and only the first of these is designated
1105 # as the one being installed.
1107 # Note that we have to use TARGET instead of TARGET_ARCH when
1108 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
1109 # be set to cross-build, we have to make sure TARGET is set
1112 .if defined(KERNFAST)
1117 # Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah
1118 .if !defined(KERNCONF) && ${KERNFAST} != "1"
1119 KERNCONF=${KERNFAST}
1122 .if ${TARGET_ARCH} == "powerpc64"
1123 KERNCONF?= GENERIC64
1127 INSTKERNNAME?= kernel
1129 KERNSRCDIR?= ${.CURDIR}/sys
1130 KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf
1131 KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR}
1132 KERNCONFDIR?= ${KRNLCONFDIR}
1136 .if defined(NO_INSTALLKERNEL)
1137 # All of the BUILDKERNELS loops start at index 1.
1138 BUILDKERNELS+= dummy
1140 .for _kernel in ${KERNCONF}
1141 .if exists(${KERNCONFDIR}/${_kernel})
1142 BUILDKERNELS+= ${_kernel}
1143 .if empty(INSTALLKERNEL) && !defined(NO_INSTALLKERNEL)
1144 INSTALLKERNEL= ${_kernel}
1149 ${WMAKE_TGTS:N_worldtmp:Nbuild32} ${.ALLTARGETS:M_*:N_worldtmp}: .MAKE .PHONY
1154 # Builds all kernels defined by BUILDKERNELS.
1156 buildkernel: .MAKE .PHONY
1157 .if empty(BUILDKERNELS:Ndummy)
1158 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \
1162 .for _kernel in ${BUILDKERNELS:Ndummy}
1163 @echo "--------------------------------------------------------------"
1164 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
1165 @echo "--------------------------------------------------------------"
1166 @echo "===> ${_kernel}"
1167 mkdir -p ${KRNLOBJDIR}
1168 .if !defined(NO_KERNELCONFIG)
1170 @echo "--------------------------------------------------------------"
1171 @echo ">>> stage 1: configuring the kernel"
1172 @echo "--------------------------------------------------------------"
1173 cd ${KRNLCONFDIR}; \
1175 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
1176 -I '${KERNCONFDIR}' '${KERNCONFDIR}/${_kernel}'
1178 .if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN)
1180 @echo "--------------------------------------------------------------"
1181 @echo ">>> stage 2.1: cleaning up the object tree"
1182 @echo "--------------------------------------------------------------"
1183 ${_+_}cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR}
1185 .if !defined(NO_KERNELOBJ)
1187 @echo "--------------------------------------------------------------"
1188 @echo ">>> stage 2.2: rebuilding the object tree"
1189 @echo "--------------------------------------------------------------"
1190 ${_+_}cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj
1193 @echo "--------------------------------------------------------------"
1194 @echo ">>> stage 2.3: build tools"
1195 @echo "--------------------------------------------------------------"
1196 ${_+_}cd ${.CURDIR}; ${KTMAKE} kernel-tools
1197 .if !defined(NO_KERNELDEPEND)
1199 @echo "--------------------------------------------------------------"
1200 @echo ">>> stage 3.1: making dependencies"
1201 @echo "--------------------------------------------------------------"
1202 ${_+_}cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ
1205 @echo "--------------------------------------------------------------"
1206 @echo ">>> stage 3.2: building everything"
1207 @echo "--------------------------------------------------------------"
1208 ${_+_}cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ
1209 @echo "--------------------------------------------------------------"
1210 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
1211 @echo "--------------------------------------------------------------"
1215 # installkernel, etc.
1217 # Install the kernel defined by INSTALLKERNEL
1219 installkernel installkernel.debug \
1220 reinstallkernel reinstallkernel.debug: _installcheck_kernel
1221 .if !defined(NO_INSTALLKERNEL)
1222 .if empty(INSTALLKERNEL)
1223 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
1226 @echo "--------------------------------------------------------------"
1227 @echo ">>> Installing kernel ${INSTALLKERNEL}"
1228 @echo "--------------------------------------------------------------"
1229 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
1230 ${CROSSENV} PATH=${TMPPATH} \
1231 ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
1233 .if ${BUILDKERNELS:[#]} > 1
1234 .for _kernel in ${BUILDKERNELS:[2..-1]}
1235 @echo "--------------------------------------------------------------"
1236 @echo ">>> Installing kernel ${_kernel}"
1237 @echo "--------------------------------------------------------------"
1238 cd ${KRNLOBJDIR}/${_kernel}; \
1239 ${CROSSENV} PATH=${TMPPATH} \
1240 ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME}.${_kernel} ${.TARGET:S/kernel//}
1244 distributekernel distributekernel.debug:
1245 .if !defined(NO_INSTALLKERNEL)
1246 .if empty(INSTALLKERNEL)
1247 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
1250 mkdir -p ${DESTDIR}/${DISTDIR}
1251 .if defined(NO_ROOT)
1252 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.premeta
1254 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
1255 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.premeta/} \
1256 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} KERNEL=${INSTKERNNAME} \
1257 DESTDIR=${INSTALL_DDIR}/kernel \
1258 ${.TARGET:S/distributekernel/install/}
1259 .if defined(NO_ROOT)
1260 sed -e 's|^./kernel|.|' ${DESTDIR}/${DISTDIR}/kernel.premeta > \
1261 ${DESTDIR}/${DISTDIR}/kernel.meta
1264 .if ${BUILDKERNELS:[#]} > 1
1265 .for _kernel in ${BUILDKERNELS:[2..-1]}
1266 .if defined(NO_ROOT)
1267 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta
1269 cd ${KRNLOBJDIR}/${_kernel}; \
1270 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.${_kernel}.premeta/} \
1271 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} \
1272 KERNEL=${INSTKERNNAME}.${_kernel} \
1273 DESTDIR=${INSTALL_DDIR}/kernel.${_kernel} \
1274 ${.TARGET:S/distributekernel/install/}
1275 .if defined(NO_ROOT)
1276 sed -e 's|^./kernel|.|' \
1277 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta > \
1278 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta
1284 .if defined(NO_ROOT)
1285 .if !defined(NO_INSTALLKERNEL)
1286 cd ${DESTDIR}/${DISTDIR}/kernel; \
1287 tar cvf - @${DESTDIR}/${DISTDIR}/kernel.meta | \
1288 ${XZ_CMD} > ${PACKAGEDIR}/kernel.txz
1290 .if ${BUILDKERNELS:[#]} > 1
1291 .for _kernel in ${BUILDKERNELS:[2..-1]}
1292 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
1293 tar cvf - @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta | \
1294 ${XZ_CMD} > ${PACKAGEDIR}/kernel.${_kernel}.txz
1298 .if !defined(NO_INSTALLKERNEL)
1299 cd ${DESTDIR}/${DISTDIR}/kernel; \
1301 ${XZ_CMD} > ${PACKAGEDIR}/kernel.txz
1303 .if ${BUILDKERNELS:[#]} > 1
1304 .for _kernel in ${BUILDKERNELS:[2..-1]}
1305 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
1307 ${XZ_CMD} > ${PACKAGEDIR}/kernel.${_kernel}.txz
1315 # Build the API documentation with doxygen
1318 @if [ ! -x ${LOCALBASE}/bin/doxygen ]; then \
1319 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \
1322 ${_+_}cd ${.CURDIR}/tools/kerneldoc/subsys; ${MAKE} obj all
1327 # Update the source tree(s), by running svn/svnup to update to the
1331 .if (defined(CVS_UPDATE) || defined(SUP_UPDATE)) && !defined(SVN_UPDATE)
1332 @echo "--------------------------------------------------------------"
1333 @echo "CVS_UPDATE and SUP_UPDATE are no longer supported."
1334 @echo "Please see: https://wiki.freebsd.org/CvsIsDeprecated"
1335 @echo "--------------------------------------------------------------"
1338 .if defined(SVN_UPDATE)
1339 @echo "--------------------------------------------------------------"
1340 @echo ">>> Updating ${.CURDIR} using Subversion"
1341 @echo "--------------------------------------------------------------"
1342 @(cd ${.CURDIR}; ${SVN} update ${SVNFLAGS})
1346 # ------------------------------------------------------------------------
1348 # From here onwards are utility targets used by the 'make world' and
1349 # related targets. If your 'world' breaks, you may like to try to fix
1350 # the problem and manually run the following targets to attempt to
1351 # complete the build. Beware, this is *not* guaranteed to work, you
1352 # need to have a pretty good grip on the current state of the system
1353 # to attempt to manually finish it. If in doubt, 'make world' again.
1357 # legacy: Build compatibility shims for the next three targets. This is a
1358 # minimal set of tools and shims necessary to compensate for older systems
1359 # which don't have the APIs required by the targets built in bootstrap-tools,
1360 # build-tools or cross-tools.
1363 # ELF Tool Chain libraries are needed for ELF tools and dtrace tools.
1364 .if ${BOOTSTRAPPING} < 1100006
1365 _elftoolchain_libs= lib/libelf lib/libdwarf
1369 .if ${BOOTSTRAPPING} < 800107 && ${BOOTSTRAPPING} != 0
1370 @echo "ERROR: Source upgrades from versions prior to 8.0 are not supported."; \
1373 .for _tool in tools/build ${_elftoolchain_libs}
1374 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \
1375 cd ${.CURDIR}/${_tool}; \
1376 ${MAKE} DIRPRFX=${_tool}/ obj; \
1377 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \
1378 ${MAKE} DIRPRFX=${_tool}/ depend; \
1379 ${MAKE} DIRPRFX=${_tool}/ all; \
1380 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
1384 # bootstrap-tools: Build tools needed for compatibility. These are binaries that
1385 # are built to build other binaries in the system. However, the focus of these
1386 # binaries is usually quite narrow. Bootstrap tools use the host's compiler and
1387 # libraries, augmented by -legacy.
1389 _bt= _bootstrap-tools
1391 .if ${MK_GAMES} != "no"
1392 _strfile= usr.bin/fortune/strfile
1395 .if ${MK_GCC} != "no" && ${MK_CXX} != "no"
1396 _gperf= gnu/usr.bin/gperf
1399 .if ${MK_GROFF} != "no"
1400 _groff= gnu/usr.bin/groff \
1404 .if ${MK_VT} != "no"
1405 _vtfontcvt= usr.bin/vtfontcvt
1408 .if ${BOOTSTRAPPING} < 900002
1412 .if ${BOOTSTRAPPING} < 1000002
1413 _libopenbsd= lib/libopenbsd
1416 ${_bt}-usr.bin/m4: ${_bt}-lib/libopenbsd
1419 .if ${BOOTSTRAPPING} < 1000026
1420 _nmtree= lib/libnetbsd \
1423 ${_bt}-usr.sbin/nmtree: ${_bt}-lib/libnetbsd
1426 .if ${BOOTSTRAPPING} < 1000027
1430 .if ${BOOTSTRAPPING} < 1000033
1433 ${_bt}-usr.bin/lex: ${_bt}-usr.bin/m4
1436 # r277259 crunchide: Correct 64-bit section header offset
1437 # r281674 crunchide: always include both 32- and 64-bit ELF support
1438 # r285986 crunchen: use STRIPBIN rather than STRIP
1439 .if ${BOOTSTRAPPING} < 1100078
1440 _crunch= usr.sbin/crunch
1443 .if ${BOOTSTRAPPING} >= 900040 && ${BOOTSTRAPPING} < 900041
1450 ${_bt}-usr.bin/yacc: ${_bt}-lib/liby
1452 .if ${MK_BSNMP} != "no"
1453 _gensnmptree= usr.sbin/bsnmpd/gensnmptree
1456 # We need to build tblgen when we're building clang either as
1457 # the bootstrap compiler, or as the part of the normal build.
1458 .if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_CLANG} != "no"
1460 lib/clang/libllvmsupport \
1461 lib/clang/libllvmtablegen \
1462 usr.bin/clang/tblgen \
1463 usr.bin/clang/clang-tblgen
1465 ${_bt}-usr.bin/clang/clang-tblgen: ${_bt}-lib/clang/libllvmtablegen ${_bt}-lib/clang/libllvmsupport
1466 ${_bt}-usr.bin/clang/tblgen: ${_bt}-lib/clang/libllvmtablegen ${_bt}-lib/clang/libllvmsupport
1469 # Default to building the GPL DTC, but build the BSDL one if users explicitly
1472 .if ${MK_GPL_DTC} != "no"
1473 _dtc= gnu/usr.bin/dtc
1476 .if ${MK_KERBEROS} != "no"
1477 _kerberos5_bootstrap_tools= \
1478 kerberos5/tools/make-roken \
1479 kerberos5/lib/libroken \
1480 kerberos5/lib/libvers \
1481 kerberos5/tools/asn1_compile \
1482 kerberos5/tools/slc \
1485 .ORDER: ${_kerberos5_bootstrap_tools:C/^/${_bt}-/g}
1488 .if ${MK_MANDOCDB} != "no"
1489 _libopenbsd?= lib/libopenbsd
1490 _makewhatis= lib/libsqlite3 \
1492 ${_bt}-usr.bin/mandoc: ${_bt}-lib/libopenbsd ${_bt}-lib/libsqlite3
1494 _makewhatis=usr.bin/makewhatis
1497 bootstrap-tools: .PHONY
1499 # Please document (add comment) why something is in 'bootstrap-tools'.
1500 # Try to bound the building of the bootstrap-tool to just the
1501 # FreeBSD versions that need the tool built at this stage of the build.
1504 ${_kerberos5_bootstrap_tools} \
1526 ${_bt}-${_tool}: .PHONY .MAKE
1527 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1528 cd ${.CURDIR}/${_tool}; \
1529 ${MAKE} DIRPRFX=${_tool}/ obj; \
1530 ${MAKE} DIRPRFX=${_tool}/ depend; \
1531 ${MAKE} DIRPRFX=${_tool}/ all; \
1532 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
1534 bootstrap-tools: ${_bt}-${_tool}
1538 # build-tools: Build special purpose build tools
1540 .if !defined(NO_SHARE)
1541 _share= share/syscons/scrnmaps
1544 .if ${MK_GCC} != "no"
1545 _gcc_tools= gnu/usr.bin/cc/cc_tools
1548 .if ${MK_RESCUE} != "no"
1549 # rescue includes programs that have build-tools targets
1550 _rescue=rescue/rescue
1556 ${LOCAL_TOOL_DIRS} \
1557 lib/ncurses/ncurses \
1558 lib/ncurses/ncursesw \
1563 usr.bin/mkesdb_static \
1564 usr.bin/mkcsmapper_static \
1566 build-tools_${_tool}: .PHONY
1567 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \
1568 cd ${.CURDIR}/${_tool}; \
1569 ${MAKE} DIRPRFX=${_tool}/ obj; \
1570 ${MAKE} DIRPRFX=${_tool}/ build-tools
1571 build-tools: build-tools_${_tool}
1575 build-tools_${_tool}: .PHONY
1576 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \
1577 cd ${.CURDIR}/${_tool}; \
1578 ${MAKE} DIRPRFX=${_tool}/ obj; \
1579 ${MAKE} DIRPRFX=${_tool}/ depend; \
1580 ${MAKE} DIRPRFX=${_tool}/ all
1581 build-tools: build-tools_${_tool}
1585 # kernel-tools: Build kernel-building tools
1588 mkdir -p ${MAKEOBJDIRPREFIX}/usr
1589 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1590 -p ${MAKEOBJDIRPREFIX}/usr >/dev/null
1593 # cross-tools: All the tools needed to build the rest of the system after
1594 # we get done with the earlier stages. It is the last set of tools needed
1595 # to begin building the target binaries.
1597 .if ${TARGET_ARCH} != ${MACHINE_ARCH}
1598 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386"
1599 _btxld= usr.sbin/btxld
1603 # Rebuild ctfconvert and ctfmerge to avoid difficult-to-diagnose failures
1604 # resulting from missing bug fixes or ELF Toolchain updates.
1605 .if ${MK_CDDL} != "no"
1606 _dtrace_tools= cddl/lib/libctf cddl/usr.bin/ctfconvert \
1607 cddl/usr.bin/ctfmerge
1610 # If we're given an XAS, don't build binutils.
1611 .if ${XAS:M/*} == ""
1612 .if ${MK_BINUTILS_BOOTSTRAP} != "no"
1613 _binutils= gnu/usr.bin/binutils
1615 .if ${MK_ELFTOOLCHAIN_BOOTSTRAP} != "no"
1616 _elftctools= lib/libelftc \
1621 # These are not required by the build, but can be useful for developers who
1622 # cross-build on a FreeBSD 10 host:
1623 _elftctools+= usr.bin/addr2line
1625 .elif ${TARGET_ARCH} != ${MACHINE_ARCH} && ${MK_ELFTOOLCHAIN_BOOTSTRAP} != "no"
1626 # If cross-building with an external binutils we still need to build strip for
1627 # the target (for at least crunchide).
1628 _elftctools= lib/libelftc \
1632 # If an full path to an external cross compiler is given, don't build
1634 .if ${XCC:N${CCACHE_BIN}:M/*} == "" && ${MK_CROSS_COMPILER} != "no"
1635 .if ${MK_CLANG_BOOTSTRAP} != "no"
1636 _clang= usr.bin/clang
1637 _clang_libs= lib/clang
1639 .if ${MK_GCC_BOOTSTRAP} != "no"
1643 .if ${MK_USB} != "no"
1644 _usb_tools= sys/boot/usb/tools
1647 cross-tools: .MAKE .PHONY
1658 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1659 cd ${.CURDIR}/${_tool}; \
1660 ${MAKE} DIRPRFX=${_tool}/ obj; \
1661 ${MAKE} DIRPRFX=${_tool}/ depend; \
1662 ${MAKE} DIRPRFX=${_tool}/ all; \
1663 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
1666 NXBDESTDIR= ${OBJTREE}/nxb-bin
1667 NXBENV= MAKEOBJDIRPREFIX=${OBJTREE}/nxb \
1668 INSTALL="sh ${.CURDIR}/tools/install.sh" \
1669 PATH=${PATH}:${OBJTREE}/gperf_for_gcc/usr/bin
1670 NXBMAKE= ${NXBENV} ${MAKE} \
1671 TBLGEN=${NXBDESTDIR}/usr/bin/tblgen \
1672 CLANG_TBLGEN=${NXBDESTDIR}/usr/bin/clang-tblgen \
1673 MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH} \
1674 MK_GDB=no MK_TESTS=no \
1676 MK_HTML=no NO_LINT=yes MK_MAN=no \
1677 -DNO_PIC MK_PROFILE=no -DNO_SHARED \
1678 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
1679 MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \
1680 MK_LLDB=no MK_DEBUG_FILES=no
1682 # native-xtools is the current target for qemu-user cross builds of ports
1683 # via poudriere and the imgact_binmisc kernel module.
1684 # For non-clang enabled targets that are still using the in tree gcc
1685 # we must build a gperf binary for one instance of its Makefiles. On
1686 # clang-enabled systems, the gperf binary is obsolete.
1687 native-xtools: .PHONY
1688 .if ${MK_GCC_BOOTSTRAP} != "no"
1689 mkdir -p ${OBJTREE}/gperf_for_gcc/usr/bin
1690 ${_+_}@${ECHODIR} "===> ${_gperf} (obj,depend,all,install)"; \
1691 cd ${.CURDIR}/${_gperf}; \
1692 ${NXBMAKE} DIRPRFX=${_gperf}/ obj; \
1693 ${NXBMAKE} DIRPRFX=${_gperf}/ depend; \
1694 ${NXBMAKE} DIRPRFX=${_gperf}/ all; \
1695 ${NXBMAKE} DIRPRFX=${_gperf}/ DESTDIR=${OBJTREE}/gperf_for_gcc install
1697 mkdir -p ${NXBDESTDIR}/bin ${NXBDESTDIR}/sbin ${NXBDESTDIR}/usr
1698 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1699 -p ${NXBDESTDIR}/usr >/dev/null
1700 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
1701 -p ${NXBDESTDIR}/usr/include >/dev/null
1702 .if ${MK_DEBUG_FILES} != "no"
1703 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
1704 -p ${NXBDESTDIR}/usr/lib >/dev/null
1765 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1766 cd ${.CURDIR}/${_tool}; \
1767 ${NXBMAKE} DIRPRFX=${_tool}/ obj; \
1768 ${NXBMAKE} DIRPRFX=${_tool}/ depend; \
1769 ${NXBMAKE} DIRPRFX=${_tool}/ all; \
1770 ${NXBMAKE} DIRPRFX=${_tool}/ DESTDIR=${NXBDESTDIR} install
1774 # hierarchy - ensure that all the needed directories are present
1776 hierarchy hier: .MAKE .PHONY
1777 ${_+_}cd ${.CURDIR}/etc; ${HMAKE} distrib-dirs
1780 # libraries - build all libraries, and install them under ${DESTDIR}.
1782 # The list of libraries with dependents (${_prebuild_libs}) and their
1783 # interdependencies (__L) are built automatically by the
1784 # ${.CURDIR}/tools/make_libdeps.sh script.
1786 libraries: .MAKE .PHONY
1787 ${_+_}cd ${.CURDIR}; \
1788 ${MAKE} -f Makefile.inc1 _prereq_libs; \
1789 ${MAKE} -f Makefile.inc1 _startup_libs; \
1790 ${MAKE} -f Makefile.inc1 _prebuild_libs; \
1791 ${MAKE} -f Makefile.inc1 _generic_libs
1794 # static libgcc.a prerequisite for shared libc
1796 _prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc lib/libcompiler_rt
1798 # These dependencies are not automatically generated:
1800 # gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before
1801 # all shared libraries for ELF.
1803 _startup_libs= gnu/lib/csu
1804 _startup_libs+= lib/csu
1805 _startup_libs+= gnu/lib/libgcc
1806 _startup_libs+= lib/libcompiler_rt
1807 _startup_libs+= lib/libc
1808 _startup_libs+= lib/libc_nonshared
1809 .if ${MK_LIBCPLUSPLUS} != "no"
1810 _startup_libs+= lib/libcxxrt
1813 gnu/lib/libgcc__L: lib/libc__L
1814 gnu/lib/libgcc__L: lib/libc_nonshared__L
1815 .if ${MK_LIBCPLUSPLUS} != "no"
1816 lib/libcxxrt__L: gnu/lib/libgcc__L
1819 _prebuild_libs= ${_kerberos5_lib_libasn1} \
1820 ${_kerberos5_lib_libhdb} \
1821 ${_kerberos5_lib_libheimbase} \
1822 ${_kerberos5_lib_libheimntlm} \
1824 ${_kerberos5_lib_libheimipcc} \
1825 ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \
1826 ${_kerberos5_lib_libroken} \
1827 ${_kerberos5_lib_libwind} \
1828 lib/libbz2 ${_libcom_err} lib/libcrypt \
1829 lib/libelf lib/libexpat \
1832 lib/libkiconv lib/libkvm lib/liblzma lib/libmd lib/libnv \
1833 ${_lib_libcapsicum} \
1834 lib/ncurses/ncurses lib/ncurses/ncursesw \
1835 lib/libopie lib/libpam ${_lib_libthr} \
1836 ${_lib_libradius} lib/libsbuf lib/libtacplus \
1838 ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \
1839 ${_cddl_lib_libuutil} \
1840 ${_cddl_lib_libavl} \
1841 ${_cddl_lib_libzfs_core} \
1842 ${_cddl_lib_libctf} \
1843 lib/libutil lib/libpjdlog ${_lib_libypclnt} lib/libz lib/msun \
1844 ${_secure_lib_libcrypto} ${_lib_libldns} \
1845 ${_secure_lib_libssh} ${_secure_lib_libssl} \
1847 .if ${MK_GNUCXX} != "no"
1848 _prebuild_libs+= gnu/lib/libstdc++ gnu/lib/libsupc++
1849 gnu/lib/libstdc++__L: lib/msun__L
1850 gnu/lib/libsupc++__L: gnu/lib/libstdc++__L
1853 .if ${MK_LIBCPLUSPLUS} != "no"
1854 _prebuild_libs+= lib/libc++
1857 lib/libgeom__L: lib/libexpat__L
1858 lib/libkvm__L: lib/libelf__L
1860 .if ${MK_LIBTHR} != "no"
1861 _lib_libthr= lib/libthr
1864 .if ${MK_RADIUS_SUPPORT} != "no"
1865 _lib_libradius= lib/libradius
1868 .if ${MK_OFED} != "no"
1869 _ofed_lib= contrib/ofed/usr.lib/
1872 .if ${MK_CASPER} != "no"
1873 _lib_libcapsicum=lib/libcapsicum
1876 lib/libcapsicum__L: lib/libnv__L
1877 lib/libpjdlog__L: lib/libutil__L
1878 lib/liblzma__L: lib/libthr__L
1880 _generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib}
1881 .for _DIR in ${LOCAL_LIB_DIRS}
1882 .if exists(${.CURDIR}/${_DIR}/Makefile)
1883 _generic_libs+= ${_DIR}
1887 lib/libopie__L lib/libtacplus__L: lib/libmd__L
1889 .if ${MK_CDDL} != "no"
1890 _cddl_lib_libumem= cddl/lib/libumem
1891 _cddl_lib_libnvpair= cddl/lib/libnvpair
1892 _cddl_lib_libavl= cddl/lib/libavl
1893 _cddl_lib_libuutil= cddl/lib/libuutil
1894 _cddl_lib_libzfs_core= cddl/lib/libzfs_core
1895 _cddl_lib_libctf= cddl/lib/libctf
1897 cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L
1898 cddl/lib/libzfs__L: lib/libgeom__L
1899 cddl/lib/libctf__L: lib/libz__L
1901 # cddl/lib/libdtrace requires lib/libproc and lib/librtld_db; it's only built
1902 # on select architectures though (see cddl/lib/Makefile)
1903 .if ${MACHINE_CPUARCH} != "sparc64"
1904 _prebuild_libs+= lib/libproc lib/librtld_db
1907 .if ${MK_CRYPT} != "no"
1908 .if ${MK_OPENSSL} != "no"
1909 _secure_lib_libcrypto= secure/lib/libcrypto
1910 _secure_lib_libssl= secure/lib/libssl
1911 lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L
1912 .if ${MK_LDNS} != "no"
1913 _lib_libldns= lib/libldns
1914 lib/libldns__L: secure/lib/libcrypto__L
1916 .if ${MK_OPENSSH} != "no"
1917 _secure_lib_libssh= secure/lib/libssh
1918 secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
1919 .if ${MK_LDNS} != "no"
1920 secure/lib/libssh__L: lib/libldns__L
1922 .if ${MK_KERBEROS_SUPPORT} != "no"
1923 secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \
1924 kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \
1925 lib/libmd__L kerberos5/lib/libroken__L
1929 _secure_lib= secure/lib
1932 .if ${MK_KERBEROS} != "no"
1933 kerberos5/lib/libasn1__L: lib/libcom_err__L kerberos5/lib/libroken__L
1934 kerberos5/lib/libhdb__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1935 kerberos5/lib/libkrb5__L kerberos5/lib/libroken__L \
1936 kerberos5/lib/libwind__L lib/libsqlite3__L
1937 kerberos5/lib/libheimntlm__L: secure/lib/libcrypto__L kerberos5/lib/libkrb5__L \
1938 kerberos5/lib/libroken__L lib/libcom_err__L
1939 kerberos5/lib/libhx509__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1940 secure/lib/libcrypto__L kerberos5/lib/libroken__L kerberos5/lib/libwind__L
1941 kerberos5/lib/libkrb5__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1942 lib/libcrypt__L secure/lib/libcrypto__L kerberos5/lib/libhx509__L \
1943 kerberos5/lib/libroken__L kerberos5/lib/libwind__L \
1944 kerberos5/lib/libheimbase__L kerberos5/lib/libheimipcc__L
1945 kerberos5/lib/libroken__L: lib/libcrypt__L
1946 kerberos5/lib/libwind__L: kerberos5/lib/libroken__L lib/libcom_err__L
1947 kerberos5/lib/libheimbase__L: lib/libthr__L
1948 kerberos5/lib/libheimipcc__L: kerberos5/lib/libroken__L kerberos5/lib/libheimbase__L lib/libthr__L
1951 lib/libsqlite3__L: lib/libthr__L
1953 .if ${MK_GSSAPI} != "no"
1954 _lib_libgssapi= lib/libgssapi
1957 .if ${MK_KERBEROS} != "no"
1958 _kerberos5_lib= kerberos5/lib
1959 _kerberos5_lib_libasn1= kerberos5/lib/libasn1
1960 _kerberos5_lib_libhdb= kerberos5/lib/libhdb
1961 _kerberos5_lib_libheimbase= kerberos5/lib/libheimbase
1962 _kerberos5_lib_libkrb5= kerberos5/lib/libkrb5
1963 _kerberos5_lib_libhx509= kerberos5/lib/libhx509
1964 _kerberos5_lib_libroken= kerberos5/lib/libroken
1965 _kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm
1966 _libsqlite3= lib/libsqlite3
1967 _kerberos5_lib_libheimipcc= kerberos5/lib/libheimipcc
1968 _kerberos5_lib_libwind= kerberos5/lib/libwind
1969 _libcom_err= lib/libcom_err
1972 .if ${MK_NIS} != "no"
1973 _lib_libypclnt= lib/libypclnt
1976 .if ${MK_OPENSSL} == "no"
1977 lib/libradius__L: lib/libmd__L
1981 ${_cddl_lib_libctf:D${_cddl_lib_libctf}__L} lib/libelf__L lib/librtld_db__L lib/libutil__L
1982 .if ${MK_CXX} != "no"
1983 .if ${MK_LIBCPLUSPLUS} != "no"
1984 lib/libproc__L: lib/libcxxrt__L
1985 .else # This implies MK_GNUCXX != "no"; see lib/libproc
1986 lib/libproc__L: gnu/lib/libsupc++__L
1990 gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncursesw__L
1992 .for _lib in ${_prereq_libs}
1993 ${_lib}__PL: .PHONY .MAKE
1994 .if exists(${.CURDIR}/${_lib})
1995 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1996 cd ${.CURDIR}/${_lib}; \
1997 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj; \
1998 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ depend; \
1999 ${MAKE} MK_TESTS=no MK_PROFILE=no -DNO_PIC \
2000 DIRPRFX=${_lib}/ all; \
2001 ${MAKE} MK_TESTS=no MK_PROFILE=no -DNO_PIC \
2002 DIRPRFX=${_lib}/ install
2006 .for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
2007 ${_lib}__L: .PHONY .MAKE
2008 .if exists(${.CURDIR}/${_lib})
2009 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
2010 cd ${.CURDIR}/${_lib}; \
2011 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj; \
2012 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ depend; \
2013 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ all; \
2014 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ install
2018 # libpam is special: we need to build static PAM modules before
2019 # static PAM library, and dynamic PAM library before dynamic PAM
2021 lib/libpam__L: .PHONY .MAKE
2022 ${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \
2023 cd ${.CURDIR}/lib/libpam; \
2024 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ obj; \
2025 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ depend; \
2026 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ \
2027 -D_NO_LIBPAM_SO_YET all; \
2028 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ \
2029 -D_NO_LIBPAM_SO_YET install
2031 _prereq_libs: ${_prereq_libs:S/$/__PL/}
2032 _startup_libs: ${_startup_libs:S/$/__L/}
2033 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
2034 _generic_libs: ${_generic_libs:S/$/__L/}
2036 # Enable SUBDIR_PARALLEL when not calling 'make all', unless called from
2037 # 'everything' with _PARALLEL_SUBDIR_OK set. This is because it is unlikely
2038 # that running 'make all' from the top-level, especially with a SUBDIR_OVERRIDE
2039 # or LOCAL_DIRS set, will have a reliable build if SUBDIRs are built in
2040 # parallel. This is safe for the world stage of buildworld though since it has
2041 # already built libraries in a proper order and installed includes into
2042 # WORLDTMP. Special handling is done for SUBDIR ordering for 'install*' to
2043 # avoid trashing a system if it crashes mid-install.
2044 .if !make(all) || defined(_PARALLEL_SUBDIR_OK)
2048 .include <bsd.subdir.mk>
2050 .if make(check-old) || make(check-old-dirs) || \
2051 make(check-old-files) || make(check-old-libs) || \
2052 make(delete-old) || make(delete-old-dirs) || \
2053 make(delete-old-files) || make(delete-old-libs)
2056 # check for / delete old files section
2059 .include "ObsoleteFiles.inc"
2061 OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \
2062 else you can not start such an application. Consult UPDATING for more \
2063 information regarding how to cope with the removal/revision bump of a \
2066 .if !defined(BATCH_DELETE_OLD_FILES)
2073 @echo ">>> Removing old files (only deletes safe to delete libs)"
2074 # Ask for every old file if the user really wants to remove it.
2075 # It's annoying, but better safe than sorry.
2076 # NB: We cannot pass the list of OLD_FILES as a parameter because the
2077 # argument list will get too long. Using .for/.endfor make "loops" will make
2078 # the Makefile parser segfault.
2081 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
2082 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
2083 while read file; do \
2084 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
2085 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
2086 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
2088 for ext in debug symbols; do \
2089 if ! [ -e "${DESTDIR}/$${file}" ] && [ -f \
2090 "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \
2091 rm ${RM_I} "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" \
2096 # Remove catpages without corresponding manpages.
2098 find ${DESTDIR}/usr/share/man/cat* ! -type d | \
2099 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
2100 while read catpage; do \
2102 if [ ! -e "$${manpage}" ]; then \
2103 rm ${RM_I} $${catpage} <&3; \
2106 @echo ">>> Old files removed"
2109 @echo ">>> Checking for old files"
2111 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
2112 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
2113 while read file; do \
2114 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
2115 echo "${DESTDIR}/$${file}"; \
2117 for ext in debug symbols; do \
2118 if [ -f "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \
2119 echo "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}"; \
2123 # Check for catpages without corresponding manpages.
2124 @find ${DESTDIR}/usr/share/man/cat* ! -type d | \
2125 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
2126 while read catpage; do \
2128 if [ ! -e "$${manpage}" ]; then \
2134 @echo ">>> Removing old libraries"
2135 @echo "${OLD_LIBS_MESSAGE}" | fmt
2138 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
2139 -V OLD_LIBS | xargs -n1 | \
2140 while read file; do \
2141 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
2142 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
2143 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
2145 for ext in debug symbols; do \
2146 if ! [ -e "${DESTDIR}/$${file}" ] && [ -f \
2147 "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \
2148 rm ${RM_I} "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" \
2153 @echo ">>> Old libraries removed"
2156 @echo ">>> Checking for old libraries"
2158 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
2159 -V OLD_LIBS | xargs -n1 | \
2160 while read file; do \
2161 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
2162 echo "${DESTDIR}/$${file}"; \
2164 for ext in debug symbols; do \
2165 if [ -f "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \
2166 echo "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}"; \
2172 @echo ">>> Removing old directories"
2174 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
2175 -V OLD_DIRS | xargs -n1 | sort -r | \
2176 while read dir; do \
2177 if [ -d "${DESTDIR}/$${dir}" ]; then \
2178 rmdir -v "${DESTDIR}/$${dir}" || true; \
2179 elif [ -L "${DESTDIR}/$${dir}" ]; then \
2180 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
2183 @echo ">>> Old directories removed"
2186 @echo ">>> Checking for old directories"
2188 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
2189 -V OLD_DIRS | xargs -n1 | \
2190 while read dir; do \
2191 if [ -d "${DESTDIR}/$${dir}" ]; then \
2192 echo "${DESTDIR}/$${dir}"; \
2193 elif [ -L "${DESTDIR}/$${dir}" ]; then \
2194 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
2198 delete-old: delete-old-files delete-old-dirs
2199 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
2201 check-old: check-old-files check-old-libs check-old-dirs
2202 @echo "To remove old files and directories run '${MAKE} delete-old'."
2203 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
2208 # showconfig - show build configuration.
2211 @(${MAKE} -n -f ${.CURDIR}/sys/conf/kern.opts.mk -V dummy -dg1; \
2212 ${MAKE} -n -f ${.CURDIR}/share/mk/src.opts.mk -V dummy -dg1) 2>&1 | grep ^MK_ | sort -u
2214 .if !empty(KRNLOBJDIR) && !empty(KERNCONF)
2215 DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/
2217 .if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE)
2218 .if exists(${KERNCONFDIR}/${KERNCONF})
2219 FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \
2220 '${KERNCONFDIR}/${KERNCONF}' ; echo
2226 .if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH})
2227 DTBOUTPUTPATH= ${.CURDIR}
2231 # Build 'standalone' Device Tree Blob
2234 @PATH=${TMPPATH} MACHINE=${TARGET} \
2235 ${.CURDIR}/sys/tools/fdt/make_dtb.sh ${.CURDIR}/sys \
2236 "${FDT_DTS_FILE}" ${DTBOUTPUTPATH}
2241 # In the following, the first 'rm' in a series will usually remove all
2242 # files and directories. If it does not, then there are probably some
2243 # files with file flags set, so this unsets them and tries the 'rm' a
2244 # second time. There are situations where this target will be cleaning
2245 # some directories via more than one method, but that duplication is
2246 # needed to correctly handle all the possible situations. Removing all
2247 # files without file flags set in the first 'rm' instance saves time,
2248 # because 'chflags' will need to operate on fewer files afterwards.
2250 # It is expected that BW_CANONICALOBJDIR == the CANONICALOBJDIR as would be
2251 # created by bsd.obj.mk, except that we don't want to .include that file
2254 BW_CANONICALOBJDIR:=${OBJTREE}${.CURDIR}
2256 .if exists(${BW_CANONICALOBJDIR}/)
2257 -rm -rf ${BW_CANONICALOBJDIR}/*
2258 -chflags -R 0 ${BW_CANONICALOBJDIR}
2259 rm -rf ${BW_CANONICALOBJDIR}/*
2261 .if ${.CURDIR} == ${.OBJDIR} || ${.CURDIR}/obj == ${.OBJDIR}
2262 # To be safe in this case, fall back to a 'make cleandir'
2263 ${_+_}@cd ${.CURDIR}; ${MAKE} cleandir
2266 .if defined(TARGET) && defined(TARGET_ARCH)
2268 .if ${TARGET} == ${MACHINE} && ${TARGET_ARCH} == ${MACHINE_ARCH}
2269 XDEV_CPUTYPE?=${CPUTYPE}
2271 XDEV_CPUTYPE?=${TARGET_CPUTYPE}
2274 NOFUN=-DNO_FSCHG MK_HTML=no -DNO_LINT \
2275 MK_MAN=no MK_NLS=no MK_PROFILE=no \
2276 MK_KERBEROS=no MK_RESCUE=no MK_TESTS=no MK_WARNS=no \
2277 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
2278 CPUTYPE=${XDEV_CPUTYPE}
2280 XDDIR=${TARGET_ARCH}-freebsd
2283 .error XDTP variable should be an absolute path
2286 CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \
2287 INSTALL="sh ${.CURDIR}/tools/install.sh"
2289 TOOLS_PREFIX=${XDTP}
2290 CD2CFLAGS=-isystem ${XDDESTDIR}/usr/include -L${XDDESTDIR}/usr/lib \
2291 --sysroot=${XDDESTDIR}/ -B${XDDESTDIR}/usr/libexec \
2292 -B${XDDESTDIR}/usr/bin -B${XDDESTDIR}/usr/lib
2293 CD2ENV=${CDENV} CC="${CC} ${CD2CFLAGS}" CXX="${CXX} ${CD2CFLAGS}" \
2294 CPP="${CPP} ${CD2CFLAGS}" \
2295 MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH}
2297 CDTMP= ${MAKEOBJDIRPREFIX}/${XDDIR}/${.CURDIR}/tmp
2298 CDMAKE=${CDENV} PATH=${CDTMP}/usr/bin:${PATH} ${MAKE} ${NOFUN}
2299 CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDDESTDIR}/usr/bin:${PATH} ${MAKE} ${NOFUN}
2300 XDDESTDIR=${DESTDIR}/${XDTP}
2302 OSREL!= uname -r | sed -e 's/[-(].*//'
2305 .ORDER: xdev-build xdev-install xdev-links
2306 xdev: xdev-build xdev-install
2308 .ORDER: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools
2309 xdev-build: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools
2311 _xb-worldtmp: .PHONY
2312 mkdir -p ${CDTMP}/usr
2313 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
2314 -p ${CDTMP}/usr >/dev/null
2316 _xb-bootstrap-tools: .PHONY
2320 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
2321 cd ${.CURDIR}/${_tool}; \
2322 ${CDMAKE} DIRPRFX=${_tool}/ obj; \
2323 ${CDMAKE} DIRPRFX=${_tool}/ depend; \
2324 ${CDMAKE} DIRPRFX=${_tool}/ all; \
2325 ${CDMAKE} DIRPRFX=${_tool}/ DESTDIR=${CDTMP} install
2328 _xb-build-tools: .PHONY
2329 ${_+_}@cd ${.CURDIR}; \
2330 ${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools
2332 _xb-cross-tools: .PHONY
2340 ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \
2341 cd ${.CURDIR}/${_tool}; \
2342 ${CDMAKE} DIRPRFX=${_tool}/ obj; \
2343 ${CDMAKE} DIRPRFX=${_tool}/ depend; \
2344 ${CDMAKE} DIRPRFX=${_tool}/ all
2348 ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}"
2349 mkdir -p ${XDDESTDIR}
2350 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
2351 -p ${XDDESTDIR} >/dev/null
2352 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
2353 -p ${XDDESTDIR}/usr >/dev/null
2354 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
2355 -p ${XDDESTDIR}/usr/include >/dev/null
2356 .if ${MK_LIB32} != "no"
2357 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib32.dist \
2358 -p ${XDDESTDIR}/usr >/dev/null
2360 .if ${MK_TESTS} != "no"
2361 mkdir -p ${XDDESTDIR}${TESTSBASE}
2362 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
2363 -p ${XDDESTDIR}${TESTSBASE} >/dev/null
2366 .ORDER: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries
2367 xdev-install: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries
2369 _xi-cross-tools: .PHONY
2370 @echo "_xi-cross-tools"
2378 ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \
2379 cd ${.CURDIR}/${_tool}; \
2380 ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR}
2383 _xi-includes: .PHONY
2384 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 includes \
2385 DESTDIR=${XDDESTDIR}
2387 _xi-libraries: .PHONY
2388 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \
2389 DESTDIR=${XDDESTDIR}
2392 ${_+_}cd ${XDDESTDIR}/usr/bin; \
2393 mkdir -p ../../../../usr/bin; \
2395 ln -sf ../../${XDTP}/usr/bin/$$i \
2396 ../../../../usr/bin/${XDDIR}-$$i; \
2397 ln -sf ../../${XDTP}/usr/bin/$$i \
2398 ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \
2401 xdev xdev-build xdev-install xdev-links:
2402 @echo "*** Error: Both TARGET and TARGET_ARCH must be defined for \"${.TARGET}\" target"