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. These are generally
213 # APIs that tools from one of those three stages need to
214 # build that aren't present on the host.
215 # 1. bootstrap-tools stage [BMAKE]
216 # This stage is responsible for creating programs that
217 # are needed for backward compatibility reasons. They
218 # are not built as cross-tools.
219 # 2. build-tools stage [TMAKE]
220 # This stage is responsible for creating the object
221 # tree and building any tools that are needed during
223 # 3. cross-tools stage [XMAKE]
224 # This stage is responsible for creating any tools that
225 # are needed for building the system. A cross-compiler is one
227 # 4. world stage [WMAKE]
228 # This stage actually builds the world.
229 # 5. install stage (optional) [IMAKE]
230 # This stage installs a previously built world.
235 # Common environment for world related stages
236 CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \
237 MACHINE_ARCH=${TARGET_ARCH} \
239 CPUTYPE=${TARGET_CPUTYPE}
240 .if ${MK_GROFF} != "no"
241 CROSSENV+= GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
242 GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \
243 GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac
245 .if defined(TARGET_CFLAGS)
246 CROSSENV+= ${TARGET_CFLAGS}
249 # bootstrap-tools stage
250 BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
251 PATH=${BPATH}:${PATH} \
252 WORLDTMP=${WORLDTMP} \
253 VERSION="${VERSION}" \
254 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}"
255 BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
256 ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
258 BOOTSTRAPPING=${OSRELDATE} \
260 MK_HTML=no NO_LINT=yes MK_MAN=no \
261 -DNO_PIC MK_PROFILE=no -DNO_SHARED \
262 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
263 MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \
264 MK_LLDB=no MK_TESTS=no \
268 TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
269 ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
270 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
272 BOOTSTRAPPING=${OSRELDATE} \
275 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
276 MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \
277 MK_LLDB=no MK_TESTS=no
280 XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \
281 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
282 MK_GDB=no MK_TESTS=no
285 KTMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
286 PATH=${BPATH}:${PATH} \
287 WORLDTMP=${WORLDTMP} \
289 KTMAKE= TOOLS_PREFIX=${WORLDTMP} MAKEOBJDIRPREFIX=${WORLDTMP} \
290 ${KTMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
292 BOOTSTRAPPING=${OSRELDATE} \
294 MK_HTML=no -DNO_LINT MK_MAN=no \
295 -DNO_PIC MK_PROFILE=no -DNO_SHARED \
296 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no
299 WMAKEENV= ${CROSSENV} \
300 _SHLIBDIRPREFIX=${WORLDTMP} \
302 VERSION="${VERSION}" \
303 INSTALL="sh ${.CURDIR}/tools/install.sh" \
307 HMAKE= PATH=${TMPPATH} ${MAKE} LOCAL_MTREE=${LOCAL_MTREE:Q}
309 HMAKE+= PATH=${TMPPATH} METALOG=${METALOG} -DNO_ROOT
312 .if ${MK_CDDL} == "no"
316 .if defined(CROSS_TOOLCHAIN)
317 LOCALBASE?= /usr/local
318 .include "${LOCALBASE}/share/toolchains/${CROSS_TOOLCHAIN}.mk"
320 .if defined(CROSS_TOOLCHAIN_PREFIX)
321 CROSS_COMPILER_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
322 CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
325 # If we do not have a bootstrap binutils (because the in-tree one does not
326 # support the target architecture), provide a default cross-binutils prefix.
327 # This allows aarch64 builds, for example, to automatically use the
328 # aarch64-binutils port or package.
329 .if !empty(BROKEN_OPTIONS:MBINUTILS_BOOTSTRAP) && \
330 !defined(CROSS_BINUTILS_PREFIX)
331 CROSS_BINUTILS_PREFIX=/usr/local/${TARGET_ARCH}-freebsd/bin/
332 .if !exists(${CROSS_BINUTILS_PREFIX})
333 .error In-tree binutils does not support the ${TARGET_ARCH} architecture. Install the ${TARGET_ARCH}-binutils port or package or set CROSS_BINUTILS_PREFIX.
337 XCOMPILERS= CC CXX CPP
338 .for COMPILER in ${XCOMPILERS}
339 .if defined(CROSS_COMPILER_PREFIX)
340 X${COMPILER}?= ${CROSS_COMPILER_PREFIX}${${COMPILER}}
342 X${COMPILER}?= ${${COMPILER}}
345 XBINUTILS= AS AR LD NM OBJCOPY OBJDUMP RANLIB SIZE STRINGS
346 .for BINUTIL in ${XBINUTILS}
347 .if defined(CROSS_BINUTILS_PREFIX)
348 X${BINUTIL}?= ${CROSS_BINUTILS_PREFIX}${${BINUTIL}}
350 X${BINUTIL}?= ${${BINUTIL}}
353 WMAKEENV+= CC="${XCC} ${XCFLAGS}" CXX="${XCXX} ${XCFLAGS} ${XCXXFLAGS}" \
354 DEPFLAGS="${DEPFLAGS}" \
355 CPP="${XCPP} ${XCFLAGS}" \
356 AS="${XAS}" AR="${XAR}" LD="${XLD}" NM=${XNM} \
357 OBJDUMP=${XOBJDUMP} OBJCOPY="${XOBJCOPY}" \
358 RANLIB=${XRANLIB} STRINGS=${XSTRINGS} \
362 .if defined(CROSS_BINUTILS_PREFIX)
363 # In the case of xdev-build tools, CROSS_BINUTILS_PREFIX won't be a
364 # directory, but the compiler will look in the right place for it's
365 # tools so we don't need to tell it where to look.
366 .if exists(${CROSS_BINUTILS_PREFIX})
367 BFLAGS+= -B${CROSS_BINUTILS_PREFIX}
370 BFLAGS+= -B${WORLDTMP}/usr/bin
372 .if ${TARGET} == "arm"
373 .if ${TARGET_ARCH:M*hf*} != ""
374 TARGET_ABI= gnueabihf
379 .if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc
380 XCFLAGS+= -isystem ${WORLDTMP}/usr/include -L${WORLDTMP}/usr/lib
381 XCXXFLAGS+= -I${WORLDTMP}/usr/include/c++/v1 -std=gnu++11 -L${WORLDTMP}/../lib/libc++
382 DEPFLAGS+= -I${WORLDTMP}/usr/include/c++/v1
385 TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0
386 XCFLAGS+= -target ${TARGET_TRIPLE}
388 XCFLAGS+= --sysroot=${WORLDTMP} ${BFLAGS}
389 XCXXFLAGS+= --sysroot=${WORLDTMP} ${BFLAGS}
391 .if defined(CROSS_BINUTILS_PREFIX) && exists(${CROSS_BINUTILS_PREFIX})
392 BFLAGS+= -B${CROSS_BINUTILS_PREFIX}
394 XCXXFLAGS+= ${BFLAGS}
398 WMAKE= ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 DESTDIR=${WORLDTMP}
400 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
402 LIB32_OBJTREE= ${OBJTREE}${.CURDIR}/world32
403 LIB32TMP= ${OBJTREE}${.CURDIR}/lib32
405 .if ${TARGET_ARCH} == "amd64"
406 .if empty(TARGET_CPUTYPE)
407 LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2
409 LIB32CPUFLAGS= -march=${TARGET_CPUTYPE}
411 LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \
412 MACHINE_CPU="i686 mmx sse sse2"
415 LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32"
417 .elif ${TARGET_ARCH} == "powerpc64"
418 .if empty(TARGET_CPUTYPE)
419 LIB32CPUFLAGS= -mcpu=powerpc
421 LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE}
423 LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc
425 LD="${LD} -m elf32ppc_fbsd"
429 LIB32FLAGS= -m32 ${LIB32CPUFLAGS} -DCOMPAT_32BIT \
430 -isystem ${LIB32TMP}/usr/include/ \
431 -L${LIB32TMP}/usr/lib32 \
432 -B${LIB32TMP}/usr/lib32
434 LIB32FLAGS+= --sysroot=${WORLDTMP}
437 # Yes, the flags are redundant.
438 LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${LIB32_OBJTREE} \
439 _SHLIBDIRPREFIX=${LIB32TMP} \
440 _LDSCRIPTROOT=${LIB32TMP} \
441 VERSION="${VERSION}" \
442 INSTALL="sh ${.CURDIR}/tools/install.sh" \
445 SHLIBDIR=/usr/lib32 \
446 LIBPRIVATEDIR=/usr/lib32/private \
447 DTRACE="${DTRACE} -32"
448 LIB32WMAKEFLAGS+= CC="${XCC} ${LIB32FLAGS}" \
449 CXX="${XCXX} ${LIB32FLAGS}" \
450 DESTDIR=${LIB32TMP} \
458 LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} ${LIB32WMAKEFLAGS} \
460 LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} \
461 MK_TOOLCHAIN=no ${IMAKE_INSTALL}
464 IMAKEENV= ${CROSSENV:N_LDSCRIPTROOT=*}
465 IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 \
466 ${IMAKE_INSTALL} ${IMAKE_MTREE}
467 .if empty(.MAKEFLAGS:M-n)
468 IMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMP} \
469 LD_LIBRARY_PATH=${INSTALLTMP} \
470 PATH_LOCALE=${INSTALLTMP}/locale
471 IMAKE+= __MAKE_SHELL=${INSTALLTMP}/sh
473 IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP}
475 .if defined(DB_FROM_SRC)
476 INSTALLFLAGS+= -N ${.CURDIR}/etc
477 MTREEFLAGS+= -N ${.CURDIR}/etc
479 _INSTALL_DDIR= ${DESTDIR}/${DISTDIR}
480 INSTALL_DDIR= ${_INSTALL_DDIR:S://:/:g:C:/$::}
482 METALOG?= ${DESTDIR}/${DISTDIR}/METALOG
483 IMAKE+= -DNO_ROOT METALOG=${METALOG}
484 INSTALLFLAGS+= -U -M ${METALOG} -D ${INSTALL_DDIR}
487 .if defined(DB_FROM_SRC) || defined(NO_ROOT)
488 IMAKE_INSTALL= INSTALL="install ${INSTALLFLAGS}"
489 IMAKE_MTREE= MTREE_CMD="mtree ${MTREEFLAGS}"
493 KMAKEENV= ${WMAKEENV}
494 KMAKE= ${KMAKEENV} ${MAKE} ${.MAKEFLAGS} ${KERNEL_FLAGS} KERNEL=${INSTKERNNAME}
499 # Attempt to rebuild the entire system, with reasonable chance of
500 # success, regardless of how old your existing system is.
503 .if ${.CURDIR:C/[^,]//g} != ""
504 # The m4 build of sendmail files doesn't like it if ',' is used
505 # anywhere in the path of it's files.
507 @echo "*** Error: path to source tree contains a comma ','"
512 @echo "--------------------------------------------------------------"
513 @echo ">>> Rebuilding the temporary build tree"
514 @echo "--------------------------------------------------------------"
515 .if !defined(NO_CLEAN)
517 .if defined(LIB32TMP)
521 rm -rf ${WORLDTMP}/legacy/usr/include
522 # XXX - These three can depend on any header file.
523 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
524 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c
525 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
528 lib usr legacy/bin legacy/usr
529 mkdir -p ${WORLDTMP}/${_dir}
531 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
532 -p ${WORLDTMP}/legacy/usr >/dev/null
533 .if ${MK_GROFF} != "no"
534 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.groff.dist \
535 -p ${WORLDTMP}/legacy/usr >/dev/null
537 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
538 -p ${WORLDTMP}/usr >/dev/null
539 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
540 -p ${WORLDTMP}/usr/include >/dev/null
541 ln -sf ${.CURDIR}/sys ${WORLDTMP}
542 .if ${MK_DEBUG_FILES} != "no"
543 # We could instead disable debug files for these build stages
544 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
545 -p ${WORLDTMP}/legacy/usr/lib >/dev/null
546 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
547 -p ${WORLDTMP}/usr/lib >/dev/null
549 .if ${MK_TESTS} != "no"
550 mkdir -p ${WORLDTMP}${TESTSBASE}
551 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
552 -p ${WORLDTMP}${TESTSBASE} >/dev/null
554 .for _mtree in ${LOCAL_MTREE}
555 mtree -deU -f ${.CURDIR}/${_mtree} -p ${WORLDTMP} > /dev/null
559 @echo "--------------------------------------------------------------"
560 @echo ">>> stage 1.1: legacy release compatibility shims"
561 @echo "--------------------------------------------------------------"
562 ${_+_}cd ${.CURDIR}; ${BMAKE} legacy
565 @echo "--------------------------------------------------------------"
566 @echo ">>> stage 1.2: bootstrap tools"
567 @echo "--------------------------------------------------------------"
568 ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools
570 .if !defined(NO_CLEAN)
572 @echo "--------------------------------------------------------------"
573 @echo ">>> stage 2.1: cleaning up the object tree"
574 @echo "--------------------------------------------------------------"
575 ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
576 .if defined(LIB32TMP)
577 ${_+_}cd ${.CURDIR}; ${LIB32WMAKE} -f Makefile.inc1 ${CLEANDIR:S/^/par-/}
582 @echo "--------------------------------------------------------------"
583 @echo ">>> stage 2.2: rebuilding the object tree"
584 @echo "--------------------------------------------------------------"
585 ${_+_}cd ${.CURDIR}; ${WMAKE} par-obj
588 @echo "--------------------------------------------------------------"
589 @echo ">>> stage 2.3: build tools"
590 @echo "--------------------------------------------------------------"
591 ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools
594 @echo "--------------------------------------------------------------"
595 @echo ">>> stage 3: cross tools"
596 @echo "--------------------------------------------------------------"
597 ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools
598 ${_+_}cd ${.CURDIR}; ${XMAKE} kernel-tools
601 @echo "--------------------------------------------------------------"
602 @echo ">>> stage 4.1: building includes"
603 @echo "--------------------------------------------------------------"
604 ${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
607 @echo "--------------------------------------------------------------"
608 @echo ">>> stage 4.2: building libraries"
609 @echo "--------------------------------------------------------------"
610 ${_+_}cd ${.CURDIR}; \
611 ${WMAKE} -DNO_FSCHG MK_HTML=no -DNO_LINT MK_MAN=no \
612 MK_PROFILE=no MK_TESTS=no MK_TESTS_SUPPORT=${MK_TESTS} libraries
615 @echo "--------------------------------------------------------------"
616 @echo ">>> stage 4.3: make dependencies"
617 @echo "--------------------------------------------------------------"
618 ${_+_}cd ${.CURDIR}; ${WMAKE} par-depend
621 @echo "--------------------------------------------------------------"
622 @echo ">>> stage 4.4: building everything"
623 @echo "--------------------------------------------------------------"
624 ${_+_}cd ${.CURDIR}; ${WMAKE} par-all
625 .if defined(LIB32TMP)
628 @echo "--------------------------------------------------------------"
629 @echo ">>> stage 5.1: building 32 bit shim libraries"
630 @echo "--------------------------------------------------------------"
631 mkdir -p ${LIB32TMP}/usr/include
632 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
633 -p ${LIB32TMP}/usr >/dev/null
634 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
635 -p ${LIB32TMP}/usr/include >/dev/null
636 .if ${MK_DEBUG_FILES} != "no"
637 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
638 -p ${LIB32TMP}/usr/lib >/dev/null
641 ln -sf ${.CURDIR}/sys ${WORLDTMP}
642 .for _t in obj includes
643 cd ${.CURDIR}/include; ${LIB32WMAKE} DIRPRFX=include/ ${_t}
644 cd ${.CURDIR}/lib; ${LIB32WMAKE} DIRPRFX=lib/ ${_t}
645 .if ${MK_CDDL} != "no"
646 cd ${.CURDIR}/cddl/lib; ${LIB32WMAKE} DIRPRFX=cddl/lib/ ${_t}
648 cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} DIRPRFX=gnu/lib/ ${_t}
649 .if ${MK_CRYPT} != "no"
650 cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} DIRPRFX=secure/lib/ ${_t}
652 .if ${MK_KERBEROS} != "no"
653 cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} DIRPRFX=kerberos5/lib ${_t}
656 .for _dir in usr.bin/lex/lib
657 cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} DIRPRFX=${_dir}/ obj
659 .for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic
660 cd ${.CURDIR}/${_dir}; \
661 WORLDTMP=${WORLDTMP} \
662 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
663 MAKEOBJDIRPREFIX=${LIB32_OBJTREE} ${MAKE} SSP_CFLAGS= DESTDIR= \
664 DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
668 ${LIB32WMAKE} -f Makefile.inc1 libraries
669 .for _t in obj depend all
670 cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32WMAKE} \
671 DIRPRFX=libexec/rtld-elf/ ${_t}
672 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32WMAKE} \
673 DIRPRFX=usr.bin/ldd ${_t}
676 distribute32 install32:
677 cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
678 .if ${MK_CDDL} != "no"
679 cd ${.CURDIR}/cddl/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
681 cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
682 .if ${MK_CRYPT} != "no"
683 cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
685 .if ${MK_KERBEROS} != "no"
686 cd ${.CURDIR}/kerberos5/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
688 cd ${.CURDIR}/libexec/rtld-elf; \
689 PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//}
690 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32IMAKE} ${.TARGET:S/32$//}
694 .if !defined(SUBDIR_OVERRIDE)
695 WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools
697 WMAKE_TGTS+= _cleanobj _obj _build-tools
698 .if !defined(SUBDIR_OVERRIDE)
699 WMAKE_TGTS+= _cross-tools
701 WMAKE_TGTS+= _includes _libraries _depend everything
702 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
706 buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
707 .ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
710 @echo "--------------------------------------------------------------"
711 @echo ">>> World build started on `LC_ALL=C date`"
712 @echo "--------------------------------------------------------------"
716 @echo "--------------------------------------------------------------"
717 @echo ">>> World build completed on `LC_ALL=C date`"
718 @echo "--------------------------------------------------------------"
721 # We need to have this as a target because the indirection between Makefile
722 # and Makefile.inc1 causes the correct PATH to be used, rather than a
723 # modification of the current environment's PATH. In addition, we need
724 # to quote multiword values.
729 .if ${.TARGETS:Mbuildenv}
730 .if ${.MAKEFLAGS:M-j}
731 .error The buildenv target is incompatible with -j
735 @echo Entering world for ${TARGET_ARCH}:${TARGET}
736 @cd ${.CURDIR} && env ${WMAKEENV} ${BUILDENV_SHELL} || true
738 TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything:Nbuild32}
739 toolchain: ${TOOLCHAIN_TGTS}
740 kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries}
745 # Checks to be sure system is ready for installworld/installkernel.
747 installcheck: _installcheck_world _installcheck_kernel
749 _installcheck_kernel:
752 # Require DESTDIR to be set if installing for a different architecture or
753 # using the user/group database in the source tree.
755 .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE} || \
757 .if !make(distributeworld)
758 _installcheck_world: __installcheck_DESTDIR
759 _installcheck_kernel: __installcheck_DESTDIR
760 __installcheck_DESTDIR:
761 .if !defined(DESTDIR) || empty(DESTDIR)
762 @echo "ERROR: Please set DESTDIR!"; \
768 .if !defined(DB_FROM_SRC)
770 # Check for missing UIDs/GIDs.
772 CHECK_UIDS= auditdistd
774 .if ${MK_SENDMAIL} != "no"
780 CHECK_GIDS+= proxy authpf
782 .if ${MK_UNBOUND} != "no"
786 _installcheck_world: __installcheck_UGID
788 .for uid in ${CHECK_UIDS}
789 @if ! `id -u ${uid} >/dev/null 2>&1`; then \
790 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \
794 .for gid in ${CHECK_GIDS}
795 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \
796 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \
803 # Required install tools to be saved in a scratch dir for safety.
805 .if ${MK_ZONEINFO} != "no"
806 _zoneinfo= zic tzsetup
809 ITOOLS= [ awk cap_mkdb cat chflags chmod chown \
810 date echo egrep find grep id install ${_install-info} \
811 ln lockf make mkdir mtree mv pwd_mkdb \
812 rm sed services_mkdb sh strip sysctl test true uname wc ${_zoneinfo} \
815 # Needed for share/man
816 .if ${MK_MAN} != "no"
823 # Distributes everything compiled by a `buildworld'.
827 # Installs everything compiled by a 'buildworld'.
830 # Non-base distributions produced by the base system
831 EXTRA_DISTRIBUTIONS= doc
832 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
833 EXTRA_DISTRIBUTIONS+= lib32
835 .if ${MK_TESTS} != "no"
836 EXTRA_DISTRIBUTIONS+= tests
840 .if ${MK_DEBUG_FILES} != "no"
841 DEBUG_DISTRIBUTIONS+= base ${EXTRA_DISTRIBUTIONS:S,doc,,:S,tests,,}
844 MTREE_MAGIC?= mtree 2.0
846 distributeworld installworld: _installcheck_world
847 mkdir -p ${INSTALLTMP}
848 progs=$$(for prog in ${ITOOLS}; do \
849 if progpath=`which $$prog`; then \
852 echo "Required tool $$prog not found in PATH." >&2; \
856 libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | \
857 while read line; do \
859 if [ "$$2 $$3" != "not found" ]; then \
862 echo "Required library $$1 not found." >&2; \
866 cp $$libs $$progs ${INSTALLTMP}
867 cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale
869 echo "#${MTREE_MAGIC}" > ${METALOG}
871 .if make(distributeworld)
872 .for dist in ${EXTRA_DISTRIBUTIONS}
873 -mkdir ${DESTDIR}/${DISTDIR}/${dist}
874 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
875 -p ${DESTDIR}/${DISTDIR}/${dist} >/dev/null
876 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
877 -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null
878 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
879 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/include >/dev/null
880 .if ${MK_DEBUG_FILES} != "no"
881 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
882 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib >/dev/null
884 .if ${MK_TESTS} != "no" && ${dist} == "tests"
885 -mkdir -p ${DESTDIR}/${DISTDIR}/${dist}${TESTSBASE}
886 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
887 -p ${DESTDIR}/${DISTDIR}/${dist}${TESTSBASE} >/dev/null
890 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \
891 sed -e 's#^\./#./${dist}/#' >> ${METALOG}
892 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.usr.dist | \
893 sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG}
894 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.include.dist | \
895 sed -e 's#^\./#./${dist}/usr/include/#' >> ${METALOG}
898 -mkdir ${DESTDIR}/${DISTDIR}/base
899 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
900 METALOG=${METALOG} ${IMAKE_INSTALL} ${IMAKE_MTREE} \
901 DISTBASE=/base DESTDIR=${DESTDIR}/${DISTDIR}/base \
902 LOCAL_MTREE=${LOCAL_MTREE:Q} distrib-dirs
904 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \
905 ${IMAKEENV} rm -rf ${INSTALLTMP}
906 .if make(distributeworld)
907 .for dist in ${EXTRA_DISTRIBUTIONS}
908 find ${DESTDIR}/${DISTDIR}/${dist} -mindepth 1 -empty -delete
911 .for dist in base ${EXTRA_DISTRIBUTIONS}
912 @# For each file that exists in this dist, print the corresponding
913 @# line from the METALOG. This relies on the fact that
914 @# a line containing only the filename will sort immediatly before
915 @# the relevant mtree line.
916 cd ${DESTDIR}/${DISTDIR}; \
917 find ./${dist} | sort -u ${METALOG} - | \
918 awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \
919 ${DESTDIR}/${DISTDIR}/${dist}.meta
921 .for dist in ${DEBUG_DISTRIBUTIONS}
922 @# For each file that exists in this dist, print the corresponding
923 @# line from the METALOG. This relies on the fact that
924 @# a line containing only the filename will sort immediatly before
925 @# the relevant mtree line.
926 cd ${DESTDIR}/${DISTDIR}; \
927 find ./${dist}/usr/lib/debug | sort -u ${METALOG} - | \
928 awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \
929 ${DESTDIR}/${DISTDIR}/${dist}.debug.meta
935 .for dist in base ${EXTRA_DISTRIBUTIONS}
937 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
938 tar cvf - --exclude usr/lib/debug \
939 @${DESTDIR}/${DISTDIR}/${dist}.meta | \
940 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/${dist}.txz
942 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
943 tar cvf - --exclude usr/lib/debug . | \
944 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/${dist}.txz
948 .for dist in ${DEBUG_DISTRIBUTIONS}
949 . if defined(NO_ROOT)
950 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
951 tar cvf - @${DESTDIR}/${DISTDIR}/${dist}.debug.meta | \
952 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/${dist}-dbg.txz
954 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
955 tar cvLf - usr/lib/debug | \
956 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/${dist}-dbg.txz
963 # If you have a build server, you can NFS mount the source and obj directories
964 # and do a 'make reinstall' on the *client* to install new binaries from the
965 # most recent server build.
968 @echo "--------------------------------------------------------------"
969 @echo ">>> Making hierarchy"
970 @echo "--------------------------------------------------------------"
971 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 \
972 LOCAL_MTREE=${LOCAL_MTREE:Q} hierarchy
974 @echo "--------------------------------------------------------------"
975 @echo ">>> Installing everything"
976 @echo "--------------------------------------------------------------"
977 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
978 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
979 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32
983 @echo "--------------------------------------------------------------"
984 @echo ">>> Distributing everything"
985 @echo "--------------------------------------------------------------"
986 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
987 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
988 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 \
992 distrib-dirs distribution: .MAKE
993 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
994 ${IMAKE_INSTALL} ${IMAKE_MTREE} METALOG=${METALOG} ${.TARGET}
997 # buildkernel and installkernel
999 # Which kernels to build and/or install is specified by setting
1000 # KERNCONF. If not defined a GENERIC kernel is built/installed.
1001 # Only the existing (depending TARGET) config files are used
1002 # for building kernels and only the first of these is designated
1003 # as the one being installed.
1005 # Note that we have to use TARGET instead of TARGET_ARCH when
1006 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
1007 # be set to cross-build, we have to make sure TARGET is set
1010 .if defined(KERNFAST)
1015 # Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah
1016 .if !defined(KERNCONF) && ${KERNFAST} != "1"
1017 KERNCONF=${KERNFAST}
1020 .if ${TARGET_ARCH} == "powerpc64"
1021 KERNCONF?= GENERIC64
1025 INSTKERNNAME?= kernel
1027 KERNSRCDIR?= ${.CURDIR}/sys
1028 KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf
1029 KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR}
1030 KERNCONFDIR?= ${KRNLCONFDIR}
1034 .for _kernel in ${KERNCONF}
1035 .if exists(${KERNCONFDIR}/${_kernel})
1036 BUILDKERNELS+= ${_kernel}
1037 .if empty(INSTALLKERNEL)
1038 INSTALLKERNEL= ${_kernel}
1043 buildkernel ${WMAKE_TGTS} ${.ALLTARGETS:M_*}: .MAKE
1048 # Builds all kernels defined by BUILDKERNELS.
1051 .if empty(BUILDKERNELS)
1052 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \
1056 .for _kernel in ${BUILDKERNELS}
1057 @echo "--------------------------------------------------------------"
1058 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
1059 @echo "--------------------------------------------------------------"
1060 @echo "===> ${_kernel}"
1061 mkdir -p ${KRNLOBJDIR}
1062 .if !defined(NO_KERNELCONFIG)
1064 @echo "--------------------------------------------------------------"
1065 @echo ">>> stage 1: configuring the kernel"
1066 @echo "--------------------------------------------------------------"
1067 cd ${KRNLCONFDIR}; \
1069 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
1070 -I '${KERNCONFDIR}' '${KERNCONFDIR}/${_kernel}'
1072 .if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN)
1074 @echo "--------------------------------------------------------------"
1075 @echo ">>> stage 2.1: cleaning up the object tree"
1076 @echo "--------------------------------------------------------------"
1077 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR}
1079 .if !defined(NO_KERNELOBJ)
1081 @echo "--------------------------------------------------------------"
1082 @echo ">>> stage 2.2: rebuilding the object tree"
1083 @echo "--------------------------------------------------------------"
1084 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj
1087 @echo "--------------------------------------------------------------"
1088 @echo ">>> stage 2.3: build tools"
1089 @echo "--------------------------------------------------------------"
1090 ${_+_}cd ${.CURDIR}; ${KTMAKE} kernel-tools
1091 .if !defined(NO_KERNELDEPEND)
1093 @echo "--------------------------------------------------------------"
1094 @echo ">>> stage 3.1: making dependencies"
1095 @echo "--------------------------------------------------------------"
1096 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ
1099 @echo "--------------------------------------------------------------"
1100 @echo ">>> stage 3.2: building everything"
1101 @echo "--------------------------------------------------------------"
1102 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ
1103 @echo "--------------------------------------------------------------"
1104 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
1105 @echo "--------------------------------------------------------------"
1109 # installkernel, etc.
1111 # Install the kernel defined by INSTALLKERNEL
1113 installkernel installkernel.debug \
1114 reinstallkernel reinstallkernel.debug: _installcheck_kernel
1115 .if empty(INSTALLKERNEL)
1116 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
1119 @echo "--------------------------------------------------------------"
1120 @echo ">>> Installing kernel ${INSTALLKERNEL}"
1121 @echo "--------------------------------------------------------------"
1122 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
1123 ${CROSSENV} PATH=${TMPPATH} \
1124 ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
1126 distributekernel distributekernel.debug:
1127 .if empty(INSTALLKERNEL)
1128 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
1131 mkdir -p ${DESTDIR}/${DISTDIR}
1132 .if defined(NO_ROOT)
1133 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.premeta
1135 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
1136 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.premeta/} \
1137 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} KERNEL=${INSTKERNNAME} \
1138 DESTDIR=${INSTALL_DDIR}/kernel \
1139 ${.TARGET:S/distributekernel/install/}
1140 .if defined(NO_ROOT)
1141 sed -e 's|^./kernel|.|' ${DESTDIR}/${DISTDIR}/kernel.premeta > \
1142 ${DESTDIR}/${DISTDIR}/kernel.meta
1144 .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
1145 .if defined(NO_ROOT)
1146 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta
1148 cd ${KRNLOBJDIR}/${_kernel}; \
1149 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.${_kernel}.premeta/} \
1150 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} \
1151 KERNEL=${INSTKERNNAME}.${_kernel} \
1152 DESTDIR=${INSTALL_DDIR}/kernel.${_kernel} \
1153 ${.TARGET:S/distributekernel/install/}
1154 .if defined(NO_ROOT)
1155 sed -e 's|^./kernel|.|' \
1156 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta > \
1157 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta
1162 .if defined(NO_ROOT)
1163 cd ${DESTDIR}/${DISTDIR}/kernel; \
1164 tar cvf - @${DESTDIR}/${DISTDIR}/kernel.meta | \
1165 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.txz
1166 .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
1167 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
1168 tar cvf - @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta | \
1169 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz
1172 cd ${DESTDIR}/${DISTDIR}/kernel; \
1174 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.txz
1175 .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
1176 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
1178 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz
1185 # Build the API documentation with doxygen
1188 @if [ ! -x `/usr/bin/which doxygen` ]; then \
1189 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \
1192 cd ${.CURDIR}/tools/kerneldoc/subsys && ${MAKE} obj all
1197 # Update the source tree(s), by running svn/svnup to update to the
1201 .if (defined(CVS_UPDATE) || defined(SUP_UPDATE)) && !defined(SVN_UPDATE)
1202 @echo "--------------------------------------------------------------"
1203 @echo "CVS_UPDATE and SUP_UPDATE are no longer supported."
1204 @echo "Please see: https://wiki.freebsd.org/CvsIsDeprecated"
1205 @echo "--------------------------------------------------------------"
1208 .if defined(SVN_UPDATE)
1209 @echo "--------------------------------------------------------------"
1210 @echo ">>> Updating ${.CURDIR} using Subversion"
1211 @echo "--------------------------------------------------------------"
1212 @(cd ${.CURDIR} && ${SVN} update ${SVNFLAGS})
1216 # ------------------------------------------------------------------------
1218 # From here onwards are utility targets used by the 'make world' and
1219 # related targets. If your 'world' breaks, you may like to try to fix
1220 # the problem and manually run the following targets to attempt to
1221 # complete the build. Beware, this is *not* guaranteed to work, you
1222 # need to have a pretty good grip on the current state of the system
1223 # to attempt to manually finish it. If in doubt, 'make world' again.
1227 # legacy: Build compatibility shims for the next three targets. This is a minimal
1228 # set of tools and shims necessary to compensate for older systems which don't have
1229 # the APIs that the targets built in bootstrap-tools, build-tools or cross-tools.
1232 .if ${BOOTSTRAPPING} < 800107 && ${BOOTSTRAPPING} != 0
1233 @echo "ERROR: Source upgrades from versions prior to 8.0 not supported."; \
1236 .for _tool in tools/build
1237 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \
1238 cd ${.CURDIR}/${_tool} && \
1239 ${MAKE} DIRPRFX=${_tool}/ obj && \
1240 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes && \
1241 ${MAKE} DIRPRFX=${_tool}/ depend && \
1242 ${MAKE} DIRPRFX=${_tool}/ all && \
1243 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
1247 # bootstrap-tools: Build tools needed for compatibility. These are binaries that
1248 # are built to build other binaries in the system. However, the focus of these
1249 # binaries is usually quite narrow. Bootstrap tools use the host's compiler and
1250 # libraries, augmented by -legacy.
1252 _bt= _bootstrap-tools
1254 .if ${MK_GAMES} != "no"
1255 _strfile= games/fortune/strfile
1258 .if ${MK_CXX} != "no"
1259 _gperf= gnu/usr.bin/gperf
1262 .if ${MK_GROFF} != "no"
1263 _groff= gnu/usr.bin/groff
1266 .if ${MK_VT} != "no"
1267 _vtfontcvt= usr.bin/vtfontcvt
1270 .if ${BOOTSTRAPPING} < 900002
1274 .if ${BOOTSTRAPPING} < 1000002
1278 ${_bt}-usr.bin/m4: ${_bt}-lib/libohash
1281 .if ${BOOTSTRAPPING} < 1000014
1282 _crunch= usr.sbin/crunch
1285 .if ${BOOTSTRAPPING} < 1000026
1286 _nmtree= lib/libnetbsd \
1289 ${_bt}-usr.sbin/nmtree: ${_bt}-lib/libnetbsd
1292 .if ${BOOTSTRAPPING} < 1000027
1296 .if ${BOOTSTRAPPING} < 1000033
1300 .if ${BOOTSTRAPPING} >= 900040 && ${BOOTSTRAPPING} < 900041
1304 .if ${BOOTSTRAPPING} < 1001506
1308 ${_bt}-usr.bin/yacc: ${_bt}-lib/liby
1311 .if ${MK_BSNMP} != "no"
1312 _gensnmptree= usr.sbin/bsnmpd/gensnmptree
1315 # We need to build tblgen when we're building clang either as
1316 # the bootstrap compiler, or as the part of the normal build.
1317 .if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_CLANG} != "no"
1319 lib/clang/libllvmsupport \
1320 lib/clang/libllvmtablegen \
1321 usr.bin/clang/tblgen \
1322 usr.bin/clang/clang-tblgen
1324 ${_bt}-usr.bin/clang/clang-tblgen: ${_bt}-lib/clang/libllvmtablegen ${_bt}-lib/clang/libllvmsupport
1325 ${_bt}-usr.bin/clang/tblgen: ${_bt}-lib/clang/libllvmtablegen ${_bt}-lib/clang/libllvmsupport
1328 # ELF Tool Chain libraries are needed for ELF tools and dtrace tools.
1329 # dtrace tools are required for older bootstrap env and cross-build
1331 .if ${BOOTSTRAPPING} < 1100006 || (${MACHINE} != ${TARGET} || \
1332 ${MACHINE_ARCH} != ${TARGET_ARCH})
1333 _elftoolchain_libs= lib/libelf lib/libdwarf
1334 .if ${MK_CDDL} != "no"
1335 _dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf cddl/usr.bin/ctfconvert \
1336 cddl/usr.bin/ctfmerge
1338 ${_bt}-cddl/usr.bin/ctfconvert: ${_bt}-lib/libelf ${_bt}-lib/libdwarf ${_bt}-cddl/lib/libctf
1339 ${_bt}-cddl/usr.bin/ctfmerge: ${_bt}-lib/libelf ${_bt}-lib/libdwarf ${_bt}-cddl/lib/libctf
1343 # Default to building the GPL DTC, but build the BSDL one if users explicitly
1346 .if ${MK_GPL_DTC} != "no"
1347 _dtc= gnu/usr.bin/dtc
1350 .if ${MK_KERBEROS} != "no"
1351 _kerberos5_bootstrap_tools= \
1352 kerberos5/tools/make-roken \
1353 kerberos5/lib/libroken \
1354 kerberos5/lib/libvers \
1355 kerberos5/tools/asn1_compile \
1356 kerberos5/tools/slc \
1359 ${_bt}-kerberos5/tools/slc: ${_bt}-kerberos5/lib/libroken
1360 ${_bt}-kerberos5/tools/asn1_compile: ${_bt}-kerberos5/lib/libroken
1363 bootstrap-tools: .PHONY
1365 # Please document (add comment) why something is in 'bootstrap-tools'.
1366 # Try to bound the building of the bootstrap-tool to just the
1367 # FreeBSD versions that need the tool built at this stage of the build.
1370 ${_kerberos5_bootstrap_tools} \
1371 ${_elftoolchain_libs} \
1380 usr.bin/makewhatis \
1393 ${_bt}-${_tool}: .PHONY .MAKE
1394 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1395 cd ${.CURDIR}/${_tool} && \
1396 ${MAKE} DIRPRFX=${_tool}/ obj && \
1397 ${MAKE} DIRPRFX=${_tool}/ depend && \
1398 ${MAKE} DIRPRFX=${_tool}/ all && \
1399 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
1401 bootstrap-tools: ${_bt}-${_tool}
1405 # build-tools: Build special purpose build tools
1407 .if !defined(NO_SHARE)
1408 _share= share/syscons/scrnmaps
1411 .if ${MK_GCC} != "no"
1412 _gcc_tools= gnu/usr.bin/cc/cc_tools
1415 .if ${MK_RESCUE} != "no"
1416 _rescue= rescue/rescue
1424 ${LOCAL_TOOL_DIRS} \
1425 lib/ncurses/ncurses \
1426 lib/ncurses/ncursesw \
1430 usr.bin/mkesdb_static \
1431 usr.bin/mkcsmapper_static \
1433 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \
1434 cd ${.CURDIR}/${_tool} && \
1435 ${MAKE} DIRPRFX=${_tool}/ obj && \
1436 ${MAKE} DIRPRFX=${_tool}/ build-tools
1440 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \
1441 cd ${.CURDIR}/${_tool} && \
1442 ${MAKE} DIRPRFX=${_tool}/ obj && \
1443 ${MAKE} DIRPRFX=${_tool}/ depend && \
1444 ${MAKE} DIRPRFX=${_tool}/ all
1448 # kernel-tools: Build kernel-building tools
1451 mkdir -p ${MAKEOBJDIRPREFIX}/usr
1452 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1453 -p ${MAKEOBJDIRPREFIX}/usr >/dev/null
1456 # cross-tools: All the tools needed to build the rest of the system after
1457 # we get done with the earlier stages. It is the last set of tools needed
1458 # to begin building the target binaries.
1460 .if ${TARGET_ARCH} != ${MACHINE_ARCH}
1461 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386"
1462 _btxld= usr.sbin/btxld
1465 .if ${TARGET_ARCH} != ${MACHINE_ARCH}
1466 .if ${MK_RESCUE} != "no" || defined(RELEASEDIR)
1467 _crunchide= usr.sbin/crunch/crunchide
1469 .if ${TARGET_ARCH} == "i386" && defined(RELEASEDIR)
1470 _kgzip= usr.sbin/kgzip
1474 # If we're given an XAS, don't build binutils.
1475 .if ${XAS:M/*} == ""
1476 .if ${MK_BINUTILS_BOOTSTRAP} != "no"
1477 _binutils= gnu/usr.bin/binutils
1479 .if ${MK_ELFTOOLCHAIN_TOOLS} != "no"
1480 _elftctools= lib/libelftc \
1485 # These are not required by the build, but can be useful for developers who
1486 # cross-build on a FreeBSD 10 host:
1487 _elftctools+= usr.bin/addr2line
1489 .elif ${TARGET_ARCH} != ${MACHINE_ARCH} && ${MK_ELFTOOLCHAIN_TOOLS} != "no"
1490 # If cross-building with an external binutils we still need to build strip for
1491 # the target (for at least crunchide).
1492 _elftctools= lib/libelftc \
1496 # If an full path to an external cross compiler is given, don't build
1498 .if ${XCC:M/*} == "" && ${MK_CROSS_COMPILER} != "no"
1499 .if ${MK_CLANG_BOOTSTRAP} != "no"
1500 _clang= usr.bin/clang
1501 _clang_libs= lib/clang
1503 .if ${MK_GCC_BOOTSTRAP} != "no"
1519 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1520 cd ${.CURDIR}/${_tool} && \
1521 ${MAKE} DIRPRFX=${_tool}/ obj && \
1522 ${MAKE} DIRPRFX=${_tool}/ depend && \
1523 ${MAKE} DIRPRFX=${_tool}/ all && \
1524 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
1527 NXBENV= MAKEOBJDIRPREFIX=${OBJTREE}/nxb \
1528 INSTALL="sh ${.CURDIR}/tools/install.sh" \
1529 VERSION="${VERSION}"
1530 NXBMAKE= ${NXBENV} ${MAKE} \
1531 TBLGEN=${OBJTREE}/nxb-bin/usr/bin/tblgen \
1532 CLANG_TBLGEN=${OBJTREE}/nxb-bin/usr/bin/clang-tblgen \
1533 MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH} \
1534 MK_GDB=no MK_TESTS=no \
1536 MK_HTML=no NO_LINT=yes MK_MAN=no \
1537 -DNO_PIC MK_PROFILE=no -DNO_SHARED \
1538 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
1539 MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \
1542 native-xtools: .MAKE
1543 mkdir -p ${OBJTREE}/nxb-bin/bin
1544 mkdir -p ${OBJTREE}/nxb-bin/sbin
1545 mkdir -p ${OBJTREE}/nxb-bin/usr
1546 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1547 -p ${OBJTREE}/nxb-bin/usr >/dev/null
1548 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
1549 -p ${OBJTREE}/nxb-bin/usr/include >/dev/null
1609 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1610 cd ${.CURDIR}/${_tool} && \
1611 ${NXBMAKE} DIRPRFX=${_tool}/ obj && \
1612 ${NXBMAKE} DIRPRFX=${_tool}/ depend && \
1613 ${NXBMAKE} DIRPRFX=${_tool}/ all && \
1614 ${NXBMAKE} DIRPRFX=${_tool}/ DESTDIR=${OBJTREE}/nxb-bin install
1618 # hierarchy - ensure that all the needed directories are present
1620 hierarchy hier: .MAKE
1621 cd ${.CURDIR}/etc && ${HMAKE} distrib-dirs
1624 # libraries - build all libraries, and install them under ${DESTDIR}.
1626 # The list of libraries with dependents (${_prebuild_libs}) and their
1627 # interdependencies (__L) are built automatically by the
1628 # ${.CURDIR}/tools/make_libdeps.sh script.
1632 ${MAKE} -f Makefile.inc1 _prereq_libs && \
1633 ${MAKE} -f Makefile.inc1 _startup_libs && \
1634 ${MAKE} -f Makefile.inc1 _prebuild_libs && \
1635 ${MAKE} -f Makefile.inc1 _generic_libs
1638 # static libgcc.a prerequisite for shared libc
1640 _prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc lib/libcompiler_rt
1642 # These dependencies are not automatically generated:
1644 # gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before
1645 # all shared libraries for ELF.
1647 _startup_libs= gnu/lib/csu
1648 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
1649 _startup_libs+= lib/csu/${MACHINE_ARCH}-elf
1650 .elif exists(${.CURDIR}/lib/csu/${MACHINE_ARCH})
1651 _startup_libs+= lib/csu/${MACHINE_ARCH}
1653 _startup_libs+= lib/csu/${MACHINE_CPUARCH}
1655 _startup_libs+= gnu/lib/libgcc
1656 _startup_libs+= lib/libcompiler_rt
1657 _startup_libs+= lib/libc
1658 _startup_libs+= lib/libc_nonshared
1659 .if ${MK_LIBCPLUSPLUS} != "no"
1660 _startup_libs+= lib/libcxxrt
1663 gnu/lib/libgcc__L: lib/libc__L
1664 gnu/lib/libgcc__L: lib/libc_nonshared__L
1665 .if ${MK_LIBCPLUSPLUS} != "no"
1666 lib/libcxxrt__L: gnu/lib/libgcc__L
1669 _prebuild_libs= ${_kerberos5_lib_libasn1} \
1670 ${_kerberos5_lib_libhdb} \
1671 ${_kerberos5_lib_libheimbase} \
1672 ${_kerberos5_lib_libheimntlm} \
1673 ${_kerberos5_lib_libheimsqlite} \
1674 ${_kerberos5_lib_libheimipcc} \
1675 ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \
1676 ${_kerberos5_lib_libroken} \
1677 ${_kerberos5_lib_libwind} \
1678 lib/libbz2 ${_libcom_err} lib/libcrypt \
1679 lib/libelf lib/libexpat \
1682 lib/libkiconv lib/libkvm lib/liblzma lib/libmd lib/libnv \
1683 ${_lib_libcapsicum} \
1684 lib/ncurses/ncurses lib/ncurses/ncursesw \
1685 lib/libopie lib/libpam ${_lib_libthr} \
1686 ${_lib_libradius} lib/libsbuf lib/libtacplus \
1688 ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \
1689 ${_cddl_lib_libuutil} \
1690 ${_cddl_lib_libavl} \
1691 ${_cddl_lib_libzfs_core} \
1692 ${_cddl_lib_libctf} \
1693 lib/libutil lib/libpjdlog ${_lib_libypclnt} lib/libz lib/msun \
1694 ${_secure_lib_libcrypto} ${_lib_libldns} \
1695 ${_secure_lib_libssh} ${_secure_lib_libssl} \
1697 .if ${MK_GNUCXX} != "no"
1698 _prebuild_libs+= gnu/lib/libstdc++ gnu/lib/libsupc++
1699 gnu/lib/libstdc++__L: lib/msun__L
1700 gnu/lib/libsupc++__L: gnu/lib/libstdc++__L
1703 .if ${MK_LIBCPLUSPLUS} != "no"
1704 _prebuild_libs+= lib/libc++
1707 lib/libgeom__L: lib/libexpat__L
1709 .if ${MK_LIBTHR} != "no"
1710 _lib_libthr= lib/libthr
1713 .if ${MK_RADIUS_SUPPORT} != "no"
1714 _lib_libradius= lib/libradius
1717 .if ${MK_OFED} != "no"
1718 _ofed_lib= contrib/ofed/usr.lib/
1721 .if ${MK_CASPER} != "no"
1722 _lib_libcapsicum=lib/libcapsicum
1725 lib/libcapsicum__L: lib/libnv__L
1726 lib/libpjdlog__L: lib/libutil__L
1727 lib/liblzma__L: lib/libthr__L
1729 _generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib}
1730 .for _DIR in ${LOCAL_LIB_DIRS}
1731 .if exists(${.CURDIR}/${_DIR}/Makefile)
1732 _generic_libs+= ${_DIR}
1736 lib/libopie__L lib/libtacplus__L: lib/libmd__L
1738 .if ${MK_CDDL} != "no"
1739 _cddl_lib_libumem= cddl/lib/libumem
1740 _cddl_lib_libnvpair= cddl/lib/libnvpair
1741 _cddl_lib_libavl= cddl/lib/libavl
1742 _cddl_lib_libuutil= cddl/lib/libuutil
1743 _cddl_lib_libzfs_core= cddl/lib/libzfs_core
1744 _cddl_lib_libctf= cddl/lib/libctf
1746 cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L
1747 cddl/lib/libzfs__L: lib/libgeom__L
1748 cddl/lib/libctf__L: lib/libz__L
1751 .if ${MK_CRYPT} != "no"
1752 .if ${MK_OPENSSL} != "no"
1753 _secure_lib_libcrypto= secure/lib/libcrypto
1754 _secure_lib_libssl= secure/lib/libssl
1755 lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L
1756 .if ${MK_LDNS} != "no"
1757 _lib_libldns= lib/libldns
1758 lib/libldns__L: secure/lib/libcrypto__L
1760 .if ${MK_OPENSSH} != "no"
1761 _secure_lib_libssh= secure/lib/libssh
1762 secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
1763 .if ${MK_LDNS} != "no"
1764 secure/lib/libssh__L: lib/libldns__L
1766 .if ${MK_KERBEROS_SUPPORT} != "no"
1767 secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \
1768 kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \
1769 lib/libmd__L kerberos5/lib/libroken__L
1773 _secure_lib= secure/lib
1776 .if ${MK_KERBEROS} != "no"
1777 kerberos5/lib/libasn1__L: lib/libcom_err__L kerberos5/lib/libroken__L
1778 kerberos5/lib/libhdb__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1779 kerberos5/lib/libkrb5__L kerberos5/lib/libroken__L \
1780 kerberos5/lib/libwind__L kerberos5/lib/libheimsqlite__L
1781 kerberos5/lib/libheimntlm__L: secure/lib/libcrypto__L kerberos5/lib/libkrb5__L \
1782 kerberos5/lib/libroken__L lib/libcom_err__L
1783 kerberos5/lib/libhx509__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1784 secure/lib/libcrypto__L kerberos5/lib/libroken__L kerberos5/lib/libwind__L
1785 kerberos5/lib/libkrb5__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1786 lib/libcrypt__L secure/lib/libcrypto__L kerberos5/lib/libhx509__L \
1787 kerberos5/lib/libroken__L kerberos5/lib/libwind__L \
1788 kerberos5/lib/libheimbase__L kerberos5/lib/libheimipcc__L
1789 kerberos5/lib/libroken__L: lib/libcrypt__L
1790 kerberos5/lib/libwind__L: kerberos5/lib/libroken__L lib/libcom_err__L
1791 kerberos5/lib/libheimbase__L: lib/libthr__L
1792 kerberos5/lib/libheimipcc__L: kerberos5/lib/libroken__L kerberos5/lib/libheimbase__L lib/libthr__L
1793 kerberos5/lib/libheimsqlite__L: lib/libthr__L
1796 .if ${MK_GSSAPI} != "no"
1797 _lib_libgssapi= lib/libgssapi
1800 .if ${MK_KERBEROS} != "no"
1801 _kerberos5_lib= kerberos5/lib
1802 _kerberos5_lib_libasn1= kerberos5/lib/libasn1
1803 _kerberos5_lib_libhdb= kerberos5/lib/libhdb
1804 _kerberos5_lib_libheimbase= kerberos5/lib/libheimbase
1805 _kerberos5_lib_libkrb5= kerberos5/lib/libkrb5
1806 _kerberos5_lib_libhx509= kerberos5/lib/libhx509
1807 _kerberos5_lib_libroken= kerberos5/lib/libroken
1808 _kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm
1809 _kerberos5_lib_libheimsqlite= kerberos5/lib/libheimsqlite
1810 _kerberos5_lib_libheimipcc= kerberos5/lib/libheimipcc
1811 _kerberos5_lib_libwind= kerberos5/lib/libwind
1812 _libcom_err= lib/libcom_err
1815 .if ${MK_NIS} != "no"
1816 _lib_libypclnt= lib/libypclnt
1819 .if ${MK_OPENSSL} == "no"
1820 lib/libradius__L: lib/libmd__L
1823 gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncursesw__L
1825 .for _lib in ${_prereq_libs}
1826 ${_lib}__PL: .PHONY .MAKE
1827 .if exists(${.CURDIR}/${_lib})
1828 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1829 cd ${.CURDIR}/${_lib} && \
1830 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj && \
1831 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ depend && \
1832 ${MAKE} MK_TESTS=no MK_PROFILE=no -DNO_PIC \
1833 DIRPRFX=${_lib}/ all && \
1834 ${MAKE} MK_TESTS=no MK_PROFILE=no -DNO_PIC \
1835 DIRPRFX=${_lib}/ install
1839 .for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
1840 ${_lib}__L: .PHONY .MAKE
1841 .if exists(${.CURDIR}/${_lib})
1842 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1843 cd ${.CURDIR}/${_lib} && \
1844 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj && \
1845 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ depend && \
1846 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ all && \
1847 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ install
1851 # libpam is special: we need to build static PAM modules before
1852 # static PAM library, and dynamic PAM library before dynamic PAM
1854 lib/libpam__L: .PHONY .MAKE
1855 ${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \
1856 cd ${.CURDIR}/lib/libpam && \
1857 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ obj && \
1858 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ depend && \
1859 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ \
1860 -D_NO_LIBPAM_SO_YET all && \
1861 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ \
1862 -D_NO_LIBPAM_SO_YET install
1864 _prereq_libs: ${_prereq_libs:S/$/__PL/}
1865 _startup_libs: ${_startup_libs:S/$/__L/}
1866 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
1867 _generic_libs: ${_generic_libs:S/$/__L/}
1869 .for __target in all clean cleandepend cleandir depend includes obj
1870 .for entry in ${SUBDIR}
1871 ${entry}.${__target}__D: .PHONY .MAKE
1872 ${_+_}@set -e; if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
1873 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \
1874 edir=${entry}.${MACHINE_ARCH}; \
1875 cd ${.CURDIR}/$${edir}; \
1877 ${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \
1879 cd ${.CURDIR}/$${edir}; \
1881 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
1883 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
1886 .include <bsd.subdir.mk>
1888 .if make(check-old) || make(check-old-dirs) || \
1889 make(check-old-files) || make(check-old-libs) || \
1890 make(delete-old) || make(delete-old-dirs) || \
1891 make(delete-old-files) || make(delete-old-libs)
1894 # check for / delete old files section
1897 .include "ObsoleteFiles.inc"
1899 OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \
1900 else you can not start such an application. Consult UPDATING for more \
1901 information regarding how to cope with the removal/revision bump of a \
1904 .if !defined(BATCH_DELETE_OLD_FILES)
1911 @echo ">>> Removing old files (only deletes safe to delete libs)"
1912 # Ask for every old file if the user really wants to remove it.
1913 # It's annoying, but better safe than sorry.
1914 # NB: We cannot pass the list of OLD_FILES as a parameter because the
1915 # argument list will get too long. Using .for/.endfor make "loops" will make
1916 # the Makefile parser segfault.
1919 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1920 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1921 while read file; do \
1922 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1923 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1924 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1927 # Remove catpages without corresponding manpages.
1929 find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1930 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1931 while read catpage; do \
1933 if [ ! -e "$${manpage}" ]; then \
1934 rm ${RM_I} $${catpage} <&3; \
1937 @echo ">>> Old files removed"
1940 @echo ">>> Checking for old files"
1942 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1943 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1944 while read file; do \
1945 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1946 echo "${DESTDIR}/$${file}"; \
1949 # Check for catpages without corresponding manpages.
1950 @find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1951 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1952 while read catpage; do \
1954 if [ ! -e "$${manpage}" ]; then \
1960 @echo ">>> Removing old libraries"
1961 @echo "${OLD_LIBS_MESSAGE}" | fmt
1964 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1965 -V OLD_LIBS | xargs -n1 | \
1966 while read file; do \
1967 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1968 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1969 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1971 for ext in debug symbols; do \
1972 if ! [ -e "${DESTDIR}/$${file}" ] && [ -f \
1973 "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \
1974 rm ${RM_I} "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" \
1979 @echo ">>> Old libraries removed"
1982 @echo ">>> Checking for old libraries"
1984 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1985 -V OLD_LIBS | xargs -n1 | \
1986 while read file; do \
1987 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1988 echo "${DESTDIR}/$${file}"; \
1990 for ext in debug symbols; do \
1991 if [ -f "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \
1992 echo "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}"; \
1998 @echo ">>> Removing old directories"
2000 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
2001 -V OLD_DIRS | xargs -n1 | sort -r | \
2002 while read dir; do \
2003 if [ -d "${DESTDIR}/$${dir}" ]; then \
2004 rmdir -v "${DESTDIR}/$${dir}" || true; \
2005 elif [ -L "${DESTDIR}/$${dir}" ]; then \
2006 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
2009 @echo ">>> Old directories removed"
2012 @echo ">>> Checking for old directories"
2014 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
2015 -V OLD_DIRS | xargs -n1 | \
2016 while read dir; do \
2017 if [ -d "${DESTDIR}/$${dir}" ]; then \
2018 echo "${DESTDIR}/$${dir}"; \
2019 elif [ -L "${DESTDIR}/$${dir}" ]; then \
2020 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
2024 delete-old: delete-old-files delete-old-dirs
2025 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
2027 check-old: check-old-files check-old-libs check-old-dirs
2028 @echo "To remove old files and directories run '${MAKE} delete-old'."
2029 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
2034 # showconfig - show build configuration.
2037 @(${MAKE} -n -f ${.CURDIR}/sys/conf/kern.opts.mk -V dummy -dg1; \
2038 ${MAKE} -n -f ${.CURDIR}/share/mk/src.opts.mk -V dummy -dg1) 2>&1 | grep ^MK_ | sort -u
2040 .if !empty(KRNLOBJDIR) && !empty(KERNCONF)
2041 DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/
2043 .if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE)
2044 .if exists(${KERNCONFDIR}/${KERNCONF})
2045 FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \
2046 '${KERNCONFDIR}/${KERNCONF}' ; echo
2052 .if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH})
2053 DTBOUTPUTPATH= ${.CURDIR}
2057 # Build 'standalone' Device Tree Blob
2060 @PATH=${TMPPATH} MACHINE=${TARGET} \
2061 ${.CURDIR}/sys/tools/fdt/make_dtb.sh ${.CURDIR}/sys \
2062 "${FDT_DTS_FILE}" ${DTBOUTPUTPATH}
2066 .if defined(TARGET) && defined(TARGET_ARCH)
2068 .if ${TARGET} == ${MACHINE} && ${TARGET_ARCH} == ${MACHINE_ARCH}
2069 XDEV_CPUTYPE?=${CPUTYPE}
2071 XDEV_CPUTYPE?=${TARGET_CPUTYPE}
2074 NOFUN=-DNO_FSCHG MK_HTML=no -DNO_LINT \
2075 MK_MAN=no MK_NLS=no MK_PROFILE=no \
2076 MK_KERBEROS=no MK_RESCUE=no MK_TESTS=no MK_WARNS=no \
2077 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
2078 CPUTYPE=${XDEV_CPUTYPE}
2080 XDDIR=${TARGET_ARCH}-freebsd
2083 .error XDTP variable should be an absolute path
2086 CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \
2087 INSTALL="sh ${.CURDIR}/tools/install.sh"
2089 _SHLIBDIRPREFIX=${XDDESTDIR} \
2090 TOOLS_PREFIX=${XDTP}
2091 CD2CFLAGS=-isystem ${XDDESTDIR}/usr/include -L${XDDESTDIR}/usr/lib \
2092 --sysroot=${XDDESTDIR}/ -B${XDDESTDIR}/usr/libexec \
2093 -B${XDDESTDIR}/usr/bin -B${XDDESTDIR}/usr/lib
2094 CD2ENV=${CDENV} CC="${CC} ${CD2CFLAGS}" CXX="${CXX} ${CD2CFLAGS}" \
2095 CPP="${CPP} ${CD2CFLAGS}" \
2096 MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH}
2098 CDTMP= ${MAKEOBJDIRPREFIX}/${XDDIR}/${.CURDIR}/tmp
2099 CDMAKE=${CDENV} PATH=${CDTMP}/usr/bin:${PATH} ${MAKE} ${NOFUN}
2100 CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDDESTDIR}/usr/bin:${PATH} ${MAKE} ${NOFUN}
2101 XDDESTDIR=${DESTDIR}/${XDTP}
2103 OSREL!= uname -r | sed -e 's/[-(].*//'
2106 .ORDER: xdev-build xdev-install xdev-links
2107 xdev: xdev-build xdev-install
2109 .ORDER: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools
2110 xdev-build: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools
2113 mkdir -p ${CDTMP}/usr
2114 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
2115 -p ${CDTMP}/usr >/dev/null
2117 _xb-bootstrap-tools:
2121 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
2122 cd ${.CURDIR}/${_tool} && \
2123 ${CDMAKE} DIRPRFX=${_tool}/ obj && \
2124 ${CDMAKE} DIRPRFX=${_tool}/ depend && \
2125 ${CDMAKE} DIRPRFX=${_tool}/ all && \
2126 ${CDMAKE} DIRPRFX=${_tool}/ DESTDIR=${CDTMP} install
2130 ${_+_}@cd ${.CURDIR}; \
2131 ${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools
2141 ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \
2142 cd ${.CURDIR}/${_tool} && \
2143 ${CDMAKE} DIRPRFX=${_tool}/ obj && \
2144 ${CDMAKE} DIRPRFX=${_tool}/ depend && \
2145 ${CDMAKE} DIRPRFX=${_tool}/ all
2149 ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}"
2150 mkdir -p ${XDDESTDIR}
2151 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
2152 -p ${XDDESTDIR} >/dev/null
2153 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
2154 -p ${XDDESTDIR}/usr >/dev/null
2155 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
2156 -p ${XDDESTDIR}/usr/include >/dev/null
2157 .if ${MK_TESTS} != "no"
2158 mkdir -p ${XDDESTDIR}${TESTSBASE}
2159 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
2160 -p ${XDDESTDIR}${TESTSBASE} >/dev/null
2163 .ORDER: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries
2164 xdev-install: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries
2167 @echo "_xi-cross-tools"
2175 ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \
2176 cd ${.CURDIR}/${_tool}; \
2177 ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR}
2181 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 par-includes \
2182 DESTDIR=${XDDESTDIR}
2185 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \
2186 DESTDIR=${XDDESTDIR}
2189 ${_+_}cd ${XDDESTDIR}/usr/bin; \
2190 mkdir -p ../../../../usr/bin; \
2192 ln -sf ../../${XDTP}/usr/bin/$$i \
2193 ../../../../usr/bin/${XDDIR}-$$i; \
2194 ln -sf ../../${XDTP}/usr/bin/$$i \
2195 ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \
2198 xdev xdev-build xdev-install xdev-links:
2199 @echo "*** Error: Both TARGET and TARGET_ARCH must be defined for \"${.TARGET}\" target"