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?= 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}
321 XCOMPILERS= CC CXX CPP
322 .for COMPILER in ${XCOMPILERS}
323 .if defined(CROSS_COMPILER_PREFIX)
324 X${COMPILER}?= ${CROSS_COMPILER_PREFIX}${${COMPILER}}
326 X${COMPILER}?= ${${COMPILER}}
329 XBINUTILS= AS AR LD NM OBJCOPY OBJDUMP RANLIB SIZE STRINGS
330 .for BINUTIL in ${XBINUTILS}
331 .if defined(CROSS_BINUTILS_PREFIX)
332 X${BINUTIL}?= ${CROSS_BINUTILS_PREFIX}${${BINUTIL}}
334 X${BINUTIL}?= ${${BINUTIL}}
337 WMAKEENV+= CC="${XCC} ${XCFLAGS}" CXX="${XCXX} ${XCFLAGS} ${XCXXFLAGS}" \
338 DEPFLAGS="${DEPFLAGS}" \
339 CPP="${XCPP} ${XCFLAGS}" \
340 AS="${XAS}" AR="${XAR}" LD="${XLD}" NM=${XNM} \
341 OBJDUMP=${XOBJDUMP} OBJCOPY="${XOBJCOPY}" \
342 RANLIB=${XRANLIB} STRINGS=${XSTRINGS} \
346 .if defined(CROSS_BINUTILS_PREFIX)
347 # In the case of xdev-build tools, CROSS_BINUTILS_PREFIX won't be a
348 # directory, but the compiler will look in the right place for it's
349 # tools so we don't need to tell it where to look.
350 .if exists(${CROSS_BINUTILS_PREFIX})
351 BFLAGS+= -B${CROSS_BINUTILS_PREFIX}
354 BFLAGS+= -B${WORLDTMP}/usr/bin
356 .if ${TARGET} == "arm"
357 .if ${TARGET_ARCH:M*hf*} != ""
358 TARGET_ABI= gnueabihf
363 .if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc
364 XCFLAGS+= -isystem ${WORLDTMP}/usr/include -L${WORLDTMP}/usr/lib
365 XCXXFLAGS+= -I${WORLDTMP}/usr/include/c++/v1 -std=gnu++11 -L${WORLDTMP}/../lib/libc++
366 DEPFLAGS+= -I${WORLDTMP}/usr/include/c++/v1
369 TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0
370 XCFLAGS+= -target ${TARGET_TRIPLE}
371 XCFLAGS+= --sysroot=${WORLDTMP} ${BFLAGS}
372 XCXXFLAGS+= --sysroot=${WORLDTMP} ${BFLAGS}
376 WMAKE= ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 DESTDIR=${WORLDTMP}
378 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
380 LIB32_OBJTREE= ${OBJTREE}${.CURDIR}/world32
381 LIB32TMP= ${OBJTREE}${.CURDIR}/lib32
383 .if ${TARGET_ARCH} == "amd64"
384 .if empty(TARGET_CPUTYPE)
385 LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2
387 LIB32CPUFLAGS= -march=${TARGET_CPUTYPE}
389 LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \
390 MACHINE_CPU="i686 mmx sse sse2"
393 LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32"
395 .elif ${TARGET_ARCH} == "powerpc64"
396 .if empty(TARGET_CPUTYPE)
397 LIB32CPUFLAGS= -mcpu=powerpc
399 LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE}
401 LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc
403 LD="${LD} -m elf32ppc_fbsd"
407 LIB32FLAGS= -m32 ${LIB32CPUFLAGS} -DCOMPAT_32BIT \
408 -isystem ${LIB32TMP}/usr/include/ \
409 -L${LIB32TMP}/usr/lib32 \
410 -B${LIB32TMP}/usr/lib32
412 LIB32FLAGS+= --sysroot=${WORLDTMP}
415 # Yes, the flags are redundant.
416 LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${LIB32_OBJTREE} \
417 _SHLIBDIRPREFIX=${LIB32TMP} \
418 _LDSCRIPTROOT=${LIB32TMP} \
419 VERSION="${VERSION}" \
420 INSTALL="sh ${.CURDIR}/tools/install.sh" \
423 SHLIBDIR=/usr/lib32 \
424 LIBPRIVATEDIR=/usr/lib32/private \
425 DTRACE="${DTRACE} -32"
426 LIB32WMAKEFLAGS+= CC="${XCC} ${LIB32FLAGS}" \
427 CXX="${XCXX} ${LIB32FLAGS}" \
428 DESTDIR=${LIB32TMP} \
436 LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} ${LIB32WMAKEFLAGS} \
438 LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} \
439 MK_TOOLCHAIN=no ${IMAKE_INSTALL}
442 IMAKEENV= ${CROSSENV:N_LDSCRIPTROOT=*}
443 IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 \
444 ${IMAKE_INSTALL} ${IMAKE_MTREE}
445 .if empty(.MAKEFLAGS:M-n)
446 IMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMP} \
447 LD_LIBRARY_PATH=${INSTALLTMP} \
448 PATH_LOCALE=${INSTALLTMP}/locale
449 IMAKE+= __MAKE_SHELL=${INSTALLTMP}/sh
451 IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP}
453 .if defined(DB_FROM_SRC)
454 INSTALLFLAGS+= -N ${.CURDIR}/etc
455 MTREEFLAGS+= -N ${.CURDIR}/etc
457 _INSTALL_DDIR= ${DESTDIR}/${DISTDIR}
458 INSTALL_DDIR= ${_INSTALL_DDIR:S://:/:g:C:/$::}
460 METALOG?= ${DESTDIR}/${DISTDIR}/METALOG
461 IMAKE+= -DNO_ROOT METALOG=${METALOG}
462 INSTALLFLAGS+= -U -M ${METALOG} -D ${INSTALL_DDIR}
465 .if defined(DB_FROM_SRC) || defined(NO_ROOT)
466 IMAKE_INSTALL= INSTALL="install ${INSTALLFLAGS}"
467 IMAKE_MTREE= MTREE_CMD="mtree ${MTREEFLAGS}"
471 KMAKEENV= ${WMAKEENV}
472 KMAKE= ${KMAKEENV} ${MAKE} ${.MAKEFLAGS} ${KERNEL_FLAGS} KERNEL=${INSTKERNNAME}
477 # Attempt to rebuild the entire system, with reasonable chance of
478 # success, regardless of how old your existing system is.
481 .if ${.CURDIR:C/[^,]//g} != ""
482 # The m4 build of sendmail files doesn't like it if ',' is used
483 # anywhere in the path of it's files.
485 @echo "*** Error: path to source tree contains a comma ','"
490 @echo "--------------------------------------------------------------"
491 @echo ">>> Rebuilding the temporary build tree"
492 @echo "--------------------------------------------------------------"
493 .if !defined(NO_CLEAN)
495 .if defined(LIB32TMP)
499 rm -rf ${WORLDTMP}/legacy/usr/include
500 # XXX - These three can depend on any header file.
501 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
502 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c
503 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
506 lib usr legacy/bin legacy/usr
507 mkdir -p ${WORLDTMP}/${_dir}
509 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
510 -p ${WORLDTMP}/legacy/usr >/dev/null
511 .if ${MK_GROFF} != "no"
512 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.groff.dist \
513 -p ${WORLDTMP}/legacy/usr >/dev/null
515 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
516 -p ${WORLDTMP}/usr >/dev/null
517 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
518 -p ${WORLDTMP}/usr/include >/dev/null
519 ln -sf ${.CURDIR}/sys ${WORLDTMP}
520 .if ${MK_DEBUG_FILES} != "no"
521 # We could instead disable debug files for these build stages
522 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
523 -p ${WORLDTMP}/legacy/usr/lib >/dev/null
524 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
525 -p ${WORLDTMP}/usr/lib >/dev/null
527 .if ${MK_TESTS} != "no"
528 mkdir -p ${WORLDTMP}${TESTSBASE}
529 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
530 -p ${WORLDTMP}${TESTSBASE} >/dev/null
532 .for _mtree in ${LOCAL_MTREE}
533 mtree -deU -f ${.CURDIR}/${_mtree} -p ${WORLDTMP} > /dev/null
537 @echo "--------------------------------------------------------------"
538 @echo ">>> stage 1.1: legacy release compatibility shims"
539 @echo "--------------------------------------------------------------"
540 ${_+_}cd ${.CURDIR}; ${BMAKE} legacy
543 @echo "--------------------------------------------------------------"
544 @echo ">>> stage 1.2: bootstrap tools"
545 @echo "--------------------------------------------------------------"
546 ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools
548 .if !defined(NO_CLEAN)
550 @echo "--------------------------------------------------------------"
551 @echo ">>> stage 2.1: cleaning up the object tree"
552 @echo "--------------------------------------------------------------"
553 ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
554 .if defined(LIB32TMP)
555 ${_+_}cd ${.CURDIR}; ${LIB32WMAKE} -f Makefile.inc1 ${CLEANDIR:S/^/par-/}
560 @echo "--------------------------------------------------------------"
561 @echo ">>> stage 2.2: rebuilding the object tree"
562 @echo "--------------------------------------------------------------"
563 ${_+_}cd ${.CURDIR}; ${WMAKE} par-obj
566 @echo "--------------------------------------------------------------"
567 @echo ">>> stage 2.3: build tools"
568 @echo "--------------------------------------------------------------"
569 ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools
572 @echo "--------------------------------------------------------------"
573 @echo ">>> stage 3: cross tools"
574 @echo "--------------------------------------------------------------"
575 ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools
576 ${_+_}cd ${.CURDIR}; ${XMAKE} kernel-tools
579 @echo "--------------------------------------------------------------"
580 @echo ">>> stage 4.1: building includes"
581 @echo "--------------------------------------------------------------"
582 ${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
585 @echo "--------------------------------------------------------------"
586 @echo ">>> stage 4.2: building libraries"
587 @echo "--------------------------------------------------------------"
588 ${_+_}cd ${.CURDIR}; \
589 ${WMAKE} -DNO_FSCHG MK_HTML=no -DNO_LINT MK_MAN=no \
590 MK_PROFILE=no MK_TESTS=no MK_TESTS_SUPPORT=${MK_TESTS} libraries
593 @echo "--------------------------------------------------------------"
594 @echo ">>> stage 4.3: make dependencies"
595 @echo "--------------------------------------------------------------"
596 ${_+_}cd ${.CURDIR}; ${WMAKE} par-depend
599 @echo "--------------------------------------------------------------"
600 @echo ">>> stage 4.4: building everything"
601 @echo "--------------------------------------------------------------"
602 ${_+_}cd ${.CURDIR}; ${WMAKE} par-all
603 .if defined(LIB32TMP)
606 @echo "--------------------------------------------------------------"
607 @echo ">>> stage 5.1: building 32 bit shim libraries"
608 @echo "--------------------------------------------------------------"
609 mkdir -p ${LIB32TMP}/usr/include
610 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
611 -p ${LIB32TMP}/usr >/dev/null
612 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
613 -p ${LIB32TMP}/usr/include >/dev/null
614 .if ${MK_DEBUG_FILES} != "no"
615 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
616 -p ${LIB32TMP}/usr/lib >/dev/null
619 ln -sf ${.CURDIR}/sys ${WORLDTMP}
620 .for _t in obj includes
621 cd ${.CURDIR}/include; ${LIB32WMAKE} DIRPRFX=include/ ${_t}
622 cd ${.CURDIR}/lib; ${LIB32WMAKE} DIRPRFX=lib/ ${_t}
623 .if ${MK_CDDL} != "no"
624 cd ${.CURDIR}/cddl/lib; ${LIB32WMAKE} DIRPRFX=cddl/lib/ ${_t}
626 cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} DIRPRFX=gnu/lib/ ${_t}
627 .if ${MK_CRYPT} != "no"
628 cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} DIRPRFX=secure/lib/ ${_t}
630 .if ${MK_KERBEROS} != "no"
631 cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} DIRPRFX=kerberos5/lib ${_t}
634 .for _dir in usr.bin/lex/lib
635 cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} DIRPRFX=${_dir}/ obj
637 .for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic
638 cd ${.CURDIR}/${_dir}; \
639 WORLDTMP=${WORLDTMP} \
640 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
641 MAKEOBJDIRPREFIX=${LIB32_OBJTREE} ${MAKE} SSP_CFLAGS= DESTDIR= \
642 DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
646 ${LIB32WMAKE} -f Makefile.inc1 libraries
647 .for _t in obj depend all
648 cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32WMAKE} \
649 DIRPRFX=libexec/rtld-elf/ ${_t}
650 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32WMAKE} \
651 DIRPRFX=usr.bin/ldd ${_t}
654 distribute32 install32:
655 cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
656 .if ${MK_CDDL} != "no"
657 cd ${.CURDIR}/cddl/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
659 cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
660 .if ${MK_CRYPT} != "no"
661 cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
663 .if ${MK_KERBEROS} != "no"
664 cd ${.CURDIR}/kerberos5/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
666 cd ${.CURDIR}/libexec/rtld-elf; \
667 PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//}
668 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32IMAKE} ${.TARGET:S/32$//}
672 .if !defined(SUBDIR_OVERRIDE)
673 WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools
675 WMAKE_TGTS+= _cleanobj _obj _build-tools
676 .if !defined(SUBDIR_OVERRIDE)
677 WMAKE_TGTS+= _cross-tools
679 WMAKE_TGTS+= _includes _libraries _depend everything
680 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
684 buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
685 .ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
688 @echo "--------------------------------------------------------------"
689 @echo ">>> World build started on `LC_ALL=C date`"
690 @echo "--------------------------------------------------------------"
694 @echo "--------------------------------------------------------------"
695 @echo ">>> World build completed on `LC_ALL=C date`"
696 @echo "--------------------------------------------------------------"
699 # We need to have this as a target because the indirection between Makefile
700 # and Makefile.inc1 causes the correct PATH to be used, rather than a
701 # modification of the current environment's PATH. In addition, we need
702 # to quote multiword values.
707 .if ${.TARGETS:Mbuildenv}
708 .if ${.MAKEFLAGS:M-j}
709 .error The buildenv target is incompatible with -j
713 @echo Entering world for ${TARGET_ARCH}:${TARGET}
714 @cd ${.CURDIR} && env ${WMAKEENV} ${BUILDENV_SHELL} || true
716 TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything:Nbuild32}
717 toolchain: ${TOOLCHAIN_TGTS}
718 kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries}
723 # Checks to be sure system is ready for installworld/installkernel.
725 installcheck: _installcheck_world _installcheck_kernel
727 _installcheck_kernel:
730 # Require DESTDIR to be set if installing for a different architecture or
731 # using the user/group database in the source tree.
733 .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE} || \
735 .if !make(distributeworld)
736 _installcheck_world: __installcheck_DESTDIR
737 _installcheck_kernel: __installcheck_DESTDIR
738 __installcheck_DESTDIR:
739 .if !defined(DESTDIR) || empty(DESTDIR)
740 @echo "ERROR: Please set DESTDIR!"; \
746 .if !defined(DB_FROM_SRC)
748 # Check for missing UIDs/GIDs.
750 CHECK_UIDS= auditdistd
752 .if ${MK_SENDMAIL} != "no"
758 CHECK_GIDS+= proxy authpf
760 .if ${MK_UNBOUND} != "no"
764 _installcheck_world: __installcheck_UGID
766 .for uid in ${CHECK_UIDS}
767 @if ! `id -u ${uid} >/dev/null 2>&1`; then \
768 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \
772 .for gid in ${CHECK_GIDS}
773 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \
774 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \
781 # Required install tools to be saved in a scratch dir for safety.
783 .if ${MK_ZONEINFO} != "no"
784 _zoneinfo= zic tzsetup
787 ITOOLS= [ awk cap_mkdb cat chflags chmod chown \
788 date echo egrep find grep id install ${_install-info} \
789 ln lockf make mkdir mtree mv pwd_mkdb \
790 rm sed services_mkdb sh strip sysctl test true uname wc ${_zoneinfo} \
793 # Needed for share/man
794 .if ${MK_MAN} != "no"
801 # Distributes everything compiled by a `buildworld'.
805 # Installs everything compiled by a 'buildworld'.
808 # Non-base distributions produced by the base system
809 EXTRA_DISTRIBUTIONS= doc
810 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
811 EXTRA_DISTRIBUTIONS+= lib32
813 .if ${MK_TESTS} != "no"
814 EXTRA_DISTRIBUTIONS+= tests
818 .if ${MK_DEBUG_FILES} != "no"
819 DEBUG_DISTRIBUTIONS+= base ${EXTRA_DISTRIBUTIONS:S,doc,,:S,tests,,}
822 MTREE_MAGIC?= mtree 2.0
824 distributeworld installworld: _installcheck_world
825 mkdir -p ${INSTALLTMP}
826 progs=$$(for prog in ${ITOOLS}; do \
827 if progpath=`which $$prog`; then \
830 echo "Required tool $$prog not found in PATH." >&2; \
834 libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | \
835 while read line; do \
837 if [ "$$2 $$3" != "not found" ]; then \
840 echo "Required library $$1 not found." >&2; \
844 cp $$libs $$progs ${INSTALLTMP}
845 cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale
847 echo "#${MTREE_MAGIC}" > ${METALOG}
849 .if make(distributeworld)
850 .for dist in ${EXTRA_DISTRIBUTIONS}
851 -mkdir ${DESTDIR}/${DISTDIR}/${dist}
852 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
853 -p ${DESTDIR}/${DISTDIR}/${dist} >/dev/null
854 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
855 -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null
856 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
857 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/include >/dev/null
858 .if ${MK_DEBUG_FILES} != "no"
859 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
860 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib >/dev/null
862 .if ${MK_TESTS} != "no" && ${dist} == "tests"
863 -mkdir -p ${DESTDIR}/${DISTDIR}/${dist}${TESTSBASE}
864 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
865 -p ${DESTDIR}/${DISTDIR}/${dist}${TESTSBASE} >/dev/null
868 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \
869 sed -e 's#^\./#./${dist}/#' >> ${METALOG}
870 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.usr.dist | \
871 sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG}
872 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.include.dist | \
873 sed -e 's#^\./#./${dist}/usr/include/#' >> ${METALOG}
876 -mkdir ${DESTDIR}/${DISTDIR}/base
877 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
878 METALOG=${METALOG} ${IMAKE_INSTALL} ${IMAKE_MTREE} \
879 DISTBASE=/base DESTDIR=${DESTDIR}/${DISTDIR}/base \
880 LOCAL_MTREE=${LOCAL_MTREE:Q} distrib-dirs
882 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \
883 ${IMAKEENV} rm -rf ${INSTALLTMP}
884 .if make(distributeworld)
885 .for dist in ${EXTRA_DISTRIBUTIONS}
886 find ${DESTDIR}/${DISTDIR}/${dist} -mindepth 1 -empty -delete
889 .for dist in base ${EXTRA_DISTRIBUTIONS}
890 @# For each file that exists in this dist, print the corresponding
891 @# line from the METALOG. This relies on the fact that
892 @# a line containing only the filename will sort immediatly before
893 @# the relevant mtree line.
894 cd ${DESTDIR}/${DISTDIR}; \
895 find ./${dist} | sort -u ${METALOG} - | \
896 awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \
897 ${DESTDIR}/${DISTDIR}/${dist}.meta
899 .for dist in ${DEBUG_DISTRIBUTIONS}
900 @# For each file that exists in this dist, print the corresponding
901 @# line from the METALOG. This relies on the fact that
902 @# a line containing only the filename will sort immediatly before
903 @# the relevant mtree line.
904 cd ${DESTDIR}/${DISTDIR}; \
905 find ./${dist}/usr/lib/debug | sort -u ${METALOG} - | \
906 awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \
907 ${DESTDIR}/${DISTDIR}/${dist}.debug.meta
913 .for dist in base ${EXTRA_DISTRIBUTIONS}
915 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
916 tar cvf - --exclude usr/lib/debug \
917 @${DESTDIR}/${DISTDIR}/${dist}.meta | \
918 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/${dist}.txz
920 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
921 tar cvf - --exclude usr/lib/debug . | \
922 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/${dist}.txz
926 .for dist in ${DEBUG_DISTRIBUTIONS}
927 . if defined(NO_ROOT)
928 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
929 tar cvf - @${DESTDIR}/${DISTDIR}/${dist}.debug.meta | \
930 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/${dist}-dbg.txz
932 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
933 tar cvLf - usr/lib/debug | \
934 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/${dist}-dbg.txz
941 # If you have a build server, you can NFS mount the source and obj directories
942 # and do a 'make reinstall' on the *client* to install new binaries from the
943 # most recent server build.
946 @echo "--------------------------------------------------------------"
947 @echo ">>> Making hierarchy"
948 @echo "--------------------------------------------------------------"
949 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 \
950 LOCAL_MTREE=${LOCAL_MTREE:Q} hierarchy
952 @echo "--------------------------------------------------------------"
953 @echo ">>> Installing everything"
954 @echo "--------------------------------------------------------------"
955 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
956 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
957 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32
961 @echo "--------------------------------------------------------------"
962 @echo ">>> Distributing everything"
963 @echo "--------------------------------------------------------------"
964 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
965 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
966 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 \
970 distrib-dirs distribution: .MAKE
971 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
972 ${IMAKE_INSTALL} ${IMAKE_MTREE} METALOG=${METALOG} ${.TARGET}
975 # buildkernel and installkernel
977 # Which kernels to build and/or install is specified by setting
978 # KERNCONF. If not defined a GENERIC kernel is built/installed.
979 # Only the existing (depending TARGET) config files are used
980 # for building kernels and only the first of these is designated
981 # as the one being installed.
983 # Note that we have to use TARGET instead of TARGET_ARCH when
984 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
985 # be set to cross-build, we have to make sure TARGET is set
988 .if defined(KERNFAST)
993 # Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah
994 .if !defined(KERNCONF) && ${KERNFAST} != "1"
998 .if ${TARGET_ARCH} == "powerpc64"
1003 INSTKERNNAME?= kernel
1005 KERNSRCDIR?= ${.CURDIR}/sys
1006 KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf
1007 KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR}
1008 KERNCONFDIR?= ${KRNLCONFDIR}
1012 .for _kernel in ${KERNCONF}
1013 .if exists(${KERNCONFDIR}/${_kernel})
1014 BUILDKERNELS+= ${_kernel}
1015 .if empty(INSTALLKERNEL)
1016 INSTALLKERNEL= ${_kernel}
1021 buildkernel ${WMAKE_TGTS} ${.ALLTARGETS:M_*}: .MAKE
1026 # Builds all kernels defined by BUILDKERNELS.
1029 .if empty(BUILDKERNELS)
1030 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \
1034 .for _kernel in ${BUILDKERNELS}
1035 @echo "--------------------------------------------------------------"
1036 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
1037 @echo "--------------------------------------------------------------"
1038 @echo "===> ${_kernel}"
1039 mkdir -p ${KRNLOBJDIR}
1040 .if !defined(NO_KERNELCONFIG)
1042 @echo "--------------------------------------------------------------"
1043 @echo ">>> stage 1: configuring the kernel"
1044 @echo "--------------------------------------------------------------"
1045 cd ${KRNLCONFDIR}; \
1047 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
1048 -I '${KERNCONFDIR}' '${KERNCONFDIR}/${_kernel}'
1050 .if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN)
1052 @echo "--------------------------------------------------------------"
1053 @echo ">>> stage 2.1: cleaning up the object tree"
1054 @echo "--------------------------------------------------------------"
1055 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR}
1057 .if !defined(NO_KERNELOBJ)
1059 @echo "--------------------------------------------------------------"
1060 @echo ">>> stage 2.2: rebuilding the object tree"
1061 @echo "--------------------------------------------------------------"
1062 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj
1065 @echo "--------------------------------------------------------------"
1066 @echo ">>> stage 2.3: build tools"
1067 @echo "--------------------------------------------------------------"
1068 ${_+_}cd ${.CURDIR}; ${KTMAKE} kernel-tools
1069 .if !defined(NO_KERNELDEPEND)
1071 @echo "--------------------------------------------------------------"
1072 @echo ">>> stage 3.1: making dependencies"
1073 @echo "--------------------------------------------------------------"
1074 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ
1077 @echo "--------------------------------------------------------------"
1078 @echo ">>> stage 3.2: building everything"
1079 @echo "--------------------------------------------------------------"
1080 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ
1081 @echo "--------------------------------------------------------------"
1082 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
1083 @echo "--------------------------------------------------------------"
1087 # installkernel, etc.
1089 # Install the kernel defined by INSTALLKERNEL
1091 installkernel installkernel.debug \
1092 reinstallkernel reinstallkernel.debug: _installcheck_kernel
1093 .if empty(INSTALLKERNEL)
1094 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
1097 @echo "--------------------------------------------------------------"
1098 @echo ">>> Installing kernel ${INSTALLKERNEL}"
1099 @echo "--------------------------------------------------------------"
1100 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
1101 ${CROSSENV} PATH=${TMPPATH} \
1102 ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
1104 distributekernel distributekernel.debug:
1105 .if empty(INSTALLKERNEL)
1106 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
1109 mkdir -p ${DESTDIR}/${DISTDIR}
1110 .if defined(NO_ROOT)
1111 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.premeta
1113 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
1114 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.premeta/} \
1115 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} KERNEL=${INSTKERNNAME} \
1116 DESTDIR=${INSTALL_DDIR}/kernel \
1117 ${.TARGET:S/distributekernel/install/}
1118 .if defined(NO_ROOT)
1119 sed -e 's|^./kernel|.|' ${DESTDIR}/${DISTDIR}/kernel.premeta > \
1120 ${DESTDIR}/${DISTDIR}/kernel.meta
1122 .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
1123 .if defined(NO_ROOT)
1124 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta
1126 cd ${KRNLOBJDIR}/${_kernel}; \
1127 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.${_kernel}.premeta/} \
1128 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} \
1129 KERNEL=${INSTKERNNAME}.${_kernel} \
1130 DESTDIR=${INSTALL_DDIR}/kernel.${_kernel} \
1131 ${.TARGET:S/distributekernel/install/}
1132 .if defined(NO_ROOT)
1133 sed -e 's|^./kernel|.|' \
1134 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta > \
1135 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta
1140 .if defined(NO_ROOT)
1141 cd ${DESTDIR}/${DISTDIR}/kernel; \
1142 tar cvf - @${DESTDIR}/${DISTDIR}/kernel.meta | \
1143 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.txz
1144 .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
1145 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
1146 tar cvf - @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta | \
1147 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz
1150 cd ${DESTDIR}/${DISTDIR}/kernel; \
1152 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.txz
1153 .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
1154 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
1156 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz
1163 # Build the API documentation with doxygen
1166 @if [ ! -x `/usr/bin/which doxygen` ]; then \
1167 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \
1170 cd ${.CURDIR}/tools/kerneldoc/subsys && ${MAKE} obj all
1175 # Update the source tree(s), by running svn/svnup to update to the
1179 .if (defined(CVS_UPDATE) || defined(SUP_UPDATE)) && !defined(SVN_UPDATE)
1180 @echo "--------------------------------------------------------------"
1181 @echo "CVS_UPDATE and SUP_UPDATE are no longer supported."
1182 @echo "Please see: https://wiki.freebsd.org/CvsIsDeprecated"
1183 @echo "--------------------------------------------------------------"
1186 .if defined(SVN_UPDATE)
1187 @echo "--------------------------------------------------------------"
1188 @echo ">>> Updating ${.CURDIR} using Subversion"
1189 @echo "--------------------------------------------------------------"
1190 @(cd ${.CURDIR} && ${SVN} update ${SVNFLAGS})
1194 # ------------------------------------------------------------------------
1196 # From here onwards are utility targets used by the 'make world' and
1197 # related targets. If your 'world' breaks, you may like to try to fix
1198 # the problem and manually run the following targets to attempt to
1199 # complete the build. Beware, this is *not* guaranteed to work, you
1200 # need to have a pretty good grip on the current state of the system
1201 # to attempt to manually finish it. If in doubt, 'make world' again.
1205 # legacy: Build compatibility shims for the next three targets
1208 .if ${BOOTSTRAPPING} < 800107 && ${BOOTSTRAPPING} != 0
1209 @echo "ERROR: Source upgrades from versions prior to 8.0 not supported."; \
1212 .for _tool in tools/build
1213 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \
1214 cd ${.CURDIR}/${_tool} && \
1215 ${MAKE} DIRPRFX=${_tool}/ obj && \
1216 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes && \
1217 ${MAKE} DIRPRFX=${_tool}/ depend && \
1218 ${MAKE} DIRPRFX=${_tool}/ all && \
1219 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
1223 # bootstrap-tools: Build tools needed for compatibility
1225 _bt= _bootstrap-tools
1227 .if ${MK_GAMES} != "no"
1228 _strfile= games/fortune/strfile
1231 .if ${MK_CXX} != "no"
1232 _gperf= gnu/usr.bin/gperf
1235 .if ${MK_GROFF} != "no"
1236 _groff= gnu/usr.bin/groff
1239 .if ${MK_VT} != "no"
1240 _vtfontcvt= usr.bin/vtfontcvt
1243 .if ${BOOTSTRAPPING} < 900002
1247 .if ${BOOTSTRAPPING} < 1000002
1251 ${_bt}-usr.bin/m4: ${_bt}-lib/libohash
1254 .if ${BOOTSTRAPPING} < 1000014
1255 _crunch= usr.sbin/crunch
1258 .if ${BOOTSTRAPPING} < 1000026
1259 _nmtree= lib/libnetbsd \
1262 ${_bt}-usr.sbin/nmtree: ${_bt}-lib/libnetbsd
1265 .if ${BOOTSTRAPPING} < 1000027
1269 .if ${BOOTSTRAPPING} < 1000033
1273 .if ${BOOTSTRAPPING} >= 900040 && ${BOOTSTRAPPING} < 900041
1277 .if ${BOOTSTRAPPING} < 1001506
1281 ${_bt}-usr.bin/yacc: ${_bt}-lib/liby
1284 .if ${MK_BSNMP} != "no"
1285 _gensnmptree= usr.sbin/bsnmpd/gensnmptree
1288 # We need to build tblgen when we're building clang either as
1289 # the bootstrap compiler, or as the part of the normal build.
1290 .if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_CLANG} != "no"
1292 lib/clang/libllvmsupport \
1293 lib/clang/libllvmtablegen \
1294 usr.bin/clang/tblgen \
1295 usr.bin/clang/clang-tblgen
1297 ${_bt}-usr.bin/clang/clang-tblgen: ${_bt}-lib/clang/libllvmtablegen ${_bt}-lib/clang/libllvmsupport
1298 ${_bt}-usr.bin/clang/tblgen: ${_bt}-lib/clang/libllvmtablegen ${_bt}-lib/clang/libllvmsupport
1301 # ELF Tool Chain libraries are needed for ELF tools and dtrace tools.
1302 # dtrace tools are required for older bootstrap env and cross-build
1304 .if ${BOOTSTRAPPING} < 1100006 || (${MACHINE} != ${TARGET} || \
1305 ${MACHINE_ARCH} != ${TARGET_ARCH})
1306 _elftoolchain_libs= lib/libelf lib/libdwarf
1307 .if ${MK_CDDL} != "no"
1308 _dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf cddl/usr.bin/ctfconvert \
1309 cddl/usr.bin/ctfmerge
1311 ${_bt}-cddl/usr.bin/ctfconvert: ${_bt}-lib/libelf ${_bt}-lib/libdwarf ${_bt}-cddl/lib/libctf
1312 ${_bt}-cddl/usr.bin/ctfmerge: ${_bt}-lib/libelf ${_bt}-lib/libdwarf ${_bt}-cddl/lib/libctf
1316 # Default to building the GPL DTC, but build the BSDL one if users explicitly
1319 .if ${MK_GPL_DTC} != "no"
1320 _dtc= gnu/usr.bin/dtc
1323 .if ${MK_KERBEROS} != "no"
1324 _kerberos5_bootstrap_tools= \
1325 kerberos5/tools/make-roken \
1326 kerberos5/lib/libroken \
1327 kerberos5/lib/libvers \
1328 kerberos5/tools/asn1_compile \
1329 kerberos5/tools/slc \
1332 ${_bt}-kerberos5/tools/slc: ${_bt}-kerberos5/lib/libroken
1333 ${_bt}-kerberos5/tools/asn1_compile: ${_bt}-kerberos5/lib/libroken
1336 bootstrap-tools: .PHONY
1338 # Please document (add comment) why something is in 'bootstrap-tools'.
1339 # Try to bound the building of the bootstrap-tool to just the
1340 # FreeBSD versions that need the tool built at this stage of the build.
1343 ${_kerberos5_bootstrap_tools} \
1344 ${_elftoolchain_libs} \
1353 usr.bin/makewhatis \
1366 ${_bt}-${_tool}: .PHONY .MAKE
1367 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1368 cd ${.CURDIR}/${_tool} && \
1369 ${MAKE} DIRPRFX=${_tool}/ obj && \
1370 ${MAKE} DIRPRFX=${_tool}/ depend && \
1371 ${MAKE} DIRPRFX=${_tool}/ all && \
1372 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
1374 bootstrap-tools: ${_bt}-${_tool}
1378 # build-tools: Build special purpose build tools
1380 .if !defined(NO_SHARE)
1381 _share= share/syscons/scrnmaps
1384 .if ${MK_GCC} != "no"
1385 _gcc_tools= gnu/usr.bin/cc/cc_tools
1388 .if ${MK_RESCUE} != "no"
1389 _rescue= rescue/rescue
1397 ${LOCAL_TOOL_DIRS} \
1398 lib/ncurses/ncurses \
1399 lib/ncurses/ncursesw \
1403 usr.bin/mkesdb_static \
1404 usr.bin/mkcsmapper_static \
1406 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \
1407 cd ${.CURDIR}/${_tool} && \
1408 ${MAKE} DIRPRFX=${_tool}/ obj && \
1409 ${MAKE} DIRPRFX=${_tool}/ build-tools
1413 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \
1414 cd ${.CURDIR}/${_tool} && \
1415 ${MAKE} DIRPRFX=${_tool}/ obj && \
1416 ${MAKE} DIRPRFX=${_tool}/ depend && \
1417 ${MAKE} DIRPRFX=${_tool}/ all
1421 # kernel-tools: Build kernel-building tools
1424 mkdir -p ${MAKEOBJDIRPREFIX}/usr
1425 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1426 -p ${MAKEOBJDIRPREFIX}/usr >/dev/null
1429 # cross-tools: Build cross-building tools
1431 .if ${TARGET_ARCH} != ${MACHINE_ARCH}
1432 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386"
1433 _btxld= usr.sbin/btxld
1436 .if ${TARGET_ARCH} != ${MACHINE_ARCH}
1437 .if ${MK_RESCUE} != "no" || defined(RELEASEDIR)
1438 _crunchide= usr.sbin/crunch/crunchide
1440 .if ${TARGET_ARCH} == "i386" && defined(RELEASEDIR)
1441 _kgzip= usr.sbin/kgzip
1445 # If we're given an XAS, don't build binutils.
1446 .if ${XAS:M/*} == ""
1447 .if ${MK_BINUTILS_BOOTSTRAP} != "no"
1448 _binutils= gnu/usr.bin/binutils
1450 .if ${MK_ELFTOOLCHAIN_TOOLS} != "no"
1451 _elftctools= lib/libelftc \
1456 # These are not required by the build, but can be useful for developers who
1457 # cross-build on a FreeBSD 10 host:
1458 _elftctools+= usr.bin/addr2line
1462 # If an full path to an external cross compiler is given, don't build
1464 .if ${XCC:M/*} == "" && ${MK_CROSS_COMPILER} != "no"
1465 .if ${MK_CLANG_BOOTSTRAP} != "no"
1466 _clang= usr.bin/clang
1467 _clang_libs= lib/clang
1469 .if ${MK_GCC_BOOTSTRAP} != "no"
1481 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
1486 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1487 cd ${.CURDIR}/${_tool} && \
1488 ${MAKE} DIRPRFX=${_tool}/ obj && \
1489 ${MAKE} DIRPRFX=${_tool}/ depend && \
1490 ${MAKE} DIRPRFX=${_tool}/ all && \
1491 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
1494 NXBENV= MAKEOBJDIRPREFIX=${OBJTREE}/nxb \
1495 INSTALL="sh ${.CURDIR}/tools/install.sh" \
1496 VERSION="${VERSION}"
1497 NXBMAKE= ${NXBENV} ${MAKE} \
1498 TBLGEN=${OBJTREE}/nxb-bin/usr/bin/tblgen \
1499 CLANG_TBLGEN=${OBJTREE}/nxb-bin/usr/bin/clang-tblgen \
1500 MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH} \
1501 MK_GDB=no MK_TESTS=no \
1503 MK_HTML=no NO_LINT=yes MK_MAN=no \
1504 -DNO_PIC MK_PROFILE=no -DNO_SHARED \
1505 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
1506 MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \
1509 native-xtools: .MAKE
1510 mkdir -p ${OBJTREE}/nxb-bin/bin
1511 mkdir -p ${OBJTREE}/nxb-bin/sbin
1512 mkdir -p ${OBJTREE}/nxb-bin/usr
1513 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1514 -p ${OBJTREE}/nxb-bin/usr >/dev/null
1515 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
1516 -p ${OBJTREE}/nxb-bin/usr/include >/dev/null
1576 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1577 cd ${.CURDIR}/${_tool} && \
1578 ${NXBMAKE} DIRPRFX=${_tool}/ obj && \
1579 ${NXBMAKE} DIRPRFX=${_tool}/ depend && \
1580 ${NXBMAKE} DIRPRFX=${_tool}/ all && \
1581 ${NXBMAKE} DIRPRFX=${_tool}/ DESTDIR=${OBJTREE}/nxb-bin install
1585 # hierarchy - ensure that all the needed directories are present
1587 hierarchy hier: .MAKE
1588 cd ${.CURDIR}/etc && ${HMAKE} distrib-dirs
1591 # libraries - build all libraries, and install them under ${DESTDIR}.
1593 # The list of libraries with dependents (${_prebuild_libs}) and their
1594 # interdependencies (__L) are built automatically by the
1595 # ${.CURDIR}/tools/make_libdeps.sh script.
1599 ${MAKE} -f Makefile.inc1 _prereq_libs && \
1600 ${MAKE} -f Makefile.inc1 _startup_libs && \
1601 ${MAKE} -f Makefile.inc1 _prebuild_libs && \
1602 ${MAKE} -f Makefile.inc1 _generic_libs
1605 # static libgcc.a prerequisite for shared libc
1607 _prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc lib/libcompiler_rt
1609 # These dependencies are not automatically generated:
1611 # gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before
1612 # all shared libraries for ELF.
1614 _startup_libs= gnu/lib/csu
1615 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
1616 _startup_libs+= lib/csu/${MACHINE_ARCH}-elf
1617 .elif exists(${.CURDIR}/lib/csu/${MACHINE_ARCH})
1618 _startup_libs+= lib/csu/${MACHINE_ARCH}
1620 _startup_libs+= lib/csu/${MACHINE_CPUARCH}
1622 _startup_libs+= gnu/lib/libgcc
1623 _startup_libs+= lib/libcompiler_rt
1624 _startup_libs+= lib/libc
1625 _startup_libs+= lib/libc_nonshared
1626 .if ${MK_LIBCPLUSPLUS} != "no"
1627 _startup_libs+= lib/libcxxrt
1630 gnu/lib/libgcc__L: lib/libc__L
1631 gnu/lib/libgcc__L: lib/libc_nonshared__L
1632 .if ${MK_LIBCPLUSPLUS} != "no"
1633 lib/libcxxrt__L: gnu/lib/libgcc__L
1636 _prebuild_libs= ${_kerberos5_lib_libasn1} \
1637 ${_kerberos5_lib_libhdb} \
1638 ${_kerberos5_lib_libheimbase} \
1639 ${_kerberos5_lib_libheimntlm} \
1640 ${_kerberos5_lib_libheimsqlite} \
1641 ${_kerberos5_lib_libheimipcc} \
1642 ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \
1643 ${_kerberos5_lib_libroken} \
1644 ${_kerberos5_lib_libwind} \
1645 lib/libbz2 ${_libcom_err} lib/libcrypt \
1646 lib/libelf lib/libexpat \
1649 lib/libkiconv lib/libkvm lib/liblzma lib/libmd lib/libnv \
1650 ${_lib_libcapsicum} \
1651 lib/ncurses/ncurses lib/ncurses/ncursesw \
1652 lib/libopie lib/libpam ${_lib_libthr} \
1653 ${_lib_libradius} lib/libsbuf lib/libtacplus \
1655 ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \
1656 ${_cddl_lib_libuutil} \
1657 ${_cddl_lib_libavl} \
1658 ${_cddl_lib_libzfs_core} \
1659 ${_cddl_lib_libctf} \
1660 lib/libutil lib/libpjdlog ${_lib_libypclnt} lib/libz lib/msun \
1661 ${_secure_lib_libcrypto} ${_lib_libldns} \
1662 ${_secure_lib_libssh} ${_secure_lib_libssl} \
1664 .if ${MK_GNUCXX} != "no"
1665 _prebuild_libs+= gnu/lib/libstdc++ gnu/lib/libsupc++
1666 gnu/lib/libstdc++__L: lib/msun__L
1667 gnu/lib/libsupc++__L: gnu/lib/libstdc++__L
1670 lib/libgeom__L: lib/libexpat__L
1672 .if ${MK_LIBTHR} != "no"
1673 _lib_libthr= lib/libthr
1676 .if ${MK_RADIUS_SUPPORT} != "no"
1677 _lib_libradius= lib/libradius
1680 .if ${MK_OFED} != "no"
1681 _ofed_lib= contrib/ofed/usr.lib/
1684 .if ${MK_CASPER} != "no"
1685 _lib_libcapsicum=lib/libcapsicum
1688 lib/libcapsicum__L: lib/libnv__L
1689 lib/libpjdlog__L: lib/libutil__L
1690 lib/liblzma__L: lib/libthr__L
1692 _generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib}
1693 .for _DIR in ${LOCAL_LIB_DIRS}
1694 .if exists(${.CURDIR}/${_DIR}/Makefile)
1695 _generic_libs+= ${_DIR}
1699 lib/libopie__L lib/libtacplus__L: lib/libmd__L
1701 .if ${MK_CDDL} != "no"
1702 _cddl_lib_libumem= cddl/lib/libumem
1703 _cddl_lib_libnvpair= cddl/lib/libnvpair
1704 _cddl_lib_libavl= cddl/lib/libavl
1705 _cddl_lib_libuutil= cddl/lib/libuutil
1706 _cddl_lib_libzfs_core= cddl/lib/libzfs_core
1707 _cddl_lib_libctf= cddl/lib/libctf
1709 cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L
1710 cddl/lib/libzfs__L: lib/libgeom__L
1711 cddl/lib/libctf__L: lib/libz__L
1714 .if ${MK_CRYPT} != "no"
1715 .if ${MK_OPENSSL} != "no"
1716 _secure_lib_libcrypto= secure/lib/libcrypto
1717 _secure_lib_libssl= secure/lib/libssl
1718 lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L
1719 .if ${MK_LDNS} != "no"
1720 _lib_libldns= lib/libldns
1721 lib/libldns__L: secure/lib/libcrypto__L
1723 .if ${MK_OPENSSH} != "no"
1724 _secure_lib_libssh= secure/lib/libssh
1725 secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
1726 .if ${MK_LDNS} != "no"
1727 secure/lib/libssh__L: lib/libldns__L
1729 .if ${MK_KERBEROS_SUPPORT} != "no"
1730 secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \
1731 kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \
1732 lib/libmd__L kerberos5/lib/libroken__L
1736 _secure_lib= secure/lib
1739 .if ${MK_KERBEROS} != "no"
1740 kerberos5/lib/libasn1__L: lib/libcom_err__L kerberos5/lib/libroken__L
1741 kerberos5/lib/libhdb__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1742 kerberos5/lib/libkrb5__L kerberos5/lib/libroken__L \
1743 kerberos5/lib/libwind__L kerberos5/lib/libheimsqlite__L
1744 kerberos5/lib/libheimntlm__L: secure/lib/libcrypto__L kerberos5/lib/libkrb5__L \
1745 kerberos5/lib/libroken__L lib/libcom_err__L
1746 kerberos5/lib/libhx509__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1747 secure/lib/libcrypto__L kerberos5/lib/libroken__L kerberos5/lib/libwind__L
1748 kerberos5/lib/libkrb5__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1749 lib/libcrypt__L secure/lib/libcrypto__L kerberos5/lib/libhx509__L \
1750 kerberos5/lib/libroken__L kerberos5/lib/libwind__L \
1751 kerberos5/lib/libheimbase__L kerberos5/lib/libheimipcc__L
1752 kerberos5/lib/libroken__L: lib/libcrypt__L
1753 kerberos5/lib/libwind__L: kerberos5/lib/libroken__L lib/libcom_err__L
1754 kerberos5/lib/libheimbase__L: lib/libthr__L
1755 kerberos5/lib/libheimipcc__L: kerberos5/lib/libroken__L kerberos5/lib/libheimbase__L lib/libthr__L
1756 kerberos5/lib/libheimsqlite__L: lib/libthr__L
1759 .if ${MK_GSSAPI} != "no"
1760 _lib_libgssapi= lib/libgssapi
1763 .if ${MK_KERBEROS} != "no"
1764 _kerberos5_lib= kerberos5/lib
1765 _kerberos5_lib_libasn1= kerberos5/lib/libasn1
1766 _kerberos5_lib_libhdb= kerberos5/lib/libhdb
1767 _kerberos5_lib_libheimbase= kerberos5/lib/libheimbase
1768 _kerberos5_lib_libkrb5= kerberos5/lib/libkrb5
1769 _kerberos5_lib_libhx509= kerberos5/lib/libhx509
1770 _kerberos5_lib_libroken= kerberos5/lib/libroken
1771 _kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm
1772 _kerberos5_lib_libheimsqlite= kerberos5/lib/libheimsqlite
1773 _kerberos5_lib_libheimipcc= kerberos5/lib/libheimipcc
1774 _kerberos5_lib_libwind= kerberos5/lib/libwind
1775 _libcom_err= lib/libcom_err
1778 .if ${MK_NIS} != "no"
1779 _lib_libypclnt= lib/libypclnt
1782 .if ${MK_OPENSSL} == "no"
1783 lib/libradius__L: lib/libmd__L
1786 gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncursesw__L
1788 .for _lib in ${_prereq_libs}
1789 ${_lib}__PL: .PHONY .MAKE
1790 .if exists(${.CURDIR}/${_lib})
1791 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1792 cd ${.CURDIR}/${_lib} && \
1793 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj && \
1794 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ depend && \
1795 ${MAKE} MK_TESTS=no MK_PROFILE=no -DNO_PIC \
1796 DIRPRFX=${_lib}/ all && \
1797 ${MAKE} MK_TESTS=no MK_PROFILE=no -DNO_PIC \
1798 DIRPRFX=${_lib}/ install
1802 .for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
1803 ${_lib}__L: .PHONY .MAKE
1804 .if exists(${.CURDIR}/${_lib})
1805 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1806 cd ${.CURDIR}/${_lib} && \
1807 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj && \
1808 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ depend && \
1809 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ all && \
1810 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ install
1814 # libpam is special: we need to build static PAM modules before
1815 # static PAM library, and dynamic PAM library before dynamic PAM
1817 lib/libpam__L: .PHONY .MAKE
1818 ${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \
1819 cd ${.CURDIR}/lib/libpam && \
1820 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ obj && \
1821 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ depend && \
1822 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ \
1823 -D_NO_LIBPAM_SO_YET all && \
1824 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ \
1825 -D_NO_LIBPAM_SO_YET install
1827 _prereq_libs: ${_prereq_libs:S/$/__PL/}
1828 _startup_libs: ${_startup_libs:S/$/__L/}
1829 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
1830 _generic_libs: ${_generic_libs:S/$/__L/}
1832 .for __target in all clean cleandepend cleandir depend includes obj
1833 .for entry in ${SUBDIR}
1834 ${entry}.${__target}__D: .PHONY .MAKE
1835 ${_+_}@set -e; if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
1836 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \
1837 edir=${entry}.${MACHINE_ARCH}; \
1838 cd ${.CURDIR}/$${edir}; \
1840 ${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \
1842 cd ${.CURDIR}/$${edir}; \
1844 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
1846 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
1849 .include <bsd.subdir.mk>
1851 .if make(check-old) || make(check-old-dirs) || \
1852 make(check-old-files) || make(check-old-libs) || \
1853 make(delete-old) || make(delete-old-dirs) || \
1854 make(delete-old-files) || make(delete-old-libs)
1857 # check for / delete old files section
1860 .include "ObsoleteFiles.inc"
1862 OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \
1863 else you can not start such an application. Consult UPDATING for more \
1864 information regarding how to cope with the removal/revision bump of a \
1867 .if !defined(BATCH_DELETE_OLD_FILES)
1874 @echo ">>> Removing old files (only deletes safe to delete libs)"
1875 # Ask for every old file if the user really wants to remove it.
1876 # It's annoying, but better safe than sorry.
1877 # NB: We cannot pass the list of OLD_FILES as a parameter because the
1878 # argument list will get too long. Using .for/.endfor make "loops" will make
1879 # the Makefile parser segfault.
1882 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1883 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1884 while read file; do \
1885 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1886 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1887 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1890 # Remove catpages without corresponding manpages.
1892 find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1893 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1894 while read catpage; do \
1896 if [ ! -e "$${manpage}" ]; then \
1897 rm ${RM_I} $${catpage} <&3; \
1900 @echo ">>> Old files removed"
1903 @echo ">>> Checking for old files"
1905 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1906 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1907 while read file; do \
1908 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1909 echo "${DESTDIR}/$${file}"; \
1912 # Check for catpages without corresponding manpages.
1913 @find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1914 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1915 while read catpage; do \
1917 if [ ! -e "$${manpage}" ]; then \
1923 @echo ">>> Removing old libraries"
1924 @echo "${OLD_LIBS_MESSAGE}" | fmt
1927 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1928 -V OLD_LIBS | xargs -n1 | \
1929 while read file; do \
1930 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1931 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1932 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1934 for ext in debug symbols; do \
1935 if ! [ -e "${DESTDIR}/$${file}" ] && [ -f \
1936 "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \
1937 rm ${RM_I} "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" \
1942 @echo ">>> Old libraries removed"
1945 @echo ">>> Checking for old libraries"
1947 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1948 -V OLD_LIBS | xargs -n1 | \
1949 while read file; do \
1950 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1951 echo "${DESTDIR}/$${file}"; \
1953 for ext in debug symbols; do \
1954 if [ -f "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \
1955 echo "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}"; \
1961 @echo ">>> Removing old directories"
1963 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1964 -V OLD_DIRS | xargs -n1 | sort -r | \
1965 while read dir; do \
1966 if [ -d "${DESTDIR}/$${dir}" ]; then \
1967 rmdir -v "${DESTDIR}/$${dir}" || true; \
1968 elif [ -L "${DESTDIR}/$${dir}" ]; then \
1969 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1972 @echo ">>> Old directories removed"
1975 @echo ">>> Checking for old directories"
1977 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1978 -V OLD_DIRS | xargs -n1 | \
1979 while read dir; do \
1980 if [ -d "${DESTDIR}/$${dir}" ]; then \
1981 echo "${DESTDIR}/$${dir}"; \
1982 elif [ -L "${DESTDIR}/$${dir}" ]; then \
1983 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1987 delete-old: delete-old-files delete-old-dirs
1988 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1990 check-old: check-old-files check-old-libs check-old-dirs
1991 @echo "To remove old files and directories run '${MAKE} delete-old'."
1992 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1997 # showconfig - show build configuration.
2000 @(${MAKE} -n -f ${.CURDIR}/sys/conf/kern.opts.mk -V dummy -dg1; \
2001 ${MAKE} -n -f ${.CURDIR}/share/mk/src.opts.mk -V dummy -dg1) 2>&1 | grep ^MK_ | sort -u
2003 .if !empty(KRNLOBJDIR) && !empty(KERNCONF)
2004 DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/
2006 .if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE)
2007 .if exists(${KERNCONFDIR}/${KERNCONF})
2008 FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \
2009 '${KERNCONFDIR}/${KERNCONF}' ; echo
2015 .if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH})
2016 DTBOUTPUTPATH= ${.CURDIR}
2020 # Build 'standalone' Device Tree Blob
2023 @PATH=${TMPPATH} MACHINE=${TARGET} \
2024 ${.CURDIR}/sys/tools/fdt/make_dtb.sh ${.CURDIR}/sys \
2025 "${FDT_DTS_FILE}" ${DTBOUTPUTPATH}
2029 .if defined(TARGET) && defined(TARGET_ARCH)
2031 .if ${TARGET} == ${MACHINE} && ${TARGET_ARCH} == ${MACHINE_ARCH}
2032 XDEV_CPUTYPE?=${CPUTYPE}
2034 XDEV_CPUTYPE?=${TARGET_CPUTYPE}
2037 NOFUN=-DNO_FSCHG MK_HTML=no -DNO_LINT \
2038 MK_MAN=no MK_NLS=no MK_PROFILE=no \
2039 MK_KERBEROS=no MK_RESCUE=no MK_TESTS=no MK_WARNS=no \
2040 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
2041 CPUTYPE=${XDEV_CPUTYPE}
2043 XDDIR=${TARGET_ARCH}-freebsd
2046 .error XDTP variable should be an absolute path
2049 CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \
2050 INSTALL="sh ${.CURDIR}/tools/install.sh"
2052 _SHLIBDIRPREFIX=${XDDESTDIR} \
2053 TOOLS_PREFIX=${XDTP}
2054 CD2CFLAGS=-isystem ${XDDESTDIR}/usr/include -L${XDDESTDIR}/usr/lib \
2055 --sysroot=${XDDESTDIR}/ -B${XDDESTDIR}/usr/libexec \
2056 -B${XDDESTDIR}/usr/bin -B${XDDESTDIR}/usr/lib
2057 CD2ENV=${CDENV} CC="${CC} ${CD2CFLAGS}" CXX="${CXX} ${CD2CFLAGS}" \
2058 CPP="${CPP} ${CD2CFLAGS}" \
2059 MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH}
2061 CDTMP= ${MAKEOBJDIRPREFIX}/${XDDIR}/${.CURDIR}/tmp
2062 CDMAKE=${CDENV} PATH=${CDTMP}/usr/bin:${PATH} ${MAKE} ${NOFUN}
2063 CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDDESTDIR}/usr/bin:${PATH} ${MAKE} ${NOFUN}
2064 XDDESTDIR=${DESTDIR}/${XDTP}
2066 OSREL!= uname -r | sed -e 's/[-(].*//'
2069 .ORDER: xdev-build xdev-install xdev-links
2070 xdev: xdev-build xdev-install
2072 .ORDER: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools
2073 xdev-build: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools
2076 mkdir -p ${CDTMP}/usr
2077 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
2078 -p ${CDTMP}/usr >/dev/null
2080 _xb-bootstrap-tools:
2084 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
2085 cd ${.CURDIR}/${_tool} && \
2086 ${CDMAKE} DIRPRFX=${_tool}/ obj && \
2087 ${CDMAKE} DIRPRFX=${_tool}/ depend && \
2088 ${CDMAKE} DIRPRFX=${_tool}/ all && \
2089 ${CDMAKE} DIRPRFX=${_tool}/ DESTDIR=${CDTMP} install
2093 ${_+_}@cd ${.CURDIR}; \
2094 ${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools
2104 ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \
2105 cd ${.CURDIR}/${_tool} && \
2106 ${CDMAKE} DIRPRFX=${_tool}/ obj && \
2107 ${CDMAKE} DIRPRFX=${_tool}/ depend && \
2108 ${CDMAKE} DIRPRFX=${_tool}/ all
2112 ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}"
2113 mkdir -p ${XDDESTDIR}
2114 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
2115 -p ${XDDESTDIR} >/dev/null
2116 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
2117 -p ${XDDESTDIR}/usr >/dev/null
2118 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
2119 -p ${XDDESTDIR}/usr/include >/dev/null
2120 .if ${MK_TESTS} != "no"
2121 mkdir -p ${XDDESTDIR}${TESTSBASE}
2122 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
2123 -p ${XDDESTDIR}${TESTSBASE} >/dev/null
2126 .ORDER: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries
2127 xdev-install: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries
2130 @echo "_xi-cross-tools"
2138 ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \
2139 cd ${.CURDIR}/${_tool}; \
2140 ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR}
2144 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 par-includes \
2145 DESTDIR=${XDDESTDIR}
2148 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \
2149 DESTDIR=${XDDESTDIR}
2152 ${_+_}cd ${XDDESTDIR}/usr/bin; \
2153 mkdir -p ../../../../usr/bin; \
2155 ln -sf ../../${XDTP}/usr/bin/$$i \
2156 ../../../../usr/bin/${XDDIR}-$$i; \
2157 ln -sf ../../${XDTP}/usr/bin/$$i \
2158 ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \
2161 xdev xdev-build xdev-install xdev-links:
2162 @echo "*** Error: Both TARGET and TARGET_ARCH must be defined for \"${.TARGET}\" target"