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:/bin/sh)
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 .include "share/mk/src.opts.mk"
52 .include <bsd.arch.inc.mk>
53 .include <bsd.compiler.mk>
55 # We must do lib/ and libexec/ before bin/ in case of a mid-install error to
56 # keep the users system reasonably usable. For static->dynamic root upgrades,
57 # we don't want to install a dynamic binary without rtld and the needed
58 # libraries. More commonly, for dynamic root, we don't want to install a
59 # binary that requires a newer library version that hasn't been installed yet.
60 # This ordering is not a guarantee though. The only guarantee of a working
61 # system here would require fine-grained ordering of all components based
62 # on their dependencies.
64 .if !empty(SUBDIR_OVERRIDE)
65 SUBDIR= ${SUBDIR_OVERRIDE}
69 # Ensure libraries are installed before progressing.
73 .if ${MK_CDDL} != "no"
77 .if ${MK_KERBEROS} != "no"
80 .if ${MK_RESCUE} != "no"
84 .if ${MK_CRYPT} != "no"
87 .if !defined(NO_SHARE)
90 SUBDIR+=sys usr.bin usr.sbin
91 .if ${MK_TESTS} != "no"
94 .if ${MK_OFED} != "no"
98 # Local directories are last, since it is nice to at least get the base
99 # system rebuilt before you do them.
100 .for _DIR in ${LOCAL_DIRS}
101 .if exists(${.CURDIR}/${_DIR}/Makefile)
105 # Add LOCAL_LIB_DIRS, but only if they will not be picked up as a SUBDIR
106 # of a LOCAL_DIRS directory. This allows LOCAL_DIRS=foo and
107 # LOCAL_LIB_DIRS=foo/lib to behave as expected.
108 .for _DIR in ${LOCAL_DIRS:M*/} ${LOCAL_DIRS:N*/:S|$|/|}
109 _REDUNDENT_LIB_DIRS+= ${LOCAL_LIB_DIRS:M${_DIR}*}
111 .for _DIR in ${LOCAL_LIB_DIRS}
112 .if empty(_REDUNDENT_LIB_DIRS:M${_DIR}) && exists(${.CURDIR}/${_DIR}/Makefile)
115 .warning ${_DIR} not added to SUBDIR list. See UPDATING 20141121.
119 # We must do etc/ last as it hooks into building the man whatis file
120 # by calling 'makedb' in share/man. This is only relevant for
121 # install/distribute so they build the whatis file after every manpage is
128 .endif # !empty(SUBDIR_OVERRIDE)
131 .warning NOCLEAN option is deprecated. Use NO_CLEAN instead.
134 .if defined(NO_CLEANDIR)
135 CLEANDIR= clean cleandepend
142 BUILDENV_SHELL?=/bin/sh
144 SVN?= /usr/local/bin/svn
147 MAKEOBJDIRPREFIX?= /usr/obj
148 .if !defined(OSRELDATE)
149 .if exists(/usr/include/osreldate.h)
150 OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
151 /usr/include/osreldate.h
158 # Set VERSION for CTFMERGE to use via the default CTFFLAGS=-L VERSION.
159 .if !defined(VERSION)
160 REVISION!= ${MAKE} -C ${SRCDIR}/release -V REVISION
161 BRANCH!= ${MAKE} -C ${SRCDIR}/release -V BRANCH
162 SRCRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
163 ${SRCDIR}/sys/sys/param.h
164 VERSION= FreeBSD ${REVISION}-${BRANCH:C/-p[0-9]+$//} ${TARGET_ARCH} ${SRCRELDATE}
168 KNOWN_ARCHES?= aarch64/arm64 amd64 arm armeb/arm armv6/arm armv6hf/arm i386 i386/pc98 mips mipsel/mips mips64el/mips mips64/mips mipsn32el/mips mipsn32/mips powerpc powerpc64/powerpc sparc64
169 .if ${TARGET} == ${TARGET_ARCH}
172 _t= ${TARGET_ARCH}/${TARGET}
175 .if empty(KNOWN_ARCHES:M${_t})
176 .error Unknown target ${TARGET_ARCH}:${TARGET}.
180 .if ${TARGET} == ${MACHINE}
181 TARGET_CPUTYPE?=${CPUTYPE}
186 .if !empty(TARGET_CPUTYPE)
187 _TARGET_CPUTYPE=${TARGET_CPUTYPE}
189 _TARGET_CPUTYPE=dummy
191 _CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} \
192 -f /dev/null -m ${.CURDIR}/share/mk -V CPUTYPE
193 .if ${_CPUTYPE} != ${_TARGET_CPUTYPE}
194 .error CPUTYPE global should be set with ?=.
197 BUILD_ARCH!= uname -p
198 .if ${MACHINE_ARCH} != ${BUILD_ARCH}
199 .error To cross-build, set TARGET_ARCH.
202 .if ${MACHINE} == ${TARGET} && ${MACHINE_ARCH} == ${TARGET_ARCH} && !defined(CROSS_BUILD_TESTING)
203 OBJTREE= ${MAKEOBJDIRPREFIX}
205 OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH}
207 WORLDTMP= ${OBJTREE}${.CURDIR}/tmp
208 BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/bin
209 XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin
210 STRICTTMPPATH= ${BPATH}:${XPATH}
211 TMPPATH= ${STRICTTMPPATH}:${PATH}
214 # Avoid running mktemp(1) unless actually needed.
215 # It may not be functional, e.g., due to new ABI
216 # when in the middle of installing over this system.
218 .if make(distributeworld) || make(installworld)
219 INSTALLTMP!= /usr/bin/mktemp -d -u -t install
223 # Building a world goes through the following stages
225 # 1. legacy stage [BMAKE]
226 # This stage is responsible for creating compatibility
227 # shims that are needed by the bootstrap-tools,
228 # build-tools and cross-tools stages. These are generally
229 # APIs that tools from one of those three stages need to
230 # build that aren't present on the host.
231 # 1. bootstrap-tools stage [BMAKE]
232 # This stage is responsible for creating programs that
233 # are needed for backward compatibility reasons. They
234 # are not built as cross-tools.
235 # 2. build-tools stage [TMAKE]
236 # This stage is responsible for creating the object
237 # tree and building any tools that are needed during
238 # the build process. Some programs are listed during
239 # this phase because they build binaries to generate
240 # files needed to build these programs. This stage also
241 # builds the 'build-tools' target rather than 'all'.
242 # 3. cross-tools stage [XMAKE]
243 # This stage is responsible for creating any tools that
244 # are needed for building the system. A cross-compiler is one
245 # of them. This differs from build tools in two ways:
246 # 1. the 'all' target is built rather than 'build-tools'
247 # 2. these tools are installed into TMPPATH for stage 4.
248 # 4. world stage [WMAKE]
249 # This stage actually builds the world.
250 # 5. install stage (optional) [IMAKE]
251 # This stage installs a previously built world.
256 # Common environment for world related stages
257 CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \
258 MACHINE_ARCH=${TARGET_ARCH} \
260 CPUTYPE=${TARGET_CPUTYPE}
261 .if ${MK_GROFF} != "no"
262 CROSSENV+= GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
263 GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \
264 GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac
266 .if defined(TARGET_CFLAGS)
267 CROSSENV+= ${TARGET_CFLAGS}
270 # bootstrap-tools stage
271 BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
272 PATH=${BPATH}:${PATH} \
273 WORLDTMP=${WORLDTMP} \
274 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}"
275 # need to keep this in sync with targets/pseudo/bootstrap-tools/Makefile
277 BOOTSTRAPPING=${OSRELDATE} \
279 MK_HTML=no NO_LINT=yes MK_MAN=no \
280 -DNO_PIC MK_PROFILE=no -DNO_SHARED \
281 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
282 MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \
283 MK_LLDB=no MK_TESTS=no \
286 BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
287 ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
291 TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
292 ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
293 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
295 BOOTSTRAPPING=${OSRELDATE} \
298 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
299 MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \
300 MK_LLDB=no MK_TESTS=no
303 XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \
304 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
305 MK_GDB=no MK_TESTS=no
308 KTMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
309 PATH=${BPATH}:${PATH} \
311 KTMAKE= TOOLS_PREFIX=${WORLDTMP} MAKEOBJDIRPREFIX=${WORLDTMP} \
312 ${KTMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
314 BOOTSTRAPPING=${OSRELDATE} \
316 MK_HTML=no -DNO_LINT MK_MAN=no \
317 -DNO_PIC MK_PROFILE=no -DNO_SHARED \
318 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no
321 WMAKEENV= ${CROSSENV} \
323 INSTALL="sh ${.CURDIR}/tools/install.sh" \
327 HMAKE= PATH=${TMPPATH} ${MAKE} LOCAL_MTREE=${LOCAL_MTREE:Q}
329 HMAKE+= PATH=${TMPPATH} METALOG=${METALOG} -DNO_ROOT
332 .if defined(CROSS_TOOLCHAIN)
333 LOCALBASE?= /usr/local
334 .include "${LOCALBASE}/share/toolchains/${CROSS_TOOLCHAIN}.mk"
336 .if defined(CROSS_TOOLCHAIN_PREFIX)
337 CROSS_COMPILER_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
338 CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
341 # If we do not have a bootstrap binutils (because the in-tree one does not
342 # support the target architecture), provide a default cross-binutils prefix.
343 # This allows aarch64 builds, for example, to automatically use the
344 # aarch64-binutils port or package.
345 .if !make(showconfig)
346 .if !empty(BROKEN_OPTIONS:MBINUTILS_BOOTSTRAP) && \
347 !defined(CROSS_BINUTILS_PREFIX)
348 CROSS_BINUTILS_PREFIX=/usr/local/${TARGET_ARCH}-freebsd/bin/
349 .if !exists(${CROSS_BINUTILS_PREFIX})
350 .error In-tree binutils does not support the ${TARGET_ARCH} architecture. Install the ${TARGET_ARCH}-binutils port or package or set CROSS_BINUTILS_PREFIX.
355 XCOMPILERS= CC CXX CPP
356 .for COMPILER in ${XCOMPILERS}
357 .if defined(CROSS_COMPILER_PREFIX)
358 X${COMPILER}?= ${CROSS_COMPILER_PREFIX}${${COMPILER}}
360 X${COMPILER}?= ${${COMPILER}}
363 XBINUTILS= AS AR LD NM OBJCOPY OBJDUMP RANLIB SIZE STRINGS
364 .for BINUTIL in ${XBINUTILS}
365 .if defined(CROSS_BINUTILS_PREFIX) && \
366 exists(${CROSS_BINUTILS_PREFIX}${${BINUTIL}})
367 X${BINUTIL}?= ${CROSS_BINUTILS_PREFIX}${${BINUTIL}}
369 X${BINUTIL}?= ${${BINUTIL}}
372 WMAKEENV+= CC="${XCC} ${XCFLAGS}" CXX="${XCXX} ${XCFLAGS} ${XCXXFLAGS}" \
373 DEPFLAGS="${DEPFLAGS}" \
374 CPP="${XCPP} ${XCFLAGS}" \
375 AS="${XAS}" AR="${XAR}" LD="${XLD}" NM=${XNM} \
376 OBJDUMP=${XOBJDUMP} OBJCOPY="${XOBJCOPY}" \
377 RANLIB=${XRANLIB} STRINGS=${XSTRINGS} \
381 .if defined(CROSS_BINUTILS_PREFIX)
382 # In the case of xdev-build tools, CROSS_BINUTILS_PREFIX won't be a
383 # directory, but the compiler will look in the right place for it's
384 # tools so we don't need to tell it where to look.
385 .if exists(${CROSS_BINUTILS_PREFIX})
386 BFLAGS+= -B${CROSS_BINUTILS_PREFIX}
389 BFLAGS+= -B${WORLDTMP}/usr/bin
391 .if ${TARGET} == "arm"
392 .if ${TARGET_ARCH:M*hf*} != ""
393 TARGET_ABI= gnueabihf
398 .if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc
399 XCFLAGS+= -isystem ${WORLDTMP}/usr/include -L${WORLDTMP}/usr/lib
400 XCXXFLAGS+= -I${WORLDTMP}/usr/include/c++/v1 -std=gnu++11 -L${WORLDTMP}/../lib/libc++
401 DEPFLAGS+= -I${WORLDTMP}/usr/include/c++/v1
404 TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0
405 XCFLAGS+= -target ${TARGET_TRIPLE}
407 XCFLAGS+= --sysroot=${WORLDTMP} ${BFLAGS}
408 XCXXFLAGS+= --sysroot=${WORLDTMP} ${BFLAGS}
410 .if defined(CROSS_BINUTILS_PREFIX) && exists(${CROSS_BINUTILS_PREFIX})
411 BFLAGS+= -B${CROSS_BINUTILS_PREFIX}
413 XCXXFLAGS+= ${BFLAGS}
417 WMAKE= ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 DESTDIR=${WORLDTMP}
419 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
421 LIB32_OBJTREE= ${OBJTREE}${.CURDIR}/world32
422 LIB32TMP= ${OBJTREE}${.CURDIR}/lib32
424 .if ${TARGET_ARCH} == "amd64"
425 .if empty(TARGET_CPUTYPE)
426 LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2
428 LIB32CPUFLAGS= -march=${TARGET_CPUTYPE}
430 LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \
431 MACHINE_CPU="i686 mmx sse sse2"
434 LD="${XLD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" \
435 OBJCOPY="${XOBJCOPY}"
437 .elif ${TARGET_ARCH} == "powerpc64"
438 .if empty(TARGET_CPUTYPE)
439 LIB32CPUFLAGS= -mcpu=powerpc
441 LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE}
443 LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc
445 LD="${XLD} -m elf32ppc_fbsd" \
446 OBJCOPY="${XOBJCOPY}"
450 LIB32FLAGS= -m32 ${LIB32CPUFLAGS} -DCOMPAT_32BIT \
451 -isystem ${LIB32TMP}/usr/include/ \
452 -L${LIB32TMP}/usr/lib32 \
453 -B${LIB32TMP}/usr/lib32
455 LIB32FLAGS+= --sysroot=${WORLDTMP}
458 # Yes, the flags are redundant.
459 LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${LIB32_OBJTREE} \
460 _LDSCRIPTROOT=${LIB32TMP} \
461 INSTALL="sh ${.CURDIR}/tools/install.sh" \
464 SHLIBDIR=/usr/lib32 \
465 DTRACE="${DTRACE} -32"
466 LIB32WMAKEFLAGS+= CC="${XCC} ${LIB32FLAGS}" \
467 CXX="${XCXX} ${LIB32FLAGS}" \
468 DESTDIR=${LIB32TMP} \
476 LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} ${LIB32WMAKEFLAGS} \
478 LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} \
479 MK_TOOLCHAIN=no ${IMAKE_INSTALL}
482 IMAKEENV= ${CROSSENV:N_LDSCRIPTROOT=*}
483 IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 \
484 ${IMAKE_INSTALL} ${IMAKE_MTREE}
485 .if empty(.MAKEFLAGS:M-n)
486 IMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMP} \
487 LD_LIBRARY_PATH=${INSTALLTMP} \
488 PATH_LOCALE=${INSTALLTMP}/locale
489 IMAKE+= __MAKE_SHELL=${INSTALLTMP}/sh
491 IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP}
493 .if defined(DB_FROM_SRC)
494 INSTALLFLAGS+= -N ${.CURDIR}/etc
495 MTREEFLAGS+= -N ${.CURDIR}/etc
497 _INSTALL_DDIR= ${DESTDIR}/${DISTDIR}
498 INSTALL_DDIR= ${_INSTALL_DDIR:S://:/:g:C:/$::}
500 METALOG?= ${DESTDIR}/${DISTDIR}/METALOG
501 IMAKE+= -DNO_ROOT METALOG=${METALOG}
502 INSTALLFLAGS+= -U -M ${METALOG} -D ${INSTALL_DDIR}
505 .if defined(DB_FROM_SRC) || defined(NO_ROOT)
506 IMAKE_INSTALL= INSTALL="install ${INSTALLFLAGS}"
507 IMAKE_MTREE= MTREE_CMD="mtree ${MTREEFLAGS}"
511 KMAKEENV= ${WMAKEENV}
512 KMAKE= ${KMAKEENV} ${MAKE} ${.MAKEFLAGS} ${KERNEL_FLAGS} KERNEL=${INSTKERNNAME}
517 # Attempt to rebuild the entire system, with reasonable chance of
518 # success, regardless of how old your existing system is.
521 .if ${.CURDIR:C/[^,]//g} != ""
522 # The m4 build of sendmail files doesn't like it if ',' is used
523 # anywhere in the path of it's files.
525 @echo "*** Error: path to source tree contains a comma ','"
530 @echo "--------------------------------------------------------------"
531 @echo ">>> Rebuilding the temporary build tree"
532 @echo "--------------------------------------------------------------"
533 .if !defined(NO_CLEAN)
535 .if defined(LIB32TMP)
539 rm -rf ${WORLDTMP}/legacy/usr/include
540 # XXX - These three can depend on any header file.
541 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
542 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c
543 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
546 lib usr legacy/bin legacy/usr
547 mkdir -p ${WORLDTMP}/${_dir}
549 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
550 -p ${WORLDTMP}/legacy/usr >/dev/null
551 .if ${MK_GROFF} != "no"
552 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.groff.dist \
553 -p ${WORLDTMP}/legacy/usr >/dev/null
555 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
556 -p ${WORLDTMP}/usr >/dev/null
557 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
558 -p ${WORLDTMP}/usr/include >/dev/null
559 ln -sf ${.CURDIR}/sys ${WORLDTMP}
560 .if ${MK_DEBUG_FILES} != "no"
561 # We could instead disable debug files for these build stages
562 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
563 -p ${WORLDTMP}/legacy/usr/lib >/dev/null
564 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
565 -p ${WORLDTMP}/usr/lib >/dev/null
567 .if ${MK_LIB32} != "no"
568 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib32.dist \
569 -p ${WORLDTMP}/usr >/dev/null
570 .if ${MK_DEBUG_FILES} != "no"
571 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib32.dist \
572 -p ${WORLDTMP}/legacy/usr/lib/debug/usr >/dev/null
573 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib32.dist \
574 -p ${WORLDTMP}/usr/lib/debug/usr >/dev/null
577 .if ${MK_TESTS} != "no"
578 mkdir -p ${WORLDTMP}${TESTSBASE}
579 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
580 -p ${WORLDTMP}${TESTSBASE} >/dev/null
581 .if ${MK_DEBUG_FILES} != "no"
582 mkdir -p ${WORLDTMP}/usr/lib/debug/${TESTSBASE}
583 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
584 -p ${WORLDTMP}/usr/lib/debug/${TESTSBASE} >/dev/null
587 .for _mtree in ${LOCAL_MTREE}
588 mtree -deU -f ${.CURDIR}/${_mtree} -p ${WORLDTMP} > /dev/null
592 @echo "--------------------------------------------------------------"
593 @echo ">>> stage 1.1: legacy release compatibility shims"
594 @echo "--------------------------------------------------------------"
595 ${_+_}cd ${.CURDIR}; ${BMAKE} legacy
598 @echo "--------------------------------------------------------------"
599 @echo ">>> stage 1.2: bootstrap tools"
600 @echo "--------------------------------------------------------------"
601 ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools
603 .if !defined(NO_CLEAN)
605 @echo "--------------------------------------------------------------"
606 @echo ">>> stage 2.1: cleaning up the object tree"
607 @echo "--------------------------------------------------------------"
608 ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR}
609 .if defined(LIB32TMP)
610 ${_+_}cd ${.CURDIR}; ${LIB32WMAKE} -f Makefile.inc1 ${CLEANDIR}
615 @echo "--------------------------------------------------------------"
616 @echo ">>> stage 2.2: rebuilding the object tree"
617 @echo "--------------------------------------------------------------"
618 ${_+_}cd ${.CURDIR}; ${WMAKE} obj
621 @echo "--------------------------------------------------------------"
622 @echo ">>> stage 2.3: build tools"
623 @echo "--------------------------------------------------------------"
624 ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools
627 @echo "--------------------------------------------------------------"
628 @echo ">>> stage 3: cross tools"
629 @echo "--------------------------------------------------------------"
630 ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools
631 ${_+_}cd ${.CURDIR}; ${XMAKE} kernel-tools
634 @echo "--------------------------------------------------------------"
635 @echo ">>> stage 4.1: building includes"
636 @echo "--------------------------------------------------------------"
637 # Special handling for SUBDIR_OVERRIDE in buildworld as they most likely need
638 # headers from default SUBDIR. Do SUBDIR_OVERRIDE includes last.
639 ${_+_}cd ${.CURDIR}; ${WMAKE} SUBDIR_OVERRIDE= SHARED=symlinks \
641 ${_+_}cd ${.CURDIR}; ${WMAKE} SUBDIR_OVERRIDE= SHARED=symlinks \
643 .if !empty(SUBDIR_OVERRIDE) && make(buildworld)
644 ${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks buildincludes
645 ${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks installincludes
649 @echo "--------------------------------------------------------------"
650 @echo ">>> stage 4.2: building libraries"
651 @echo "--------------------------------------------------------------"
652 ${_+_}cd ${.CURDIR}; \
653 ${WMAKE} -DNO_FSCHG MK_HTML=no -DNO_LINT MK_MAN=no \
654 MK_PROFILE=no MK_TESTS=no MK_TESTS_SUPPORT=${MK_TESTS} libraries
657 @echo "--------------------------------------------------------------"
658 @echo ">>> stage 4.3: make dependencies"
659 @echo "--------------------------------------------------------------"
660 ${_+_}cd ${.CURDIR}; ${WMAKE} depend
663 @echo "--------------------------------------------------------------"
664 @echo ">>> stage 4.4: building everything"
665 @echo "--------------------------------------------------------------"
666 ${_+_}cd ${.CURDIR}; ${WMAKE} par-all
667 .if defined(LIB32TMP)
670 @echo "--------------------------------------------------------------"
671 @echo ">>> stage 5.1: building 32 bit shim libraries"
672 @echo "--------------------------------------------------------------"
673 mkdir -p ${LIB32TMP}/usr/include
674 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
675 -p ${LIB32TMP}/usr >/dev/null
676 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
677 -p ${LIB32TMP}/usr/include >/dev/null
678 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib32.dist \
679 -p ${LIB32TMP}/usr >/dev/null
680 .if ${MK_DEBUG_FILES} != "no"
681 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
682 -p ${LIB32TMP}/usr/lib >/dev/null
683 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib32.dist \
684 -p ${LIB32TMP}/usr/lib/debug/usr >/dev/null
687 ln -sf ${.CURDIR}/sys ${WORLDTMP}
688 .for _t in obj includes
689 ${_+_}cd ${.CURDIR}/include; ${LIB32WMAKE} DIRPRFX=include/ ${_t}
690 ${_+_}cd ${.CURDIR}/lib; ${LIB32WMAKE} DIRPRFX=lib/ ${_t}
691 .if ${MK_CDDL} != "no"
692 ${_+_}cd ${.CURDIR}/cddl/lib; ${LIB32WMAKE} DIRPRFX=cddl/lib/ ${_t}
694 ${_+_}cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} DIRPRFX=gnu/lib/ ${_t}
695 .if ${MK_CRYPT} != "no"
696 ${_+_}cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} DIRPRFX=secure/lib/ ${_t}
698 .if ${MK_KERBEROS} != "no"
699 ${_+_}cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} DIRPRFX=kerberos5/lib ${_t}
702 .for _dir in usr.bin/lex/lib
703 ${_+_}cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} DIRPRFX=${_dir}/ obj
705 .for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic
706 ${_+_}cd ${.CURDIR}/${_dir}; \
707 WORLDTMP=${WORLDTMP} \
708 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
709 MAKEOBJDIRPREFIX=${LIB32_OBJTREE} ${MAKE} SSP_CFLAGS= DESTDIR= \
710 DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
713 ${_+_}cd ${.CURDIR}; \
714 ${LIB32WMAKE} -f Makefile.inc1 libraries
715 .for _t in obj depend all
716 ${_+_}cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32WMAKE} \
717 DIRPRFX=libexec/rtld-elf/ ${_t}
718 ${_+_}cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32WMAKE} \
719 DIRPRFX=usr.bin/ldd ${_t}
722 distribute32 install32: .MAKE .PHONY
723 ${_+_}cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
724 .if ${MK_CDDL} != "no"
725 ${_+_}cd ${.CURDIR}/cddl/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
727 ${_+_}cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
728 .if ${MK_CRYPT} != "no"
729 ${_+_}cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
731 .if ${MK_KERBEROS} != "no"
732 ${_+_}cd ${.CURDIR}/kerberos5/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
734 ${_+_}cd ${.CURDIR}/libexec/rtld-elf; \
735 PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//}
736 ${_+_}cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32IMAKE} \
741 WMAKE_TGTS+= _worldtmp _legacy
742 .if empty(SUBDIR_OVERRIDE)
743 WMAKE_TGTS+= _bootstrap-tools
745 WMAKE_TGTS+= _cleanobj _obj _build-tools _cross-tools
746 WMAKE_TGTS+= _includes _libraries _depend everything
747 .if defined(LIB32TMP) && ${MK_LIB32} != "no" && empty(SUBDIR_OVERRIDE)
751 buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
752 .ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
755 @echo "--------------------------------------------------------------"
756 @echo ">>> World build started on `LC_ALL=C date`"
757 @echo "--------------------------------------------------------------"
761 @echo "--------------------------------------------------------------"
762 @echo ">>> World build completed on `LC_ALL=C date`"
763 @echo "--------------------------------------------------------------"
766 # We need to have this as a target because the indirection between Makefile
767 # and Makefile.inc1 causes the correct PATH to be used, rather than a
768 # modification of the current environment's PATH. In addition, we need
769 # to quote multiword values.
772 @echo ${WMAKEENV:Q} ${.MAKE.EXPORTED:@v@$v=\"${$v}\"@}
774 .if ${.TARGETS:Mbuildenv}
775 .if ${.MAKEFLAGS:M-j}
776 .error The buildenv target is incompatible with -j
780 @echo Entering world for ${TARGET_ARCH}:${TARGET}
781 @cd ${.CURDIR} && env ${WMAKEENV} ${BUILDENV_SHELL} || true
783 TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything:Nbuild32}
784 toolchain: ${TOOLCHAIN_TGTS}
785 kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries}
790 # Checks to be sure system is ready for installworld/installkernel.
792 installcheck: _installcheck_world _installcheck_kernel
794 _installcheck_kernel:
797 # Require DESTDIR to be set if installing for a different architecture or
798 # using the user/group database in the source tree.
800 .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE} || \
802 .if !make(distributeworld)
803 _installcheck_world: __installcheck_DESTDIR
804 _installcheck_kernel: __installcheck_DESTDIR
805 __installcheck_DESTDIR:
806 .if !defined(DESTDIR) || empty(DESTDIR)
807 @echo "ERROR: Please set DESTDIR!"; \
813 .if !defined(DB_FROM_SRC)
815 # Check for missing UIDs/GIDs.
817 CHECK_UIDS= auditdistd
819 .if ${MK_SENDMAIL} != "no"
825 CHECK_GIDS+= proxy authpf
827 .if ${MK_UNBOUND} != "no"
831 _installcheck_world: __installcheck_UGID
833 .for uid in ${CHECK_UIDS}
834 @if ! `id -u ${uid} >/dev/null 2>&1`; then \
835 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \
839 .for gid in ${CHECK_GIDS}
840 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \
841 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \
848 # Required install tools to be saved in a scratch dir for safety.
850 .if ${MK_ZONEINFO} != "no"
851 _zoneinfo= zic tzsetup
854 ITOOLS= [ awk cap_mkdb cat chflags chmod chown cmp cp \
855 date echo egrep find grep id install ${_install-info} \
856 ln make mkdir mtree mv pwd_mkdb \
857 rm sed services_mkdb sh strip sysctl test true uname wc ${_zoneinfo} \
860 # Needed for share/man
861 .if ${MK_MAN} != "no"
868 # Distributes everything compiled by a `buildworld'.
872 # Installs everything compiled by a 'buildworld'.
875 # Non-base distributions produced by the base system
876 EXTRA_DISTRIBUTIONS= doc
877 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
878 EXTRA_DISTRIBUTIONS+= lib32
880 .if ${MK_TESTS} != "no"
881 EXTRA_DISTRIBUTIONS+= tests
885 .if ${MK_DEBUG_FILES} != "no"
886 DEBUG_DISTRIBUTIONS+= base ${EXTRA_DISTRIBUTIONS:S,doc,,:S,tests,,}
889 MTREE_MAGIC?= mtree 2.0
891 distributeworld installworld: _installcheck_world
892 mkdir -p ${INSTALLTMP}
893 progs=$$(for prog in ${ITOOLS}; do \
894 if progpath=`which $$prog`; then \
897 echo "Required tool $$prog not found in PATH." >&2; \
901 libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | \
902 while read line; do \
904 if [ "$$2 $$3" != "not found" ]; then \
907 echo "Required library $$1 not found." >&2; \
911 cp $$libs $$progs ${INSTALLTMP}
912 cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale
914 echo "#${MTREE_MAGIC}" > ${METALOG}
916 .if make(distributeworld)
917 .for dist in ${EXTRA_DISTRIBUTIONS}
918 -mkdir ${DESTDIR}/${DISTDIR}/${dist}
919 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
920 -p ${DESTDIR}/${DISTDIR}/${dist} >/dev/null
921 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
922 -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null
923 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
924 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/include >/dev/null
925 .if ${MK_DEBUG_FILES} != "no"
926 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
927 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib >/dev/null
929 .if ${MK_LIB32} != "no"
930 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib32.dist \
931 -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null
932 .if ${MK_DEBUG_FILES} != "no"
933 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib32.dist \
934 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib/debug/usr >/dev/null
937 .if ${MK_TESTS} != "no" && ${dist} == "tests"
938 -mkdir -p ${DESTDIR}/${DISTDIR}/${dist}${TESTSBASE}
939 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
940 -p ${DESTDIR}/${DISTDIR}/${dist}${TESTSBASE} >/dev/null
941 .if ${MK_DEBUG_FILES} != "no"
942 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
943 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib/debug/${TESTSBASE} >/dev/null
947 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \
948 sed -e 's#^\./#./${dist}/#' >> ${METALOG}
949 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.usr.dist | \
950 sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG}
951 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.include.dist | \
952 sed -e 's#^\./#./${dist}/usr/include/#' >> ${METALOG}
953 .if ${MK_LIB32} != "no"
954 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.lib32.dist | \
955 sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG}
959 -mkdir ${DESTDIR}/${DISTDIR}/base
960 ${_+_}cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
961 METALOG=${METALOG} ${IMAKE_INSTALL} ${IMAKE_MTREE} \
962 DISTBASE=/base DESTDIR=${DESTDIR}/${DISTDIR}/base \
963 LOCAL_MTREE=${LOCAL_MTREE:Q} distrib-dirs
965 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \
966 ${IMAKEENV} rm -rf ${INSTALLTMP}
967 .if make(distributeworld)
968 .for dist in ${EXTRA_DISTRIBUTIONS}
969 find ${DESTDIR}/${DISTDIR}/${dist} -mindepth 1 -empty -delete
972 .for dist in base ${EXTRA_DISTRIBUTIONS}
973 @# For each file that exists in this dist, print the corresponding
974 @# line from the METALOG. This relies on the fact that
975 @# a line containing only the filename will sort immediatly before
976 @# the relevant mtree line.
977 cd ${DESTDIR}/${DISTDIR}; \
978 find ./${dist} | sort -u ${METALOG} - | \
979 awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \
980 ${DESTDIR}/${DISTDIR}/${dist}.meta
982 .for dist in ${DEBUG_DISTRIBUTIONS}
983 @# For each file that exists in this dist, print the corresponding
984 @# line from the METALOG. This relies on the fact that
985 @# a line containing only the filename will sort immediatly before
986 @# the relevant mtree line.
987 cd ${DESTDIR}/${DISTDIR}; \
988 find ./${dist}/usr/lib/debug | sort -u ${METALOG} - | \
989 awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \
990 ${DESTDIR}/${DISTDIR}/${dist}.debug.meta
996 .for dist in base ${EXTRA_DISTRIBUTIONS}
998 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
999 tar cvf - --exclude usr/lib/debug \
1000 @${DESTDIR}/${DISTDIR}/${dist}.meta | \
1001 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/${dist}.txz
1003 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
1004 tar cvf - --exclude usr/lib/debug . | \
1005 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/${dist}.txz
1009 .for dist in ${DEBUG_DISTRIBUTIONS}
1010 . if defined(NO_ROOT)
1011 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
1012 tar cvf - @${DESTDIR}/${DISTDIR}/${dist}.debug.meta | \
1013 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/${dist}-dbg.txz
1015 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
1016 tar cvLf - usr/lib/debug | \
1017 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/${dist}-dbg.txz
1024 # If you have a build server, you can NFS mount the source and obj directories
1025 # and do a 'make reinstall' on the *client* to install new binaries from the
1026 # most recent server build.
1028 reinstall: .MAKE .PHONY
1029 @echo "--------------------------------------------------------------"
1030 @echo ">>> Making hierarchy"
1031 @echo "--------------------------------------------------------------"
1032 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 \
1033 LOCAL_MTREE=${LOCAL_MTREE:Q} hierarchy
1035 @echo "--------------------------------------------------------------"
1036 @echo ">>> Installing everything"
1037 @echo "--------------------------------------------------------------"
1038 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
1039 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
1040 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32
1043 redistribute: .MAKE .PHONY
1044 @echo "--------------------------------------------------------------"
1045 @echo ">>> Distributing everything"
1046 @echo "--------------------------------------------------------------"
1047 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
1048 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
1049 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 \
1053 distrib-dirs: .MAKE .PHONY
1054 ${_+_}cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
1055 ${IMAKE_INSTALL} ${IMAKE_MTREE} METALOG=${METALOG} ${.TARGET}
1057 distribution: .MAKE .PHONY
1058 ${_+_}cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
1059 ${IMAKE_INSTALL} ${IMAKE_MTREE} METALOG=${METALOG} ${.TARGET}
1060 ${_+_}cd ${.CURDIR}; ${CROSSENV} PATH=${TMPPATH} \
1061 ${MAKE} -f Makefile.inc1 ${IMAKE_INSTALL} \
1062 METALOG=${METALOG} installconfig
1065 # buildkernel and installkernel
1067 # Which kernels to build and/or install is specified by setting
1068 # KERNCONF. If not defined a GENERIC kernel is built/installed.
1069 # Only the existing (depending TARGET) config files are used
1070 # for building kernels and only the first of these is designated
1071 # as the one being installed.
1073 # Note that we have to use TARGET instead of TARGET_ARCH when
1074 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
1075 # be set to cross-build, we have to make sure TARGET is set
1078 .if defined(KERNFAST)
1083 # Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah
1084 .if !defined(KERNCONF) && ${KERNFAST} != "1"
1085 KERNCONF=${KERNFAST}
1088 .if ${TARGET_ARCH} == "powerpc64"
1089 KERNCONF?= GENERIC64
1093 INSTKERNNAME?= kernel
1095 KERNSRCDIR?= ${.CURDIR}/sys
1096 KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf
1097 KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR}
1098 KERNCONFDIR?= ${KRNLCONFDIR}
1102 .for _kernel in ${KERNCONF}
1103 .if exists(${KERNCONFDIR}/${_kernel})
1104 BUILDKERNELS+= ${_kernel}
1105 .if empty(INSTALLKERNEL)
1106 INSTALLKERNEL= ${_kernel}
1111 ${WMAKE_TGTS:N_worldtmp:Nbuild32} ${.ALLTARGETS:M_*:N_worldtmp}: .MAKE .PHONY
1116 # Builds all kernels defined by BUILDKERNELS.
1118 buildkernel: .MAKE .PHONY
1119 .if empty(BUILDKERNELS)
1120 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \
1124 .for _kernel in ${BUILDKERNELS}
1125 @echo "--------------------------------------------------------------"
1126 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
1127 @echo "--------------------------------------------------------------"
1128 @echo "===> ${_kernel}"
1129 mkdir -p ${KRNLOBJDIR}
1130 .if !defined(NO_KERNELCONFIG)
1132 @echo "--------------------------------------------------------------"
1133 @echo ">>> stage 1: configuring the kernel"
1134 @echo "--------------------------------------------------------------"
1135 cd ${KRNLCONFDIR}; \
1137 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
1138 -I '${KERNCONFDIR}' '${KERNCONFDIR}/${_kernel}'
1140 .if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN)
1142 @echo "--------------------------------------------------------------"
1143 @echo ">>> stage 2.1: cleaning up the object tree"
1144 @echo "--------------------------------------------------------------"
1145 ${_+_}cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR}
1147 .if !defined(NO_KERNELOBJ)
1149 @echo "--------------------------------------------------------------"
1150 @echo ">>> stage 2.2: rebuilding the object tree"
1151 @echo "--------------------------------------------------------------"
1152 ${_+_}cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj
1155 @echo "--------------------------------------------------------------"
1156 @echo ">>> stage 2.3: build tools"
1157 @echo "--------------------------------------------------------------"
1158 ${_+_}cd ${.CURDIR}; ${KTMAKE} kernel-tools
1159 .if !defined(NO_KERNELDEPEND)
1161 @echo "--------------------------------------------------------------"
1162 @echo ">>> stage 3.1: making dependencies"
1163 @echo "--------------------------------------------------------------"
1164 ${_+_}cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ
1167 @echo "--------------------------------------------------------------"
1168 @echo ">>> stage 3.2: building everything"
1169 @echo "--------------------------------------------------------------"
1170 ${_+_}cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ
1171 @echo "--------------------------------------------------------------"
1172 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
1173 @echo "--------------------------------------------------------------"
1177 # installkernel, etc.
1179 # Install the kernel defined by INSTALLKERNEL
1181 installkernel installkernel.debug \
1182 reinstallkernel reinstallkernel.debug: _installcheck_kernel
1183 .if empty(INSTALLKERNEL)
1184 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
1187 @echo "--------------------------------------------------------------"
1188 @echo ">>> Installing kernel ${INSTALLKERNEL}"
1189 @echo "--------------------------------------------------------------"
1190 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
1191 ${CROSSENV} PATH=${TMPPATH} \
1192 ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
1193 .if ${BUILDKERNELS:[#]} > 1
1194 .for _kernel in ${BUILDKERNELS:[2..-1]}
1195 @echo "--------------------------------------------------------------"
1196 @echo ">>> Installing kernel ${_kernel}"
1197 @echo "--------------------------------------------------------------"
1198 cd ${KRNLOBJDIR}/${_kernel}; \
1199 ${CROSSENV} PATH=${TMPPATH} \
1200 ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME}.${_kernel} ${.TARGET:S/kernel//}
1204 distributekernel distributekernel.debug:
1205 .if empty(INSTALLKERNEL)
1206 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
1209 mkdir -p ${DESTDIR}/${DISTDIR}
1210 .if defined(NO_ROOT)
1211 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.premeta
1213 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
1214 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.premeta/} \
1215 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} KERNEL=${INSTKERNNAME} \
1216 DESTDIR=${INSTALL_DDIR}/kernel \
1217 ${.TARGET:S/distributekernel/install/}
1218 .if defined(NO_ROOT)
1219 sed -e 's|^./kernel|.|' ${DESTDIR}/${DISTDIR}/kernel.premeta > \
1220 ${DESTDIR}/${DISTDIR}/kernel.meta
1222 .if ${BUILDKERNELS:[#]} > 1
1223 .for _kernel in ${BUILDKERNELS:[2..-1]}
1224 .if defined(NO_ROOT)
1225 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta
1227 cd ${KRNLOBJDIR}/${_kernel}; \
1228 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.${_kernel}.premeta/} \
1229 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} \
1230 KERNEL=${INSTKERNNAME}.${_kernel} \
1231 DESTDIR=${INSTALL_DDIR}/kernel.${_kernel} \
1232 ${.TARGET:S/distributekernel/install/}
1233 .if defined(NO_ROOT)
1234 sed -e 's|^./kernel|.|' \
1235 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta > \
1236 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta
1242 .if defined(NO_ROOT)
1243 cd ${DESTDIR}/${DISTDIR}/kernel; \
1244 tar cvf - @${DESTDIR}/${DISTDIR}/kernel.meta | \
1245 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.txz
1246 .if ${BUILDKERNELS:[#]} > 1
1247 .for _kernel in ${BUILDKERNELS:[2..-1]}
1248 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
1249 tar cvf - @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta | \
1250 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz
1254 cd ${DESTDIR}/${DISTDIR}/kernel; \
1256 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.txz
1257 .if ${BUILDKERNELS:[#]} > 1
1258 .for _kernel in ${BUILDKERNELS:[2..-1]}
1259 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
1261 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz
1269 # Build the API documentation with doxygen
1272 @if [ ! -x `/usr/bin/which doxygen` ]; then \
1273 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \
1276 ${_+_}cd ${.CURDIR}/tools/kerneldoc/subsys && ${MAKE} obj all
1281 # Update the source tree(s), by running svn/svnup to update to the
1285 .if (defined(CVS_UPDATE) || defined(SUP_UPDATE)) && !defined(SVN_UPDATE)
1286 @echo "--------------------------------------------------------------"
1287 @echo "CVS_UPDATE and SUP_UPDATE are no longer supported."
1288 @echo "Please see: https://wiki.freebsd.org/CvsIsDeprecated"
1289 @echo "--------------------------------------------------------------"
1292 .if defined(SVN_UPDATE)
1293 @echo "--------------------------------------------------------------"
1294 @echo ">>> Updating ${.CURDIR} using Subversion"
1295 @echo "--------------------------------------------------------------"
1296 @(cd ${.CURDIR} && ${SVN} update ${SVNFLAGS})
1300 # ------------------------------------------------------------------------
1302 # From here onwards are utility targets used by the 'make world' and
1303 # related targets. If your 'world' breaks, you may like to try to fix
1304 # the problem and manually run the following targets to attempt to
1305 # complete the build. Beware, this is *not* guaranteed to work, you
1306 # need to have a pretty good grip on the current state of the system
1307 # to attempt to manually finish it. If in doubt, 'make world' again.
1311 # legacy: Build compatibility shims for the next three targets. This is a
1312 # minimal set of tools and shims necessary to compensate for older systems
1313 # which don't have the APIs required by the targets built in bootstrap-tools,
1314 # build-tools or cross-tools.
1317 # ELF Tool Chain libraries are needed for ELF tools and dtrace tools.
1318 .if ${BOOTSTRAPPING} < 1100006
1319 _elftoolchain_libs= lib/libelf lib/libdwarf
1323 .if ${BOOTSTRAPPING} < 800107 && ${BOOTSTRAPPING} != 0
1324 @echo "ERROR: Source upgrades from versions prior to 8.0 are not supported."; \
1327 .for _tool in tools/build ${_elftoolchain_libs}
1328 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \
1329 cd ${.CURDIR}/${_tool} && \
1330 ${MAKE} DIRPRFX=${_tool}/ obj && \
1331 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes && \
1332 ${MAKE} DIRPRFX=${_tool}/ depend && \
1333 ${MAKE} DIRPRFX=${_tool}/ all && \
1334 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
1338 # bootstrap-tools: Build tools needed for compatibility. These are binaries that
1339 # are built to build other binaries in the system. However, the focus of these
1340 # binaries is usually quite narrow. Bootstrap tools use the host's compiler and
1341 # libraries, augmented by -legacy.
1343 _bt= _bootstrap-tools
1345 .if ${MK_GAMES} != "no"
1346 _strfile= usr.bin/fortune/strfile
1349 .if ${MK_GCC} != "no" && ${MK_CXX} != "no"
1350 _gperf= gnu/usr.bin/gperf
1353 .if ${MK_GROFF} != "no"
1354 _groff= gnu/usr.bin/groff \
1358 .if ${MK_VT} != "no"
1359 _vtfontcvt= usr.bin/vtfontcvt
1362 .if ${BOOTSTRAPPING} < 900002
1366 .if ${BOOTSTRAPPING} < 1000002
1367 _libohash= lib/libohash
1370 ${_bt}-usr.bin/m4: ${_bt}-lib/libohash
1373 .if ${BOOTSTRAPPING} < 1000026
1374 _nmtree= lib/libnetbsd \
1377 ${_bt}-usr.sbin/nmtree: ${_bt}-lib/libnetbsd
1380 .if ${BOOTSTRAPPING} < 1000027
1384 .if ${BOOTSTRAPPING} < 1000033
1387 ${_bt}-usr.bin/lex: ${_bt}-usr.bin/m4
1390 # r277259 crunchide: Correct 64-bit section header offset
1391 # r281674 crunchide: always include both 32- and 64-bit ELF support
1392 # r285986 crunchen: use STRIPBIN rather than STRIP
1393 .if ${BOOTSTRAPPING} < 1100078
1394 _crunch= usr.sbin/crunch
1397 .if ${BOOTSTRAPPING} >= 900040 && ${BOOTSTRAPPING} < 900041
1404 ${_bt}-usr.bin/yacc: ${_bt}-lib/liby
1406 .if ${MK_BSNMP} != "no"
1407 _gensnmptree= usr.sbin/bsnmpd/gensnmptree
1410 # We need to build tblgen when we're building clang either as
1411 # the bootstrap compiler, or as the part of the normal build.
1412 .if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_CLANG} != "no"
1414 lib/clang/libllvmsupport \
1415 lib/clang/libllvmtablegen \
1416 usr.bin/clang/tblgen \
1417 usr.bin/clang/clang-tblgen
1419 ${_bt}-usr.bin/clang/clang-tblgen: ${_bt}-lib/clang/libllvmtablegen ${_bt}-lib/clang/libllvmsupport
1420 ${_bt}-usr.bin/clang/tblgen: ${_bt}-lib/clang/libllvmtablegen ${_bt}-lib/clang/libllvmsupport
1423 # Default to building the GPL DTC, but build the BSDL one if users explicitly
1426 .if ${MK_GPL_DTC} != "no"
1427 _dtc= gnu/usr.bin/dtc
1430 .if ${MK_KERBEROS} != "no"
1431 _kerberos5_bootstrap_tools= \
1432 kerberos5/tools/make-roken \
1433 kerberos5/lib/libroken \
1434 kerberos5/lib/libvers \
1435 kerberos5/tools/asn1_compile \
1436 kerberos5/tools/slc \
1439 .ORDER: ${_kerberos5_bootstrap_tools:C/^/${_bt}-/g}
1442 .if ${MK_MANDOCDB} != "no"
1443 _libohash?= lib/libohash
1444 _makewhatis= lib/libsqlite3 \
1446 ${_bt}-usr.bin/mandoc: ${_bt}-lib/libohash ${_bt}-lib/libsqlite3
1448 _makewhatis=usr.bin/makewhatis
1451 # Rebuild up-to-date libmd for xinstall
1452 ${_bt}-usr.bin/xinstall: ${_bt}-lib/libmd
1454 bootstrap-tools: .PHONY
1456 # Please document (add comment) why something is in 'bootstrap-tools'.
1457 # Try to bound the building of the bootstrap-tool to just the
1458 # FreeBSD versions that need the tool built at this stage of the build.
1461 ${_kerberos5_bootstrap_tools} \
1483 ${_bt}-${_tool}: .PHONY .MAKE
1484 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1485 cd ${.CURDIR}/${_tool} && \
1486 ${MAKE} DIRPRFX=${_tool}/ obj && \
1487 ${MAKE} DIRPRFX=${_tool}/ depend && \
1488 ${MAKE} DIRPRFX=${_tool}/ all && \
1489 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
1491 bootstrap-tools: ${_bt}-${_tool}
1495 # build-tools: Build special purpose build tools
1497 .if !defined(NO_SHARE)
1498 _share= share/syscons/scrnmaps
1501 .if ${MK_GCC} != "no"
1502 _gcc_tools= gnu/usr.bin/cc/cc_tools
1505 .if ${MK_RESCUE} != "no"
1506 # rescue includes programs that have build-tools targets
1507 _rescue=rescue/rescue
1513 ${LOCAL_TOOL_DIRS} \
1514 lib/ncurses/ncurses \
1515 lib/ncurses/ncursesw \
1520 usr.bin/mkesdb_static \
1521 usr.bin/mkcsmapper_static \
1523 build-tools_${_tool}: .PHONY
1524 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \
1525 cd ${.CURDIR}/${_tool} && \
1526 ${MAKE} DIRPRFX=${_tool}/ obj && \
1527 ${MAKE} DIRPRFX=${_tool}/ build-tools
1528 build-tools: build-tools_${_tool}
1532 build-tools_${_tool}: .PHONY
1533 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \
1534 cd ${.CURDIR}/${_tool} && \
1535 ${MAKE} DIRPRFX=${_tool}/ obj && \
1536 ${MAKE} DIRPRFX=${_tool}/ depend && \
1537 ${MAKE} DIRPRFX=${_tool}/ all
1538 build-tools: build-tools_${_tool}
1542 # kernel-tools: Build kernel-building tools
1545 mkdir -p ${MAKEOBJDIRPREFIX}/usr
1546 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1547 -p ${MAKEOBJDIRPREFIX}/usr >/dev/null
1550 # cross-tools: All the tools needed to build the rest of the system after
1551 # we get done with the earlier stages. It is the last set of tools needed
1552 # to begin building the target binaries.
1554 .if ${TARGET_ARCH} != ${MACHINE_ARCH}
1555 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386"
1556 _btxld= usr.sbin/btxld
1560 # Rebuild ctfconvert and ctfmerge to avoid difficult-to-diagnose failures
1561 # resulting from missing bug fixes or ELF Toolchain updates.
1562 .if ${MK_CDDL} != "no"
1563 _dtrace_tools= cddl/lib/libctf cddl/usr.bin/ctfconvert \
1564 cddl/usr.bin/ctfmerge
1567 # If we're given an XAS, don't build binutils.
1568 .if ${XAS:M/*} == ""
1569 .if ${MK_BINUTILS_BOOTSTRAP} != "no"
1570 _binutils= gnu/usr.bin/binutils
1572 .if ${MK_ELFTOOLCHAIN_BOOTSTRAP} != "no"
1573 _elftctools= lib/libelftc \
1578 # These are not required by the build, but can be useful for developers who
1579 # cross-build on a FreeBSD 10 host:
1580 _elftctools+= usr.bin/addr2line
1582 .elif ${TARGET_ARCH} != ${MACHINE_ARCH} && ${MK_ELFTOOLCHAIN_BOOTSTRAP} != "no"
1583 # If cross-building with an external binutils we still need to build strip for
1584 # the target (for at least crunchide).
1585 _elftctools= lib/libelftc \
1589 # If an full path to an external cross compiler is given, don't build
1591 .if ${XCC:M/*} == "" && ${MK_CROSS_COMPILER} != "no"
1592 .if ${MK_CLANG_BOOTSTRAP} != "no"
1593 _clang= usr.bin/clang
1594 _clang_libs= lib/clang
1596 .if ${MK_GCC_BOOTSTRAP} != "no"
1600 .if ${MK_USB} != "no"
1601 _usb_tools= sys/boot/usb/tools
1604 cross-tools: .MAKE .PHONY
1615 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1616 cd ${.CURDIR}/${_tool} && \
1617 ${MAKE} DIRPRFX=${_tool}/ obj && \
1618 ${MAKE} DIRPRFX=${_tool}/ depend && \
1619 ${MAKE} DIRPRFX=${_tool}/ all && \
1620 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
1623 NXBENV= MAKEOBJDIRPREFIX=${OBJTREE}/nxb \
1624 INSTALL="sh ${.CURDIR}/tools/install.sh" \
1625 PATH=${PATH}:${OBJTREE}/gperf_for_gcc/usr/bin
1626 NXBMAKE= ${NXBENV} ${MAKE} \
1627 TBLGEN=${OBJTREE}/nxb-bin/usr/bin/tblgen \
1628 CLANG_TBLGEN=${OBJTREE}/nxb-bin/usr/bin/clang-tblgen \
1629 MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH} \
1630 MK_GDB=no MK_TESTS=no \
1632 MK_HTML=no NO_LINT=yes MK_MAN=no \
1633 -DNO_PIC MK_PROFILE=no -DNO_SHARED \
1634 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
1635 MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \
1638 # native-xtools is the current target for qemu-user cross builds of ports
1639 # via poudriere and the imgact_binmisc kernel module.
1640 # For non-clang enabled targets that are still using the in tree gcc
1641 # we must build a gperf binary for one instance of its Makefiles. On
1642 # clang-enabled systems, the gperf binary is obsolete.
1643 native-xtools: .PHONY
1644 .if ${MK_GCC_BOOTSTRAP} != "no"
1645 mkdir -p ${OBJTREE}/gperf_for_gcc/usr/bin
1646 ${_+_}@${ECHODIR} "===> ${_gperf} (obj,depend,all,install)"; \
1647 cd ${.CURDIR}/${_gperf} && \
1648 ${NXBMAKE} DIRPRFX=${_gperf}/ obj && \
1649 ${NXBMAKE} DIRPRFX=${_gperf}/ depend && \
1650 ${NXBMAKE} DIRPRFX=${_gperf}/ all && \
1651 ${NXBMAKE} DIRPRFX=${_gperf}/ DESTDIR=${OBJTREE}/gperf_for_gcc install
1653 mkdir -p ${OBJTREE}/nxb-bin/bin
1654 mkdir -p ${OBJTREE}/nxb-bin/sbin
1655 mkdir -p ${OBJTREE}/nxb-bin/usr
1656 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1657 -p ${OBJTREE}/nxb-bin/usr >/dev/null
1658 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
1659 -p ${OBJTREE}/nxb-bin/usr/include >/dev/null
1719 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1720 cd ${.CURDIR}/${_tool} && \
1721 ${NXBMAKE} DIRPRFX=${_tool}/ obj && \
1722 ${NXBMAKE} DIRPRFX=${_tool}/ depend && \
1723 ${NXBMAKE} DIRPRFX=${_tool}/ all && \
1724 ${NXBMAKE} DIRPRFX=${_tool}/ DESTDIR=${OBJTREE}/nxb-bin install
1728 # hierarchy - ensure that all the needed directories are present
1730 hierarchy hier: .MAKE .PHONY
1731 ${_+_}cd ${.CURDIR}/etc && ${HMAKE} distrib-dirs
1734 # libraries - build all libraries, and install them under ${DESTDIR}.
1736 # The list of libraries with dependents (${_prebuild_libs}) and their
1737 # interdependencies (__L) are built automatically by the
1738 # ${.CURDIR}/tools/make_libdeps.sh script.
1740 libraries: .MAKE .PHONY
1741 ${_+_}cd ${.CURDIR} && \
1742 ${MAKE} -f Makefile.inc1 _prereq_libs && \
1743 ${MAKE} -f Makefile.inc1 _startup_libs && \
1744 ${MAKE} -f Makefile.inc1 _prebuild_libs && \
1745 ${MAKE} -f Makefile.inc1 _generic_libs
1748 # static libgcc.a prerequisite for shared libc
1750 _prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc lib/libcompiler_rt
1752 # These dependencies are not automatically generated:
1754 # gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before
1755 # all shared libraries for ELF.
1757 _startup_libs= gnu/lib/csu
1758 _startup_libs+= lib/csu
1759 _startup_libs+= gnu/lib/libgcc
1760 _startup_libs+= lib/libcompiler_rt
1761 _startup_libs+= lib/libc
1762 _startup_libs+= lib/libc_nonshared
1763 .if ${MK_LIBCPLUSPLUS} != "no"
1764 _startup_libs+= lib/libcxxrt
1767 gnu/lib/libgcc__L: lib/libc__L
1768 gnu/lib/libgcc__L: lib/libc_nonshared__L
1769 .if ${MK_LIBCPLUSPLUS} != "no"
1770 lib/libcxxrt__L: gnu/lib/libgcc__L
1773 _prebuild_libs= ${_kerberos5_lib_libasn1} \
1774 ${_kerberos5_lib_libhdb} \
1775 ${_kerberos5_lib_libheimbase} \
1776 ${_kerberos5_lib_libheimntlm} \
1778 ${_kerberos5_lib_libheimipcc} \
1779 ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \
1780 ${_kerberos5_lib_libroken} \
1781 ${_kerberos5_lib_libwind} \
1782 lib/libbz2 ${_libcom_err} lib/libcrypt \
1783 lib/libelf lib/libexpat \
1786 lib/libkiconv lib/libkvm lib/liblzma lib/libmd lib/libnv \
1787 ${_lib_libcapsicum} \
1788 lib/ncurses/ncurses lib/ncurses/ncursesw \
1789 lib/libopie lib/libpam ${_lib_libthr} \
1790 ${_lib_libradius} lib/libsbuf lib/libtacplus \
1792 ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \
1793 ${_cddl_lib_libuutil} \
1794 ${_cddl_lib_libavl} \
1795 ${_cddl_lib_libzfs_core} \
1796 ${_cddl_lib_libctf} \
1797 lib/libutil lib/libpjdlog ${_lib_libypclnt} lib/libz lib/msun \
1798 ${_secure_lib_libcrypto} ${_lib_libldns} \
1799 ${_secure_lib_libssh} ${_secure_lib_libssl} \
1801 .if ${MK_GNUCXX} != "no"
1802 _prebuild_libs+= gnu/lib/libstdc++ gnu/lib/libsupc++
1803 gnu/lib/libstdc++__L: lib/msun__L
1804 gnu/lib/libsupc++__L: gnu/lib/libstdc++__L
1807 .if ${MK_LIBCPLUSPLUS} != "no"
1808 _prebuild_libs+= lib/libc++
1811 lib/libgeom__L: lib/libexpat__L
1813 .if ${MK_LIBTHR} != "no"
1814 _lib_libthr= lib/libthr
1817 .if ${MK_RADIUS_SUPPORT} != "no"
1818 _lib_libradius= lib/libradius
1821 .if ${MK_OFED} != "no"
1822 _ofed_lib= contrib/ofed/usr.lib/
1825 .if ${MK_CASPER} != "no"
1826 _lib_libcapsicum=lib/libcapsicum
1829 lib/libcapsicum__L: lib/libnv__L
1830 lib/libpjdlog__L: lib/libutil__L
1831 lib/liblzma__L: lib/libthr__L
1833 _generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib}
1834 .for _DIR in ${LOCAL_LIB_DIRS}
1835 .if exists(${.CURDIR}/${_DIR}/Makefile)
1836 _generic_libs+= ${_DIR}
1840 lib/libopie__L lib/libtacplus__L: lib/libmd__L
1842 .if ${MK_CDDL} != "no"
1843 _cddl_lib_libumem= cddl/lib/libumem
1844 _cddl_lib_libnvpair= cddl/lib/libnvpair
1845 _cddl_lib_libavl= cddl/lib/libavl
1846 _cddl_lib_libuutil= cddl/lib/libuutil
1847 _cddl_lib_libzfs_core= cddl/lib/libzfs_core
1848 _cddl_lib_libctf= cddl/lib/libctf
1850 cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L
1851 cddl/lib/libzfs__L: lib/libgeom__L
1852 cddl/lib/libctf__L: lib/libz__L
1854 # cddl/lib/libdtrace requires lib/libproc and lib/librtld_db; it's only built
1855 # on select architectures though (see cddl/lib/Makefile)
1856 .if ${MACHINE_CPUARCH} != "sparc64"
1857 _prebuild_libs+= lib/libproc lib/librtld_db
1860 .if ${MK_CRYPT} != "no"
1861 .if ${MK_OPENSSL} != "no"
1862 _secure_lib_libcrypto= secure/lib/libcrypto
1863 _secure_lib_libssl= secure/lib/libssl
1864 lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L
1865 .if ${MK_LDNS} != "no"
1866 _lib_libldns= lib/libldns
1867 lib/libldns__L: secure/lib/libcrypto__L
1869 .if ${MK_OPENSSH} != "no"
1870 _secure_lib_libssh= secure/lib/libssh
1871 secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
1872 .if ${MK_LDNS} != "no"
1873 secure/lib/libssh__L: lib/libldns__L
1875 .if ${MK_KERBEROS_SUPPORT} != "no"
1876 secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \
1877 kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \
1878 lib/libmd__L kerberos5/lib/libroken__L
1882 _secure_lib= secure/lib
1885 .if ${MK_KERBEROS} != "no"
1886 kerberos5/lib/libasn1__L: lib/libcom_err__L kerberos5/lib/libroken__L
1887 kerberos5/lib/libhdb__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1888 kerberos5/lib/libkrb5__L kerberos5/lib/libroken__L \
1889 kerberos5/lib/libwind__L lib/libsqlite3__L
1890 kerberos5/lib/libheimntlm__L: secure/lib/libcrypto__L kerberos5/lib/libkrb5__L \
1891 kerberos5/lib/libroken__L lib/libcom_err__L
1892 kerberos5/lib/libhx509__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1893 secure/lib/libcrypto__L kerberos5/lib/libroken__L kerberos5/lib/libwind__L
1894 kerberos5/lib/libkrb5__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1895 lib/libcrypt__L secure/lib/libcrypto__L kerberos5/lib/libhx509__L \
1896 kerberos5/lib/libroken__L kerberos5/lib/libwind__L \
1897 kerberos5/lib/libheimbase__L kerberos5/lib/libheimipcc__L
1898 kerberos5/lib/libroken__L: lib/libcrypt__L
1899 kerberos5/lib/libwind__L: kerberos5/lib/libroken__L lib/libcom_err__L
1900 kerberos5/lib/libheimbase__L: lib/libthr__L
1901 kerberos5/lib/libheimipcc__L: kerberos5/lib/libroken__L kerberos5/lib/libheimbase__L lib/libthr__L
1904 lib/libsqlite3__L: lib/libthr__L
1906 .if ${MK_GSSAPI} != "no"
1907 _lib_libgssapi= lib/libgssapi
1910 .if ${MK_KERBEROS} != "no"
1911 _kerberos5_lib= kerberos5/lib
1912 _kerberos5_lib_libasn1= kerberos5/lib/libasn1
1913 _kerberos5_lib_libhdb= kerberos5/lib/libhdb
1914 _kerberos5_lib_libheimbase= kerberos5/lib/libheimbase
1915 _kerberos5_lib_libkrb5= kerberos5/lib/libkrb5
1916 _kerberos5_lib_libhx509= kerberos5/lib/libhx509
1917 _kerberos5_lib_libroken= kerberos5/lib/libroken
1918 _kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm
1919 _libsqlite3= lib/libsqlite3
1920 _kerberos5_lib_libheimipcc= kerberos5/lib/libheimipcc
1921 _kerberos5_lib_libwind= kerberos5/lib/libwind
1922 _libcom_err= lib/libcom_err
1925 .if ${MK_NIS} != "no"
1926 _lib_libypclnt= lib/libypclnt
1929 .if ${MK_OPENSSL} == "no"
1930 lib/libradius__L: lib/libmd__L
1934 ${_cddl_lib_libctf:D${_cddl_lib_libctf}__L} lib/libelf__L lib/librtld_db__L lib/libutil__L
1935 .if ${MK_CXX} != "no"
1936 .if ${MK_LIBCPLUSPLUS} != "no"
1937 lib/libproc__L: lib/libcxxrt__L
1938 .else # This implies MK_GNUCXX != "no"; see lib/libproc
1939 lib/libproc__L: gnu/lib/libsupc++__L
1943 gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncursesw__L
1945 .for _lib in ${_prereq_libs}
1946 ${_lib}__PL: .PHONY .MAKE
1947 .if exists(${.CURDIR}/${_lib})
1948 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1949 cd ${.CURDIR}/${_lib} && \
1950 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj && \
1951 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ depend && \
1952 ${MAKE} MK_TESTS=no MK_PROFILE=no -DNO_PIC \
1953 DIRPRFX=${_lib}/ all && \
1954 ${MAKE} MK_TESTS=no MK_PROFILE=no -DNO_PIC \
1955 DIRPRFX=${_lib}/ install
1959 .for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
1960 ${_lib}__L: .PHONY .MAKE
1961 .if exists(${.CURDIR}/${_lib})
1962 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1963 cd ${.CURDIR}/${_lib} && \
1964 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj && \
1965 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ depend && \
1966 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ all && \
1967 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ install
1971 # libpam is special: we need to build static PAM modules before
1972 # static PAM library, and dynamic PAM library before dynamic PAM
1974 lib/libpam__L: .PHONY .MAKE
1975 ${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \
1976 cd ${.CURDIR}/lib/libpam && \
1977 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ obj && \
1978 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ depend && \
1979 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ \
1980 -D_NO_LIBPAM_SO_YET all && \
1981 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ \
1982 -D_NO_LIBPAM_SO_YET install
1984 _prereq_libs: ${_prereq_libs:S/$/__PL/}
1985 _startup_libs: ${_startup_libs:S/$/__L/}
1986 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
1987 _generic_libs: ${_generic_libs:S/$/__L/}
1989 # Enable SUBDIR_PARALLEL when not calling 'make all', unless called as
1990 # 'par-all'. This is because it is unlikely that running 'make all' from
1991 # the top-level, especially with a SUBDIR_OVERRIDE or LOCAL_DIRS set,
1992 # will have a reliable build if SUBDIRs are built in parallel. This is
1993 # safe for the world stage of buildworld though since it has already
1994 # built libraries in a proper order and installed includes into WORLDTMP.
1995 # Special handling is done for SUBDIR ordering for 'install*' to avoid
1996 # trashing a system if it crashes mid-install.
2002 .include <bsd.subdir.mk>
2004 .if make(check-old) || make(check-old-dirs) || \
2005 make(check-old-files) || make(check-old-libs) || \
2006 make(delete-old) || make(delete-old-dirs) || \
2007 make(delete-old-files) || make(delete-old-libs)
2010 # check for / delete old files section
2013 .include "ObsoleteFiles.inc"
2015 OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \
2016 else you can not start such an application. Consult UPDATING for more \
2017 information regarding how to cope with the removal/revision bump of a \
2020 .if !defined(BATCH_DELETE_OLD_FILES)
2027 @echo ">>> Removing old files (only deletes safe to delete libs)"
2028 # Ask for every old file if the user really wants to remove it.
2029 # It's annoying, but better safe than sorry.
2030 # NB: We cannot pass the list of OLD_FILES as a parameter because the
2031 # argument list will get too long. Using .for/.endfor make "loops" will make
2032 # the Makefile parser segfault.
2035 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
2036 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
2037 while read file; do \
2038 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
2039 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
2040 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
2042 for ext in debug symbols; do \
2043 if ! [ -e "${DESTDIR}/$${file}" ] && [ -f \
2044 "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \
2045 rm ${RM_I} "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" \
2050 # Remove catpages without corresponding manpages.
2052 find ${DESTDIR}/usr/share/man/cat* ! -type d | \
2053 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
2054 while read catpage; do \
2056 if [ ! -e "$${manpage}" ]; then \
2057 rm ${RM_I} $${catpage} <&3; \
2060 @echo ">>> Old files removed"
2063 @echo ">>> Checking for old files"
2065 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
2066 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
2067 while read file; do \
2068 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
2069 echo "${DESTDIR}/$${file}"; \
2071 for ext in debug symbols; do \
2072 if [ -f "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \
2073 echo "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}"; \
2077 # Check for catpages without corresponding manpages.
2078 @find ${DESTDIR}/usr/share/man/cat* ! -type d | \
2079 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
2080 while read catpage; do \
2082 if [ ! -e "$${manpage}" ]; then \
2088 @echo ">>> Removing old libraries"
2089 @echo "${OLD_LIBS_MESSAGE}" | fmt
2092 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
2093 -V OLD_LIBS | xargs -n1 | \
2094 while read file; do \
2095 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
2096 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
2097 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
2099 for ext in debug symbols; do \
2100 if ! [ -e "${DESTDIR}/$${file}" ] && [ -f \
2101 "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \
2102 rm ${RM_I} "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" \
2107 @echo ">>> Old libraries removed"
2110 @echo ">>> Checking for old libraries"
2112 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
2113 -V OLD_LIBS | xargs -n1 | \
2114 while read file; do \
2115 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
2116 echo "${DESTDIR}/$${file}"; \
2118 for ext in debug symbols; do \
2119 if [ -f "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \
2120 echo "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}"; \
2126 @echo ">>> Removing old directories"
2128 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
2129 -V OLD_DIRS | xargs -n1 | sort -r | \
2130 while read dir; do \
2131 if [ -d "${DESTDIR}/$${dir}" ]; then \
2132 rmdir -v "${DESTDIR}/$${dir}" || true; \
2133 elif [ -L "${DESTDIR}/$${dir}" ]; then \
2134 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
2137 @echo ">>> Old directories removed"
2140 @echo ">>> Checking for old directories"
2142 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
2143 -V OLD_DIRS | xargs -n1 | \
2144 while read dir; do \
2145 if [ -d "${DESTDIR}/$${dir}" ]; then \
2146 echo "${DESTDIR}/$${dir}"; \
2147 elif [ -L "${DESTDIR}/$${dir}" ]; then \
2148 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
2152 delete-old: delete-old-files delete-old-dirs
2153 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
2155 check-old: check-old-files check-old-libs check-old-dirs
2156 @echo "To remove old files and directories run '${MAKE} delete-old'."
2157 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
2162 # showconfig - show build configuration.
2165 @(${MAKE} -n -f ${.CURDIR}/sys/conf/kern.opts.mk -V dummy -dg1; \
2166 ${MAKE} -n -f ${.CURDIR}/share/mk/src.opts.mk -V dummy -dg1) 2>&1 | grep ^MK_ | sort -u
2168 .if !empty(KRNLOBJDIR) && !empty(KERNCONF)
2169 DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/
2171 .if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE)
2172 .if exists(${KERNCONFDIR}/${KERNCONF})
2173 FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \
2174 '${KERNCONFDIR}/${KERNCONF}' ; echo
2180 .if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH})
2181 DTBOUTPUTPATH= ${.CURDIR}
2185 # Build 'standalone' Device Tree Blob
2188 @PATH=${TMPPATH} MACHINE=${TARGET} \
2189 ${.CURDIR}/sys/tools/fdt/make_dtb.sh ${.CURDIR}/sys \
2190 "${FDT_DTS_FILE}" ${DTBOUTPUTPATH}
2194 .if defined(TARGET) && defined(TARGET_ARCH)
2196 .if ${TARGET} == ${MACHINE} && ${TARGET_ARCH} == ${MACHINE_ARCH}
2197 XDEV_CPUTYPE?=${CPUTYPE}
2199 XDEV_CPUTYPE?=${TARGET_CPUTYPE}
2202 NOFUN=-DNO_FSCHG MK_HTML=no -DNO_LINT \
2203 MK_MAN=no MK_NLS=no MK_PROFILE=no \
2204 MK_KERBEROS=no MK_RESCUE=no MK_TESTS=no MK_WARNS=no \
2205 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
2206 CPUTYPE=${XDEV_CPUTYPE}
2208 XDDIR=${TARGET_ARCH}-freebsd
2211 .error XDTP variable should be an absolute path
2214 CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \
2215 INSTALL="sh ${.CURDIR}/tools/install.sh"
2217 TOOLS_PREFIX=${XDTP}
2218 CD2CFLAGS=-isystem ${XDDESTDIR}/usr/include -L${XDDESTDIR}/usr/lib \
2219 --sysroot=${XDDESTDIR}/ -B${XDDESTDIR}/usr/libexec \
2220 -B${XDDESTDIR}/usr/bin -B${XDDESTDIR}/usr/lib
2221 CD2ENV=${CDENV} CC="${CC} ${CD2CFLAGS}" CXX="${CXX} ${CD2CFLAGS}" \
2222 CPP="${CPP} ${CD2CFLAGS}" \
2223 MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH}
2225 CDTMP= ${MAKEOBJDIRPREFIX}/${XDDIR}/${.CURDIR}/tmp
2226 CDMAKE=${CDENV} PATH=${CDTMP}/usr/bin:${PATH} ${MAKE} ${NOFUN}
2227 CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDDESTDIR}/usr/bin:${PATH} ${MAKE} ${NOFUN}
2228 XDDESTDIR=${DESTDIR}/${XDTP}
2230 OSREL!= uname -r | sed -e 's/[-(].*//'
2233 .ORDER: xdev-build xdev-install xdev-links
2234 xdev: xdev-build xdev-install
2236 .ORDER: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools
2237 xdev-build: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools
2239 _xb-worldtmp: .PHONY
2240 mkdir -p ${CDTMP}/usr
2241 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
2242 -p ${CDTMP}/usr >/dev/null
2244 _xb-bootstrap-tools: .PHONY
2248 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
2249 cd ${.CURDIR}/${_tool} && \
2250 ${CDMAKE} DIRPRFX=${_tool}/ obj && \
2251 ${CDMAKE} DIRPRFX=${_tool}/ depend && \
2252 ${CDMAKE} DIRPRFX=${_tool}/ all && \
2253 ${CDMAKE} DIRPRFX=${_tool}/ DESTDIR=${CDTMP} install
2256 _xb-build-tools: .PHONY
2257 ${_+_}@cd ${.CURDIR}; \
2258 ${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools
2260 _xb-cross-tools: .PHONY
2268 ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \
2269 cd ${.CURDIR}/${_tool} && \
2270 ${CDMAKE} DIRPRFX=${_tool}/ obj && \
2271 ${CDMAKE} DIRPRFX=${_tool}/ depend && \
2272 ${CDMAKE} DIRPRFX=${_tool}/ all
2276 ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}"
2277 mkdir -p ${XDDESTDIR}
2278 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
2279 -p ${XDDESTDIR} >/dev/null
2280 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
2281 -p ${XDDESTDIR}/usr >/dev/null
2282 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
2283 -p ${XDDESTDIR}/usr/include >/dev/null
2284 .if ${MK_LIB32} != "no"
2285 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib32.dist \
2286 -p ${XDDESTDIR}/usr >/dev/null
2288 .if ${MK_TESTS} != "no"
2289 mkdir -p ${XDDESTDIR}${TESTSBASE}
2290 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
2291 -p ${XDDESTDIR}${TESTSBASE} >/dev/null
2294 .ORDER: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries
2295 xdev-install: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries
2297 _xi-cross-tools: .PHONY
2298 @echo "_xi-cross-tools"
2306 ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \
2307 cd ${.CURDIR}/${_tool}; \
2308 ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR}
2311 _xi-includes: .PHONY
2312 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 buildincludes \
2313 DESTDIR=${XDDESTDIR}
2314 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 installincludes \
2315 DESTDIR=${XDDESTDIR}
2317 _xi-libraries: .PHONY
2318 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \
2319 DESTDIR=${XDDESTDIR}
2322 ${_+_}cd ${XDDESTDIR}/usr/bin; \
2323 mkdir -p ../../../../usr/bin; \
2325 ln -sf ../../${XDTP}/usr/bin/$$i \
2326 ../../../../usr/bin/${XDDIR}-$$i; \
2327 ln -sf ../../${XDTP}/usr/bin/$$i \
2328 ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \
2331 xdev xdev-build xdev-install xdev-links:
2332 @echo "*** Error: Both TARGET and TARGET_ARCH must be defined for \"${.TARGET}\" target"