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 share/info early so that installation of info `dir'
54 # entries works correctly. Do it first since it is less likely to
55 # grow dependencies on include and lib than vice versa.
57 # We must do lib/ and libexec/ before bin/, because if installworld
58 # installs a new /bin/sh, the 'make' command will *immediately*
59 # use that new version. And the new (dynamically-linked) /bin/sh
60 # will expect to find appropriate libraries in /lib and /libexec.
63 .if defined(SUBDIR_OVERRIDE)
64 SUBDIR= ${SUBDIR_OVERRIDE}
66 SUBDIR= share/info lib libexec
68 .if ${MK_GAMES} != "no"
71 .if ${MK_CDDL} != "no"
75 .if ${MK_KERBEROS} != "no"
78 .if ${MK_RESCUE} != "no"
82 .if ${MK_CRYPT} != "no"
85 .if !defined(NO_SHARE)
88 SUBDIR+=sys usr.bin usr.sbin
89 .if ${MK_TESTS} != "no"
92 .if ${MK_OFED} != "no"
96 # We must do etc/ last for install/distribute to work.
100 # These are last, since it is nice to at least get the base system
101 # rebuilt before you do them.
102 .for _DIR in ${LOCAL_LIB_DIRS} ${LOCAL_DIRS}
103 .if exists(${.CURDIR}/${_DIR}/Makefile)
112 .if defined(NO_CLEANDIR)
113 CLEANDIR= clean cleandepend
120 BUILDENV_SHELL?=/bin/sh
122 SVN?= /usr/local/bin/svn
125 MAKEOBJDIRPREFIX?= /usr/obj
126 .if !defined(OSRELDATE)
127 .if exists(/usr/include/osreldate.h)
128 OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
129 /usr/include/osreldate.h
135 .if !defined(VERSION)
136 REVISION!= ${MAKE} -C ${SRCDIR}/release -V REVISION
137 BRANCH!= ${MAKE} -C ${SRCDIR}/release -V BRANCH
138 SRCRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
139 ${SRCDIR}/sys/sys/param.h
140 VERSION= FreeBSD ${REVISION}-${BRANCH:C/-p[0-9]+$//} ${TARGET_ARCH} ${SRCRELDATE}
143 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
144 .if ${TARGET} == ${TARGET_ARCH}
147 _t= ${TARGET_ARCH}/${TARGET}
150 .if empty(KNOWN_ARCHES:M${_t})
151 .error Unknown target ${TARGET_ARCH}:${TARGET}.
155 .if ${TARGET} == ${MACHINE}
156 TARGET_CPUTYPE?=${CPUTYPE}
161 .if !empty(TARGET_CPUTYPE)
162 _TARGET_CPUTYPE=${TARGET_CPUTYPE}
164 _TARGET_CPUTYPE=dummy
166 _CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} \
167 -f /dev/null -m ${.CURDIR}/share/mk -V CPUTYPE
168 .if ${_CPUTYPE} != ${_TARGET_CPUTYPE}
169 .error CPUTYPE global should be set with ?=.
172 BUILD_ARCH!= uname -p
173 .if ${MACHINE_ARCH} != ${BUILD_ARCH}
174 .error To cross-build, set TARGET_ARCH.
177 .if ${MACHINE} == ${TARGET} && ${MACHINE_ARCH} == ${TARGET_ARCH} && !defined(CROSS_BUILD_TESTING)
178 OBJTREE= ${MAKEOBJDIRPREFIX}
180 OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH}
182 WORLDTMP= ${OBJTREE}${.CURDIR}/tmp
183 # /usr/games added for fortune which depend on strfile
184 BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games:${WORLDTMP}/legacy/bin
185 XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
186 STRICTTMPPATH= ${BPATH}:${XPATH}
187 TMPPATH= ${STRICTTMPPATH}:${PATH}
190 # Avoid running mktemp(1) unless actually needed.
191 # It may not be functional, e.g., due to new ABI
192 # when in the middle of installing over this system.
194 .if make(distributeworld) || make(installworld)
195 INSTALLTMP!= /usr/bin/mktemp -d -u -t install
199 # Building a world goes through the following stages
201 # 1. legacy stage [BMAKE]
202 # This stage is responsible for creating compatibility
203 # shims that are needed by the bootstrap-tools,
204 # build-tools and cross-tools stages.
205 # 1. bootstrap-tools stage [BMAKE]
206 # This stage is responsible for creating programs that
207 # are needed for backward compatibility reasons. They
208 # are not built as cross-tools.
209 # 2. build-tools stage [TMAKE]
210 # This stage is responsible for creating the object
211 # tree and building any tools that are needed during
213 # 3. cross-tools stage [XMAKE]
214 # This stage is responsible for creating any tools that
215 # are needed for cross-builds. A cross-compiler is one
217 # 4. world stage [WMAKE]
218 # This stage actually builds the world.
219 # 5. install stage (optional) [IMAKE]
220 # This stage installs a previously built world.
225 # Common environment for world related stages
226 CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \
227 MACHINE_ARCH=${TARGET_ARCH} \
229 CPUTYPE=${TARGET_CPUTYPE}
230 .if ${MK_GROFF} != "no"
231 CROSSENV+= GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
232 GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \
233 GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac
235 .if defined(TARGET_CFLAGS)
236 CROSSENV+= ${TARGET_CFLAGS}
239 # bootstrap-tools stage
240 BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
241 PATH=${BPATH}:${PATH} \
242 WORLDTMP=${WORLDTMP} \
243 VERSION="${VERSION}" \
244 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}"
245 BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
246 ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
248 BOOTSTRAPPING=${OSRELDATE} \
250 MK_HTML=no MK_INFO=no NO_LINT=yes MK_MAN=no \
251 -DNO_PIC MK_PROFILE=no -DNO_SHARED \
252 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
253 MK_CLANG_FULL=no MK_LLDB=no MK_TESTS=no
256 TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
257 ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
258 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
260 BOOTSTRAPPING=${OSRELDATE} \
263 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no MK_CLANG_FULL=no MK_LLDB=no MK_TESTS=no
266 XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \
267 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
268 MK_GDB=no MK_TESTS=no
271 KTMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
272 PATH=${BPATH}:${PATH} \
273 WORLDTMP=${WORLDTMP} \
275 KTMAKE= TOOLS_PREFIX=${WORLDTMP} MAKEOBJDIRPREFIX=${WORLDTMP} \
276 ${KTMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
278 BOOTSTRAPPING=${OSRELDATE} \
280 MK_HTML=no MK_INFO=no -DNO_LINT MK_MAN=no \
281 -DNO_PIC MK_PROFILE=no -DNO_SHARED \
282 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no
285 WMAKEENV= ${CROSSENV} \
286 _SHLIBDIRPREFIX=${WORLDTMP} \
288 VERSION="${VERSION}" \
289 INSTALL="sh ${.CURDIR}/tools/install.sh" \
293 HMAKE= PATH=${TMPPATH} ${MAKE} LOCAL_MTREE=${LOCAL_MTREE:Q}
295 HMAKE+= PATH=${TMPPATH} METALOG=${METALOG} -DNO_ROOT
298 .if ${MK_CDDL} == "no"
302 .if defined(CROSS_TOOLCHAIN)
303 LOCALBASE?= /usr/local
304 .include "${LOCALBASE}/share/toolchains/${CROSS_TOOLCHAIN}.mk"
306 .if defined(CROSS_TOOLCHAIN_PREFIX)
307 CROSS_COMPILER_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
308 CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
310 XCOMPILERS= CC CXX CPP
311 .for COMPILER in ${XCOMPILERS}
312 .if defined(CROSS_COMPILER_PREFIX)
313 X${COMPILER}?= ${CROSS_COMPILER_PREFIX}${${COMPILER}}
315 X${COMPILER}?= ${${COMPILER}}
318 XBINUTILS= AS AR LD NM OBJCOPY OBJDUMP RANLIB SIZE STRINGS
319 .for BINUTIL in ${XBINUTILS}
320 .if defined(CROSS_BINUTILS_PREFIX)
321 X${BINUTIL}?= ${CROSS_BINUTILS_PREFIX}${${BINUTIL}}
323 X${BINUTIL}?= ${${BINUTIL}}
326 WMAKEENV+= CC="${XCC} ${XFLAGS}" CXX="${XCXX} ${XFLAGS}" \
327 CPP="${XCPP} ${XFLAGS}" \
328 AS="${XAS}" AR="${XAR}" LD="${XLD}" NM=${XNM} \
329 OBJDUMP=${XOBJDUMP} OBJCOPY="${XOBJCOPY}" \
330 RANLIB=${XRANLIB} STRINGS=${XSTRINGS} \
334 XFLAGS= --sysroot=${WORLDTMP}
335 .if defined(CROSS_BINUTILS_PREFIX)
336 # In the case of xdev-build tools, CROSS_BINUTILS_PREFIX won't be a
337 # directory, but the compiler will look in the right place for it's
338 # tools so we don't need to tell it where to look.
339 .if exists(${CROSS_BINUTILS_PREFIX})
340 XFLAGS+= -B${CROSS_BINUTILS_PREFIX}
343 XFLAGS+= -B${WORLDTMP}/usr/bin
345 .if ${TARGET} == "arm"
346 .if ${TARGET_ARCH:M*hf*} != ""
347 TARGET_ABI= gnueabihf
352 .if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc
353 XFLAGS+= -isystem ${WORLDTMP}/usr/include -L${WORLDTMP}/usr/lib
356 TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0
357 XFLAGS+= -target ${TARGET_TRIPLE}
361 WMAKE= ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 DESTDIR=${WORLDTMP}
363 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
365 LIB32_OBJTREE= ${OBJTREE}${.CURDIR}/world32
366 LIB32TMP= ${OBJTREE}${.CURDIR}/lib32
368 .if ${TARGET_ARCH} == "amd64"
369 .if empty(TARGET_CPUTYPE)
370 LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2
372 LIB32CPUFLAGS= -march=${TARGET_CPUTYPE}
374 LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \
375 MACHINE_CPU="i686 mmx sse sse2"
378 LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32"
380 .elif ${TARGET_ARCH} == "powerpc64"
381 .if empty(TARGET_CPUTYPE)
382 LIB32CPUFLAGS= -mcpu=powerpc
384 LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE}
386 LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc
388 LD="${LD} -m elf32ppc_fbsd"
392 LIB32FLAGS= -m32 ${LIB32CPUFLAGS} -DCOMPAT_32BIT \
393 -isystem ${LIB32TMP}/usr/include/ \
394 -L${LIB32TMP}/usr/lib32 \
395 -B${LIB32TMP}/usr/lib32
397 LIB32FLAGS+= --sysroot=${WORLDTMP}
400 # Yes, the flags are redundant.
401 LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${LIB32_OBJTREE} \
402 _SHLIBDIRPREFIX=${LIB32TMP} \
403 _LDSCRIPTROOT=${LIB32TMP} \
404 VERSION="${VERSION}" \
405 INSTALL="sh ${.CURDIR}/tools/install.sh" \
408 SHLIBDIR=/usr/lib32 \
409 LIBPRIVATEDIR=/usr/lib32/private \
410 DTRACE="${DTRACE} -32"
411 LIB32WMAKEFLAGS+= CC="${XCC} ${LIB32FLAGS}" \
412 CXX="${XCXX} ${LIB32FLAGS}" \
413 DESTDIR=${LIB32TMP} \
421 LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} ${LIB32WMAKEFLAGS} \
422 MK_MAN=no MK_INFO=no MK_HTML=no
423 LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} \
424 MK_TOOLCHAIN=no ${IMAKE_INSTALL}
427 IMAKEENV= ${CROSSENV:N_LDSCRIPTROOT=*}
428 IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 \
429 ${IMAKE_INSTALL} ${IMAKE_MTREE}
430 .if empty(.MAKEFLAGS:M-n)
431 IMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMP} \
432 LD_LIBRARY_PATH=${INSTALLTMP} \
433 PATH_LOCALE=${INSTALLTMP}/locale
434 IMAKE+= __MAKE_SHELL=${INSTALLTMP}/sh
436 IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP}
438 .if defined(DB_FROM_SRC)
439 INSTALLFLAGS+= -N ${.CURDIR}/etc
440 MTREEFLAGS+= -N ${.CURDIR}/etc
442 _INSTALL_DDIR= ${DESTDIR}/${DISTDIR}
443 INSTALL_DDIR= ${_INSTALL_DDIR:S://:/:g:C:/$::}
445 METALOG?= ${DESTDIR}/${DISTDIR}/METALOG
446 IMAKE+= -DNO_ROOT METALOG=${METALOG}
447 INSTALLFLAGS+= -U -M ${METALOG} -D ${INSTALL_DDIR}
450 .if defined(DB_FROM_SRC) || defined(NO_ROOT)
451 IMAKE_INSTALL= INSTALL="install ${INSTALLFLAGS}"
452 IMAKE_MTREE= MTREE_CMD="mtree ${MTREEFLAGS}"
456 KMAKEENV= ${WMAKEENV}
457 KMAKE= ${KMAKEENV} ${MAKE} ${.MAKEFLAGS} ${KERNEL_FLAGS} KERNEL=${INSTKERNNAME}
462 # Attempt to rebuild the entire system, with reasonable chance of
463 # success, regardless of how old your existing system is.
466 .if ${.CURDIR:C/[^,]//g} != ""
467 # The m4 build of sendmail files doesn't like it if ',' is used
468 # anywhere in the path of it's files.
470 @echo "*** Error: path to source tree contains a comma ','"
475 @echo "--------------------------------------------------------------"
476 @echo ">>> Rebuilding the temporary build tree"
477 @echo "--------------------------------------------------------------"
478 .if !defined(NO_CLEAN)
480 .if defined(LIB32TMP)
484 rm -rf ${WORLDTMP}/legacy/usr/include
485 # XXX - These three can depend on any header file.
486 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
487 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c
488 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
491 lib usr legacy/bin legacy/usr
492 mkdir -p ${WORLDTMP}/${_dir}
494 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
495 -p ${WORLDTMP}/legacy/usr >/dev/null
496 .if ${MK_GROFF} != "no"
497 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.groff.dist \
498 -p ${WORLDTMP}/legacy/usr >/dev/null
500 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
501 -p ${WORLDTMP}/usr >/dev/null
502 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
503 -p ${WORLDTMP}/usr/include >/dev/null
504 ln -sf ${.CURDIR}/sys ${WORLDTMP}
505 .if ${MK_DEBUG_FILES} != "no"
506 # We could instead disable debug files for these build stages
507 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
508 -p ${WORLDTMP}/legacy/usr/lib >/dev/null
509 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
510 -p ${WORLDTMP}/usr/lib >/dev/null
512 .if ${MK_TESTS} != "no"
513 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
514 -p ${WORLDTMP}/usr >/dev/null
516 .for _mtree in ${LOCAL_MTREE}
517 mtree -deU -f ${.CURDIR}/${_mtree} -p ${WORLDTMP} > /dev/null
521 @echo "--------------------------------------------------------------"
522 @echo ">>> stage 1.1: legacy release compatibility shims"
523 @echo "--------------------------------------------------------------"
524 ${_+_}cd ${.CURDIR}; ${BMAKE} legacy
527 @echo "--------------------------------------------------------------"
528 @echo ">>> stage 1.2: bootstrap tools"
529 @echo "--------------------------------------------------------------"
530 ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools
532 .if !defined(NO_CLEAN)
534 @echo "--------------------------------------------------------------"
535 @echo ">>> stage 2.1: cleaning up the object tree"
536 @echo "--------------------------------------------------------------"
537 ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
538 .if defined(LIB32TMP)
539 ${_+_}cd ${.CURDIR}; ${LIB32WMAKE} -f Makefile.inc1 ${CLEANDIR:S/^/par-/}
544 @echo "--------------------------------------------------------------"
545 @echo ">>> stage 2.2: rebuilding the object tree"
546 @echo "--------------------------------------------------------------"
547 ${_+_}cd ${.CURDIR}; ${WMAKE} par-obj
550 @echo "--------------------------------------------------------------"
551 @echo ">>> stage 2.3: build tools"
552 @echo "--------------------------------------------------------------"
553 ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools
556 @echo "--------------------------------------------------------------"
557 @echo ">>> stage 3: cross tools"
558 @echo "--------------------------------------------------------------"
559 ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools
560 ${_+_}cd ${.CURDIR}; ${XMAKE} kernel-tools
563 @echo "--------------------------------------------------------------"
564 @echo ">>> stage 4.1: building includes"
565 @echo "--------------------------------------------------------------"
566 ${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
569 @echo "--------------------------------------------------------------"
570 @echo ">>> stage 4.2: building libraries"
571 @echo "--------------------------------------------------------------"
572 ${_+_}cd ${.CURDIR}; \
573 ${WMAKE} -DNO_FSCHG MK_HTML=no MK_INFO=no -DNO_LINT MK_MAN=no \
574 MK_PROFILE=no MK_TESTS=no libraries
577 @echo "--------------------------------------------------------------"
578 @echo ">>> stage 4.3: make dependencies"
579 @echo "--------------------------------------------------------------"
580 ${_+_}cd ${.CURDIR}; ${WMAKE} par-depend
583 @echo "--------------------------------------------------------------"
584 @echo ">>> stage 4.4: building everything"
585 @echo "--------------------------------------------------------------"
586 ${_+_}cd ${.CURDIR}; ${WMAKE} par-all
587 .if defined(LIB32TMP)
590 @echo "--------------------------------------------------------------"
591 @echo ">>> stage 5.1: building 32 bit shim libraries"
592 @echo "--------------------------------------------------------------"
593 mkdir -p ${LIB32TMP}/usr/include
594 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
595 -p ${LIB32TMP}/usr >/dev/null
596 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
597 -p ${LIB32TMP}/usr/include >/dev/null
598 .if ${MK_DEBUG_FILES} != "no"
599 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
600 -p ${LIB32TMP}/usr/lib >/dev/null
603 ln -sf ${.CURDIR}/sys ${WORLDTMP}
604 .for _t in obj includes
605 cd ${.CURDIR}/include; ${LIB32WMAKE} DIRPRFX=include/ ${_t}
606 cd ${.CURDIR}/lib; ${LIB32WMAKE} DIRPRFX=lib/ ${_t}
607 .if ${MK_CDDL} != "no"
608 cd ${.CURDIR}/cddl/lib; ${LIB32WMAKE} DIRPRFX=cddl/lib/ ${_t}
610 cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} DIRPRFX=gnu/lib/ ${_t}
611 .if ${MK_CRYPT} != "no"
612 cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} DIRPRFX=secure/lib/ ${_t}
614 .if ${MK_KERBEROS} != "no"
615 cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} DIRPRFX=kerberos5/lib ${_t}
618 .for _dir in usr.bin/lex/lib
619 cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} DIRPRFX=${_dir}/ obj
621 .for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic
622 cd ${.CURDIR}/${_dir}; \
623 WORLDTMP=${WORLDTMP} \
624 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
625 MAKEOBJDIRPREFIX=${LIB32_OBJTREE} ${MAKE} SSP_CFLAGS= DESTDIR= \
626 DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
630 ${LIB32WMAKE} -f Makefile.inc1 libraries
631 .for _t in obj depend all
632 cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32WMAKE} \
633 DIRPRFX=libexec/rtld-elf/ ${_t}
634 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32WMAKE} \
635 DIRPRFX=usr.bin/ldd ${_t}
638 distribute32 install32:
639 cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
640 .if ${MK_CDDL} != "no"
641 cd ${.CURDIR}/cddl/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
643 cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
644 .if ${MK_CRYPT} != "no"
645 cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
647 .if ${MK_KERBEROS} != "no"
648 cd ${.CURDIR}/kerberos5/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
650 cd ${.CURDIR}/libexec/rtld-elf; \
651 PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//}
652 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32IMAKE} ${.TARGET:S/32$//}
656 .if !defined(SUBDIR_OVERRIDE)
657 WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools
659 WMAKE_TGTS+= _cleanobj _obj _build-tools
660 .if !defined(SUBDIR_OVERRIDE)
661 WMAKE_TGTS+= _cross-tools
663 WMAKE_TGTS+= _includes _libraries _depend everything
664 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
668 buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
669 .ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
672 @echo "--------------------------------------------------------------"
673 @echo ">>> World build started on `LC_ALL=C date`"
674 @echo "--------------------------------------------------------------"
678 @echo "--------------------------------------------------------------"
679 @echo ">>> World build completed on `LC_ALL=C date`"
680 @echo "--------------------------------------------------------------"
683 # We need to have this as a target because the indirection between Makefile
684 # and Makefile.inc1 causes the correct PATH to be used, rather than a
685 # modification of the current environment's PATH. In addition, we need
686 # to quote multiword values.
692 @echo Entering world for ${TARGET_ARCH}:${TARGET}
693 @cd ${.CURDIR} && env ${WMAKEENV} ${BUILDENV_SHELL} || true
695 TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything:Nbuild32}
696 toolchain: ${TOOLCHAIN_TGTS}
697 kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries}
702 # Checks to be sure system is ready for installworld/installkernel.
704 installcheck: _installcheck_world _installcheck_kernel
706 _installcheck_kernel:
709 # Require DESTDIR to be set if installing for a different architecture or
710 # using the user/group database in the source tree.
712 .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE} || \
714 .if !make(distributeworld)
715 _installcheck_world: __installcheck_DESTDIR
716 _installcheck_kernel: __installcheck_DESTDIR
717 __installcheck_DESTDIR:
718 .if !defined(DESTDIR) || empty(DESTDIR)
719 @echo "ERROR: Please set DESTDIR!"; \
725 .if !defined(DB_FROM_SRC)
727 # Check for missing UIDs/GIDs.
729 CHECK_UIDS= auditdistd
731 .if ${MK_SENDMAIL} != "no"
737 CHECK_GIDS+= proxy authpf
739 .if ${MK_UNBOUND} != "no"
743 _installcheck_world: __installcheck_UGID
745 .for uid in ${CHECK_UIDS}
746 @if ! `id -u ${uid} >/dev/null 2>&1`; then \
747 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \
751 .for gid in ${CHECK_GIDS}
752 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \
753 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \
760 # Required install tools to be saved in a scratch dir for safety.
762 .if ${MK_INFO} != "no"
763 _install-info= install-info
765 .if ${MK_ZONEINFO} != "no"
766 _zoneinfo= zic tzsetup
769 ITOOLS= [ awk cap_mkdb cat chflags chmod chown \
770 date echo egrep find grep id install ${_install-info} \
771 ln lockf make mkdir mtree mv pwd_mkdb \
772 rm sed services_mkdb sh sysctl test true uname wc ${_zoneinfo} \
778 # Distributes everything compiled by a `buildworld'.
782 # Installs everything compiled by a 'buildworld'.
785 # Non-base distributions produced by the base system
786 EXTRA_DISTRIBUTIONS= doc
787 .if ${MK_GAMES} != "no"
788 EXTRA_DISTRIBUTIONS+= games
790 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
791 EXTRA_DISTRIBUTIONS+= lib32
793 .if ${MK_TESTS} != "no"
794 EXTRA_DISTRIBUTIONS+= tests
798 .if ${MK_DEBUG_FILES} != "no"
799 DEBUG_DISTRIBUTIONS+= base ${EXTRA_DISTRIBUTIONS:S,doc,,}
802 MTREE_MAGIC?= mtree 2.0
804 distributeworld installworld: _installcheck_world
805 mkdir -p ${INSTALLTMP}
806 progs=$$(for prog in ${ITOOLS}; do \
807 if progpath=`which $$prog`; then \
810 echo "Required tool $$prog not found in PATH." >&2; \
814 libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | \
815 while read line; do \
817 if [ "$$2 $$3" != "not found" ]; then \
820 echo "Required library $$1 not found." >&2; \
824 cp $$libs $$progs ${INSTALLTMP}
825 cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale
827 echo "#${MTREE_MAGIC}" > ${METALOG}
829 .if make(distributeworld)
830 .for dist in ${EXTRA_DISTRIBUTIONS}
831 -mkdir ${DESTDIR}/${DISTDIR}/${dist}
832 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
833 -p ${DESTDIR}/${DISTDIR}/${dist} >/dev/null
834 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
835 -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null
836 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
837 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/include >/dev/null
838 .if ${MK_DEBUG_FILES} != "no"
839 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
840 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib >/dev/null
842 .if ${MK_TESTS} != "no" && ${dist} == "tests"
843 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
844 -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null
847 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \
848 sed -e 's#^\./#./${dist}/#' >> ${METALOG}
849 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.usr.dist | \
850 sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG}
851 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.include.dist | \
852 sed -e 's#^\./#./${dist}/usr/include/#' >> ${METALOG}
855 -mkdir ${DESTDIR}/${DISTDIR}/base
856 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
857 METALOG=${METALOG} ${IMAKE_INSTALL} ${IMAKE_MTREE} \
858 DISTBASE=/base DESTDIR=${DESTDIR}/${DISTDIR}/base \
859 LOCAL_MTREE=${LOCAL_MTREE:Q} distrib-dirs
861 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \
862 ${IMAKEENV} rm -rf ${INSTALLTMP}
863 .if make(distributeworld)
864 .for dist in ${EXTRA_DISTRIBUTIONS}
865 find ${DESTDIR}/${DISTDIR}/${dist} -mindepth 1 -empty -delete
868 .for dist in base ${EXTRA_DISTRIBUTIONS}
869 @# For each file that exists in this dist, print the corresponding
870 @# line from the METALOG. This relies on the fact that
871 @# a line containing only the filename will sort immediatly before
872 @# the relevant mtree line.
873 cd ${DESTDIR}/${DISTDIR}; \
874 find ./${dist} | sort -u ${METALOG} - | \
875 awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \
876 ${DESTDIR}/${DISTDIR}/${dist}.meta
878 .for dist in ${DEBUG_DISTRIBUTIONS}
879 @# For each file that exists in this dist, print the corresponding
880 @# line from the METALOG. This relies on the fact that
881 @# a line containing only the filename will sort immediatly before
882 @# the relevant mtree line.
883 cd ${DESTDIR}/${DISTDIR}; \
884 find ./${dist}/usr/lib/debug | sort -u ${METALOG} - | \
885 awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \
886 ${DESTDIR}/${DISTDIR}/${dist}.debug.meta
892 .for dist in base ${EXTRA_DISTRIBUTIONS}
894 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
895 tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz \
896 --exclude usr/lib/debug \
897 @${DESTDIR}/${DISTDIR}/${dist}.meta
899 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
900 tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz \
901 --exclude usr/lib/debug .
905 .for dist in ${DEBUG_DISTRIBUTIONS}
906 . if defined(NO_ROOT)
907 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
908 tar cvJf ${DESTDIR}/${DISTDIR}/${dist}-dbg.txz \
909 @${DESTDIR}/${DISTDIR}/${dist}.debug.meta
911 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
912 tar cvJfL ${DESTDIR}/${DISTDIR}/${dist}-dbg.txz \
920 # If you have a build server, you can NFS mount the source and obj directories
921 # and do a 'make reinstall' on the *client* to install new binaries from the
922 # most recent server build.
925 @echo "--------------------------------------------------------------"
926 @echo ">>> Making hierarchy"
927 @echo "--------------------------------------------------------------"
928 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 \
929 LOCAL_MTREE=${LOCAL_MTREE:Q} hierarchy
931 @echo "--------------------------------------------------------------"
932 @echo ">>> Installing everything"
933 @echo "--------------------------------------------------------------"
934 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
935 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
936 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32
940 @echo "--------------------------------------------------------------"
941 @echo ">>> Distributing everything"
942 @echo "--------------------------------------------------------------"
943 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
944 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
945 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 \
949 distrib-dirs distribution: .MAKE
950 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
951 ${IMAKE_INSTALL} ${IMAKE_MTREE} METALOG=${METALOG} ${.TARGET}
954 # buildkernel and installkernel
956 # Which kernels to build and/or install is specified by setting
957 # KERNCONF. If not defined a GENERIC kernel is built/installed.
958 # Only the existing (depending TARGET) config files are used
959 # for building kernels and only the first of these is designated
960 # as the one being installed.
962 # Note that we have to use TARGET instead of TARGET_ARCH when
963 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
964 # be set to cross-build, we have to make sure TARGET is set
967 .if defined(KERNFAST)
972 # Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah
973 .if !defined(KERNCONF) && ${KERNFAST} != "1"
977 .if ${TARGET_ARCH} == "powerpc64"
982 INSTKERNNAME?= kernel
984 KERNSRCDIR?= ${.CURDIR}/sys
985 KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf
986 KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR}
987 KERNCONFDIR?= ${KRNLCONFDIR}
991 .for _kernel in ${KERNCONF}
992 .if exists(${KERNCONFDIR}/${_kernel})
993 BUILDKERNELS+= ${_kernel}
994 .if empty(INSTALLKERNEL)
995 INSTALLKERNEL= ${_kernel}
1000 buildkernel ${WMAKE_TGTS} ${.ALLTARGETS:M_*}: .MAKE
1005 # Builds all kernels defined by BUILDKERNELS.
1008 .if empty(BUILDKERNELS)
1009 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \
1013 .for _kernel in ${BUILDKERNELS}
1014 @echo "--------------------------------------------------------------"
1015 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
1016 @echo "--------------------------------------------------------------"
1017 @echo "===> ${_kernel}"
1018 mkdir -p ${KRNLOBJDIR}
1019 .if !defined(NO_KERNELCONFIG)
1021 @echo "--------------------------------------------------------------"
1022 @echo ">>> stage 1: configuring the kernel"
1023 @echo "--------------------------------------------------------------"
1024 cd ${KRNLCONFDIR}; \
1026 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
1027 -I '${KERNCONFDIR}' '${KERNCONFDIR}/${_kernel}'
1029 .if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN)
1031 @echo "--------------------------------------------------------------"
1032 @echo ">>> stage 2.1: cleaning up the object tree"
1033 @echo "--------------------------------------------------------------"
1034 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR}
1036 .if !defined(NO_KERNELOBJ)
1038 @echo "--------------------------------------------------------------"
1039 @echo ">>> stage 2.2: rebuilding the object tree"
1040 @echo "--------------------------------------------------------------"
1041 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj
1044 @echo "--------------------------------------------------------------"
1045 @echo ">>> stage 2.3: build tools"
1046 @echo "--------------------------------------------------------------"
1047 ${_+_}cd ${.CURDIR}; ${KTMAKE} kernel-tools
1048 .if !defined(NO_KERNELDEPEND)
1050 @echo "--------------------------------------------------------------"
1051 @echo ">>> stage 3.1: making dependencies"
1052 @echo "--------------------------------------------------------------"
1053 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ
1056 @echo "--------------------------------------------------------------"
1057 @echo ">>> stage 3.2: building everything"
1058 @echo "--------------------------------------------------------------"
1059 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ
1060 @echo "--------------------------------------------------------------"
1061 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
1062 @echo "--------------------------------------------------------------"
1066 # installkernel, etc.
1068 # Install the kernel defined by INSTALLKERNEL
1070 installkernel installkernel.debug \
1071 reinstallkernel reinstallkernel.debug: _installcheck_kernel
1072 .if empty(INSTALLKERNEL)
1073 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
1076 @echo "--------------------------------------------------------------"
1077 @echo ">>> Installing kernel ${INSTALLKERNEL}"
1078 @echo "--------------------------------------------------------------"
1079 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
1080 ${CROSSENV} PATH=${TMPPATH} \
1081 ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
1083 distributekernel distributekernel.debug:
1084 .if empty(INSTALLKERNEL)
1085 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
1088 mkdir -p ${DESTDIR}/${DISTDIR}
1089 .if defined(NO_ROOT)
1090 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.premeta
1092 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
1093 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.premeta/} \
1094 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} KERNEL=${INSTKERNNAME} \
1095 DESTDIR=${INSTALL_DDIR}/kernel \
1096 ${.TARGET:S/distributekernel/install/}
1097 .if defined(NO_ROOT)
1098 sed -e 's|^./kernel|.|' ${DESTDIR}/${DISTDIR}/kernel.premeta > \
1099 ${DESTDIR}/${DISTDIR}/kernel.meta
1101 .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
1102 .if defined(NO_ROOT)
1103 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta
1105 cd ${KRNLOBJDIR}/${_kernel}; \
1106 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.${_kernel}.premeta/} \
1107 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} \
1108 KERNEL=${INSTKERNNAME}.${_kernel} \
1109 DESTDIR=${INSTALL_DDIR}/kernel.${_kernel} \
1110 ${.TARGET:S/distributekernel/install/}
1111 .if defined(NO_ROOT)
1112 sed -e 's|^./kernel|.|' \
1113 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta > \
1114 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta
1119 .if defined(NO_ROOT)
1120 cd ${DESTDIR}/${DISTDIR}/kernel; \
1121 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz \
1122 @${DESTDIR}/${DISTDIR}/kernel.meta
1123 .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
1124 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
1125 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz \
1126 @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta
1129 cd ${DESTDIR}/${DISTDIR}/kernel; \
1130 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz .
1131 .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
1132 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
1133 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz .
1140 # Build the API documentation with doxygen
1143 @if [ ! -x `/usr/bin/which doxygen` ]; then \
1144 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \
1147 cd ${.CURDIR}/tools/kerneldoc/subsys && ${MAKE} obj all
1152 # Update the source tree(s), by running svn/svnup to update to the
1156 .if (defined(CVS_UPDATE) || defined(SUP_UPDATE)) && !defined(SVN_UPDATE)
1157 @echo "--------------------------------------------------------------"
1158 @echo "CVS_UPDATE and SUP_UPDATE are no longer supported."
1159 @echo "Please see: https://wiki.freebsd.org/CvsIsDeprecated"
1160 @echo "--------------------------------------------------------------"
1163 .if defined(SVN_UPDATE)
1164 @echo "--------------------------------------------------------------"
1165 @echo ">>> Updating ${.CURDIR} using Subversion"
1166 @echo "--------------------------------------------------------------"
1167 @(cd ${.CURDIR} && ${SVN} update ${SVNFLAGS})
1171 # ------------------------------------------------------------------------
1173 # From here onwards are utility targets used by the 'make world' and
1174 # related targets. If your 'world' breaks, you may like to try to fix
1175 # the problem and manually run the following targets to attempt to
1176 # complete the build. Beware, this is *not* guaranteed to work, you
1177 # need to have a pretty good grip on the current state of the system
1178 # to attempt to manually finish it. If in doubt, 'make world' again.
1182 # legacy: Build compatibility shims for the next three targets
1185 .if ${BOOTSTRAPPING} < 800107 && ${BOOTSTRAPPING} != 0
1186 @echo "ERROR: Source upgrades from versions prior to 8.0 not supported."; \
1189 .for _tool in tools/build
1190 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \
1191 cd ${.CURDIR}/${_tool} && \
1192 ${MAKE} DIRPRFX=${_tool}/ obj && \
1193 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes && \
1194 ${MAKE} DIRPRFX=${_tool}/ depend && \
1195 ${MAKE} DIRPRFX=${_tool}/ all && \
1196 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
1200 # bootstrap-tools: Build tools needed for compatibility
1202 .if ${MK_GAMES} != "no"
1203 _strfile= games/fortune/strfile
1206 .if ${MK_CXX} != "no"
1207 _gperf= gnu/usr.bin/gperf
1210 .if ${MK_GROFF} != "no"
1211 _groff= gnu/usr.bin/groff
1214 .if ${MK_VT} != "no"
1215 _vtfontcvt= usr.bin/vtfontcvt
1218 .if ${BOOTSTRAPPING} < 900002
1222 .if ${BOOTSTRAPPING} < 1000002
1227 .if ${BOOTSTRAPPING} < 1000013
1232 .if ${BOOTSTRAPPING} < 1000014
1233 _crunch= usr.sbin/crunch
1236 .if ${BOOTSTRAPPING} < 1000026
1237 _nmtree= lib/libnetbsd \
1241 .if ${BOOTSTRAPPING} < 1000027
1245 .if ${BOOTSTRAPPING} < 1000033
1249 .if ${BOOTSTRAPPING} >= 900040 && ${BOOTSTRAPPING} < 900041
1253 .if ${MK_BSNMP} != "no"
1254 _gensnmptree= usr.sbin/bsnmpd/gensnmptree
1257 # We need to build tblgen when we're building clang either as
1258 # the bootstrap compiler, or as the part of the normal build.
1259 .if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_CLANG} != "no"
1261 lib/clang/libllvmsupport \
1262 lib/clang/libllvmtablegen \
1263 usr.bin/clang/tblgen \
1264 usr.bin/clang/clang-tblgen
1267 # dtrace tools are required for older bootstrap env and cross-build
1269 .if ${MK_CDDL} != "no" && (${BOOTSTRAPPING} < 1100006 \
1270 || (${MACHINE} != ${TARGET} || ${MACHINE_ARCH} != ${TARGET_ARCH}))
1271 _dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \
1272 lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge
1275 # Default to building the GPL DTC, but build the BSDL one if users explicitly
1278 .if ${MK_GPL_DTC} != "no"
1279 _dtc= gnu/usr.bin/dtc
1282 .if ${MK_KERBEROS} != "no"
1283 _kerberos5_bootstrap_tools= \
1284 kerberos5/tools/make-roken \
1285 kerberos5/lib/libroken \
1286 kerberos5/lib/libvers \
1287 kerberos5/tools/asn1_compile \
1288 kerberos5/tools/slc \
1292 # Please document (add comment) why something is in 'bootstrap-tools'.
1293 # Try to bound the building of the bootstrap-tool to just the
1294 # FreeBSD versions that need the tool built at this stage of the build.
1295 bootstrap-tools: .MAKE
1298 ${_kerberos5_bootstrap_tools} \
1307 usr.bin/makewhatis \
1320 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1321 cd ${.CURDIR}/${_tool} && \
1322 ${MAKE} DIRPRFX=${_tool}/ obj && \
1323 ${MAKE} DIRPRFX=${_tool}/ depend && \
1324 ${MAKE} DIRPRFX=${_tool}/ all && \
1325 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
1329 # build-tools: Build special purpose build tools
1331 .if !defined(NO_SHARE)
1332 _share= share/syscons/scrnmaps
1335 .if ${MK_GCC} != "no"
1336 _gcc_tools= gnu/usr.bin/cc/cc_tools
1339 .if ${MK_RESCUE} != "no"
1340 _rescue= rescue/rescue
1348 ${LOCAL_TOOL_DIRS} \
1349 lib/ncurses/ncurses \
1350 lib/ncurses/ncursesw \
1354 usr.bin/mkesdb_static \
1355 usr.bin/mkcsmapper_static \
1357 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \
1358 cd ${.CURDIR}/${_tool} && \
1359 ${MAKE} DIRPRFX=${_tool}/ obj && \
1360 ${MAKE} DIRPRFX=${_tool}/ build-tools
1364 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \
1365 cd ${.CURDIR}/${_tool} && \
1366 ${MAKE} DIRPRFX=${_tool}/ obj && \
1367 ${MAKE} DIRPRFX=${_tool}/ depend && \
1368 ${MAKE} DIRPRFX=${_tool}/ all
1372 # kernel-tools: Build kernel-building tools
1375 mkdir -p ${MAKEOBJDIRPREFIX}/usr
1376 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1377 -p ${MAKEOBJDIRPREFIX}/usr >/dev/null
1380 # cross-tools: Build cross-building tools
1382 .if ${TARGET_ARCH} != ${MACHINE_ARCH}
1383 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386"
1384 _btxld= usr.sbin/btxld
1387 .if ${TARGET_ARCH} != ${MACHINE_ARCH}
1388 .if ${MK_RESCUE} != "no" || defined(RELEASEDIR)
1389 _crunchide= usr.sbin/crunch/crunchide
1391 .if ${TARGET_ARCH} == "i386" && defined(RELEASEDIR)
1392 _kgzip= usr.sbin/kgzip
1396 # If we're given an XAS, don't build binutils.
1397 .if ${XAS:M/*} == "" && ${MK_BINUTILS_BOOTSTRAP} != "no"
1398 _binutils= gnu/usr.bin/binutils
1401 # If an full path to an external cross compiler is given, don't build
1403 .if ${XCC:M/*} == "" && ${MK_CROSS_COMPILER} != "no"
1404 .if ${MK_CLANG_BOOTSTRAP} != "no"
1405 _clang= usr.bin/clang
1406 _clang_libs= lib/clang
1408 .if ${MK_GCC_BOOTSTRAP} != "no"
1419 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
1424 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1425 cd ${.CURDIR}/${_tool} && \
1426 ${MAKE} DIRPRFX=${_tool}/ obj && \
1427 ${MAKE} DIRPRFX=${_tool}/ depend && \
1428 ${MAKE} DIRPRFX=${_tool}/ all && \
1429 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
1432 NXBENV= MAKEOBJDIRPREFIX=${OBJTREE}/nxb \
1433 INSTALL="sh ${.CURDIR}/tools/install.sh" \
1434 VERSION="${VERSION}"
1435 NXBMAKE= ${NXBENV} ${MAKE} \
1436 TBLGEN=${OBJTREE}/nxb-bin/usr/bin/tblgen \
1437 CLANG_TBLGEN=${OBJTREE}/nxb-bin/usr/bin/clang-tblgen \
1438 MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH} \
1439 MK_GDB=no MK_TESTS=no \
1441 MK_HTML=no MK_INFO=no NO_LINT=yes MK_MAN=no \
1442 -DNO_PIC MK_PROFILE=no -DNO_SHARED \
1443 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
1444 MK_CLANG_FULL=no MK_LLDB=no
1446 native-xtools: .MAKE
1447 mkdir -p ${OBJTREE}/nxb-bin/usr
1448 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1449 -p ${OBJTREE}/nxb-bin/usr >/dev/null
1450 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
1451 -p ${OBJTREE}/nxb-bin/usr/include >/dev/null
1466 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1467 cd ${.CURDIR}/${_tool} && \
1468 ${NXBMAKE} DIRPRFX=${_tool}/ obj && \
1469 ${NXBMAKE} DIRPRFX=${_tool}/ depend && \
1470 ${NXBMAKE} DIRPRFX=${_tool}/ all && \
1471 ${NXBMAKE} DIRPRFX=${_tool}/ DESTDIR=${OBJTREE}/nxb-bin install
1475 # hierarchy - ensure that all the needed directories are present
1477 hierarchy hier: .MAKE
1478 cd ${.CURDIR}/etc && ${HMAKE} distrib-dirs
1481 # libraries - build all libraries, and install them under ${DESTDIR}.
1483 # The list of libraries with dependents (${_prebuild_libs}) and their
1484 # interdependencies (__L) are built automatically by the
1485 # ${.CURDIR}/tools/make_libdeps.sh script.
1489 ${MAKE} -f Makefile.inc1 _prereq_libs && \
1490 ${MAKE} -f Makefile.inc1 _startup_libs && \
1491 ${MAKE} -f Makefile.inc1 _prebuild_libs && \
1492 ${MAKE} -f Makefile.inc1 _generic_libs
1495 # static libgcc.a prerequisite for shared libc
1497 _prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc lib/libcompiler_rt
1499 # These dependencies are not automatically generated:
1501 # gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before
1502 # all shared libraries for ELF.
1504 _startup_libs= gnu/lib/csu
1505 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
1506 _startup_libs+= lib/csu/${MACHINE_ARCH}-elf
1507 .elif exists(${.CURDIR}/lib/csu/${MACHINE_ARCH})
1508 _startup_libs+= lib/csu/${MACHINE_ARCH}
1510 _startup_libs+= lib/csu/${MACHINE_CPUARCH}
1512 _startup_libs+= gnu/lib/libgcc
1513 _startup_libs+= lib/libcompiler_rt
1514 _startup_libs+= lib/libc
1515 _startup_libs+= lib/libc_nonshared
1516 .if ${MK_LIBCPLUSPLUS} != "no"
1517 _startup_libs+= lib/libcxxrt
1520 gnu/lib/libgcc__L: lib/libc__L
1521 gnu/lib/libgcc__L: lib/libc_nonshared__L
1522 .if ${MK_LIBCPLUSPLUS} != "no"
1523 lib/libcxxrt__L: gnu/lib/libgcc__L
1526 _prebuild_libs= ${_kerberos5_lib_libasn1} \
1527 ${_kerberos5_lib_libhdb} \
1528 ${_kerberos5_lib_libheimbase} \
1529 ${_kerberos5_lib_libheimntlm} \
1530 ${_kerberos5_lib_libheimsqlite} \
1531 ${_kerberos5_lib_libheimipcc} \
1532 ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \
1533 ${_kerberos5_lib_libroken} \
1534 ${_kerberos5_lib_libwind} \
1536 lib/libbz2 ${_libcom_err} lib/libcrypt \
1537 lib/libelf lib/libexpat \
1539 lib/libkiconv lib/libkvm lib/liblzma lib/libmd lib/libnv \
1540 ${_lib_libcapsicum} \
1541 lib/ncurses/ncurses lib/ncurses/ncursesw \
1542 lib/libopie lib/libpam ${_lib_libthr} \
1543 lib/libradius lib/libsbuf lib/libtacplus \
1545 ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \
1546 ${_cddl_lib_libuutil} \
1547 ${_cddl_lib_libavl} \
1548 ${_cddl_lib_libzfs_core} \
1549 ${_cddl_lib_libctf} \
1550 lib/libutil lib/libpjdlog ${_lib_libypclnt} lib/libz lib/msun \
1551 ${_secure_lib_libcrypto} ${_lib_libldns} \
1552 ${_secure_lib_libssh} ${_secure_lib_libssl}
1553 .if ${MK_GNUCXX} != "no"
1554 _prebuild_libs+= gnu/lib/libstdc++ gnu/lib/libsupc++
1555 gnu/lib/libstdc++__L: lib/msun__L
1556 gnu/lib/libsupc++__L: gnu/lib/libstdc++__L
1559 lib/libgeom__L: lib/libexpat__L
1561 .if defined(WITH_ATF) || ${MK_TESTS} != "no"
1562 .if !defined(WITH_ATF)
1563 # Ensure that the ATF libraries will be built during make libraries, even
1564 # though they will have WITHOUT_TESTS
1570 .if ${MK_LIBTHR} != "no"
1571 _lib_libthr= lib/libthr
1574 .if ${MK_OFED} != "no"
1575 _ofed_lib= contrib/ofed/usr.lib/
1578 .if ${MK_CASPER} != "no"
1579 _lib_libcapsicum=lib/libcapsicum
1582 lib/libcapsicum__L: lib/libnv__L
1583 lib/libpjdlog__L: lib/libutil__L
1585 _generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib}
1586 .for _DIR in ${LOCAL_LIB_DIRS}
1587 .if exists(${.CURDIR}/${_DIR}/Makefile)
1588 _generic_libs+= ${_DIR}
1592 lib/libopie__L lib/libtacplus__L: lib/libmd__L
1594 .if ${MK_CDDL} != "no"
1595 _cddl_lib_libumem= cddl/lib/libumem
1596 _cddl_lib_libnvpair= cddl/lib/libnvpair
1597 _cddl_lib_libavl= cddl/lib/libavl
1598 _cddl_lib_libuutil= cddl/lib/libuutil
1599 _cddl_lib_libzfs_core= cddl/lib/libzfs_core
1600 _cddl_lib_libctf= cddl/lib/libctf
1602 cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L
1603 cddl/lib/libzfs__L: lib/libgeom__L
1604 cddl/lib/libctf__L: lib/libz__L
1607 .if ${MK_CRYPT} != "no"
1608 .if ${MK_OPENSSL} != "no"
1609 _secure_lib_libcrypto= secure/lib/libcrypto
1610 _secure_lib_libssl= secure/lib/libssl
1611 lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L
1612 .if ${MK_LDNS} != "no"
1613 _lib_libldns= lib/libldns
1614 lib/libldns__L: secure/lib/libcrypto__L
1616 .if ${MK_OPENSSH} != "no"
1617 _secure_lib_libssh= secure/lib/libssh
1618 secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
1619 .if ${MK_LDNS} != "no"
1620 secure/lib/libssh__L: lib/libldns__L
1622 .if ${MK_KERBEROS_SUPPORT} != "no"
1623 secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \
1624 kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \
1625 lib/libmd__L kerberos5/lib/libroken__L
1629 _secure_lib= secure/lib
1632 .if ${MK_KERBEROS} != "no"
1633 kerberos5/lib/libasn1__L: lib/libcom_err__L kerberos5/lib/libroken__L
1634 kerberos5/lib/libhdb__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1635 kerberos5/lib/libkrb5__L kerberos5/lib/libroken__L \
1636 kerberos5/lib/libwind__L kerberos5/lib/libheimsqlite__L
1637 kerberos5/lib/libheimntlm__L: secure/lib/libcrypto__L kerberos5/lib/libkrb5__L \
1638 kerberos5/lib/libroken__L lib/libcom_err__L
1639 kerberos5/lib/libhx509__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1640 secure/lib/libcrypto__L kerberos5/lib/libroken__L kerberos5/lib/libwind__L
1641 kerberos5/lib/libkrb5__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1642 lib/libcrypt__L secure/lib/libcrypto__L kerberos5/lib/libhx509__L \
1643 kerberos5/lib/libroken__L kerberos5/lib/libwind__L \
1644 kerberos5/lib/libheimbase__L kerberos5/lib/libheimipcc__L
1645 kerberos5/lib/libroken__L: lib/libcrypt__L
1646 kerberos5/lib/libwind__L: kerberos5/lib/libroken__L lib/libcom_err__L
1647 kerberos5/lib/libheimbase__L: lib/libthr__L
1648 kerberos5/lib/libheimipcc__L: kerberos5/lib/libroken__L kerberos5/lib/libheimbase__L lib/libthr__L
1649 kerberos5/lib/libheimsqlite__L: lib/libthr__L
1652 .if ${MK_GSSAPI} != "no"
1653 _lib_libgssapi= lib/libgssapi
1656 .if ${MK_KERBEROS} != "no"
1657 _kerberos5_lib= kerberos5/lib
1658 _kerberos5_lib_libasn1= kerberos5/lib/libasn1
1659 _kerberos5_lib_libhdb= kerberos5/lib/libhdb
1660 _kerberos5_lib_libheimbase= kerberos5/lib/libheimbase
1661 _kerberos5_lib_libkrb5= kerberos5/lib/libkrb5
1662 _kerberos5_lib_libhx509= kerberos5/lib/libhx509
1663 _kerberos5_lib_libroken= kerberos5/lib/libroken
1664 _kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm
1665 _kerberos5_lib_libheimsqlite= kerberos5/lib/libheimsqlite
1666 _kerberos5_lib_libheimipcc= kerberos5/lib/libheimipcc
1667 _kerberos5_lib_libwind= kerberos5/lib/libwind
1668 _libcom_err= lib/libcom_err
1671 .if ${MK_NIS} != "no"
1672 _lib_libypclnt= lib/libypclnt
1675 .if ${MK_OPENSSL} == "no"
1676 lib/libradius__L: lib/libmd__L
1679 .for _lib in ${_prereq_libs}
1680 ${_lib}__PL: .PHONY .MAKE
1681 .if exists(${.CURDIR}/${_lib})
1682 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1683 cd ${.CURDIR}/${_lib} && \
1684 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj && \
1685 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ depend && \
1686 ${MAKE} MK_TESTS=no MK_PROFILE=no -DNO_PIC \
1687 DIRPRFX=${_lib}/ all && \
1688 ${MAKE} MK_TESTS=no MK_PROFILE=no -DNO_PIC \
1689 DIRPRFX=${_lib}/ install
1693 .for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
1694 ${_lib}__L: .PHONY .MAKE
1695 .if exists(${.CURDIR}/${_lib})
1696 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1697 cd ${.CURDIR}/${_lib} && \
1698 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj && \
1699 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ depend && \
1700 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ all && \
1701 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ install
1705 # libpam is special: we need to build static PAM modules before
1706 # static PAM library, and dynamic PAM library before dynamic PAM
1708 lib/libpam__L: .PHONY .MAKE
1709 ${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \
1710 cd ${.CURDIR}/lib/libpam && \
1711 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ obj && \
1712 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ depend && \
1713 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ \
1714 -D_NO_LIBPAM_SO_YET all && \
1715 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ \
1716 -D_NO_LIBPAM_SO_YET install
1718 _prereq_libs: ${_prereq_libs:S/$/__PL/}
1719 _startup_libs: ${_startup_libs:S/$/__L/}
1720 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
1721 _generic_libs: ${_generic_libs:S/$/__L/}
1723 .for __target in all clean cleandepend cleandir depend includes obj
1724 .for entry in ${SUBDIR}
1725 ${entry}.${__target}__D: .PHONY .MAKE
1726 ${_+_}@set -e; if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
1727 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \
1728 edir=${entry}.${MACHINE_ARCH}; \
1729 cd ${.CURDIR}/$${edir}; \
1731 ${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \
1733 cd ${.CURDIR}/$${edir}; \
1735 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
1737 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
1740 .include <bsd.subdir.mk>
1742 .if make(check-old) || make(check-old-dirs) || \
1743 make(check-old-files) || make(check-old-libs) || \
1744 make(delete-old) || make(delete-old-dirs) || \
1745 make(delete-old-files) || make(delete-old-libs)
1748 # check for / delete old files section
1751 .include "ObsoleteFiles.inc"
1753 OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \
1754 else you can not start such an application. Consult UPDATING for more \
1755 information regarding how to cope with the removal/revision bump of a \
1758 .if !defined(BATCH_DELETE_OLD_FILES)
1765 @echo ">>> Removing old files (only deletes safe to delete libs)"
1766 # Ask for every old file if the user really wants to remove it.
1767 # It's annoying, but better safe than sorry.
1768 # NB: We cannot pass the list of OLD_FILES as a parameter because the
1769 # argument list will get too long. Using .for/.endfor make "loops" will make
1770 # the Makefile parser segfault.
1773 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1774 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1775 while read file; do \
1776 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1777 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1778 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1781 # Remove catpages without corresponding manpages.
1783 find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1784 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1785 while read catpage; do \
1787 if [ ! -e "$${manpage}" ]; then \
1788 rm ${RM_I} $${catpage} <&3; \
1791 @echo ">>> Old files removed"
1794 @echo ">>> Checking for old files"
1796 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1797 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1798 while read file; do \
1799 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1800 echo "${DESTDIR}/$${file}"; \
1803 # Check for catpages without corresponding manpages.
1804 @find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1805 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1806 while read catpage; do \
1808 if [ ! -e "$${manpage}" ]; then \
1814 @echo ">>> Removing old libraries"
1815 @echo "${OLD_LIBS_MESSAGE}" | fmt
1818 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1819 -V OLD_LIBS | xargs -n1 | \
1820 while read file; do \
1821 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1822 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1823 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1825 for ext in debug symbols; do \
1826 if ! [ -e "${DESTDIR}/$${file}" ] && [ -f \
1827 "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \
1828 rm ${RM_I} "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" \
1833 @echo ">>> Old libraries removed"
1836 @echo ">>> Checking for old libraries"
1838 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1839 -V OLD_LIBS | xargs -n1 | \
1840 while read file; do \
1841 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1842 echo "${DESTDIR}/$${file}"; \
1844 for ext in debug symbols; do \
1845 if [ -f "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \
1846 echo "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}"; \
1852 @echo ">>> Removing old directories"
1854 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1855 -V OLD_DIRS | xargs -n1 | sort -r | \
1856 while read dir; do \
1857 if [ -d "${DESTDIR}/$${dir}" ]; then \
1858 rmdir -v "${DESTDIR}/$${dir}" || true; \
1859 elif [ -L "${DESTDIR}/$${dir}" ]; then \
1860 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1863 @echo ">>> Old directories removed"
1866 @echo ">>> Checking for old directories"
1868 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1869 -V OLD_DIRS | xargs -n1 | \
1870 while read dir; do \
1871 if [ -d "${DESTDIR}/$${dir}" ]; then \
1872 echo "${DESTDIR}/$${dir}"; \
1873 elif [ -L "${DESTDIR}/$${dir}" ]; then \
1874 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1878 delete-old: delete-old-files delete-old-dirs
1879 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1881 check-old: check-old-files check-old-libs check-old-dirs
1882 @echo "To remove old files and directories run '${MAKE} delete-old'."
1883 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1888 # showconfig - show build configuration.
1891 @${MAKE} -n -f src.opts.mk -V dummy -dg1 2>&1 | grep ^MK_ | sort
1893 .if !empty(KRNLOBJDIR) && !empty(KERNCONF)
1894 DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/
1896 .if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE)
1897 .if exists(${KERNCONFDIR}/${KERNCONF})
1898 FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \
1899 '${KERNCONFDIR}/${KERNCONF}' ; echo
1905 .if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH})
1906 DTBOUTPUTPATH= ${.CURDIR}
1910 # Build 'standalone' Device Tree Blob
1913 @PATH=${TMPPATH} MACHINE=${TARGET} \
1914 ${.CURDIR}/sys/tools/fdt/make_dtb.sh ${.CURDIR}/sys \
1915 "${FDT_DTS_FILE}" ${DTBOUTPUTPATH}
1919 .if defined(TARGET) && defined(TARGET_ARCH)
1921 .if ${TARGET} == ${MACHINE} && ${TARGET_ARCH} == ${MACHINE_ARCH}
1922 XDEV_CPUTYPE?=${CPUTYPE}
1924 XDEV_CPUTYPE?=${TARGET_CPUTYPE}
1927 NOFUN=-DNO_FSCHG MK_HTML=no MK_INFO=no -DNO_LINT \
1928 MK_MAN=no MK_NLS=no MK_PROFILE=no \
1929 MK_KERBEROS=no MK_RESCUE=no MK_TESTS=no MK_WARNS=no \
1930 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
1931 CPUTYPE=${XDEV_CPUTYPE}
1933 XDDIR=${TARGET_ARCH}-freebsd
1936 .error XDTP variable should be an absolute path
1939 CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \
1940 INSTALL="sh ${.CURDIR}/tools/install.sh"
1942 _SHLIBDIRPREFIX=${XDDESTDIR} \
1943 TOOLS_PREFIX=${XDTP}
1944 CD2CFLAGS=-isystem ${XDDESTDIR}/usr/include -L${XDDESTDIR}/usr/lib \
1945 --sysroot=${XDDESTDIR}/ -B${XDDESTDIR}/usr/libexec \
1946 -B${XDDESTDIR}/usr/bin -B${XDDESTDIR}/usr/lib
1947 CD2ENV=${CDENV} CC="${CC} ${CD2CFLAGS}" CXX="${CXX} ${CD2CFLAGS}" \
1948 CPP="${CPP} ${CD2CFLAGS}" \
1949 MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH}
1951 CDTMP= ${MAKEOBJDIRPREFIX}/${XDDIR}/${.CURDIR}/tmp
1952 CDMAKE=${CDENV} PATH=${CDTMP}/usr/bin:${PATH} ${MAKE} ${NOFUN}
1953 CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDDESTDIR}/usr/bin:${PATH} ${MAKE} ${NOFUN}
1954 XDDESTDIR=${DESTDIR}/${XDTP}
1956 OSREL!= uname -r | sed -e 's/[-(].*//'
1959 .ORDER: xdev-build xdev-install xdev-links
1960 xdev: xdev-build xdev-install
1962 .ORDER: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools
1963 xdev-build: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools
1966 mkdir -p ${CDTMP}/usr
1967 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1968 -p ${CDTMP}/usr >/dev/null
1970 _xb-bootstrap-tools:
1973 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1974 cd ${.CURDIR}/${_tool} && \
1975 ${CDMAKE} DIRPRFX=${_tool}/ obj && \
1976 ${CDMAKE} DIRPRFX=${_tool}/ depend && \
1977 ${CDMAKE} DIRPRFX=${_tool}/ all && \
1978 ${CDMAKE} DIRPRFX=${_tool}/ DESTDIR=${CDTMP} install
1982 ${_+_}@cd ${.CURDIR}; \
1983 ${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools
1992 ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \
1993 cd ${.CURDIR}/${_tool} && \
1994 ${CDMAKE} DIRPRFX=${_tool}/ obj && \
1995 ${CDMAKE} DIRPRFX=${_tool}/ depend && \
1996 ${CDMAKE} DIRPRFX=${_tool}/ all
2000 ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}"
2001 mkdir -p ${XDDESTDIR}
2002 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
2003 -p ${XDDESTDIR} >/dev/null
2004 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
2005 -p ${XDDESTDIR}/usr >/dev/null
2006 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
2007 -p ${XDDESTDIR}/usr/include >/dev/null
2008 .if ${MK_TESTS} != "no"
2009 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
2010 -p ${XDDESTDIR}/usr >/dev/null
2013 .ORDER: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries
2014 xdev-install: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries
2017 @echo "_xi-cross-tools"
2024 ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \
2025 cd ${.CURDIR}/${_tool}; \
2026 ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR}
2030 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 par-includes \
2031 DESTDIR=${XDDESTDIR}
2034 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \
2035 DESTDIR=${XDDESTDIR}
2038 ${_+_}cd ${XDDESTDIR}/usr/bin; \
2039 mkdir -p ../../../../usr/bin; \
2041 ln -sf ../../${XDTP}/usr/bin/$$i \
2042 ../../../../usr/bin/${XDDIR}-$$i; \
2043 ln -sf ../../${XDTP}/usr/bin/$$i \
2044 ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \
2047 xdev xdev-build xdev-install xdev-links:
2048 @echo "*** Error: Both TARGET and TARGET_ARCH must be defined for \"${.TARGET}\" target"