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 # -DNO_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_LIB_DIRS="list of dirs" to add additional dirs to libraries target
21 # LOCAL_MTREE="list of mtree files" to process to allow local directories
22 # to be created before files are installed
23 # LOCAL_TOOL_DIRS="list of dirs" to add additional dirs to the build-tools
25 # METALOG="path to metadata log" to write permission and ownership
26 # when NO_ROOT is set. (default: ${DESTDIR}/METALOG)
27 # TARGET="machine" to crossbuild world for a different machine type
28 # TARGET_ARCH= may be required when a TARGET supports multiple endians
29 # BUILDENV_SHELL= shell to launch for the buildenv target (def:/bin/sh)
30 # WORLD_FLAGS= additional flags to pass to make(1) during buildworld
31 # KERNEL_FLAGS= additional flags to pass to make(1) during buildkernel
34 # The intended user-driven targets are:
35 # buildworld - rebuild *everything*, including glue to help do upgrades
36 # installworld- install everything built by "buildworld"
37 # doxygen - build API documentation of the kernel
38 # update - convenient way to update your source tree (eg: svn/svnup)
40 # Standard targets (not defined here) are documented in the makefiles in
41 # /usr/share/mk. These include:
42 # obj depend all install clean cleandepend cleanobj
44 .if !defined(TARGET) || !defined(TARGET_ARCH)
45 .error "Both TARGET and TARGET_ARCH must be defined."
49 .include <bsd.arch.inc.mk>
50 .include <bsd.compiler.mk>
52 # We must do share/info early so that installation of info `dir'
53 # entries works correctly. Do it first since it is less likely to
54 # grow dependencies on include and lib than vice versa.
56 # We must do lib/ and libexec/ before bin/, because if installworld
57 # installs a new /bin/sh, the 'make' command will *immediately*
58 # use that new version. And the new (dynamically-linked) /bin/sh
59 # will expect to find appropriate libraries in /lib and /libexec.
62 .if defined(SUBDIR_OVERRIDE)
63 SUBDIR= ${SUBDIR_OVERRIDE}
65 SUBDIR= share/info lib libexec
67 .if ${MK_GAMES} != "no"
70 .if ${MK_CDDL} != "no"
74 .if ${MK_KERBEROS} != "no"
77 .if ${MK_RESCUE} != "no"
81 .if ${MK_CRYPT} != "no"
84 .if !defined(NO_SHARE)
87 SUBDIR+=sys usr.bin usr.sbin
88 .if ${MK_TESTS} != "no"
91 .if ${MK_OFED} != "no"
95 # We must do etc/ last for install/distribute to work.
99 # These are last, since it is nice to at least get the base system
100 # rebuilt before you do them.
101 .for _DIR in ${LOCAL_LIB_DIRS} ${LOCAL_DIRS}
102 .if exists(${.CURDIR}/${_DIR}/Makefile)
111 .if defined(NO_CLEANDIR)
112 CLEANDIR= clean cleandepend
119 BUILDENV_SHELL?=/bin/sh
121 SVN?= /usr/local/bin/svn
124 MAKEOBJDIRPREFIX?= /usr/obj
125 .if !defined(OSRELDATE)
126 .if exists(/usr/include/osreldate.h)
127 OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
128 /usr/include/osreldate.h
134 .if !defined(VERSION)
135 REVISION!= make -C ${SRCDIR}/release -V REVISION
136 BRANCH!= make -C ${SRCDIR}/release -V BRANCH
137 SRCRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
138 ${SRCDIR}/sys/sys/param.h
139 VERSION= FreeBSD ${REVISION}-${BRANCH:C/-p[0-9]+$//} ${TARGET_ARCH} ${SRCRELDATE}
142 KNOWN_ARCHES?= amd64 arm armeb/arm armv6/arm i386 i386/pc98 ia64 mips mipsel/mips mips64el/mips mips64/mips mipsn32el/mips mipsn32/mips powerpc powerpc64/powerpc sparc64
143 .if ${TARGET} == ${TARGET_ARCH}
146 _t= ${TARGET_ARCH}/${TARGET}
149 .if empty(KNOWN_ARCHES:M${_t})
150 .error Unknown target ${TARGET_ARCH}:${TARGET}.
154 .if ${TARGET} == ${MACHINE}
155 TARGET_CPUTYPE?=${CPUTYPE}
160 .if !empty(TARGET_CPUTYPE)
161 _TARGET_CPUTYPE=${TARGET_CPUTYPE}
163 _TARGET_CPUTYPE=dummy
165 _CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} \
166 -f /dev/null -m ${.CURDIR}/share/mk -V CPUTYPE
167 .if ${_CPUTYPE} != ${_TARGET_CPUTYPE}
168 .error CPUTYPE global should be set with ?=.
171 BUILD_ARCH!= uname -p
172 .if ${MACHINE_ARCH} != ${BUILD_ARCH}
173 .error To cross-build, set TARGET_ARCH.
176 .if ${MACHINE} == ${TARGET} && ${MACHINE_ARCH} == ${TARGET_ARCH} && !defined(CROSS_BUILD_TESTING)
177 OBJTREE= ${MAKEOBJDIRPREFIX}
179 OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH}
181 WORLDTMP= ${OBJTREE}${.CURDIR}/tmp
182 # /usr/games added for fortune which depend on strfile
183 BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games:${WORLDTMP}/legacy/bin
184 XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
185 STRICTTMPPATH= ${BPATH}:${XPATH}
186 TMPPATH= ${STRICTTMPPATH}:${PATH}
189 # Avoid running mktemp(1) unless actually needed.
190 # It may not be functional, e.g., due to new ABI
191 # when in the middle of installing over this system.
193 .if make(distributeworld) || make(installworld)
194 INSTALLTMP!= /usr/bin/mktemp -d -u -t install
198 # Building a world goes through the following stages
200 # 1. legacy stage [BMAKE]
201 # This stage is responsible for creating compatibility
202 # shims that are needed by the bootstrap-tools,
203 # build-tools and cross-tools stages.
204 # 1. bootstrap-tools stage [BMAKE]
205 # This stage is responsible for creating programs that
206 # are needed for backward compatibility reasons. They
207 # are not built as cross-tools.
208 # 2. build-tools stage [TMAKE]
209 # This stage is responsible for creating the object
210 # tree and building any tools that are needed during
212 # 3. cross-tools stage [XMAKE]
213 # This stage is responsible for creating any tools that
214 # are needed for cross-builds. A cross-compiler is one
216 # 4. world stage [WMAKE]
217 # This stage actually builds the world.
218 # 5. install stage (optional) [IMAKE]
219 # This stage installs a previously built world.
224 # Common environment for world related stages
225 CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \
226 MACHINE_ARCH=${TARGET_ARCH} \
228 CPUTYPE=${TARGET_CPUTYPE}
229 .if ${MK_GROFF} != "no"
230 CROSSENV+= GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
231 GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \
232 GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac
235 # bootstrap-tools stage
236 BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
237 PATH=${BPATH}:${PATH} \
238 WORLDTMP=${WORLDTMP} \
239 VERSION="${VERSION}" \
240 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
241 COMPILER_TYPE=${COMPILER_TYPE}
242 BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
243 ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
245 BOOTSTRAPPING=${OSRELDATE} \
247 -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \
248 -DNO_PIC -DNO_PROFILE -DNO_SHARED \
249 -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD
252 TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
253 ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
254 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
256 BOOTSTRAPPING=${OSRELDATE} \
259 -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD
262 XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \
263 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
267 KTMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
268 PATH=${BPATH}:${PATH} \
269 WORLDTMP=${WORLDTMP} \
270 VERSION="${VERSION}" \
271 COMPILER_TYPE=${COMPILER_TYPE}
272 KTMAKE= TOOLS_PREFIX=${WORLDTMP} MAKEOBJDIRPREFIX=${WORLDTMP} \
273 ${KTMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
275 BOOTSTRAPPING=${OSRELDATE} \
277 -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \
278 -DNO_PIC -DNO_PROFILE -DNO_SHARED \
279 -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD
282 WMAKEENV= ${CROSSENV} \
283 _SHLIBDIRPREFIX=${WORLDTMP} \
285 VERSION="${VERSION}" \
286 INSTALL="sh ${.CURDIR}/tools/install.sh" \
290 HMAKE= PATH=${TMPPATH} ${MAKE} LOCAL_MTREE=${LOCAL_MTREE:Q}
292 HMAKE+= PATH=${TMPPATH} METALOG=${METALOG} -DNO_ROOT
295 .if ${MK_CDDL} == "no"
299 .if defined(CROSS_TOOLCHAIN_PREFIX)
300 CROSS_COMPILER_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
301 CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
303 XCOMPILERS= CC CXX CPP
304 .for COMPILER in ${XCOMPILERS}
305 .if defined(CROSS_COMPILER_PREFIX)
306 X${COMPILER}?= ${CROSS_COMPILER_PREFIX}${${COMPILER}}
308 X${COMPILER}?= ${${COMPILER}}
311 XBINUTILS= AS AR LD NM OBJDUMP RANLIB STRINGS
312 .for BINUTIL in ${XBINUTILS}
313 .if defined(CROSS_BINUTILS_PREFIX)
314 X${BINUTIL}?= ${CROSS_BINUTILS_PREFIX}${${BINUTIL}}
316 X${BINUTIL}?= ${${BINUTIL}}
319 WMAKEENV+= CC="${XCC} ${XFLAGS}" CXX="${XCXX} ${XFLAGS}" \
320 CPP="${XCPP} ${XFLAGS}" \
321 AS="${XAS}" AR="${XAR}" LD="${XLD}" NM=${XNM} \
322 OBJDUMP=${XOBJDUMP} RANLIB=${XRANLIB} STRINGS=${XSTRINGS}
324 .if ${XCC:T:Mgcc} == "gcc"
325 WMAKE_COMPILER_TYPE= gcc
326 .elif ${XCC:T:Mclang} == "clang"
327 WMAKE_COMPILER_TYPE= clang
328 .elif ${MK_CLANG_IS_CC} == "no"
329 WMAKE_COMPILER_TYPE= gcc
331 WMAKE_COMPILER_TYPE= clang
333 IMAKE_COMPILER_TYPE= COMPILER_TYPE=${WMAKE_COMPILER_TYPE}
336 XFLAGS= --sysroot=${WORLDTMP}
337 .if defined(CROSS_BINUTILS_PREFIX)
338 # In the case of xdev-build tools, CROSS_BINUTILS_PREFIX won't be a
339 # directory, but the compiler will look in the right place for it's
340 # tools so we don't need to tell it where to look.
341 .if exists(${CROSS_BINUTILS_PREFIX})
342 XFLAGS+= -B${CROSS_BINUTILS_PREFIX}
345 XFLAGS+= -B${WORLDTMP}/usr/bin
347 .if ${TARGET_ARCH} != ${MACHINE_ARCH} && ${WMAKE_COMPILER_TYPE} == "clang"
348 .if (${TARGET_ARCH} == "arm" || ${TARGET_ARCH} == "armv6") && \
349 ${MK_ARM_EABI} != "no"
354 TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0
355 XFLAGS+= -target ${TARGET_TRIPLE}
359 WMAKEENV+= COMPILER_TYPE=${WMAKE_COMPILER_TYPE}
360 WMAKE= ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 DESTDIR=${WORLDTMP}
362 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
364 LIB32TMP= ${OBJTREE}${.CURDIR}/lib32
366 .if ${TARGET_ARCH} == "amd64"
367 .if empty(TARGET_CPUTYPE)
368 LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2
370 LIB32CPUFLAGS= -march=${TARGET_CPUTYPE}
372 LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \
373 MACHINE_CPU="i686 mmx sse sse2"
376 LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32"
378 .elif ${TARGET_ARCH} == "powerpc64"
379 .if empty(TARGET_CPUTYPE)
380 LIB32CPUFLAGS= -mcpu=powerpc
382 LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE}
384 LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc
386 LD="${LD} -m elf32ppc_fbsd"
390 LIB32FLAGS= -m32 ${LIB32CPUFLAGS} -DCOMPAT_32BIT \
391 -isystem ${LIB32TMP}/usr/include/ \
392 -L${LIB32TMP}/usr/lib32 \
393 -B${LIB32TMP}/usr/lib32
395 LIB32FLAGS+= --sysroot=${WORLDTMP}
398 # Yes, the flags are redundant.
399 LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \
400 _SHLIBDIRPREFIX=${LIB32TMP} \
401 _LDSCRIPTROOT=${LIB32TMP} \
402 VERSION="${VERSION}" \
403 INSTALL="sh ${.CURDIR}/tools/install.sh" \
406 SHLIBDIR=/usr/lib32 \
407 LIBPRIVATEDIR=/usr/lib32/private \
408 COMPILER_TYPE=${WMAKE_COMPILER_TYPE}
410 CC="${XCC} ${LIB32FLAGS}" \
411 CXX="${XCXX} ${LIB32FLAGS}" \
412 DESTDIR=${LIB32TMP} \
419 LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} ${LIB32WMAKEFLAGS} \
420 -DWITHOUT_MAN -DWITHOUT_INFO -DWITHOUT_HTML
421 LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} -DNO_INCS \
425 IMAKEENV= ${CROSSENV:N_LDSCRIPTROOT=*}
426 IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 \
427 ${IMAKE_INSTALL} ${IMAKE_MTREE} ${IMAKE_COMPILER_TYPE}
428 .if empty(.MAKEFLAGS:M-n)
429 IMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMP} \
430 LD_LIBRARY_PATH=${INSTALLTMP} \
431 PATH_LOCALE=${INSTALLTMP}/locale
432 IMAKE+= __MAKE_SHELL=${INSTALLTMP}/sh
434 IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP}
436 .if defined(DB_FROM_SRC)
437 INSTALLFLAGS+= -N ${.CURDIR}/etc
438 MTREEFLAGS+= -N ${.CURDIR}/etc
440 _INSTALL_DDIR= ${DESTDIR}/${DISTDIR}
441 INSTALL_DDIR= ${_INSTALL_DDIR:S://:/:g:C:/$::}
443 METALOG?= ${DESTDIR}/${DISTDIR}/METALOG
444 IMAKE+= -DNO_ROOT METALOG=${METALOG}
445 INSTALLFLAGS+= -U -M ${METALOG} -D ${INSTALL_DDIR}
448 .if defined(DB_FROM_SRC) || defined(NO_ROOT)
449 IMAKE_INSTALL= INSTALL="install ${INSTALLFLAGS}"
450 IMAKE_MTREE= MTREE_CMD="nmtree ${MTREEFLAGS}"
454 KMAKEENV= ${WMAKEENV}
455 KMAKE= ${KMAKEENV} ${MAKE} ${.MAKEFLAGS} ${KERNEL_FLAGS} KERNEL=${INSTKERNNAME}
460 # Attempt to rebuild the entire system, with reasonable chance of
461 # success, regardless of how old your existing system is.
464 .if ${.CURDIR:C/[^,]//g} != ""
465 # The m4 build of sendmail files doesn't like it if ',' is used
466 # anywhere in the path of it's files.
468 @echo "*** Error: path to source tree contains a comma ','"
473 @echo "--------------------------------------------------------------"
474 @echo ">>> Rebuilding the temporary build tree"
475 @echo "--------------------------------------------------------------"
476 .if !defined(NO_CLEAN)
478 .if defined(LIB32TMP)
482 rm -rf ${WORLDTMP}/legacy/usr/include
483 # XXX - These three can depend on any header file.
484 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
485 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c
486 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
489 lib usr legacy/bin legacy/usr
490 mkdir -p ${WORLDTMP}/${_dir}
492 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
493 -p ${WORLDTMP}/legacy/usr >/dev/null
494 .if ${MK_GROFF} != "no"
495 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.groff.dist \
496 -p ${WORLDTMP}/legacy/usr >/dev/null
498 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
499 -p ${WORLDTMP}/usr >/dev/null
500 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
501 -p ${WORLDTMP}/usr/include >/dev/null
502 ln -sf ${.CURDIR}/sys ${WORLDTMP}
503 .if ${MK_DEBUG_FILES} != "no"
504 # We could instead disable debug files for these build stages
505 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
506 -p ${WORLDTMP}/legacy/usr/lib >/dev/null
507 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
508 -p ${WORLDTMP}/usr/lib >/dev/null
510 .if ${MK_TESTS} != "no"
511 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
512 -p ${WORLDTMP}/usr >/dev/null
514 .for _mtree in ${LOCAL_MTREE}
515 mtree -deU -f ${.CURDIR}/${_mtree} -p ${WORLDTMP} > /dev/null
519 @echo "--------------------------------------------------------------"
520 @echo ">>> stage 1.1: legacy release compatibility shims"
521 @echo "--------------------------------------------------------------"
522 ${_+_}cd ${.CURDIR}; ${BMAKE} legacy
525 @echo "--------------------------------------------------------------"
526 @echo ">>> stage 1.2: bootstrap tools"
527 @echo "--------------------------------------------------------------"
528 ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools
530 .if !defined(NO_CLEAN)
532 @echo "--------------------------------------------------------------"
533 @echo ">>> stage 2.1: cleaning up the object tree"
534 @echo "--------------------------------------------------------------"
535 ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
536 .if defined(LIB32TMP)
537 ${_+_}cd ${.CURDIR}; ${LIB32WMAKE} -f Makefile.inc1 ${CLEANDIR:S/^/par-/}
542 @echo "--------------------------------------------------------------"
543 @echo ">>> stage 2.2: rebuilding the object tree"
544 @echo "--------------------------------------------------------------"
545 ${_+_}cd ${.CURDIR}; ${WMAKE} par-obj
548 @echo "--------------------------------------------------------------"
549 @echo ">>> stage 2.3: build tools"
550 @echo "--------------------------------------------------------------"
551 ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools
554 @echo "--------------------------------------------------------------"
555 @echo ">>> stage 3: cross tools"
556 @echo "--------------------------------------------------------------"
557 ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools
558 ${_+_}cd ${.CURDIR}; ${XMAKE} kernel-tools
561 @echo "--------------------------------------------------------------"
562 @echo ">>> stage 4.1: building includes"
563 @echo "--------------------------------------------------------------"
564 ${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
567 @echo "--------------------------------------------------------------"
568 @echo ">>> stage 4.2: building libraries"
569 @echo "--------------------------------------------------------------"
570 ${_+_}cd ${.CURDIR}; \
571 ${WMAKE} -DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
572 -DWITHOUT_MAN -DNO_PROFILE libraries
575 @echo "--------------------------------------------------------------"
576 @echo ">>> stage 4.3: make dependencies"
577 @echo "--------------------------------------------------------------"
578 ${_+_}cd ${.CURDIR}; ${WMAKE} par-depend
581 @echo "--------------------------------------------------------------"
582 @echo ">>> stage 4.4: building everything"
583 @echo "--------------------------------------------------------------"
584 ${_+_}cd ${.CURDIR}; ${WMAKE} par-all
585 .if defined(LIB32TMP)
588 @echo "--------------------------------------------------------------"
589 @echo ">>> stage 5.1: building 32 bit shim libraries"
590 @echo "--------------------------------------------------------------"
591 mkdir -p ${LIB32TMP}/usr/include
592 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
593 -p ${LIB32TMP}/usr >/dev/null
594 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
595 -p ${LIB32TMP}/usr/include >/dev/null
596 .if ${MK_DEBUG_FILES} != "no"
597 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
598 -p ${LIB32TMP}/usr/lib >/dev/null
601 ln -sf ${.CURDIR}/sys ${WORLDTMP}
602 .for _t in obj includes
603 cd ${.CURDIR}/include; ${LIB32WMAKE} DIRPRFX=include/ ${_t}
604 cd ${.CURDIR}/lib; ${LIB32WMAKE} DIRPRFX=lib/ ${_t}
605 .if ${MK_CDDL} != "no"
606 cd ${.CURDIR}/cddl/lib; ${LIB32WMAKE} DIRPRFX=cddl/lib/ ${_t}
608 cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} DIRPRFX=gnu/lib/ ${_t}
609 .if ${MK_CRYPT} != "no"
610 cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} DIRPRFX=secure/lib/ ${_t}
612 .if ${MK_KERBEROS} != "no"
613 cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} DIRPRFX=kerberos5/lib ${_t}
616 .for _dir in usr.bin/lex/lib
617 cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} DIRPRFX=${_dir}/ obj
619 .for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic
620 cd ${.CURDIR}/${_dir}; \
621 WORLDTMP=${WORLDTMP} \
622 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
623 MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \
624 DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF \
625 -DEARLY_BUILD build-tools
628 ${LIB32WMAKE} -f Makefile.inc1 libraries
629 .for _t in obj depend all
630 cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32WMAKE} \
631 DIRPRFX=libexec/rtld-elf/ ${_t}
632 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32WMAKE} \
633 DIRPRFX=usr.bin/ldd ${_t}
636 distribute32 install32:
637 cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
638 .if ${MK_CDDL} != "no"
639 cd ${.CURDIR}/cddl/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
641 cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
642 .if ${MK_CRYPT} != "no"
643 cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
645 .if ${MK_KERBEROS} != "no"
646 cd ${.CURDIR}/kerberos5/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
648 cd ${.CURDIR}/libexec/rtld-elf; \
649 PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//}
650 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32IMAKE} ${.TARGET:S/32$//}
654 .if !defined(SUBDIR_OVERRIDE)
655 WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools
657 WMAKE_TGTS+= _cleanobj _obj _build-tools
658 .if !defined(SUBDIR_OVERRIDE)
659 WMAKE_TGTS+= _cross-tools
661 WMAKE_TGTS+= _includes _libraries _depend everything
662 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
666 buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
667 .ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
670 @echo "--------------------------------------------------------------"
671 @echo ">>> World build started on `LC_ALL=C date`"
672 @echo "--------------------------------------------------------------"
676 @echo "--------------------------------------------------------------"
677 @echo ">>> World build completed on `LC_ALL=C date`"
678 @echo "--------------------------------------------------------------"
681 # We need to have this as a target because the indirection between Makefile
682 # and Makefile.inc1 causes the correct PATH to be used, rather than a
683 # modification of the current environment's PATH. In addition, we need
684 # to quote multiword values.
690 @echo Entering world for ${TARGET_ARCH}:${TARGET}
691 @cd ${.CURDIR} && env ${WMAKEENV} ${BUILDENV_SHELL} || true
693 TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything:Nbuild32}
694 toolchain: ${TOOLCHAIN_TGTS}
695 kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries}
700 # Checks to be sure system is ready for installworld/installkernel.
702 installcheck: _installcheck_world _installcheck_kernel
704 _installcheck_kernel:
707 # Require DESTDIR to be set if installing for a different architecture or
708 # using the user/group database in the source tree.
710 .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE} || \
712 .if !make(distributeworld)
713 _installcheck_world: __installcheck_DESTDIR
714 _installcheck_kernel: __installcheck_DESTDIR
715 __installcheck_DESTDIR:
716 .if !defined(DESTDIR) || empty(DESTDIR)
717 @echo "ERROR: Please set DESTDIR!"; \
723 .if !defined(DB_FROM_SRC)
725 # Check for missing UIDs/GIDs.
727 CHECK_UIDS= auditdistd
729 .if ${MK_SENDMAIL} != "no"
735 CHECK_GIDS+= proxy authpf
737 .if ${MK_UNBOUND} != "no"
741 _installcheck_world: __installcheck_UGID
743 .for uid in ${CHECK_UIDS}
744 @if ! `id -u ${uid} >/dev/null 2>&1`; then \
745 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \
749 .for gid in ${CHECK_GIDS}
750 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \
751 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \
758 # Required install tools to be saved in a scratch dir for safety.
760 .if ${MK_INFO} != "no"
761 _install-info= install-info
763 .if ${MK_ZONEINFO} != "no"
764 _zoneinfo= zic tzsetup
767 .if exists(/usr/sbin/nmtree)
768 _nmtree_itools= nmtree
771 ITOOLS= [ awk cap_mkdb cat chflags chmod chown \
772 date echo egrep find grep id install ${_install-info} \
773 ln lockf make mkdir mtree ${_nmtree_itools} mv pwd_mkdb \
774 rm sed sh sysctl test true uname wc ${_zoneinfo}
779 # Distributes everything compiled by a `buildworld'.
783 # Installs everything compiled by a 'buildworld'.
786 # Non-base distributions produced by the base system
787 EXTRA_DISTRIBUTIONS= doc
788 .if ${MK_GAMES} != "no"
789 EXTRA_DISTRIBUTIONS+= games
791 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
792 EXTRA_DISTRIBUTIONS+= lib32
795 MTREE_MAGIC?= mtree 2.0
797 distributeworld installworld: _installcheck_world
798 mkdir -p ${INSTALLTMP}
799 progs=$$(for prog in ${ITOOLS}; do \
800 if progpath=`which $$prog`; then \
803 echo "Required tool $$prog not found in PATH." >&2; \
807 libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | \
808 while read line; do \
810 if [ "$$2 $$3" != "not found" ]; then \
813 echo "Required library $$1 not found." >&2; \
817 cp $$libs $$progs ${INSTALLTMP}
818 cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale
820 echo "#${MTREE_MAGIC}" > ${METALOG}
822 .if make(distributeworld)
823 .for dist in ${EXTRA_DISTRIBUTIONS}
824 -mkdir ${DESTDIR}/${DISTDIR}/${dist}
825 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
826 -p ${DESTDIR}/${DISTDIR}/${dist} >/dev/null
827 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
828 -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null
829 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
830 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/include >/dev/null
831 .if ${MK_DEBUG_FILES} != "no"
832 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
833 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib >/dev/null
836 ${IMAKEENV} nmtree -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \
837 sed -e 's#^\./#./${dist}/#' >> ${METALOG}
838 ${IMAKEENV} nmtree -C -f ${.CURDIR}/etc/mtree/BSD.usr.dist | \
839 sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG}
840 ${IMAKEENV} nmtree -C -f ${.CURDIR}/etc/mtree/BSD.include.dist | \
841 sed -e 's#^\./#./${dist}/usr/include/#' >> ${METALOG}
844 -mkdir ${DESTDIR}/${DISTDIR}/base
845 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
846 METALOG=${METALOG} ${IMAKE_INSTALL} ${IMAKE_MTREE} \
847 DISTBASE=/base DESTDIR=${DESTDIR}/${DISTDIR}/base \
848 LOCAL_MTREE=${LOCAL_MTREE:Q} distrib-dirs
850 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \
851 ${IMAKEENV} rm -rf ${INSTALLTMP}
852 .if make(distributeworld)
853 .for dist in ${EXTRA_DISTRIBUTIONS}
854 find ${DESTDIR}/${DISTDIR}/${dist} -mindepth 1 -empty -delete
857 .for dist in base ${EXTRA_DISTRIBUTIONS}
858 @# For each file that exists in this dist, print the corresponding
859 @# line from the METALOG. This relies on the fact that
860 @# a line containing only the filename will sort immediatly before
861 @# the relevant mtree line.
862 cd ${DESTDIR}/${DISTDIR}; \
863 find ./${dist} | sort -u ${METALOG} - | \
864 awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \
865 ${DESTDIR}/${DISTDIR}/${dist}.meta
867 .if ${MK_DEBUG_FILES} != "no"
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}/usr/lib/debug | sort -u ${METALOG} - | \
875 awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \
876 ${DESTDIR}/${DISTDIR}/${dist}.debug.meta
883 .for dist in base ${EXTRA_DISTRIBUTIONS}
885 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
886 tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz \
887 --exclude usr/lib/debug \
888 @${DESTDIR}/${DISTDIR}/${dist}.meta
890 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
891 tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz \
892 --exclude usr/lib/debug .
896 .if ${MK_DEBUG_FILES} != "no"
897 . for dist in base ${EXTRA_DISTRIBUTIONS}
898 . if defined(NO_ROOT)
899 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
900 tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.debug.txz \
901 @${DESTDIR}/${DISTDIR}/${dist}.debug.meta
903 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
904 tar cvJfL ${DESTDIR}/${DISTDIR}/${dist}.debug.txz \
913 # If you have a build server, you can NFS mount the source and obj directories
914 # and do a 'make reinstall' on the *client* to install new binaries from the
915 # most recent server build.
918 @echo "--------------------------------------------------------------"
919 @echo ">>> Making hierarchy"
920 @echo "--------------------------------------------------------------"
921 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 \
922 LOCAL_MTREE=${LOCAL_MTREE:Q} hierarchy
924 @echo "--------------------------------------------------------------"
925 @echo ">>> Installing everything"
926 @echo "--------------------------------------------------------------"
927 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
928 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
929 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32
933 @echo "--------------------------------------------------------------"
934 @echo ">>> Distributing everything"
935 @echo "--------------------------------------------------------------"
936 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
937 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
938 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 \
942 distrib-dirs distribution:
943 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
944 ${IMAKE_INSTALL} ${IMAKE_MTREE} METALOG=${METALOG} ${.TARGET}
947 # buildkernel and installkernel
949 # Which kernels to build and/or install is specified by setting
950 # KERNCONF. If not defined a GENERIC kernel is built/installed.
951 # Only the existing (depending TARGET) config files are used
952 # for building kernels and only the first of these is designated
953 # as the one being installed.
955 # Note that we have to use TARGET instead of TARGET_ARCH when
956 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
957 # be set to cross-build, we have to make sure TARGET is set
960 .if defined(KERNFAST)
965 # Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah
966 .if !defined(KERNCONF) && ${KERNFAST} != "1"
970 .if ${TARGET_ARCH} == "powerpc64"
975 INSTKERNNAME?= kernel
977 KERNSRCDIR?= ${.CURDIR}/sys
978 KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf
979 KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR}
980 KERNCONFDIR?= ${KRNLCONFDIR}
984 .for _kernel in ${KERNCONF}
985 .if exists(${KERNCONFDIR}/${_kernel})
986 BUILDKERNELS+= ${_kernel}
987 .if empty(INSTALLKERNEL)
988 INSTALLKERNEL= ${_kernel}
996 # Builds all kernels defined by BUILDKERNELS.
999 .if empty(BUILDKERNELS)
1000 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \
1004 .for _kernel in ${BUILDKERNELS}
1005 @echo "--------------------------------------------------------------"
1006 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
1007 @echo "--------------------------------------------------------------"
1008 @echo "===> ${_kernel}"
1009 mkdir -p ${KRNLOBJDIR}
1010 .if !defined(NO_KERNELCONFIG)
1012 @echo "--------------------------------------------------------------"
1013 @echo ">>> stage 1: configuring the kernel"
1014 @echo "--------------------------------------------------------------"
1015 cd ${KRNLCONFDIR}; \
1017 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
1018 ${KERNCONFDIR}/${_kernel}
1020 .if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN)
1022 @echo "--------------------------------------------------------------"
1023 @echo ">>> stage 2.1: cleaning up the object tree"
1024 @echo "--------------------------------------------------------------"
1025 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR}
1027 .if !defined(NO_KERNELOBJ)
1029 @echo "--------------------------------------------------------------"
1030 @echo ">>> stage 2.2: rebuilding the object tree"
1031 @echo "--------------------------------------------------------------"
1032 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj
1035 @echo "--------------------------------------------------------------"
1036 @echo ">>> stage 2.3: build tools"
1037 @echo "--------------------------------------------------------------"
1038 ${_+_}cd ${.CURDIR}; ${KTMAKE} kernel-tools
1039 .if !defined(NO_KERNELDEPEND)
1041 @echo "--------------------------------------------------------------"
1042 @echo ">>> stage 3.1: making dependencies"
1043 @echo "--------------------------------------------------------------"
1044 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ
1047 @echo "--------------------------------------------------------------"
1048 @echo ">>> stage 3.2: building everything"
1049 @echo "--------------------------------------------------------------"
1050 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ
1051 @echo "--------------------------------------------------------------"
1052 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
1053 @echo "--------------------------------------------------------------"
1057 # installkernel, etc.
1059 # Install the kernel defined by INSTALLKERNEL
1061 installkernel installkernel.debug \
1062 reinstallkernel reinstallkernel.debug: _installcheck_kernel
1063 .if empty(INSTALLKERNEL)
1064 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
1067 @echo "--------------------------------------------------------------"
1068 @echo ">>> Installing kernel ${INSTALLKERNEL}"
1069 @echo "--------------------------------------------------------------"
1070 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
1071 ${CROSSENV} PATH=${TMPPATH} \
1072 ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
1074 distributekernel distributekernel.debug:
1075 .if empty(INSTALLKERNEL)
1076 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
1079 mkdir -p ${DESTDIR}/${DISTDIR}
1080 .if defined(NO_ROOT)
1081 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.premeta
1083 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
1084 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.premeta/} \
1085 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} KERNEL=${INSTKERNNAME} \
1086 DESTDIR=${INSTALL_DDIR}/kernel \
1087 ${.TARGET:S/distributekernel/install/}
1088 .if defined(NO_ROOT)
1089 sed -e 's|^./kernel|.|' ${DESTDIR}/${DISTDIR}/kernel.premeta > \
1090 ${DESTDIR}/${DISTDIR}/kernel.meta
1092 .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
1093 .if defined(NO_ROOT)
1094 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta
1096 cd ${KRNLOBJDIR}/${_kernel}; \
1097 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.${_kernel}.premeta/} \
1098 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} \
1099 KERNEL=${INSTKERNNAME}.${_kernel} \
1100 DESTDIR=${INSTALL_DDIR}/kernel.${_kernel} \
1101 ${.TARGET:S/distributekernel/install/}
1102 .if defined(NO_ROOT)
1103 sed -e 's|^./kernel|.|' \
1104 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta > \
1105 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta
1110 .if defined(NO_ROOT)
1111 cd ${DESTDIR}/${DISTDIR}/kernel; \
1112 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz \
1113 @${DESTDIR}/${DISTDIR}/kernel.meta
1114 .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
1115 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
1116 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz \
1117 @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta
1120 cd ${DESTDIR}/${DISTDIR}/kernel; \
1121 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz .
1122 .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
1123 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
1124 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz .
1131 # Build the API documentation with doxygen
1134 @if [ ! -x `/usr/bin/which doxygen` ]; then \
1135 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \
1138 cd ${.CURDIR}/tools/kerneldoc/subsys && ${MAKE} obj all
1143 # Update the source tree(s), by running svn/svnup to update to the
1147 .if (defined(CVS_UPDATE) || defined(SUP_UPDATE)) && !defined(SVN_UPDATE)
1148 @echo "--------------------------------------------------------------"
1149 @echo "CVS_UPDATE and SUP_UPDATE are no longer supported."
1150 @echo "Please see: https://wiki.freebsd.org/CvsIsDeprecated"
1151 @echo "--------------------------------------------------------------"
1154 .if defined(SVN_UPDATE)
1155 @echo "--------------------------------------------------------------"
1156 @echo ">>> Updating ${.CURDIR} using Subversion"
1157 @echo "--------------------------------------------------------------"
1158 @(cd ${.CURDIR} && ${SVN} update ${SVNFLAGS})
1162 # ------------------------------------------------------------------------
1164 # From here onwards are utility targets used by the 'make world' and
1165 # related targets. If your 'world' breaks, you may like to try to fix
1166 # the problem and manually run the following targets to attempt to
1167 # complete the build. Beware, this is *not* guaranteed to work, you
1168 # need to have a pretty good grip on the current state of the system
1169 # to attempt to manually finish it. If in doubt, 'make world' again.
1173 # legacy: Build compatibility shims for the next three targets
1176 .if ${BOOTSTRAPPING} < 700055 && ${BOOTSTRAPPING} != 0
1177 @echo "ERROR: Source upgrades from versions prior to 7.0 not supported."; \
1180 .for _tool in tools/build
1181 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \
1182 cd ${.CURDIR}/${_tool} && \
1183 ${MAKE} DIRPRFX=${_tool}/ obj && \
1184 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes && \
1185 ${MAKE} DIRPRFX=${_tool}/ depend && \
1186 ${MAKE} DIRPRFX=${_tool}/ all && \
1187 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
1191 # bootstrap-tools: Build tools needed for compatibility
1193 .if ${MK_GAMES} != "no"
1194 _strfile= games/fortune/strfile
1197 .if ${MK_CXX} != "no"
1198 _gperf= gnu/usr.bin/gperf
1201 .if ${MK_GROFF} != "no"
1202 _groff= gnu/usr.bin/groff
1205 .if ${BOOTSTRAPPING} < 800022
1209 .if ${BOOTSTRAPPING} < 800013
1210 _mklocale= usr.bin/mklocale
1213 .if ${BOOTSTRAPPING} < 900002
1217 .if ${BOOTSTRAPPING} < 900006
1221 .if ${BOOTSTRAPPING} < 1000002
1225 .if ${BOOTSTRAPPING} < 1000013
1230 .if ${BOOTSTRAPPING} < 1000014
1231 _crunch= usr.sbin/crunch
1234 .if ${BOOTSTRAPPING} < 1000026
1235 _nmtree= lib/libnetbsd \
1239 .if ${BOOTSTRAPPING} < 1000027
1243 .if ${BOOTSTRAPPING} >= 900040 && ${BOOTSTRAPPING} < 900041
1247 .if ${MK_BSNMP} != "no" && !exists(/usr/sbin/gensnmptree)
1248 _gensnmptree= usr.sbin/bsnmpd/gensnmptree
1251 .if ${MK_CLANG} != "no"
1253 lib/clang/libllvmsupport \
1254 lib/clang/libllvmtablegen \
1255 usr.bin/clang/tblgen \
1256 usr.bin/clang/clang-tblgen
1259 # dtrace tools are required for older bootstrap env and cross-build
1260 .if ${MK_CDDL} != "no" && \
1261 ((${BOOTSTRAPPING} < 1000034 && \
1262 !(${BOOTSTRAPPING} >= 901505 && ${BOOTSTRAPPING} < 999999)) \
1263 || (${MACHINE} != ${TARGET} || ${MACHINE_ARCH} != ${TARGET_ARCH}))
1264 _dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \
1265 lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge
1268 # Default to building the BSDL DTC, but build the GPL one if users explicitly
1271 .if ${MK_GPL_DTC} != "no"
1272 _dtc= gnu/usr.bin/dtc
1275 .if ${MK_KERBEROS} != "no"
1276 _kerberos5_bootstrap_tools= \
1277 kerberos5/tools/make-roken \
1278 kerberos5/lib/libroken \
1279 kerberos5/lib/libvers \
1280 kerberos5/tools/asn1_compile \
1281 kerberos5/tools/slc \
1285 # Please document (add comment) why something is in 'bootstrap-tools'.
1286 # Try to bound the building of the bootstrap-tool to just the
1287 # FreeBSD versions that need the tool built at this stage of the build.
1288 bootstrap-tools: .MAKE
1291 ${_kerberos5_bootstrap_tools} \
1301 usr.bin/makewhatis \
1314 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1315 cd ${.CURDIR}/${_tool} && \
1316 ${MAKE} DIRPRFX=${_tool}/ obj && \
1317 ${MAKE} DIRPRFX=${_tool}/ depend && \
1318 ${MAKE} DIRPRFX=${_tool}/ all && \
1319 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
1323 # build-tools: Build special purpose build tools
1325 .if !defined(NO_SHARE)
1326 _share= share/syscons/scrnmaps
1329 .if ${MK_GCC} != "no"
1330 _gcc_tools= gnu/usr.bin/cc/cc_tools
1333 .if ${MK_RESCUE} != "no"
1334 _rescue= rescue/rescue
1342 ${LOCAL_TOOL_DIRS} \
1343 lib/ncurses/ncurses \
1344 lib/ncurses/ncursesw \
1348 usr.bin/mkesdb_static \
1349 usr.bin/mkcsmapper_static \
1351 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \
1352 cd ${.CURDIR}/${_tool} && \
1353 ${MAKE} DIRPRFX=${_tool}/ obj && \
1354 ${MAKE} DIRPRFX=${_tool}/ build-tools
1358 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \
1359 cd ${.CURDIR}/${_tool} && \
1360 ${MAKE} DIRPRFX=${_tool}/ obj && \
1361 ${MAKE} DIRPRFX=${_tool}/ depend && \
1362 ${MAKE} DIRPRFX=${_tool}/ all
1366 # kernel-tools: Build kernel-building tools
1369 mkdir -p ${MAKEOBJDIRPREFIX}/usr
1370 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1371 -p ${MAKEOBJDIRPREFIX}/usr >/dev/null
1374 # cross-tools: Build cross-building tools
1376 .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 800035
1377 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386"
1378 _btxld= usr.sbin/btxld
1381 .if ${TARGET_ARCH} != ${MACHINE_ARCH}
1382 .if ${MK_RESCUE} != "no" || defined(RELEASEDIR)
1383 _crunchide= usr.sbin/crunch/crunchide
1385 .if ${TARGET_ARCH} == "i386" && defined(RELEASEDIR)
1386 _kgzip= usr.sbin/kgzip
1390 .if ${XAS:M/*} == "" && ${MK_BINUTILS} != "no"
1391 _binutils= gnu/usr.bin/binutils
1394 # If an full path to an external cross compiler is given, don't build
1396 .if ${XCC:M/*} == "" && ${MK_CROSS_COMPILER} != "no"
1397 .if ${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang"
1398 _clang= usr.bin/clang
1399 _clang_libs= lib/clang
1404 # The boot2 for pc98 requires gcc.
1405 .if ${TARGET} == "pc98"
1416 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
1420 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1421 cd ${.CURDIR}/${_tool} && \
1422 ${MAKE} DIRPRFX=${_tool}/ obj && \
1423 ${MAKE} DIRPRFX=${_tool}/ depend && \
1424 ${MAKE} DIRPRFX=${_tool}/ all && \
1425 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
1429 # hierarchy - ensure that all the needed directories are present
1432 cd ${.CURDIR}/etc && ${HMAKE} distrib-dirs
1435 # libraries - build all libraries, and install them under ${DESTDIR}.
1437 # The list of libraries with dependents (${_prebuild_libs}) and their
1438 # interdependencies (__L) are built automatically by the
1439 # ${.CURDIR}/tools/make_libdeps.sh script.
1443 ${MAKE} -f Makefile.inc1 _prereq_libs && \
1444 ${MAKE} -f Makefile.inc1 _startup_libs && \
1445 ${MAKE} -f Makefile.inc1 _prebuild_libs && \
1446 ${MAKE} -f Makefile.inc1 _generic_libs
1449 # static libgcc.a prerequisite for shared libc
1451 _prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc lib/libcompiler_rt
1453 # These dependencies are not automatically generated:
1455 # gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before
1456 # all shared libraries for ELF.
1458 _startup_libs= gnu/lib/csu
1459 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
1460 _startup_libs+= lib/csu/${MACHINE_ARCH}-elf
1461 .elif exists(${.CURDIR}/lib/csu/${MACHINE_ARCH})
1462 _startup_libs+= lib/csu/${MACHINE_ARCH}
1464 _startup_libs+= lib/csu/${MACHINE_CPUARCH}
1466 _startup_libs+= gnu/lib/libgcc
1467 _startup_libs+= lib/libcompiler_rt
1468 _startup_libs+= lib/libc
1469 _startup_libs+= lib/libc_nonshared
1470 .if ${MK_LIBCPLUSPLUS} != "no"
1471 _startup_libs+= lib/libcxxrt
1474 gnu/lib/libgcc__L: lib/libc__L
1475 gnu/lib/libgcc__L: lib/libc_nonshared__L
1476 .if ${MK_LIBCPLUSPLUS} != "no"
1477 lib/libcxxrt__L: gnu/lib/libgcc__L
1480 _prebuild_libs= ${_kerberos5_lib_libasn1} \
1481 ${_kerberos5_lib_libhdb} \
1482 ${_kerberos5_lib_libheimbase} \
1483 ${_kerberos5_lib_libheimntlm} \
1484 ${_kerberos5_lib_libheimsqlite} \
1485 ${_kerberos5_lib_libheimipcc} \
1486 ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \
1487 ${_kerberos5_lib_libroken} \
1488 ${_kerberos5_lib_libwind} \
1490 lib/libbz2 ${_libcom_err} lib/libcrypt \
1491 lib/libelf lib/libexpat \
1492 ${_lib_libgssapi} ${_lib_libipx} \
1493 lib/libkiconv lib/libkvm lib/liblzma lib/libmd lib/libnv \
1494 ${_lib_libcapsicum} \
1495 lib/ncurses/ncurses lib/ncurses/ncursesw \
1496 lib/libopie lib/libpam ${_lib_libthr} \
1497 lib/libradius lib/libsbuf lib/libtacplus \
1498 ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \
1499 ${_cddl_lib_libzfs_core} \
1500 lib/libutil lib/libpjdlog ${_lib_libypclnt} lib/libz lib/msun \
1501 ${_secure_lib_libcrypto} ${_lib_libldns} \
1502 ${_secure_lib_libssh} ${_secure_lib_libssl}
1504 .if ${MK_TESTS} != "no"
1508 .if ${MK_LIBTHR} != "no"
1509 _lib_libthr= lib/libthr
1512 .if ${MK_OFED} != "no"
1513 _ofed_lib= contrib/ofed/usr.lib/
1516 .if ${MK_CASPER} != "no"
1517 _lib_libcapsicum=lib/libcapsicum
1520 lib/libcapsicum__L: lib/libnv__L
1521 lib/libpjdlog__L: lib/libutil__L
1523 _generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib}
1524 .for _DIR in ${LOCAL_LIB_DIRS}
1525 .if exists(${.CURDIR}/${_DIR}/Makefile)
1526 _generic_libs+= ${_DIR}
1530 lib/libopie__L lib/libtacplus__L: lib/libmd__L
1532 .if ${MK_CDDL} != "no"
1533 _cddl_lib_libumem= cddl/lib/libumem
1534 _cddl_lib_libnvpair= cddl/lib/libnvpair
1535 _cddl_lib_libzfs_core= cddl/lib/libzfs_core
1537 cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L
1540 .if ${MK_CRYPT} != "no"
1541 .if ${MK_OPENSSL} != "no"
1542 _secure_lib_libcrypto= secure/lib/libcrypto
1543 _secure_lib_libssl= secure/lib/libssl
1544 lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L
1545 .if ${MK_LDNS} != "no"
1546 _lib_libldns= lib/libldns
1547 lib/libldns__L: secure/lib/libcrypto__L
1549 .if ${MK_OPENSSH} != "no"
1550 _secure_lib_libssh= secure/lib/libssh
1551 secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
1552 .if ${MK_LDNS} != "no"
1553 secure/lib/libssh__L: lib/libldns__L
1555 .if ${MK_KERBEROS_SUPPORT} != "no"
1556 secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \
1557 kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \
1558 lib/libmd__L kerberos5/lib/libroken__L
1562 _secure_lib= secure/lib
1565 .if ${MK_KERBEROS} != "no"
1566 kerberos5/lib/libasn1__L: lib/libcom_err__L kerberos5/lib/libroken__L
1567 kerberos5/lib/libhdb__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1568 kerberos5/lib/libkrb5__L kerberos5/lib/libroken__L \
1569 kerberos5/lib/libwind__L kerberos5/lib/libheimsqlite__L
1570 kerberos5/lib/libheimntlm__L: secure/lib/libcrypto__L kerberos5/lib/libkrb5__L \
1571 kerberos5/lib/libroken__L lib/libcom_err__L
1572 kerberos5/lib/libhx509__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1573 secure/lib/libcrypto__L kerberos5/lib/libroken__L kerberos5/lib/libwind__L
1574 kerberos5/lib/libkrb5__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1575 lib/libcrypt__L secure/lib/libcrypto__L kerberos5/lib/libhx509__L \
1576 kerberos5/lib/libroken__L kerberos5/lib/libwind__L \
1577 kerberos5/lib/libheimbase__L kerberos5/lib/libheimipcc__L
1578 kerberos5/lib/libroken__L: lib/libcrypt__L
1579 kerberos5/lib/libwind__L: kerberos5/lib/libroken__L lib/libcom_err__L
1580 kerberos5/lib/libheimbase__L: lib/libthr__L
1581 kerberos5/lib/libheimipcc__L: kerberos5/lib/libroken__L kerberos5/lib/libheimbase__L lib/libthr__L
1582 kerberos5/lib/libheimsqlite__L: lib/libthr__L
1585 .if ${MK_GSSAPI} != "no"
1586 _lib_libgssapi= lib/libgssapi
1589 .if ${MK_IPX} != "no"
1590 _lib_libipx= lib/libipx
1593 .if ${MK_KERBEROS} != "no"
1594 _kerberos5_lib= kerberos5/lib
1595 _kerberos5_lib_libasn1= kerberos5/lib/libasn1
1596 _kerberos5_lib_libhdb= kerberos5/lib/libhdb
1597 _kerberos5_lib_libheimbase= kerberos5/lib/libheimbase
1598 _kerberos5_lib_libkrb5= kerberos5/lib/libkrb5
1599 _kerberos5_lib_libhx509= kerberos5/lib/libhx509
1600 _kerberos5_lib_libroken= kerberos5/lib/libroken
1601 _kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm
1602 _kerberos5_lib_libheimsqlite= kerberos5/lib/libheimsqlite
1603 _kerberos5_lib_libheimipcc= kerberos5/lib/libheimipcc
1604 _kerberos5_lib_libwind= kerberos5/lib/libwind
1605 _libcom_err= lib/libcom_err
1608 .if ${MK_NIS} != "no"
1609 _lib_libypclnt= lib/libypclnt
1612 .if ${MK_OPENSSL} == "no"
1613 lib/libradius__L: lib/libmd__L
1616 .for _lib in ${_prereq_libs}
1617 ${_lib}__PL: .PHONY .MAKE
1618 .if exists(${.CURDIR}/${_lib})
1619 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1620 cd ${.CURDIR}/${_lib} && \
1621 ${MAKE} -DNO_TESTS DIRPRFX=${_lib}/ obj && \
1622 ${MAKE} -DNO_TESTS DIRPRFX=${_lib}/ depend && \
1623 ${MAKE} -DNO_TESTS -DNO_PROFILE -DNO_PIC \
1624 DIRPRFX=${_lib}/ all && \
1625 ${MAKE} -DNO_TESTS -DNO_PROFILE -DNO_PIC \
1626 DIRPRFX=${_lib}/ install
1630 .for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
1631 ${_lib}__L: .PHONY .MAKE
1632 .if exists(${.CURDIR}/${_lib})
1633 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1634 cd ${.CURDIR}/${_lib} && \
1635 ${MAKE} -DNO_TESTS DIRPRFX=${_lib}/ obj && \
1636 ${MAKE} -DNO_TESTS DIRPRFX=${_lib}/ depend && \
1637 ${MAKE} -DNO_TESTS DIRPRFX=${_lib}/ all && \
1638 ${MAKE} -DNO_TESTS DIRPRFX=${_lib}/ install
1642 # libpam is special: we need to build static PAM modules before
1643 # static PAM library, and dynamic PAM library before dynamic PAM
1645 lib/libpam__L: .PHONY .MAKE
1646 ${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \
1647 cd ${.CURDIR}/lib/libpam && \
1648 ${MAKE} -DNO_TESTS DIRPRFX=lib/libpam/ obj && \
1649 ${MAKE} -DNO_TESTS DIRPRFX=lib/libpam/ depend && \
1650 ${MAKE} -DNO_TESTS DIRPRFX=lib/libpam/ \
1651 -D_NO_LIBPAM_SO_YET all && \
1652 ${MAKE} -DNO_TESTS DIRPRFX=lib/libpam/ \
1653 -D_NO_LIBPAM_SO_YET install
1655 _prereq_libs: ${_prereq_libs:S/$/__PL/}
1656 _startup_libs: ${_startup_libs:S/$/__L/}
1657 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
1658 _generic_libs: ${_generic_libs:S/$/__L/}
1660 .for __target in all clean cleandepend cleandir depend includes obj
1661 .for entry in ${SUBDIR}
1662 ${entry}.${__target}__D: .PHONY .MAKE
1663 ${_+_}@set -e; if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
1664 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \
1665 edir=${entry}.${MACHINE_ARCH}; \
1666 cd ${.CURDIR}/$${edir}; \
1668 ${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \
1670 cd ${.CURDIR}/$${edir}; \
1672 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
1674 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
1677 .include <bsd.subdir.mk>
1679 .if make(check-old) || make(check-old-dirs) || \
1680 make(check-old-files) || make(check-old-libs) || \
1681 make(delete-old) || make(delete-old-dirs) || \
1682 make(delete-old-files) || make(delete-old-libs)
1685 # check for / delete old files section
1688 .include "ObsoleteFiles.inc"
1690 OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \
1691 else you can not start such an application. Consult UPDATING for more \
1692 information regarding how to cope with the removal/revision bump of a \
1695 .if !defined(BATCH_DELETE_OLD_FILES)
1702 @echo ">>> Removing old files (only deletes safe to delete libs)"
1703 # Ask for every old file if the user really wants to remove it.
1704 # It's annoying, but better safe than sorry.
1705 # NB: We cannot pass the list of OLD_FILES as a parameter because the
1706 # argument list will get too long. Using .for/.endfor make "loops" will make
1707 # the Makefile parser segfault.
1710 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1711 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1712 while read file; do \
1713 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1714 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1715 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1718 # Remove catpages without corresponding manpages.
1720 find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1721 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1722 while read catpage; do \
1724 if [ ! -e "$${manpage}" ]; then \
1725 rm ${RM_I} $${catpage} <&3; \
1728 @echo ">>> Old files removed"
1731 @echo ">>> Checking for old files"
1733 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1734 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1735 while read file; do \
1736 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1737 echo "${DESTDIR}/$${file}"; \
1740 # Check for catpages without corresponding manpages.
1741 @find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1742 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1743 while read catpage; do \
1745 if [ ! -e "$${manpage}" ]; then \
1751 @echo ">>> Removing old libraries"
1752 @echo "${OLD_LIBS_MESSAGE}" | fmt
1755 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1756 -V OLD_LIBS | xargs -n1 | \
1757 while read file; do \
1758 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1759 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1760 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1762 for ext in debug symbols; do \
1763 if ! [ -e "${DESTDIR}/$${file}" ] && [ -f \
1764 "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \
1765 rm ${RM_I} "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" \
1770 @echo ">>> Old libraries removed"
1773 @echo ">>> Checking for old libraries"
1775 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1776 -V OLD_LIBS | xargs -n1 | \
1777 while read file; do \
1778 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1779 echo "${DESTDIR}/$${file}"; \
1781 for ext in debug symbols; do \
1782 if [ -f "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \
1783 echo "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}"; \
1789 @echo ">>> Removing old directories"
1791 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1792 -V OLD_DIRS | xargs -n1 | sort -r | \
1793 while read dir; do \
1794 if [ -d "${DESTDIR}/$${dir}" ]; then \
1795 rmdir -v "${DESTDIR}/$${dir}" || true; \
1796 elif [ -L "${DESTDIR}/$${dir}" ]; then \
1797 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1800 @echo ">>> Old directories removed"
1803 @echo ">>> Checking for old directories"
1805 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1806 -V OLD_DIRS | xargs -n1 | \
1807 while read dir; do \
1808 if [ -d "${DESTDIR}/$${dir}" ]; then \
1809 echo "${DESTDIR}/$${dir}"; \
1810 elif [ -L "${DESTDIR}/$${dir}" ]; then \
1811 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1815 delete-old: delete-old-files delete-old-dirs
1816 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1818 check-old: check-old-files check-old-libs check-old-dirs
1819 @echo "To remove old files and directories run '${MAKE} delete-old'."
1820 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1825 # showconfig - show build configuration.
1828 @${MAKE} -n -f bsd.own.mk -V dummy -dg1 2>&1 | grep ^MK_ | sort
1830 .if !empty(KRNLOBJDIR) && !empty(KERNCONF)
1831 DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/
1833 .if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE)
1834 .if exists(${KERNCONFDIR}/${KERNCONF})
1835 FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \
1836 ${KERNCONFDIR}/${KERNCONF} ; echo
1842 .if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH})
1843 DTBOUTPUTPATH= ${.CURDIR}
1847 # Build 'standalone' Device Tree Blob
1850 @if [ "${FDT_DTS_FILE}" = "" ]; then \
1851 echo "ERROR: FDT_DTS_FILE must be specified!"; \
1854 if [ ! -f ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE} ]; then \
1855 echo "ERROR: Specified DTS file (${FDT_DTS_FILE}) does not \
1859 if [ "${DTBOUTPUTPATH}" = "${.CURDIR}" ]; then \
1860 echo "WARNING: DTB will be placed in the current working \
1865 ${DTBOUTPUTPATH}/`echo ${FDT_DTS_FILE} | cut -d. -f1`.dtb -b 0 \
1866 -p 1024 ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE}
1870 .if defined(XDEV) && defined(XDEV_ARCH)
1872 .if ${XDEV} == ${MACHINE} && ${XDEV_ARCH} == ${MACHINE_ARCH}
1873 XDEV_CPUTYPE?=${CPUTYPE}
1875 XDEV_CPUTYPE?=${TARGET_CPUTYPE}
1878 NOFUN=-DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
1879 -DWITHOUT_MAN -DWITHOUT_NLS -DNO_PROFILE \
1880 -DWITHOUT_KERBEROS -DWITHOUT_RESCUE -DNO_WARNS \
1881 TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH} \
1882 CPUTYPE=${XDEV_CPUTYPE}
1884 XDDIR=${XDEV_ARCH}-freebsd
1886 CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \
1887 INSTALL="sh ${.CURDIR}/tools/install.sh"
1889 _SHLIBDIRPREFIX=${XDDESTDIR} \
1890 TOOLS_PREFIX=${XDDESTDIR}
1891 CD2CFLAGS=-isystem ${XDDESTDIR}/usr/include -L${XDDESTDIR}/usr/lib \
1892 -B${XDDESTDIR}/usr/lib
1893 CD2ENV=${CDENV} CC="${CC} ${CD2CFLAGS}" \
1894 MACHINE=${XDEV} MACHINE_ARCH=${XDEV_ARCH}
1896 CDTMP= ${MAKEOBJDIRPREFIX}/${XDDIR}/${.CURDIR}/tmp
1897 CDMAKE=${CDENV} PATH=${CDTMP}/usr/bin:${PATH} ${MAKE} ${NOFUN}
1898 CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDDESTDIR}/usr/bin:${PATH} ${MAKE} ${NOFUN}
1899 XDDESTDIR=${DESTDIR}/${XDTP}
1901 OSREL!= uname -r | sed -e 's/[-(].*//'
1904 .ORDER: xdev-build xdev-install
1905 xdev: xdev-build xdev-install
1907 .ORDER: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools
1908 xdev-build: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools
1911 mkdir -p ${CDTMP}/usr
1912 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1913 -p ${CDTMP}/usr >/dev/null
1915 _xb-bootstrap-tools:
1918 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1919 cd ${.CURDIR}/${_tool} && \
1920 ${CDMAKE} DIRPRFX=${_tool}/ obj && \
1921 ${CDMAKE} DIRPRFX=${_tool}/ depend && \
1922 ${CDMAKE} DIRPRFX=${_tool}/ all && \
1923 ${CDMAKE} DIRPRFX=${_tool}/ DESTDIR=${CDTMP} install
1927 ${_+_}@cd ${.CURDIR}; \
1928 ${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools
1932 gnu/usr.bin/binutils \
1937 ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \
1938 cd ${.CURDIR}/${_tool} && \
1939 ${CDMAKE} DIRPRFX=${_tool}/ obj && \
1940 ${CDMAKE} DIRPRFX=${_tool}/ depend && \
1941 ${CDMAKE} DIRPRFX=${_tool}/ all
1945 ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}"
1946 mkdir -p ${XDDESTDIR}
1947 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
1948 -p ${XDDESTDIR} >/dev/null
1949 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1950 -p ${XDDESTDIR}/usr >/dev/null
1951 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
1952 -p ${XDDESTDIR}/usr/include >/dev/null
1954 .ORDER: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
1955 xdev-install: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
1958 @echo "_xi-cross-tools"
1960 gnu/usr.bin/binutils \
1964 ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \
1965 cd ${.CURDIR}/${_tool}; \
1966 ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR}
1970 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 par-includes \
1971 DESTDIR=${XDDESTDIR}
1974 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \
1975 DESTDIR=${XDDESTDIR}
1978 ${_+_}cd ${XDDESTDIR}/usr/bin; \
1979 mkdir -p ../../../../usr/bin; \
1981 ln -sf ../../${XDTP}/usr/bin/$$i \
1982 ../../../../usr/bin/${XDDIR}-$$i; \
1983 ln -sf ../../${XDTP}/usr/bin/$$i \
1984 ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \
1987 xdev xdev-build xdev-install:
1988 @echo "*** Error: Both XDEV and XDEV_ARCH must be defined for \"${.TARGET}\" target"
1991 buildkernel ${WMAKE_TGTS} ${.ALLTARGETS:M_*}: .MAKE