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
35 # The intended user-driven targets are:
36 # buildworld - rebuild *everything*, including glue to help do upgrades
37 # installworld- install everything built by "buildworld"
38 # doxygen - build API documentation of the kernel
39 # update - convenient way to update your source tree (eg: svn/svnup)
41 # Standard targets (not defined here) are documented in the makefiles in
42 # /usr/share/mk. These include:
43 # obj depend all install clean cleandepend cleanobj
45 .if !defined(TARGET) || !defined(TARGET_ARCH)
46 .error "Both TARGET and TARGET_ARCH must be defined."
49 .include "share/mk/src.opts.mk"
50 .include <bsd.arch.inc.mk>
51 .include <bsd.compiler.mk>
53 # We must do lib/ and libexec/ before bin/, because if installworld
54 # installs a new /bin/sh, the 'make' command will *immediately*
55 # use that new version. And the new (dynamically-linked) /bin/sh
56 # will expect to find appropriate libraries in /lib and /libexec.
59 .if defined(SUBDIR_OVERRIDE)
60 SUBDIR= ${SUBDIR_OVERRIDE}
64 .if ${MK_GAMES} != "no"
67 .if ${MK_CDDL} != "no"
71 .if ${MK_KERBEROS} != "no"
74 .if ${MK_RESCUE} != "no"
78 .if ${MK_CRYPT} != "no"
81 .if !defined(NO_SHARE)
84 SUBDIR+=sys usr.bin usr.sbin
85 .if ${MK_TESTS} != "no"
88 .if ${MK_OFED} != "no"
92 # We must do etc/ last for install/distribute to work.
96 # Local directories are last, since it is nice to at least get the base
97 # system rebuilt before you do them.
98 .for _DIR in ${LOCAL_DIRS}
99 .if exists(${.CURDIR}/${_DIR}/Makefile)
103 # Add LOCAL_LIB_DIRS, but only if they will not be picked up as a SUBDIR
104 # of a LOCAL_DIRS directory. This allows LOCAL_DIRS=foo and
105 # LOCAL_LIB_DIRS=foo/lib to behave as expected.
106 .for _DIR in ${LOCAL_DIRS:M*/} ${LOCAL_DIRS:N*/:S|$|/|}
107 _REDUNDENT_LIB_DIRS+= ${LOCAL_LIB_DIRS:M${_DIR}*}
109 .for _DIR in ${LOCAL_LIB_DIRS}
110 .if empty(_REDUNDENT_LIB_DIRS:M${_DIR}) && exists(${.CURDIR}/${_DIR}/Makefile)
113 .warning ${_DIR} not added to SUBDIR list. See UPDATING 20141121.
121 .if defined(NO_CLEANDIR)
122 CLEANDIR= clean cleandepend
129 BUILDENV_SHELL?=/bin/sh
131 SVN?= /usr/local/bin/svn
134 MAKEOBJDIRPREFIX?= /usr/obj
135 .if !defined(OSRELDATE)
136 .if exists(/usr/include/osreldate.h)
137 OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
138 /usr/include/osreldate.h
144 .if !defined(VERSION)
145 REVISION!= ${MAKE} -C ${SRCDIR}/release -V REVISION
146 BRANCH!= ${MAKE} -C ${SRCDIR}/release -V BRANCH
147 SRCRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
148 ${SRCDIR}/sys/sys/param.h
149 VERSION= FreeBSD ${REVISION}-${BRANCH:C/-p[0-9]+$//} ${TARGET_ARCH} ${SRCRELDATE}
152 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
153 .if ${TARGET} == ${TARGET_ARCH}
156 _t= ${TARGET_ARCH}/${TARGET}
159 .if empty(KNOWN_ARCHES:M${_t})
160 .error Unknown target ${TARGET_ARCH}:${TARGET}.
164 .if ${TARGET} == ${MACHINE}
165 TARGET_CPUTYPE?=${CPUTYPE}
170 .if !empty(TARGET_CPUTYPE)
171 _TARGET_CPUTYPE=${TARGET_CPUTYPE}
173 _TARGET_CPUTYPE=dummy
175 _CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} \
176 -f /dev/null -m ${.CURDIR}/share/mk -V CPUTYPE
177 .if ${_CPUTYPE} != ${_TARGET_CPUTYPE}
178 .error CPUTYPE global should be set with ?=.
181 BUILD_ARCH!= uname -p
182 .if ${MACHINE_ARCH} != ${BUILD_ARCH}
183 .error To cross-build, set TARGET_ARCH.
186 .if ${MACHINE} == ${TARGET} && ${MACHINE_ARCH} == ${TARGET_ARCH} && !defined(CROSS_BUILD_TESTING)
187 OBJTREE= ${MAKEOBJDIRPREFIX}
189 OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH}
191 WORLDTMP= ${OBJTREE}${.CURDIR}/tmp
192 BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/bin
193 XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin
194 STRICTTMPPATH= ${BPATH}:${XPATH}
195 TMPPATH= ${STRICTTMPPATH}:${PATH}
198 # Avoid running mktemp(1) unless actually needed.
199 # It may not be functional, e.g., due to new ABI
200 # when in the middle of installing over this system.
202 .if make(distributeworld) || make(installworld)
203 INSTALLTMP!= /usr/bin/mktemp -d -u -t install
207 # Building a world goes through the following stages
209 # 1. legacy stage [BMAKE]
210 # This stage is responsible for creating compatibility
211 # shims that are needed by the bootstrap-tools,
212 # build-tools and cross-tools stages.
213 # 1. bootstrap-tools stage [BMAKE]
214 # This stage is responsible for creating programs that
215 # are needed for backward compatibility reasons. They
216 # are not built as cross-tools.
217 # 2. build-tools stage [TMAKE]
218 # This stage is responsible for creating the object
219 # tree and building any tools that are needed during
221 # 3. cross-tools stage [XMAKE]
222 # This stage is responsible for creating any tools that
223 # are needed for cross-builds. A cross-compiler is one
225 # 4. world stage [WMAKE]
226 # This stage actually builds the world.
227 # 5. install stage (optional) [IMAKE]
228 # This stage installs a previously built world.
233 # Common environment for world related stages
234 CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \
235 MACHINE_ARCH=${TARGET_ARCH} \
237 CPUTYPE=${TARGET_CPUTYPE}
238 .if ${MK_GROFF} != "no"
239 CROSSENV+= GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
240 GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \
241 GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac
243 .if defined(TARGET_CFLAGS)
244 CROSSENV+= ${TARGET_CFLAGS}
247 # bootstrap-tools stage
248 BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
249 PATH=${BPATH}:${PATH} \
250 WORLDTMP=${WORLDTMP} \
251 VERSION="${VERSION}" \
252 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}"
253 BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
254 ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
256 BOOTSTRAPPING=${OSRELDATE} \
258 MK_HTML=no NO_LINT=yes MK_MAN=no \
259 -DNO_PIC MK_PROFILE=no -DNO_SHARED \
260 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
261 MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \
262 MK_LLDB=no MK_TESTS=no
265 TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
266 ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
267 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
269 BOOTSTRAPPING=${OSRELDATE} \
272 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
273 MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \
274 MK_LLDB=no MK_TESTS=no
277 XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \
278 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
279 MK_GDB=no MK_TESTS=no
282 KTMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
283 PATH=${BPATH}:${PATH} \
284 WORLDTMP=${WORLDTMP} \
286 KTMAKE= TOOLS_PREFIX=${WORLDTMP} MAKEOBJDIRPREFIX=${WORLDTMP} \
287 ${KTMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
289 BOOTSTRAPPING=${OSRELDATE} \
291 MK_HTML=no -DNO_LINT MK_MAN=no \
292 -DNO_PIC MK_PROFILE=no -DNO_SHARED \
293 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no
296 WMAKEENV= ${CROSSENV} \
297 _SHLIBDIRPREFIX=${WORLDTMP} \
299 VERSION="${VERSION}" \
300 INSTALL="sh ${.CURDIR}/tools/install.sh" \
304 HMAKE= PATH=${TMPPATH} ${MAKE} LOCAL_MTREE=${LOCAL_MTREE:Q}
306 HMAKE+= PATH=${TMPPATH} METALOG=${METALOG} -DNO_ROOT
309 .if ${MK_CDDL} == "no"
313 .if defined(CROSS_TOOLCHAIN)
314 LOCALBASE?= /usr/local
315 .include "${LOCALBASE}/share/toolchains/${CROSS_TOOLCHAIN}.mk"
317 .if defined(CROSS_TOOLCHAIN_PREFIX)
318 CROSS_COMPILER_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
319 CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
322 # If we do not have a bootstrap binutils (because the in-tree one does not
323 # support the target architecture), provide a default cross-binutils prefix.
324 # This allows aarch64 builds, for example, to automatically use the
325 # aarch64-binutils port or package.
326 .if !empty(BROKEN_OPTIONS:MBINUTILS_BOOTSTRAP) && \
327 !defined(CROSS_BINUTILS_PREFIX)
328 CROSS_BINUTILS_PREFIX=/usr/local/${TARGET_ARCH}-freebsd/bin/
329 .if !exists(${CROSS_BINUTILS_PREFIX})
330 .error In-tree binutils does not support the ${TARGET_ARCH} architecture. Install the ${TARGET_ARCH}-binutils port or package or set CROSS_BINUTILS_PREFIX.
334 XCOMPILERS= CC CXX CPP
335 .for COMPILER in ${XCOMPILERS}
336 .if defined(CROSS_COMPILER_PREFIX)
337 X${COMPILER}?= ${CROSS_COMPILER_PREFIX}${${COMPILER}}
339 X${COMPILER}?= ${${COMPILER}}
342 XBINUTILS= AS AR LD NM OBJCOPY OBJDUMP RANLIB SIZE STRINGS
343 .for BINUTIL in ${XBINUTILS}
344 .if defined(CROSS_BINUTILS_PREFIX)
345 X${BINUTIL}?= ${CROSS_BINUTILS_PREFIX}${${BINUTIL}}
347 X${BINUTIL}?= ${${BINUTIL}}
350 WMAKEENV+= CC="${XCC} ${XCFLAGS}" CXX="${XCXX} ${XCFLAGS} ${XCXXFLAGS}" \
351 DEPFLAGS="${DEPFLAGS}" \
352 CPP="${XCPP} ${XCFLAGS}" \
353 AS="${XAS}" AR="${XAR}" LD="${XLD}" NM=${XNM} \
354 OBJDUMP=${XOBJDUMP} OBJCOPY="${XOBJCOPY}" \
355 RANLIB=${XRANLIB} STRINGS=${XSTRINGS} \
359 .if defined(CROSS_BINUTILS_PREFIX)
360 # In the case of xdev-build tools, CROSS_BINUTILS_PREFIX won't be a
361 # directory, but the compiler will look in the right place for it's
362 # tools so we don't need to tell it where to look.
363 .if exists(${CROSS_BINUTILS_PREFIX})
364 BFLAGS+= -B${CROSS_BINUTILS_PREFIX}
367 BFLAGS+= -B${WORLDTMP}/usr/bin
369 .if ${TARGET} == "arm"
370 .if ${TARGET_ARCH:M*hf*} != ""
371 TARGET_ABI= gnueabihf
376 .if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc
377 XCFLAGS+= -isystem ${WORLDTMP}/usr/include -L${WORLDTMP}/usr/lib
378 XCXXFLAGS+= -I${WORLDTMP}/usr/include/c++/v1 -std=gnu++11 -L${WORLDTMP}/../lib/libc++
379 DEPFLAGS+= -I${WORLDTMP}/usr/include/c++/v1
382 TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0
383 XCFLAGS+= -target ${TARGET_TRIPLE}
384 XCFLAGS+= --sysroot=${WORLDTMP} ${BFLAGS}
385 XCXXFLAGS+= --sysroot=${WORLDTMP} ${BFLAGS}
388 .if defined(CROSS_BINUTILS_PREFIX) && exists(${CROSS_BINUTILS_PREFIX})
389 BFLAGS+= -B${CROSS_BINUTILS_PREFIX}
391 XCXXFLAGS+= ${BFLAGS}
395 WMAKE= ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 DESTDIR=${WORLDTMP}
397 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
399 LIB32_OBJTREE= ${OBJTREE}${.CURDIR}/world32
400 LIB32TMP= ${OBJTREE}${.CURDIR}/lib32
402 .if ${TARGET_ARCH} == "amd64"
403 .if empty(TARGET_CPUTYPE)
404 LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2
406 LIB32CPUFLAGS= -march=${TARGET_CPUTYPE}
408 LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \
409 MACHINE_CPU="i686 mmx sse sse2"
412 LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32"
414 .elif ${TARGET_ARCH} == "powerpc64"
415 .if empty(TARGET_CPUTYPE)
416 LIB32CPUFLAGS= -mcpu=powerpc
418 LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE}
420 LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc
422 LD="${LD} -m elf32ppc_fbsd"
426 LIB32FLAGS= -m32 ${LIB32CPUFLAGS} -DCOMPAT_32BIT \
427 -isystem ${LIB32TMP}/usr/include/ \
428 -L${LIB32TMP}/usr/lib32 \
429 -B${LIB32TMP}/usr/lib32
431 LIB32FLAGS+= --sysroot=${WORLDTMP}
434 # Yes, the flags are redundant.
435 LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${LIB32_OBJTREE} \
436 _SHLIBDIRPREFIX=${LIB32TMP} \
437 _LDSCRIPTROOT=${LIB32TMP} \
438 VERSION="${VERSION}" \
439 INSTALL="sh ${.CURDIR}/tools/install.sh" \
442 SHLIBDIR=/usr/lib32 \
443 LIBPRIVATEDIR=/usr/lib32/private \
444 DTRACE="${DTRACE} -32"
445 LIB32WMAKEFLAGS+= CC="${XCC} ${LIB32FLAGS}" \
446 CXX="${XCXX} ${LIB32FLAGS}" \
447 DESTDIR=${LIB32TMP} \
455 LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} ${LIB32WMAKEFLAGS} \
457 LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} \
458 MK_TOOLCHAIN=no ${IMAKE_INSTALL}
461 IMAKEENV= ${CROSSENV:N_LDSCRIPTROOT=*}
462 IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 \
463 ${IMAKE_INSTALL} ${IMAKE_MTREE}
464 .if empty(.MAKEFLAGS:M-n)
465 IMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMP} \
466 LD_LIBRARY_PATH=${INSTALLTMP} \
467 PATH_LOCALE=${INSTALLTMP}/locale
468 IMAKE+= __MAKE_SHELL=${INSTALLTMP}/sh
470 IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP}
472 .if defined(DB_FROM_SRC)
473 INSTALLFLAGS+= -N ${.CURDIR}/etc
474 MTREEFLAGS+= -N ${.CURDIR}/etc
476 _INSTALL_DDIR= ${DESTDIR}/${DISTDIR}
477 INSTALL_DDIR= ${_INSTALL_DDIR:S://:/:g:C:/$::}
479 METALOG?= ${DESTDIR}/${DISTDIR}/METALOG
480 IMAKE+= -DNO_ROOT METALOG=${METALOG}
481 INSTALLFLAGS+= -U -M ${METALOG} -D ${INSTALL_DDIR}
484 .if defined(DB_FROM_SRC) || defined(NO_ROOT)
485 IMAKE_INSTALL= INSTALL="install ${INSTALLFLAGS}"
486 IMAKE_MTREE= MTREE_CMD="mtree ${MTREEFLAGS}"
490 KMAKEENV= ${WMAKEENV}
491 KMAKE= ${KMAKEENV} ${MAKE} ${.MAKEFLAGS} ${KERNEL_FLAGS} KERNEL=${INSTKERNNAME}
496 # Attempt to rebuild the entire system, with reasonable chance of
497 # success, regardless of how old your existing system is.
500 .if ${.CURDIR:C/[^,]//g} != ""
501 # The m4 build of sendmail files doesn't like it if ',' is used
502 # anywhere in the path of it's files.
504 @echo "*** Error: path to source tree contains a comma ','"
509 @echo "--------------------------------------------------------------"
510 @echo ">>> Rebuilding the temporary build tree"
511 @echo "--------------------------------------------------------------"
512 .if !defined(NO_CLEAN)
514 .if defined(LIB32TMP)
518 rm -rf ${WORLDTMP}/legacy/usr/include
519 # XXX - These three can depend on any header file.
520 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
521 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c
522 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
525 lib usr legacy/bin legacy/usr
526 mkdir -p ${WORLDTMP}/${_dir}
528 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
529 -p ${WORLDTMP}/legacy/usr >/dev/null
530 .if ${MK_GROFF} != "no"
531 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.groff.dist \
532 -p ${WORLDTMP}/legacy/usr >/dev/null
534 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
535 -p ${WORLDTMP}/usr >/dev/null
536 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
537 -p ${WORLDTMP}/usr/include >/dev/null
538 ln -sf ${.CURDIR}/sys ${WORLDTMP}
539 .if ${MK_DEBUG_FILES} != "no"
540 # We could instead disable debug files for these build stages
541 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
542 -p ${WORLDTMP}/legacy/usr/lib >/dev/null
543 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
544 -p ${WORLDTMP}/usr/lib >/dev/null
546 .if ${MK_TESTS} != "no"
547 mkdir -p ${WORLDTMP}${TESTSBASE}
548 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
549 -p ${WORLDTMP}${TESTSBASE} >/dev/null
551 .for _mtree in ${LOCAL_MTREE}
552 mtree -deU -f ${.CURDIR}/${_mtree} -p ${WORLDTMP} > /dev/null
556 @echo "--------------------------------------------------------------"
557 @echo ">>> stage 1.1: legacy release compatibility shims"
558 @echo "--------------------------------------------------------------"
559 ${_+_}cd ${.CURDIR}; ${BMAKE} legacy
562 @echo "--------------------------------------------------------------"
563 @echo ">>> stage 1.2: bootstrap tools"
564 @echo "--------------------------------------------------------------"
565 ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools
567 .if !defined(NO_CLEAN)
569 @echo "--------------------------------------------------------------"
570 @echo ">>> stage 2.1: cleaning up the object tree"
571 @echo "--------------------------------------------------------------"
572 ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
573 .if defined(LIB32TMP)
574 ${_+_}cd ${.CURDIR}; ${LIB32WMAKE} -f Makefile.inc1 ${CLEANDIR:S/^/par-/}
579 @echo "--------------------------------------------------------------"
580 @echo ">>> stage 2.2: rebuilding the object tree"
581 @echo "--------------------------------------------------------------"
582 ${_+_}cd ${.CURDIR}; ${WMAKE} par-obj
585 @echo "--------------------------------------------------------------"
586 @echo ">>> stage 2.3: build tools"
587 @echo "--------------------------------------------------------------"
588 ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools
591 @echo "--------------------------------------------------------------"
592 @echo ">>> stage 3: cross tools"
593 @echo "--------------------------------------------------------------"
594 ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools
595 ${_+_}cd ${.CURDIR}; ${XMAKE} kernel-tools
598 @echo "--------------------------------------------------------------"
599 @echo ">>> stage 4.1: building includes"
600 @echo "--------------------------------------------------------------"
601 ${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
604 @echo "--------------------------------------------------------------"
605 @echo ">>> stage 4.2: building libraries"
606 @echo "--------------------------------------------------------------"
607 ${_+_}cd ${.CURDIR}; \
608 ${WMAKE} -DNO_FSCHG MK_HTML=no -DNO_LINT MK_MAN=no \
609 MK_PROFILE=no MK_TESTS=no MK_TESTS_SUPPORT=${MK_TESTS} libraries
612 @echo "--------------------------------------------------------------"
613 @echo ">>> stage 4.3: make dependencies"
614 @echo "--------------------------------------------------------------"
615 ${_+_}cd ${.CURDIR}; ${WMAKE} par-depend
618 @echo "--------------------------------------------------------------"
619 @echo ">>> stage 4.4: building everything"
620 @echo "--------------------------------------------------------------"
621 ${_+_}cd ${.CURDIR}; ${WMAKE} par-all
622 .if defined(LIB32TMP)
625 @echo "--------------------------------------------------------------"
626 @echo ">>> stage 5.1: building 32 bit shim libraries"
627 @echo "--------------------------------------------------------------"
628 mkdir -p ${LIB32TMP}/usr/include
629 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
630 -p ${LIB32TMP}/usr >/dev/null
631 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
632 -p ${LIB32TMP}/usr/include >/dev/null
633 .if ${MK_DEBUG_FILES} != "no"
634 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
635 -p ${LIB32TMP}/usr/lib >/dev/null
638 ln -sf ${.CURDIR}/sys ${WORLDTMP}
639 .for _t in obj includes
640 cd ${.CURDIR}/include; ${LIB32WMAKE} DIRPRFX=include/ ${_t}
641 cd ${.CURDIR}/lib; ${LIB32WMAKE} DIRPRFX=lib/ ${_t}
642 .if ${MK_CDDL} != "no"
643 cd ${.CURDIR}/cddl/lib; ${LIB32WMAKE} DIRPRFX=cddl/lib/ ${_t}
645 cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} DIRPRFX=gnu/lib/ ${_t}
646 .if ${MK_CRYPT} != "no"
647 cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} DIRPRFX=secure/lib/ ${_t}
649 .if ${MK_KERBEROS} != "no"
650 cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} DIRPRFX=kerberos5/lib ${_t}
653 .for _dir in usr.bin/lex/lib
654 cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} DIRPRFX=${_dir}/ obj
656 .for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic
657 cd ${.CURDIR}/${_dir}; \
658 WORLDTMP=${WORLDTMP} \
659 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
660 MAKEOBJDIRPREFIX=${LIB32_OBJTREE} ${MAKE} SSP_CFLAGS= DESTDIR= \
661 DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
665 ${LIB32WMAKE} -f Makefile.inc1 libraries
666 .for _t in obj depend all
667 cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32WMAKE} \
668 DIRPRFX=libexec/rtld-elf/ ${_t}
669 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32WMAKE} \
670 DIRPRFX=usr.bin/ldd ${_t}
673 distribute32 install32:
674 cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
675 .if ${MK_CDDL} != "no"
676 cd ${.CURDIR}/cddl/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
678 cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
679 .if ${MK_CRYPT} != "no"
680 cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
682 .if ${MK_KERBEROS} != "no"
683 cd ${.CURDIR}/kerberos5/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
685 cd ${.CURDIR}/libexec/rtld-elf; \
686 PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//}
687 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32IMAKE} ${.TARGET:S/32$//}
691 .if !defined(SUBDIR_OVERRIDE)
692 WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools
694 WMAKE_TGTS+= _cleanobj _obj _build-tools
695 .if !defined(SUBDIR_OVERRIDE)
696 WMAKE_TGTS+= _cross-tools
698 WMAKE_TGTS+= _includes _libraries _depend everything
699 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
703 buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
704 .ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
707 @echo "--------------------------------------------------------------"
708 @echo ">>> World build started on `LC_ALL=C date`"
709 @echo "--------------------------------------------------------------"
713 @echo "--------------------------------------------------------------"
714 @echo ">>> World build completed on `LC_ALL=C date`"
715 @echo "--------------------------------------------------------------"
718 # We need to have this as a target because the indirection between Makefile
719 # and Makefile.inc1 causes the correct PATH to be used, rather than a
720 # modification of the current environment's PATH. In addition, we need
721 # to quote multiword values.
726 .if ${.TARGETS:Mbuildenv}
727 .if ${.MAKEFLAGS:M-j}
728 .error The buildenv target is incompatible with -j
732 @echo Entering world for ${TARGET_ARCH}:${TARGET}
733 @cd ${.CURDIR} && env ${WMAKEENV} ${BUILDENV_SHELL} || true
735 TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything:Nbuild32}
736 toolchain: ${TOOLCHAIN_TGTS}
737 kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries}
742 # Checks to be sure system is ready for installworld/installkernel.
744 installcheck: _installcheck_world _installcheck_kernel
746 _installcheck_kernel:
749 # Require DESTDIR to be set if installing for a different architecture or
750 # using the user/group database in the source tree.
752 .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE} || \
754 .if !make(distributeworld)
755 _installcheck_world: __installcheck_DESTDIR
756 _installcheck_kernel: __installcheck_DESTDIR
757 __installcheck_DESTDIR:
758 .if !defined(DESTDIR) || empty(DESTDIR)
759 @echo "ERROR: Please set DESTDIR!"; \
765 .if !defined(DB_FROM_SRC)
767 # Check for missing UIDs/GIDs.
769 CHECK_UIDS= auditdistd
771 .if ${MK_SENDMAIL} != "no"
777 CHECK_GIDS+= proxy authpf
779 .if ${MK_UNBOUND} != "no"
783 _installcheck_world: __installcheck_UGID
785 .for uid in ${CHECK_UIDS}
786 @if ! `id -u ${uid} >/dev/null 2>&1`; then \
787 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \
791 .for gid in ${CHECK_GIDS}
792 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \
793 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \
800 # Required install tools to be saved in a scratch dir for safety.
802 .if ${MK_ZONEINFO} != "no"
803 _zoneinfo= zic tzsetup
806 ITOOLS= [ awk cap_mkdb cat chflags chmod chown \
807 date echo egrep find grep id install ${_install-info} \
808 ln lockf make mkdir mtree mv pwd_mkdb \
809 rm sed services_mkdb sh strip sysctl test true uname wc ${_zoneinfo} \
812 # Needed for share/man
813 .if ${MK_MAN} != "no"
820 # Distributes everything compiled by a `buildworld'.
824 # Installs everything compiled by a 'buildworld'.
827 # Non-base distributions produced by the base system
828 EXTRA_DISTRIBUTIONS= doc
829 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
830 EXTRA_DISTRIBUTIONS+= lib32
832 .if ${MK_TESTS} != "no"
833 EXTRA_DISTRIBUTIONS+= tests
837 .if ${MK_DEBUG_FILES} != "no"
838 DEBUG_DISTRIBUTIONS+= base ${EXTRA_DISTRIBUTIONS:S,doc,,:S,tests,,}
841 MTREE_MAGIC?= mtree 2.0
843 distributeworld installworld: _installcheck_world
844 mkdir -p ${INSTALLTMP}
845 progs=$$(for prog in ${ITOOLS}; do \
846 if progpath=`which $$prog`; then \
849 echo "Required tool $$prog not found in PATH." >&2; \
853 libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | \
854 while read line; do \
856 if [ "$$2 $$3" != "not found" ]; then \
859 echo "Required library $$1 not found." >&2; \
863 cp $$libs $$progs ${INSTALLTMP}
864 cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale
866 echo "#${MTREE_MAGIC}" > ${METALOG}
868 .if make(distributeworld)
869 .for dist in ${EXTRA_DISTRIBUTIONS}
870 -mkdir ${DESTDIR}/${DISTDIR}/${dist}
871 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
872 -p ${DESTDIR}/${DISTDIR}/${dist} >/dev/null
873 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
874 -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null
875 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
876 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/include >/dev/null
877 .if ${MK_DEBUG_FILES} != "no"
878 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
879 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib >/dev/null
881 .if ${MK_TESTS} != "no" && ${dist} == "tests"
882 -mkdir -p ${DESTDIR}/${DISTDIR}/${dist}${TESTSBASE}
883 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
884 -p ${DESTDIR}/${DISTDIR}/${dist}${TESTSBASE} >/dev/null
887 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \
888 sed -e 's#^\./#./${dist}/#' >> ${METALOG}
889 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.usr.dist | \
890 sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG}
891 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.include.dist | \
892 sed -e 's#^\./#./${dist}/usr/include/#' >> ${METALOG}
895 -mkdir ${DESTDIR}/${DISTDIR}/base
896 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
897 METALOG=${METALOG} ${IMAKE_INSTALL} ${IMAKE_MTREE} \
898 DISTBASE=/base DESTDIR=${DESTDIR}/${DISTDIR}/base \
899 LOCAL_MTREE=${LOCAL_MTREE:Q} distrib-dirs
901 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \
902 ${IMAKEENV} rm -rf ${INSTALLTMP}
903 .if make(distributeworld)
904 .for dist in ${EXTRA_DISTRIBUTIONS}
905 find ${DESTDIR}/${DISTDIR}/${dist} -mindepth 1 -empty -delete
908 .for dist in base ${EXTRA_DISTRIBUTIONS}
909 @# For each file that exists in this dist, print the corresponding
910 @# line from the METALOG. This relies on the fact that
911 @# a line containing only the filename will sort immediatly before
912 @# the relevant mtree line.
913 cd ${DESTDIR}/${DISTDIR}; \
914 find ./${dist} | sort -u ${METALOG} - | \
915 awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \
916 ${DESTDIR}/${DISTDIR}/${dist}.meta
918 .for dist in ${DEBUG_DISTRIBUTIONS}
919 @# For each file that exists in this dist, print the corresponding
920 @# line from the METALOG. This relies on the fact that
921 @# a line containing only the filename will sort immediatly before
922 @# the relevant mtree line.
923 cd ${DESTDIR}/${DISTDIR}; \
924 find ./${dist}/usr/lib/debug | sort -u ${METALOG} - | \
925 awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \
926 ${DESTDIR}/${DISTDIR}/${dist}.debug.meta
932 .for dist in base ${EXTRA_DISTRIBUTIONS}
934 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
935 tar cvf - --exclude usr/lib/debug \
936 @${DESTDIR}/${DISTDIR}/${dist}.meta | \
937 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/${dist}.txz
939 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
940 tar cvf - --exclude usr/lib/debug . | \
941 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/${dist}.txz
945 .for dist in ${DEBUG_DISTRIBUTIONS}
946 . if defined(NO_ROOT)
947 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
948 tar cvf - @${DESTDIR}/${DISTDIR}/${dist}.debug.meta | \
949 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/${dist}-dbg.txz
951 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
952 tar cvLf - usr/lib/debug | \
953 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/${dist}-dbg.txz
960 # If you have a build server, you can NFS mount the source and obj directories
961 # and do a 'make reinstall' on the *client* to install new binaries from the
962 # most recent server build.
965 @echo "--------------------------------------------------------------"
966 @echo ">>> Making hierarchy"
967 @echo "--------------------------------------------------------------"
968 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 \
969 LOCAL_MTREE=${LOCAL_MTREE:Q} hierarchy
971 @echo "--------------------------------------------------------------"
972 @echo ">>> Installing everything"
973 @echo "--------------------------------------------------------------"
974 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
975 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
976 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32
980 @echo "--------------------------------------------------------------"
981 @echo ">>> Distributing everything"
982 @echo "--------------------------------------------------------------"
983 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
984 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
985 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 \
989 distrib-dirs distribution: .MAKE
990 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
991 ${IMAKE_INSTALL} ${IMAKE_MTREE} METALOG=${METALOG} ${.TARGET}
994 # buildkernel and installkernel
996 # Which kernels to build and/or install is specified by setting
997 # KERNCONF. If not defined a GENERIC kernel is built/installed.
998 # Only the existing (depending TARGET) config files are used
999 # for building kernels and only the first of these is designated
1000 # as the one being installed.
1002 # Note that we have to use TARGET instead of TARGET_ARCH when
1003 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
1004 # be set to cross-build, we have to make sure TARGET is set
1007 .if defined(KERNFAST)
1012 # Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah
1013 .if !defined(KERNCONF) && ${KERNFAST} != "1"
1014 KERNCONF=${KERNFAST}
1017 .if ${TARGET_ARCH} == "powerpc64"
1018 KERNCONF?= GENERIC64
1022 INSTKERNNAME?= kernel
1024 KERNSRCDIR?= ${.CURDIR}/sys
1025 KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf
1026 KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR}
1027 KERNCONFDIR?= ${KRNLCONFDIR}
1031 .for _kernel in ${KERNCONF}
1032 .if exists(${KERNCONFDIR}/${_kernel})
1033 BUILDKERNELS+= ${_kernel}
1034 .if empty(INSTALLKERNEL)
1035 INSTALLKERNEL= ${_kernel}
1040 buildkernel ${WMAKE_TGTS} ${.ALLTARGETS:M_*}: .MAKE
1045 # Builds all kernels defined by BUILDKERNELS.
1048 .if empty(BUILDKERNELS)
1049 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \
1053 .for _kernel in ${BUILDKERNELS}
1054 @echo "--------------------------------------------------------------"
1055 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
1056 @echo "--------------------------------------------------------------"
1057 @echo "===> ${_kernel}"
1058 mkdir -p ${KRNLOBJDIR}
1059 .if !defined(NO_KERNELCONFIG)
1061 @echo "--------------------------------------------------------------"
1062 @echo ">>> stage 1: configuring the kernel"
1063 @echo "--------------------------------------------------------------"
1064 cd ${KRNLCONFDIR}; \
1066 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
1067 -I '${KERNCONFDIR}' '${KERNCONFDIR}/${_kernel}'
1069 .if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN)
1071 @echo "--------------------------------------------------------------"
1072 @echo ">>> stage 2.1: cleaning up the object tree"
1073 @echo "--------------------------------------------------------------"
1074 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR}
1076 .if !defined(NO_KERNELOBJ)
1078 @echo "--------------------------------------------------------------"
1079 @echo ">>> stage 2.2: rebuilding the object tree"
1080 @echo "--------------------------------------------------------------"
1081 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj
1084 @echo "--------------------------------------------------------------"
1085 @echo ">>> stage 2.3: build tools"
1086 @echo "--------------------------------------------------------------"
1087 ${_+_}cd ${.CURDIR}; ${KTMAKE} kernel-tools
1088 .if !defined(NO_KERNELDEPEND)
1090 @echo "--------------------------------------------------------------"
1091 @echo ">>> stage 3.1: making dependencies"
1092 @echo "--------------------------------------------------------------"
1093 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ
1096 @echo "--------------------------------------------------------------"
1097 @echo ">>> stage 3.2: building everything"
1098 @echo "--------------------------------------------------------------"
1099 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ
1100 @echo "--------------------------------------------------------------"
1101 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
1102 @echo "--------------------------------------------------------------"
1106 # installkernel, etc.
1108 # Install the kernel defined by INSTALLKERNEL
1110 installkernel installkernel.debug \
1111 reinstallkernel reinstallkernel.debug: _installcheck_kernel
1112 .if empty(INSTALLKERNEL)
1113 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
1116 @echo "--------------------------------------------------------------"
1117 @echo ">>> Installing kernel ${INSTALLKERNEL}"
1118 @echo "--------------------------------------------------------------"
1119 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
1120 ${CROSSENV} PATH=${TMPPATH} \
1121 ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
1123 distributekernel distributekernel.debug:
1124 .if empty(INSTALLKERNEL)
1125 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
1128 mkdir -p ${DESTDIR}/${DISTDIR}
1129 .if defined(NO_ROOT)
1130 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.premeta
1132 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
1133 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.premeta/} \
1134 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} KERNEL=${INSTKERNNAME} \
1135 DESTDIR=${INSTALL_DDIR}/kernel \
1136 ${.TARGET:S/distributekernel/install/}
1137 .if defined(NO_ROOT)
1138 sed -e 's|^./kernel|.|' ${DESTDIR}/${DISTDIR}/kernel.premeta > \
1139 ${DESTDIR}/${DISTDIR}/kernel.meta
1141 .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
1142 .if defined(NO_ROOT)
1143 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta
1145 cd ${KRNLOBJDIR}/${_kernel}; \
1146 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.${_kernel}.premeta/} \
1147 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} \
1148 KERNEL=${INSTKERNNAME}.${_kernel} \
1149 DESTDIR=${INSTALL_DDIR}/kernel.${_kernel} \
1150 ${.TARGET:S/distributekernel/install/}
1151 .if defined(NO_ROOT)
1152 sed -e 's|^./kernel|.|' \
1153 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta > \
1154 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta
1159 .if defined(NO_ROOT)
1160 cd ${DESTDIR}/${DISTDIR}/kernel; \
1161 tar cvf - @${DESTDIR}/${DISTDIR}/kernel.meta | \
1162 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.txz
1163 .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
1164 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
1165 tar cvf - @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta | \
1166 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz
1169 cd ${DESTDIR}/${DISTDIR}/kernel; \
1171 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.txz
1172 .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
1173 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
1175 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz
1182 # Build the API documentation with doxygen
1185 @if [ ! -x `/usr/bin/which doxygen` ]; then \
1186 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \
1189 cd ${.CURDIR}/tools/kerneldoc/subsys && ${MAKE} obj all
1194 # Update the source tree(s), by running svn/svnup to update to the
1198 .if (defined(CVS_UPDATE) || defined(SUP_UPDATE)) && !defined(SVN_UPDATE)
1199 @echo "--------------------------------------------------------------"
1200 @echo "CVS_UPDATE and SUP_UPDATE are no longer supported."
1201 @echo "Please see: https://wiki.freebsd.org/CvsIsDeprecated"
1202 @echo "--------------------------------------------------------------"
1205 .if defined(SVN_UPDATE)
1206 @echo "--------------------------------------------------------------"
1207 @echo ">>> Updating ${.CURDIR} using Subversion"
1208 @echo "--------------------------------------------------------------"
1209 @(cd ${.CURDIR} && ${SVN} update ${SVNFLAGS})
1213 # ------------------------------------------------------------------------
1215 # From here onwards are utility targets used by the 'make world' and
1216 # related targets. If your 'world' breaks, you may like to try to fix
1217 # the problem and manually run the following targets to attempt to
1218 # complete the build. Beware, this is *not* guaranteed to work, you
1219 # need to have a pretty good grip on the current state of the system
1220 # to attempt to manually finish it. If in doubt, 'make world' again.
1224 # legacy: Build compatibility shims for the next three targets
1227 .if ${BOOTSTRAPPING} < 800107 && ${BOOTSTRAPPING} != 0
1228 @echo "ERROR: Source upgrades from versions prior to 8.0 not supported."; \
1231 .for _tool in tools/build
1232 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \
1233 cd ${.CURDIR}/${_tool} && \
1234 ${MAKE} DIRPRFX=${_tool}/ obj && \
1235 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes && \
1236 ${MAKE} DIRPRFX=${_tool}/ depend && \
1237 ${MAKE} DIRPRFX=${_tool}/ all && \
1238 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
1242 # bootstrap-tools: Build tools needed for compatibility
1244 _bt= _bootstrap-tools
1246 .if ${MK_GAMES} != "no"
1247 _strfile= games/fortune/strfile
1250 .if ${MK_CXX} != "no"
1251 _gperf= gnu/usr.bin/gperf
1254 .if ${MK_GROFF} != "no"
1255 _groff= gnu/usr.bin/groff
1258 .if ${MK_VT} != "no"
1259 _vtfontcvt= usr.bin/vtfontcvt
1262 .if ${BOOTSTRAPPING} < 900002
1266 .if ${BOOTSTRAPPING} < 1000002
1270 ${_bt}-usr.bin/m4: ${_bt}-lib/libohash
1273 .if ${BOOTSTRAPPING} < 1000014
1274 _crunch= usr.sbin/crunch
1277 .if ${BOOTSTRAPPING} < 1000026
1278 _nmtree= lib/libnetbsd \
1281 ${_bt}-usr.sbin/nmtree: ${_bt}-lib/libnetbsd
1284 .if ${BOOTSTRAPPING} < 1000027
1288 .if ${BOOTSTRAPPING} < 1000033
1292 .if ${BOOTSTRAPPING} >= 900040 && ${BOOTSTRAPPING} < 900041
1296 .if ${BOOTSTRAPPING} < 1001506
1300 ${_bt}-usr.bin/yacc: ${_bt}-lib/liby
1303 .if ${MK_BSNMP} != "no"
1304 _gensnmptree= usr.sbin/bsnmpd/gensnmptree
1307 # We need to build tblgen when we're building clang either as
1308 # the bootstrap compiler, or as the part of the normal build.
1309 .if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_CLANG} != "no"
1311 lib/clang/libllvmsupport \
1312 lib/clang/libllvmtablegen \
1313 usr.bin/clang/tblgen \
1314 usr.bin/clang/clang-tblgen
1316 ${_bt}-usr.bin/clang/clang-tblgen: ${_bt}-lib/clang/libllvmtablegen ${_bt}-lib/clang/libllvmsupport
1317 ${_bt}-usr.bin/clang/tblgen: ${_bt}-lib/clang/libllvmtablegen ${_bt}-lib/clang/libllvmsupport
1320 # ELF Tool Chain libraries are needed for ELF tools and dtrace tools.
1321 # dtrace tools are required for older bootstrap env and cross-build
1323 .if ${BOOTSTRAPPING} < 1100006 || (${MACHINE} != ${TARGET} || \
1324 ${MACHINE_ARCH} != ${TARGET_ARCH})
1325 _elftoolchain_libs= lib/libelf lib/libdwarf
1326 .if ${MK_CDDL} != "no"
1327 _dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf cddl/usr.bin/ctfconvert \
1328 cddl/usr.bin/ctfmerge
1330 ${_bt}-cddl/usr.bin/ctfconvert: ${_bt}-lib/libelf ${_bt}-lib/libdwarf ${_bt}-cddl/lib/libctf
1331 ${_bt}-cddl/usr.bin/ctfmerge: ${_bt}-lib/libelf ${_bt}-lib/libdwarf ${_bt}-cddl/lib/libctf
1335 # Default to building the GPL DTC, but build the BSDL one if users explicitly
1338 .if ${MK_GPL_DTC} != "no"
1339 _dtc= gnu/usr.bin/dtc
1342 .if ${MK_KERBEROS} != "no"
1343 _kerberos5_bootstrap_tools= \
1344 kerberos5/tools/make-roken \
1345 kerberos5/lib/libroken \
1346 kerberos5/lib/libvers \
1347 kerberos5/tools/asn1_compile \
1348 kerberos5/tools/slc \
1351 ${_bt}-kerberos5/tools/slc: ${_bt}-kerberos5/lib/libroken
1352 ${_bt}-kerberos5/tools/asn1_compile: ${_bt}-kerberos5/lib/libroken
1355 bootstrap-tools: .PHONY
1357 # Please document (add comment) why something is in 'bootstrap-tools'.
1358 # Try to bound the building of the bootstrap-tool to just the
1359 # FreeBSD versions that need the tool built at this stage of the build.
1362 ${_kerberos5_bootstrap_tools} \
1363 ${_elftoolchain_libs} \
1372 usr.bin/makewhatis \
1385 ${_bt}-${_tool}: .PHONY .MAKE
1386 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1387 cd ${.CURDIR}/${_tool} && \
1388 ${MAKE} DIRPRFX=${_tool}/ obj && \
1389 ${MAKE} DIRPRFX=${_tool}/ depend && \
1390 ${MAKE} DIRPRFX=${_tool}/ all && \
1391 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
1393 bootstrap-tools: ${_bt}-${_tool}
1397 # build-tools: Build special purpose build tools
1399 .if !defined(NO_SHARE)
1400 _share= share/syscons/scrnmaps
1403 .if ${MK_GCC} != "no"
1404 _gcc_tools= gnu/usr.bin/cc/cc_tools
1407 .if ${MK_RESCUE} != "no"
1408 _rescue= rescue/rescue
1416 ${LOCAL_TOOL_DIRS} \
1417 lib/ncurses/ncurses \
1418 lib/ncurses/ncursesw \
1422 usr.bin/mkesdb_static \
1423 usr.bin/mkcsmapper_static \
1425 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \
1426 cd ${.CURDIR}/${_tool} && \
1427 ${MAKE} DIRPRFX=${_tool}/ obj && \
1428 ${MAKE} DIRPRFX=${_tool}/ build-tools
1432 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \
1433 cd ${.CURDIR}/${_tool} && \
1434 ${MAKE} DIRPRFX=${_tool}/ obj && \
1435 ${MAKE} DIRPRFX=${_tool}/ depend && \
1436 ${MAKE} DIRPRFX=${_tool}/ all
1440 # kernel-tools: Build kernel-building tools
1443 mkdir -p ${MAKEOBJDIRPREFIX}/usr
1444 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1445 -p ${MAKEOBJDIRPREFIX}/usr >/dev/null
1448 # cross-tools: Build cross-building tools
1450 .if ${TARGET_ARCH} != ${MACHINE_ARCH}
1451 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386"
1452 _btxld= usr.sbin/btxld
1455 .if ${TARGET_ARCH} != ${MACHINE_ARCH}
1456 .if ${MK_RESCUE} != "no" || defined(RELEASEDIR)
1457 _crunchide= usr.sbin/crunch/crunchide
1459 .if ${TARGET_ARCH} == "i386" && defined(RELEASEDIR)
1460 _kgzip= usr.sbin/kgzip
1464 # If we're given an XAS, don't build binutils.
1465 .if ${XAS:M/*} == ""
1466 .if ${MK_BINUTILS_BOOTSTRAP} != "no"
1467 _binutils= gnu/usr.bin/binutils
1469 .if ${MK_ELFTOOLCHAIN_TOOLS} != "no"
1470 _elftctools= lib/libelftc \
1475 # These are not required by the build, but can be useful for developers who
1476 # cross-build on a FreeBSD 10 host:
1477 _elftctools+= usr.bin/addr2line
1479 .elif ${TARGET_ARCH} != ${MACHINE_ARCH} && ${MK_ELFTOOLCHAIN_TOOLS} != "no"
1480 # If cross-building with an external binutils we still need to build strip for
1481 # the target (for at least crunchide).
1482 _elftctools= lib/libelftc \
1486 # If an full path to an external cross compiler is given, don't build
1488 .if ${XCC:M/*} == "" && ${MK_CROSS_COMPILER} != "no"
1489 .if ${MK_CLANG_BOOTSTRAP} != "no"
1490 _clang= usr.bin/clang
1491 _clang_libs= lib/clang
1493 .if ${MK_GCC_BOOTSTRAP} != "no"
1509 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1510 cd ${.CURDIR}/${_tool} && \
1511 ${MAKE} DIRPRFX=${_tool}/ obj && \
1512 ${MAKE} DIRPRFX=${_tool}/ depend && \
1513 ${MAKE} DIRPRFX=${_tool}/ all && \
1514 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
1517 NXBENV= MAKEOBJDIRPREFIX=${OBJTREE}/nxb \
1518 INSTALL="sh ${.CURDIR}/tools/install.sh" \
1519 VERSION="${VERSION}"
1520 NXBMAKE= ${NXBENV} ${MAKE} \
1521 TBLGEN=${OBJTREE}/nxb-bin/usr/bin/tblgen \
1522 CLANG_TBLGEN=${OBJTREE}/nxb-bin/usr/bin/clang-tblgen \
1523 MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH} \
1524 MK_GDB=no MK_TESTS=no \
1526 MK_HTML=no NO_LINT=yes MK_MAN=no \
1527 -DNO_PIC MK_PROFILE=no -DNO_SHARED \
1528 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
1529 MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \
1532 native-xtools: .MAKE
1533 mkdir -p ${OBJTREE}/nxb-bin/bin
1534 mkdir -p ${OBJTREE}/nxb-bin/sbin
1535 mkdir -p ${OBJTREE}/nxb-bin/usr
1536 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1537 -p ${OBJTREE}/nxb-bin/usr >/dev/null
1538 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
1539 -p ${OBJTREE}/nxb-bin/usr/include >/dev/null
1599 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1600 cd ${.CURDIR}/${_tool} && \
1601 ${NXBMAKE} DIRPRFX=${_tool}/ obj && \
1602 ${NXBMAKE} DIRPRFX=${_tool}/ depend && \
1603 ${NXBMAKE} DIRPRFX=${_tool}/ all && \
1604 ${NXBMAKE} DIRPRFX=${_tool}/ DESTDIR=${OBJTREE}/nxb-bin install
1608 # hierarchy - ensure that all the needed directories are present
1610 hierarchy hier: .MAKE
1611 cd ${.CURDIR}/etc && ${HMAKE} distrib-dirs
1614 # libraries - build all libraries, and install them under ${DESTDIR}.
1616 # The list of libraries with dependents (${_prebuild_libs}) and their
1617 # interdependencies (__L) are built automatically by the
1618 # ${.CURDIR}/tools/make_libdeps.sh script.
1622 ${MAKE} -f Makefile.inc1 _prereq_libs && \
1623 ${MAKE} -f Makefile.inc1 _startup_libs && \
1624 ${MAKE} -f Makefile.inc1 _prebuild_libs && \
1625 ${MAKE} -f Makefile.inc1 _generic_libs
1628 # static libgcc.a prerequisite for shared libc
1630 _prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc lib/libcompiler_rt
1632 # These dependencies are not automatically generated:
1634 # gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before
1635 # all shared libraries for ELF.
1637 _startup_libs= gnu/lib/csu
1638 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
1639 _startup_libs+= lib/csu/${MACHINE_ARCH}-elf
1640 .elif exists(${.CURDIR}/lib/csu/${MACHINE_ARCH})
1641 _startup_libs+= lib/csu/${MACHINE_ARCH}
1643 _startup_libs+= lib/csu/${MACHINE_CPUARCH}
1645 _startup_libs+= gnu/lib/libgcc
1646 _startup_libs+= lib/libcompiler_rt
1647 _startup_libs+= lib/libc
1648 _startup_libs+= lib/libc_nonshared
1649 .if ${MK_LIBCPLUSPLUS} != "no"
1650 _startup_libs+= lib/libcxxrt
1653 gnu/lib/libgcc__L: lib/libc__L
1654 gnu/lib/libgcc__L: lib/libc_nonshared__L
1655 .if ${MK_LIBCPLUSPLUS} != "no"
1656 lib/libcxxrt__L: gnu/lib/libgcc__L
1659 _prebuild_libs= ${_kerberos5_lib_libasn1} \
1660 ${_kerberos5_lib_libhdb} \
1661 ${_kerberos5_lib_libheimbase} \
1662 ${_kerberos5_lib_libheimntlm} \
1663 ${_kerberos5_lib_libheimsqlite} \
1664 ${_kerberos5_lib_libheimipcc} \
1665 ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \
1666 ${_kerberos5_lib_libroken} \
1667 ${_kerberos5_lib_libwind} \
1668 lib/libbz2 ${_libcom_err} lib/libcrypt \
1669 lib/libelf lib/libexpat \
1672 lib/libkiconv lib/libkvm lib/liblzma lib/libmd lib/libnv \
1673 ${_lib_libcapsicum} \
1674 lib/ncurses/ncurses lib/ncurses/ncursesw \
1675 lib/libopie lib/libpam ${_lib_libthr} \
1676 ${_lib_libradius} lib/libsbuf lib/libtacplus \
1678 ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \
1679 ${_cddl_lib_libuutil} \
1680 ${_cddl_lib_libavl} \
1681 ${_cddl_lib_libzfs_core} \
1682 ${_cddl_lib_libctf} \
1683 lib/libutil lib/libpjdlog ${_lib_libypclnt} lib/libz lib/msun \
1684 ${_secure_lib_libcrypto} ${_lib_libldns} \
1685 ${_secure_lib_libssh} ${_secure_lib_libssl} \
1687 .if ${MK_GNUCXX} != "no"
1688 _prebuild_libs+= gnu/lib/libstdc++ gnu/lib/libsupc++
1689 gnu/lib/libstdc++__L: lib/msun__L
1690 gnu/lib/libsupc++__L: gnu/lib/libstdc++__L
1693 .if ${MK_LIBCPLUSPLUS} != "no"
1694 _prebuild_libs+= lib/libc++
1697 lib/libgeom__L: lib/libexpat__L
1699 .if ${MK_LIBTHR} != "no"
1700 _lib_libthr= lib/libthr
1703 .if ${MK_RADIUS_SUPPORT} != "no"
1704 _lib_libradius= lib/libradius
1707 .if ${MK_OFED} != "no"
1708 _ofed_lib= contrib/ofed/usr.lib/
1711 .if ${MK_CASPER} != "no"
1712 _lib_libcapsicum=lib/libcapsicum
1715 lib/libcapsicum__L: lib/libnv__L
1716 lib/libpjdlog__L: lib/libutil__L
1717 lib/liblzma__L: lib/libthr__L
1719 _generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib}
1720 .for _DIR in ${LOCAL_LIB_DIRS}
1721 .if exists(${.CURDIR}/${_DIR}/Makefile)
1722 _generic_libs+= ${_DIR}
1726 lib/libopie__L lib/libtacplus__L: lib/libmd__L
1728 .if ${MK_CDDL} != "no"
1729 _cddl_lib_libumem= cddl/lib/libumem
1730 _cddl_lib_libnvpair= cddl/lib/libnvpair
1731 _cddl_lib_libavl= cddl/lib/libavl
1732 _cddl_lib_libuutil= cddl/lib/libuutil
1733 _cddl_lib_libzfs_core= cddl/lib/libzfs_core
1734 _cddl_lib_libctf= cddl/lib/libctf
1736 cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L
1737 cddl/lib/libzfs__L: lib/libgeom__L
1738 cddl/lib/libctf__L: lib/libz__L
1741 .if ${MK_CRYPT} != "no"
1742 .if ${MK_OPENSSL} != "no"
1743 _secure_lib_libcrypto= secure/lib/libcrypto
1744 _secure_lib_libssl= secure/lib/libssl
1745 lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L
1746 .if ${MK_LDNS} != "no"
1747 _lib_libldns= lib/libldns
1748 lib/libldns__L: secure/lib/libcrypto__L
1750 .if ${MK_OPENSSH} != "no"
1751 _secure_lib_libssh= secure/lib/libssh
1752 secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
1753 .if ${MK_LDNS} != "no"
1754 secure/lib/libssh__L: lib/libldns__L
1756 .if ${MK_KERBEROS_SUPPORT} != "no"
1757 secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \
1758 kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \
1759 lib/libmd__L kerberos5/lib/libroken__L
1763 _secure_lib= secure/lib
1766 .if ${MK_KERBEROS} != "no"
1767 kerberos5/lib/libasn1__L: lib/libcom_err__L kerberos5/lib/libroken__L
1768 kerberos5/lib/libhdb__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1769 kerberos5/lib/libkrb5__L kerberos5/lib/libroken__L \
1770 kerberos5/lib/libwind__L kerberos5/lib/libheimsqlite__L
1771 kerberos5/lib/libheimntlm__L: secure/lib/libcrypto__L kerberos5/lib/libkrb5__L \
1772 kerberos5/lib/libroken__L lib/libcom_err__L
1773 kerberos5/lib/libhx509__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1774 secure/lib/libcrypto__L kerberos5/lib/libroken__L kerberos5/lib/libwind__L
1775 kerberos5/lib/libkrb5__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1776 lib/libcrypt__L secure/lib/libcrypto__L kerberos5/lib/libhx509__L \
1777 kerberos5/lib/libroken__L kerberos5/lib/libwind__L \
1778 kerberos5/lib/libheimbase__L kerberos5/lib/libheimipcc__L
1779 kerberos5/lib/libroken__L: lib/libcrypt__L
1780 kerberos5/lib/libwind__L: kerberos5/lib/libroken__L lib/libcom_err__L
1781 kerberos5/lib/libheimbase__L: lib/libthr__L
1782 kerberos5/lib/libheimipcc__L: kerberos5/lib/libroken__L kerberos5/lib/libheimbase__L lib/libthr__L
1783 kerberos5/lib/libheimsqlite__L: lib/libthr__L
1786 .if ${MK_GSSAPI} != "no"
1787 _lib_libgssapi= lib/libgssapi
1790 .if ${MK_KERBEROS} != "no"
1791 _kerberos5_lib= kerberos5/lib
1792 _kerberos5_lib_libasn1= kerberos5/lib/libasn1
1793 _kerberos5_lib_libhdb= kerberos5/lib/libhdb
1794 _kerberos5_lib_libheimbase= kerberos5/lib/libheimbase
1795 _kerberos5_lib_libkrb5= kerberos5/lib/libkrb5
1796 _kerberos5_lib_libhx509= kerberos5/lib/libhx509
1797 _kerberos5_lib_libroken= kerberos5/lib/libroken
1798 _kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm
1799 _kerberos5_lib_libheimsqlite= kerberos5/lib/libheimsqlite
1800 _kerberos5_lib_libheimipcc= kerberos5/lib/libheimipcc
1801 _kerberos5_lib_libwind= kerberos5/lib/libwind
1802 _libcom_err= lib/libcom_err
1805 .if ${MK_NIS} != "no"
1806 _lib_libypclnt= lib/libypclnt
1809 .if ${MK_OPENSSL} == "no"
1810 lib/libradius__L: lib/libmd__L
1813 gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncursesw__L
1815 .for _lib in ${_prereq_libs}
1816 ${_lib}__PL: .PHONY .MAKE
1817 .if exists(${.CURDIR}/${_lib})
1818 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1819 cd ${.CURDIR}/${_lib} && \
1820 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj && \
1821 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ depend && \
1822 ${MAKE} MK_TESTS=no MK_PROFILE=no -DNO_PIC \
1823 DIRPRFX=${_lib}/ all && \
1824 ${MAKE} MK_TESTS=no MK_PROFILE=no -DNO_PIC \
1825 DIRPRFX=${_lib}/ install
1829 .for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
1830 ${_lib}__L: .PHONY .MAKE
1831 .if exists(${.CURDIR}/${_lib})
1832 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1833 cd ${.CURDIR}/${_lib} && \
1834 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj && \
1835 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ depend && \
1836 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ all && \
1837 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ install
1841 # libpam is special: we need to build static PAM modules before
1842 # static PAM library, and dynamic PAM library before dynamic PAM
1844 lib/libpam__L: .PHONY .MAKE
1845 ${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \
1846 cd ${.CURDIR}/lib/libpam && \
1847 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ obj && \
1848 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ depend && \
1849 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ \
1850 -D_NO_LIBPAM_SO_YET all && \
1851 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ \
1852 -D_NO_LIBPAM_SO_YET install
1854 _prereq_libs: ${_prereq_libs:S/$/__PL/}
1855 _startup_libs: ${_startup_libs:S/$/__L/}
1856 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
1857 _generic_libs: ${_generic_libs:S/$/__L/}
1859 .for __target in all clean cleandepend cleandir depend includes obj
1860 .for entry in ${SUBDIR}
1861 ${entry}.${__target}__D: .PHONY .MAKE
1862 ${_+_}@set -e; if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
1863 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \
1864 edir=${entry}.${MACHINE_ARCH}; \
1865 cd ${.CURDIR}/$${edir}; \
1867 ${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \
1869 cd ${.CURDIR}/$${edir}; \
1871 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
1873 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
1876 .include <bsd.subdir.mk>
1878 .if make(check-old) || make(check-old-dirs) || \
1879 make(check-old-files) || make(check-old-libs) || \
1880 make(delete-old) || make(delete-old-dirs) || \
1881 make(delete-old-files) || make(delete-old-libs)
1884 # check for / delete old files section
1887 .include "ObsoleteFiles.inc"
1889 OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \
1890 else you can not start such an application. Consult UPDATING for more \
1891 information regarding how to cope with the removal/revision bump of a \
1894 .if !defined(BATCH_DELETE_OLD_FILES)
1901 @echo ">>> Removing old files (only deletes safe to delete libs)"
1902 # Ask for every old file if the user really wants to remove it.
1903 # It's annoying, but better safe than sorry.
1904 # NB: We cannot pass the list of OLD_FILES as a parameter because the
1905 # argument list will get too long. Using .for/.endfor make "loops" will make
1906 # the Makefile parser segfault.
1909 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1910 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1911 while read file; do \
1912 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1913 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1914 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1917 # Remove catpages without corresponding manpages.
1919 find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1920 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1921 while read catpage; do \
1923 if [ ! -e "$${manpage}" ]; then \
1924 rm ${RM_I} $${catpage} <&3; \
1927 @echo ">>> Old files removed"
1930 @echo ">>> Checking for old files"
1932 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1933 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1934 while read file; do \
1935 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1936 echo "${DESTDIR}/$${file}"; \
1939 # Check for catpages without corresponding manpages.
1940 @find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1941 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1942 while read catpage; do \
1944 if [ ! -e "$${manpage}" ]; then \
1950 @echo ">>> Removing old libraries"
1951 @echo "${OLD_LIBS_MESSAGE}" | fmt
1954 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1955 -V OLD_LIBS | xargs -n1 | \
1956 while read file; do \
1957 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1958 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1959 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1961 for ext in debug symbols; do \
1962 if ! [ -e "${DESTDIR}/$${file}" ] && [ -f \
1963 "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \
1964 rm ${RM_I} "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" \
1969 @echo ">>> Old libraries removed"
1972 @echo ">>> Checking for old libraries"
1974 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1975 -V OLD_LIBS | xargs -n1 | \
1976 while read file; do \
1977 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1978 echo "${DESTDIR}/$${file}"; \
1980 for ext in debug symbols; do \
1981 if [ -f "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \
1982 echo "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}"; \
1988 @echo ">>> Removing old directories"
1990 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1991 -V OLD_DIRS | xargs -n1 | sort -r | \
1992 while read dir; do \
1993 if [ -d "${DESTDIR}/$${dir}" ]; then \
1994 rmdir -v "${DESTDIR}/$${dir}" || true; \
1995 elif [ -L "${DESTDIR}/$${dir}" ]; then \
1996 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1999 @echo ">>> Old directories removed"
2002 @echo ">>> Checking for old directories"
2004 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
2005 -V OLD_DIRS | xargs -n1 | \
2006 while read dir; do \
2007 if [ -d "${DESTDIR}/$${dir}" ]; then \
2008 echo "${DESTDIR}/$${dir}"; \
2009 elif [ -L "${DESTDIR}/$${dir}" ]; then \
2010 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
2014 delete-old: delete-old-files delete-old-dirs
2015 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
2017 check-old: check-old-files check-old-libs check-old-dirs
2018 @echo "To remove old files and directories run '${MAKE} delete-old'."
2019 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
2024 # showconfig - show build configuration.
2027 @(${MAKE} -n -f ${.CURDIR}/sys/conf/kern.opts.mk -V dummy -dg1; \
2028 ${MAKE} -n -f ${.CURDIR}/share/mk/src.opts.mk -V dummy -dg1) 2>&1 | grep ^MK_ | sort -u
2030 .if !empty(KRNLOBJDIR) && !empty(KERNCONF)
2031 DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/
2033 .if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE)
2034 .if exists(${KERNCONFDIR}/${KERNCONF})
2035 FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \
2036 '${KERNCONFDIR}/${KERNCONF}' ; echo
2042 .if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH})
2043 DTBOUTPUTPATH= ${.CURDIR}
2047 # Build 'standalone' Device Tree Blob
2050 @PATH=${TMPPATH} MACHINE=${TARGET} \
2051 ${.CURDIR}/sys/tools/fdt/make_dtb.sh ${.CURDIR}/sys \
2052 "${FDT_DTS_FILE}" ${DTBOUTPUTPATH}
2056 .if defined(TARGET) && defined(TARGET_ARCH)
2058 .if ${TARGET} == ${MACHINE} && ${TARGET_ARCH} == ${MACHINE_ARCH}
2059 XDEV_CPUTYPE?=${CPUTYPE}
2061 XDEV_CPUTYPE?=${TARGET_CPUTYPE}
2064 NOFUN=-DNO_FSCHG MK_HTML=no -DNO_LINT \
2065 MK_MAN=no MK_NLS=no MK_PROFILE=no \
2066 MK_KERBEROS=no MK_RESCUE=no MK_TESTS=no MK_WARNS=no \
2067 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
2068 CPUTYPE=${XDEV_CPUTYPE}
2070 XDDIR=${TARGET_ARCH}-freebsd
2073 .error XDTP variable should be an absolute path
2076 CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \
2077 INSTALL="sh ${.CURDIR}/tools/install.sh"
2079 _SHLIBDIRPREFIX=${XDDESTDIR} \
2080 TOOLS_PREFIX=${XDTP}
2081 CD2CFLAGS=-isystem ${XDDESTDIR}/usr/include -L${XDDESTDIR}/usr/lib \
2082 --sysroot=${XDDESTDIR}/ -B${XDDESTDIR}/usr/libexec \
2083 -B${XDDESTDIR}/usr/bin -B${XDDESTDIR}/usr/lib
2084 CD2ENV=${CDENV} CC="${CC} ${CD2CFLAGS}" CXX="${CXX} ${CD2CFLAGS}" \
2085 CPP="${CPP} ${CD2CFLAGS}" \
2086 MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH}
2088 CDTMP= ${MAKEOBJDIRPREFIX}/${XDDIR}/${.CURDIR}/tmp
2089 CDMAKE=${CDENV} PATH=${CDTMP}/usr/bin:${PATH} ${MAKE} ${NOFUN}
2090 CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDDESTDIR}/usr/bin:${PATH} ${MAKE} ${NOFUN}
2091 XDDESTDIR=${DESTDIR}/${XDTP}
2093 OSREL!= uname -r | sed -e 's/[-(].*//'
2096 .ORDER: xdev-build xdev-install xdev-links
2097 xdev: xdev-build xdev-install
2099 .ORDER: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools
2100 xdev-build: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools
2103 mkdir -p ${CDTMP}/usr
2104 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
2105 -p ${CDTMP}/usr >/dev/null
2107 _xb-bootstrap-tools:
2111 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
2112 cd ${.CURDIR}/${_tool} && \
2113 ${CDMAKE} DIRPRFX=${_tool}/ obj && \
2114 ${CDMAKE} DIRPRFX=${_tool}/ depend && \
2115 ${CDMAKE} DIRPRFX=${_tool}/ all && \
2116 ${CDMAKE} DIRPRFX=${_tool}/ DESTDIR=${CDTMP} install
2120 ${_+_}@cd ${.CURDIR}; \
2121 ${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools
2131 ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \
2132 cd ${.CURDIR}/${_tool} && \
2133 ${CDMAKE} DIRPRFX=${_tool}/ obj && \
2134 ${CDMAKE} DIRPRFX=${_tool}/ depend && \
2135 ${CDMAKE} DIRPRFX=${_tool}/ all
2139 ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}"
2140 mkdir -p ${XDDESTDIR}
2141 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
2142 -p ${XDDESTDIR} >/dev/null
2143 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
2144 -p ${XDDESTDIR}/usr >/dev/null
2145 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
2146 -p ${XDDESTDIR}/usr/include >/dev/null
2147 .if ${MK_TESTS} != "no"
2148 mkdir -p ${XDDESTDIR}${TESTSBASE}
2149 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
2150 -p ${XDDESTDIR}${TESTSBASE} >/dev/null
2153 .ORDER: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries
2154 xdev-install: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries
2157 @echo "_xi-cross-tools"
2165 ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \
2166 cd ${.CURDIR}/${_tool}; \
2167 ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR}
2171 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 par-includes \
2172 DESTDIR=${XDDESTDIR}
2175 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \
2176 DESTDIR=${XDDESTDIR}
2179 ${_+_}cd ${XDDESTDIR}/usr/bin; \
2180 mkdir -p ../../../../usr/bin; \
2182 ln -sf ../../${XDTP}/usr/bin/$$i \
2183 ../../../../usr/bin/${XDDIR}-$$i; \
2184 ln -sf ../../${XDTP}/usr/bin/$$i \
2185 ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \
2188 xdev xdev-build xdev-install xdev-links:
2189 @echo "*** Error: Both TARGET and TARGET_ARCH must be defined for \"${.TARGET}\" target"