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 -DNO_TESTS
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 -DNO_TESTS
262 XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \
263 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
264 -DWITHOUT_GDB -DNO_TESTS
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} \
420 LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} ${LIB32WMAKEFLAGS} \
421 -DWITHOUT_MAN -DWITHOUT_INFO -DWITHOUT_HTML
422 LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} -DNO_INCS \
426 IMAKEENV= ${CROSSENV:N_LDSCRIPTROOT=*}
427 IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 \
428 ${IMAKE_INSTALL} ${IMAKE_MTREE} ${IMAKE_COMPILER_TYPE}
429 .if empty(.MAKEFLAGS:M-n)
430 IMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMP} \
431 LD_LIBRARY_PATH=${INSTALLTMP} \
432 PATH_LOCALE=${INSTALLTMP}/locale
433 IMAKE+= __MAKE_SHELL=${INSTALLTMP}/sh
435 IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP}
437 .if defined(DB_FROM_SRC)
438 INSTALLFLAGS+= -N ${.CURDIR}/etc
439 MTREEFLAGS+= -N ${.CURDIR}/etc
441 _INSTALL_DDIR= ${DESTDIR}/${DISTDIR}
442 INSTALL_DDIR= ${_INSTALL_DDIR:S://:/:g:C:/$::}
444 METALOG?= ${DESTDIR}/${DISTDIR}/METALOG
445 IMAKE+= -DNO_ROOT METALOG=${METALOG}
446 INSTALLFLAGS+= -U -M ${METALOG} -D ${INSTALL_DDIR}
449 .if defined(DB_FROM_SRC) || defined(NO_ROOT)
450 IMAKE_INSTALL= INSTALL="install ${INSTALLFLAGS}"
451 IMAKE_MTREE= MTREE_CMD="mtree ${MTREEFLAGS}"
455 KMAKEENV= ${WMAKEENV}
456 KMAKE= ${KMAKEENV} ${MAKE} ${.MAKEFLAGS} ${KERNEL_FLAGS} KERNEL=${INSTKERNNAME}
461 # Attempt to rebuild the entire system, with reasonable chance of
462 # success, regardless of how old your existing system is.
465 .if ${.CURDIR:C/[^,]//g} != ""
466 # The m4 build of sendmail files doesn't like it if ',' is used
467 # anywhere in the path of it's files.
469 @echo "*** Error: path to source tree contains a comma ','"
474 @echo "--------------------------------------------------------------"
475 @echo ">>> Rebuilding the temporary build tree"
476 @echo "--------------------------------------------------------------"
477 .if !defined(NO_CLEAN)
479 .if defined(LIB32TMP)
483 rm -rf ${WORLDTMP}/legacy/usr/include
484 # XXX - These three can depend on any header file.
485 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
486 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c
487 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
490 lib usr legacy/bin legacy/usr
491 mkdir -p ${WORLDTMP}/${_dir}
493 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
494 -p ${WORLDTMP}/legacy/usr >/dev/null
495 .if ${MK_GROFF} != "no"
496 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.groff.dist \
497 -p ${WORLDTMP}/legacy/usr >/dev/null
499 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
500 -p ${WORLDTMP}/usr >/dev/null
501 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
502 -p ${WORLDTMP}/usr/include >/dev/null
503 ln -sf ${.CURDIR}/sys ${WORLDTMP}
504 .if ${MK_DEBUG_FILES} != "no"
505 # We could instead disable debug files for these build stages
506 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
507 -p ${WORLDTMP}/legacy/usr/lib >/dev/null
508 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
509 -p ${WORLDTMP}/usr/lib >/dev/null
511 .if ${MK_TESTS} != "no"
512 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
513 -p ${WORLDTMP}/usr >/dev/null
515 .for _mtree in ${LOCAL_MTREE}
516 mtree -deU -f ${.CURDIR}/${_mtree} -p ${WORLDTMP} > /dev/null
520 @echo "--------------------------------------------------------------"
521 @echo ">>> stage 1.1: legacy release compatibility shims"
522 @echo "--------------------------------------------------------------"
523 ${_+_}cd ${.CURDIR}; ${BMAKE} legacy
526 @echo "--------------------------------------------------------------"
527 @echo ">>> stage 1.2: bootstrap tools"
528 @echo "--------------------------------------------------------------"
529 ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools
531 .if !defined(NO_CLEAN)
533 @echo "--------------------------------------------------------------"
534 @echo ">>> stage 2.1: cleaning up the object tree"
535 @echo "--------------------------------------------------------------"
536 ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
537 .if defined(LIB32TMP)
538 ${_+_}cd ${.CURDIR}; ${LIB32WMAKE} -f Makefile.inc1 ${CLEANDIR:S/^/par-/}
543 @echo "--------------------------------------------------------------"
544 @echo ">>> stage 2.2: rebuilding the object tree"
545 @echo "--------------------------------------------------------------"
546 ${_+_}cd ${.CURDIR}; ${WMAKE} par-obj
549 @echo "--------------------------------------------------------------"
550 @echo ">>> stage 2.3: build tools"
551 @echo "--------------------------------------------------------------"
552 ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools
555 @echo "--------------------------------------------------------------"
556 @echo ">>> stage 3: cross tools"
557 @echo "--------------------------------------------------------------"
558 ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools
559 ${_+_}cd ${.CURDIR}; ${XMAKE} kernel-tools
562 @echo "--------------------------------------------------------------"
563 @echo ">>> stage 4.1: building includes"
564 @echo "--------------------------------------------------------------"
565 ${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
568 @echo "--------------------------------------------------------------"
569 @echo ">>> stage 4.2: building libraries"
570 @echo "--------------------------------------------------------------"
571 ${_+_}cd ${.CURDIR}; \
572 ${WMAKE} -DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
573 -DWITHOUT_MAN -DNO_PROFILE -DNO_TESTS libraries
576 @echo "--------------------------------------------------------------"
577 @echo ">>> stage 4.3: make dependencies"
578 @echo "--------------------------------------------------------------"
579 ${_+_}cd ${.CURDIR}; ${WMAKE} par-depend
582 @echo "--------------------------------------------------------------"
583 @echo ">>> stage 4.4: building everything"
584 @echo "--------------------------------------------------------------"
585 ${_+_}cd ${.CURDIR}; ${WMAKE} par-all
586 .if defined(LIB32TMP)
589 @echo "--------------------------------------------------------------"
590 @echo ">>> stage 5.1: building 32 bit shim libraries"
591 @echo "--------------------------------------------------------------"
592 mkdir -p ${LIB32TMP}/usr/include
593 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
594 -p ${LIB32TMP}/usr >/dev/null
595 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
596 -p ${LIB32TMP}/usr/include >/dev/null
597 .if ${MK_DEBUG_FILES} != "no"
598 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
599 -p ${LIB32TMP}/usr/lib >/dev/null
602 ln -sf ${.CURDIR}/sys ${WORLDTMP}
603 .for _t in obj includes
604 cd ${.CURDIR}/include; ${LIB32WMAKE} DIRPRFX=include/ ${_t}
605 cd ${.CURDIR}/lib; ${LIB32WMAKE} DIRPRFX=lib/ ${_t}
606 .if ${MK_CDDL} != "no"
607 cd ${.CURDIR}/cddl/lib; ${LIB32WMAKE} DIRPRFX=cddl/lib/ ${_t}
609 cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} DIRPRFX=gnu/lib/ ${_t}
610 .if ${MK_CRYPT} != "no"
611 cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} DIRPRFX=secure/lib/ ${_t}
613 .if ${MK_KERBEROS} != "no"
614 cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} DIRPRFX=kerberos5/lib ${_t}
617 .for _dir in usr.bin/lex/lib
618 cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} DIRPRFX=${_dir}/ obj
620 .for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic
621 cd ${.CURDIR}/${_dir}; \
622 WORLDTMP=${WORLDTMP} \
623 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
624 MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \
625 DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF \
626 -DEARLY_BUILD build-tools
629 ${LIB32WMAKE} -f Makefile.inc1 libraries
630 .for _t in obj depend all
631 cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32WMAKE} \
632 DIRPRFX=libexec/rtld-elf/ ${_t}
633 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32WMAKE} \
634 DIRPRFX=usr.bin/ldd ${_t}
637 distribute32 install32:
638 cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
639 .if ${MK_CDDL} != "no"
640 cd ${.CURDIR}/cddl/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
642 cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
643 .if ${MK_CRYPT} != "no"
644 cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
646 .if ${MK_KERBEROS} != "no"
647 cd ${.CURDIR}/kerberos5/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
649 cd ${.CURDIR}/libexec/rtld-elf; \
650 PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//}
651 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32IMAKE} ${.TARGET:S/32$//}
655 .if !defined(SUBDIR_OVERRIDE)
656 WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools
658 WMAKE_TGTS+= _cleanobj _obj _build-tools
659 .if !defined(SUBDIR_OVERRIDE)
660 WMAKE_TGTS+= _cross-tools
662 WMAKE_TGTS+= _includes _libraries _depend everything
663 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
667 buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
668 .ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
671 @echo "--------------------------------------------------------------"
672 @echo ">>> World build started on `LC_ALL=C date`"
673 @echo "--------------------------------------------------------------"
677 @echo "--------------------------------------------------------------"
678 @echo ">>> World build completed on `LC_ALL=C date`"
679 @echo "--------------------------------------------------------------"
682 # We need to have this as a target because the indirection between Makefile
683 # and Makefile.inc1 causes the correct PATH to be used, rather than a
684 # modification of the current environment's PATH. In addition, we need
685 # to quote multiword values.
691 @echo Entering world for ${TARGET_ARCH}:${TARGET}
692 @cd ${.CURDIR} && env ${WMAKEENV} ${BUILDENV_SHELL} || true
694 TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything:Nbuild32}
695 toolchain: ${TOOLCHAIN_TGTS}
696 kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries}
701 # Checks to be sure system is ready for installworld/installkernel.
703 installcheck: _installcheck_world _installcheck_kernel
705 _installcheck_kernel:
708 # Require DESTDIR to be set if installing for a different architecture or
709 # using the user/group database in the source tree.
711 .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE} || \
713 .if !make(distributeworld)
714 _installcheck_world: __installcheck_DESTDIR
715 _installcheck_kernel: __installcheck_DESTDIR
716 __installcheck_DESTDIR:
717 .if !defined(DESTDIR) || empty(DESTDIR)
718 @echo "ERROR: Please set DESTDIR!"; \
724 .if !defined(DB_FROM_SRC)
726 # Check for missing UIDs/GIDs.
728 CHECK_UIDS= auditdistd
730 .if ${MK_SENDMAIL} != "no"
736 CHECK_GIDS+= proxy authpf
738 .if ${MK_UNBOUND} != "no"
742 _installcheck_world: __installcheck_UGID
744 .for uid in ${CHECK_UIDS}
745 @if ! `id -u ${uid} >/dev/null 2>&1`; then \
746 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \
750 .for gid in ${CHECK_GIDS}
751 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \
752 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \
759 # Required install tools to be saved in a scratch dir for safety.
761 .if ${MK_INFO} != "no"
762 _install-info= install-info
764 .if ${MK_ZONEINFO} != "no"
765 _zoneinfo= zic tzsetup
768 ITOOLS= [ awk cap_mkdb cat chflags chmod chown \
769 date echo egrep find grep id install ${_install-info} \
770 ln lockf make mkdir mtree mv pwd_mkdb \
771 rm sed services_mkdb sh sysctl test true uname wc ${_zoneinfo}
776 # Distributes everything compiled by a `buildworld'.
780 # Installs everything compiled by a 'buildworld'.
783 # Non-base distributions produced by the base system
784 EXTRA_DISTRIBUTIONS= doc
785 .if ${MK_GAMES} != "no"
786 EXTRA_DISTRIBUTIONS+= games
788 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
789 EXTRA_DISTRIBUTIONS+= lib32
792 MTREE_MAGIC?= mtree 2.0
794 distributeworld installworld: _installcheck_world
795 mkdir -p ${INSTALLTMP}
796 progs=$$(for prog in ${ITOOLS}; do \
797 if progpath=`which $$prog`; then \
800 echo "Required tool $$prog not found in PATH." >&2; \
804 libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | \
805 while read line; do \
807 if [ "$$2 $$3" != "not found" ]; then \
810 echo "Required library $$1 not found." >&2; \
814 cp $$libs $$progs ${INSTALLTMP}
815 cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale
817 echo "#${MTREE_MAGIC}" > ${METALOG}
819 .if make(distributeworld)
820 .for dist in ${EXTRA_DISTRIBUTIONS}
821 -mkdir ${DESTDIR}/${DISTDIR}/${dist}
822 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
823 -p ${DESTDIR}/${DISTDIR}/${dist} >/dev/null
824 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
825 -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null
826 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
827 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/include >/dev/null
828 .if ${MK_DEBUG_FILES} != "no"
829 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
830 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib >/dev/null
833 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \
834 sed -e 's#^\./#./${dist}/#' >> ${METALOG}
835 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.usr.dist | \
836 sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG}
837 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.include.dist | \
838 sed -e 's#^\./#./${dist}/usr/include/#' >> ${METALOG}
841 -mkdir ${DESTDIR}/${DISTDIR}/base
842 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
843 METALOG=${METALOG} ${IMAKE_INSTALL} ${IMAKE_MTREE} \
844 DISTBASE=/base DESTDIR=${DESTDIR}/${DISTDIR}/base \
845 LOCAL_MTREE=${LOCAL_MTREE:Q} distrib-dirs
847 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \
848 ${IMAKEENV} rm -rf ${INSTALLTMP}
849 .if make(distributeworld)
850 .for dist in ${EXTRA_DISTRIBUTIONS}
851 find ${DESTDIR}/${DISTDIR}/${dist} -mindepth 1 -empty -delete
854 .for dist in base ${EXTRA_DISTRIBUTIONS}
855 @# For each file that exists in this dist, print the corresponding
856 @# line from the METALOG. This relies on the fact that
857 @# a line containing only the filename will sort immediatly before
858 @# the relevant mtree line.
859 cd ${DESTDIR}/${DISTDIR}; \
860 find ./${dist} | sort -u ${METALOG} - | \
861 awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \
862 ${DESTDIR}/${DISTDIR}/${dist}.meta
864 .if ${MK_DEBUG_FILES} != "no"
865 . for dist in base ${EXTRA_DISTRIBUTIONS}
866 @# For each file that exists in this dist, print the corresponding
867 @# line from the METALOG. This relies on the fact that
868 @# a line containing only the filename will sort immediatly before
869 @# the relevant mtree line.
870 cd ${DESTDIR}/${DISTDIR}; \
871 find ./${dist}/usr/lib/debug | sort -u ${METALOG} - | \
872 awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \
873 ${DESTDIR}/${DISTDIR}/${dist}.debug.meta
880 .for dist in base ${EXTRA_DISTRIBUTIONS}
882 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
883 tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz \
884 --exclude usr/lib/debug \
885 @${DESTDIR}/${DISTDIR}/${dist}.meta
887 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
888 tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz \
889 --exclude usr/lib/debug .
893 .if ${MK_DEBUG_FILES} != "no"
894 . for dist in base ${EXTRA_DISTRIBUTIONS}
895 . if defined(NO_ROOT)
896 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
897 tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.debug.txz \
898 @${DESTDIR}/${DISTDIR}/${dist}.debug.meta
900 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
901 tar cvJfL ${DESTDIR}/${DISTDIR}/${dist}.debug.txz \
910 # If you have a build server, you can NFS mount the source and obj directories
911 # and do a 'make reinstall' on the *client* to install new binaries from the
912 # most recent server build.
915 @echo "--------------------------------------------------------------"
916 @echo ">>> Making hierarchy"
917 @echo "--------------------------------------------------------------"
918 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 \
919 LOCAL_MTREE=${LOCAL_MTREE:Q} hierarchy
921 @echo "--------------------------------------------------------------"
922 @echo ">>> Installing everything"
923 @echo "--------------------------------------------------------------"
924 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
925 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
926 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32
930 @echo "--------------------------------------------------------------"
931 @echo ">>> Distributing everything"
932 @echo "--------------------------------------------------------------"
933 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
934 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
935 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 \
939 distrib-dirs distribution:
940 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
941 ${IMAKE_INSTALL} ${IMAKE_MTREE} METALOG=${METALOG} ${.TARGET}
944 # buildkernel and installkernel
946 # Which kernels to build and/or install is specified by setting
947 # KERNCONF. If not defined a GENERIC kernel is built/installed.
948 # Only the existing (depending TARGET) config files are used
949 # for building kernels and only the first of these is designated
950 # as the one being installed.
952 # Note that we have to use TARGET instead of TARGET_ARCH when
953 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
954 # be set to cross-build, we have to make sure TARGET is set
957 .if defined(KERNFAST)
962 # Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah
963 .if !defined(KERNCONF) && ${KERNFAST} != "1"
967 .if ${TARGET_ARCH} == "powerpc64"
972 INSTKERNNAME?= kernel
974 KERNSRCDIR?= ${.CURDIR}/sys
975 KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf
976 KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR}
977 KERNCONFDIR?= ${KRNLCONFDIR}
981 .for _kernel in ${KERNCONF}
982 .if exists(${KERNCONFDIR}/${_kernel})
983 BUILDKERNELS+= ${_kernel}
984 .if empty(INSTALLKERNEL)
985 INSTALLKERNEL= ${_kernel}
993 # Builds all kernels defined by BUILDKERNELS.
996 .if empty(BUILDKERNELS)
997 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \
1001 .for _kernel in ${BUILDKERNELS}
1002 @echo "--------------------------------------------------------------"
1003 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
1004 @echo "--------------------------------------------------------------"
1005 @echo "===> ${_kernel}"
1006 mkdir -p ${KRNLOBJDIR}
1007 .if !defined(NO_KERNELCONFIG)
1009 @echo "--------------------------------------------------------------"
1010 @echo ">>> stage 1: configuring the kernel"
1011 @echo "--------------------------------------------------------------"
1012 cd ${KRNLCONFDIR}; \
1014 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
1015 ${KERNCONFDIR}/${_kernel}
1017 .if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN)
1019 @echo "--------------------------------------------------------------"
1020 @echo ">>> stage 2.1: cleaning up the object tree"
1021 @echo "--------------------------------------------------------------"
1022 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR}
1024 .if !defined(NO_KERNELOBJ)
1026 @echo "--------------------------------------------------------------"
1027 @echo ">>> stage 2.2: rebuilding the object tree"
1028 @echo "--------------------------------------------------------------"
1029 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj
1032 @echo "--------------------------------------------------------------"
1033 @echo ">>> stage 2.3: build tools"
1034 @echo "--------------------------------------------------------------"
1035 ${_+_}cd ${.CURDIR}; ${KTMAKE} kernel-tools
1036 .if !defined(NO_KERNELDEPEND)
1038 @echo "--------------------------------------------------------------"
1039 @echo ">>> stage 3.1: making dependencies"
1040 @echo "--------------------------------------------------------------"
1041 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ
1044 @echo "--------------------------------------------------------------"
1045 @echo ">>> stage 3.2: building everything"
1046 @echo "--------------------------------------------------------------"
1047 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ
1048 @echo "--------------------------------------------------------------"
1049 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
1050 @echo "--------------------------------------------------------------"
1054 # installkernel, etc.
1056 # Install the kernel defined by INSTALLKERNEL
1058 installkernel installkernel.debug \
1059 reinstallkernel reinstallkernel.debug: _installcheck_kernel
1060 .if empty(INSTALLKERNEL)
1061 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
1064 @echo "--------------------------------------------------------------"
1065 @echo ">>> Installing kernel ${INSTALLKERNEL}"
1066 @echo "--------------------------------------------------------------"
1067 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
1068 ${CROSSENV} PATH=${TMPPATH} \
1069 ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
1071 distributekernel distributekernel.debug:
1072 .if empty(INSTALLKERNEL)
1073 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
1076 mkdir -p ${DESTDIR}/${DISTDIR}
1077 .if defined(NO_ROOT)
1078 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.premeta
1080 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
1081 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.premeta/} \
1082 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} KERNEL=${INSTKERNNAME} \
1083 DESTDIR=${INSTALL_DDIR}/kernel \
1084 ${.TARGET:S/distributekernel/install/}
1085 .if defined(NO_ROOT)
1086 sed -e 's|^./kernel|.|' ${DESTDIR}/${DISTDIR}/kernel.premeta > \
1087 ${DESTDIR}/${DISTDIR}/kernel.meta
1089 .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
1090 .if defined(NO_ROOT)
1091 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta
1093 cd ${KRNLOBJDIR}/${_kernel}; \
1094 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.${_kernel}.premeta/} \
1095 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} \
1096 KERNEL=${INSTKERNNAME}.${_kernel} \
1097 DESTDIR=${INSTALL_DDIR}/kernel.${_kernel} \
1098 ${.TARGET:S/distributekernel/install/}
1099 .if defined(NO_ROOT)
1100 sed -e 's|^./kernel|.|' \
1101 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta > \
1102 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta
1107 .if defined(NO_ROOT)
1108 cd ${DESTDIR}/${DISTDIR}/kernel; \
1109 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz \
1110 @${DESTDIR}/${DISTDIR}/kernel.meta
1111 .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
1112 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
1113 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz \
1114 @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta
1117 cd ${DESTDIR}/${DISTDIR}/kernel; \
1118 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz .
1119 .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
1120 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
1121 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz .
1128 # Build the API documentation with doxygen
1131 @if [ ! -x `/usr/bin/which doxygen` ]; then \
1132 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \
1135 cd ${.CURDIR}/tools/kerneldoc/subsys && ${MAKE} obj all
1140 # Update the source tree(s), by running svn/svnup to update to the
1144 .if (defined(CVS_UPDATE) || defined(SUP_UPDATE)) && !defined(SVN_UPDATE)
1145 @echo "--------------------------------------------------------------"
1146 @echo "CVS_UPDATE and SUP_UPDATE are no longer supported."
1147 @echo "Please see: https://wiki.freebsd.org/CvsIsDeprecated"
1148 @echo "--------------------------------------------------------------"
1151 .if defined(SVN_UPDATE)
1152 @echo "--------------------------------------------------------------"
1153 @echo ">>> Updating ${.CURDIR} using Subversion"
1154 @echo "--------------------------------------------------------------"
1155 @(cd ${.CURDIR} && ${SVN} update ${SVNFLAGS})
1159 # ------------------------------------------------------------------------
1161 # From here onwards are utility targets used by the 'make world' and
1162 # related targets. If your 'world' breaks, you may like to try to fix
1163 # the problem and manually run the following targets to attempt to
1164 # complete the build. Beware, this is *not* guaranteed to work, you
1165 # need to have a pretty good grip on the current state of the system
1166 # to attempt to manually finish it. If in doubt, 'make world' again.
1170 # legacy: Build compatibility shims for the next three targets
1173 .if ${BOOTSTRAPPING} < 700055 && ${BOOTSTRAPPING} != 0
1174 @echo "ERROR: Source upgrades from versions prior to 7.0 not supported."; \
1177 .for _tool in tools/build
1178 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \
1179 cd ${.CURDIR}/${_tool} && \
1180 ${MAKE} DIRPRFX=${_tool}/ obj && \
1181 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes && \
1182 ${MAKE} DIRPRFX=${_tool}/ depend && \
1183 ${MAKE} DIRPRFX=${_tool}/ all && \
1184 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
1188 # bootstrap-tools: Build tools needed for compatibility
1190 .if ${MK_GAMES} != "no"
1191 _strfile= games/fortune/strfile
1194 .if ${MK_CXX} != "no"
1195 _gperf= gnu/usr.bin/gperf
1198 .if ${MK_GROFF} != "no"
1199 _groff= gnu/usr.bin/groff
1202 .if ${BOOTSTRAPPING} < 800022
1206 .if ${BOOTSTRAPPING} < 800013
1207 _mklocale= usr.bin/mklocale
1210 .if ${BOOTSTRAPPING} < 900002
1214 .if ${BOOTSTRAPPING} < 900006
1218 .if ${BOOTSTRAPPING} < 1000002
1222 .if ${BOOTSTRAPPING} < 1000013
1227 .if ${BOOTSTRAPPING} < 1000014
1228 _crunch= usr.sbin/crunch
1231 .if ${BOOTSTRAPPING} < 1000026
1232 _nmtree= lib/libnetbsd \
1236 .if ${BOOTSTRAPPING} < 1000027
1240 .if ${BOOTSTRAPPING} >= 900040 && ${BOOTSTRAPPING} < 900041
1244 .if ${MK_BSNMP} != "no" && !exists(/usr/sbin/gensnmptree)
1245 _gensnmptree= usr.sbin/bsnmpd/gensnmptree
1248 .if ${MK_CLANG} != "no"
1250 lib/clang/libllvmsupport \
1251 lib/clang/libllvmtablegen \
1252 usr.bin/clang/tblgen \
1253 usr.bin/clang/clang-tblgen
1256 # dtrace tools are required for older bootstrap env and cross-build
1257 .if ${MK_CDDL} != "no" && \
1258 ((${BOOTSTRAPPING} < 1000034 && \
1259 !(${BOOTSTRAPPING} >= 901505 && ${BOOTSTRAPPING} < 999999)) \
1260 || (${MACHINE} != ${TARGET} || ${MACHINE_ARCH} != ${TARGET_ARCH}))
1261 _dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \
1262 lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge
1265 # Default to building the BSDL DTC, but build the GPL one if users explicitly
1268 .if ${MK_GPL_DTC} != "no"
1269 _dtc= gnu/usr.bin/dtc
1272 .if ${MK_KERBEROS} != "no"
1273 _kerberos5_bootstrap_tools= \
1274 kerberos5/tools/make-roken \
1275 kerberos5/lib/libroken \
1276 kerberos5/lib/libvers \
1277 kerberos5/tools/asn1_compile \
1278 kerberos5/tools/slc \
1282 # Please document (add comment) why something is in 'bootstrap-tools'.
1283 # Try to bound the building of the bootstrap-tool to just the
1284 # FreeBSD versions that need the tool built at this stage of the build.
1285 bootstrap-tools: .MAKE
1288 ${_kerberos5_bootstrap_tools} \
1298 usr.bin/makewhatis \
1311 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1312 cd ${.CURDIR}/${_tool} && \
1313 ${MAKE} DIRPRFX=${_tool}/ obj && \
1314 ${MAKE} DIRPRFX=${_tool}/ depend && \
1315 ${MAKE} DIRPRFX=${_tool}/ all && \
1316 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
1320 # build-tools: Build special purpose build tools
1322 .if !defined(NO_SHARE)
1323 _share= share/syscons/scrnmaps
1326 .if ${MK_GCC} != "no"
1327 _gcc_tools= gnu/usr.bin/cc/cc_tools
1330 .if ${MK_RESCUE} != "no"
1331 _rescue= rescue/rescue
1339 ${LOCAL_TOOL_DIRS} \
1340 lib/ncurses/ncurses \
1341 lib/ncurses/ncursesw \
1345 usr.bin/mkesdb_static \
1346 usr.bin/mkcsmapper_static \
1348 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \
1349 cd ${.CURDIR}/${_tool} && \
1350 ${MAKE} DIRPRFX=${_tool}/ obj && \
1351 ${MAKE} DIRPRFX=${_tool}/ build-tools
1355 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \
1356 cd ${.CURDIR}/${_tool} && \
1357 ${MAKE} DIRPRFX=${_tool}/ obj && \
1358 ${MAKE} DIRPRFX=${_tool}/ depend && \
1359 ${MAKE} DIRPRFX=${_tool}/ all
1363 # kernel-tools: Build kernel-building tools
1366 mkdir -p ${MAKEOBJDIRPREFIX}/usr
1367 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1368 -p ${MAKEOBJDIRPREFIX}/usr >/dev/null
1371 # cross-tools: Build cross-building tools
1373 .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 800035
1374 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386"
1375 _btxld= usr.sbin/btxld
1378 .if ${TARGET_ARCH} != ${MACHINE_ARCH}
1379 .if ${MK_RESCUE} != "no" || defined(RELEASEDIR)
1380 _crunchide= usr.sbin/crunch/crunchide
1382 .if ${TARGET_ARCH} == "i386" && defined(RELEASEDIR)
1383 _kgzip= usr.sbin/kgzip
1387 .if ${XAS:M/*} == "" && ${MK_BINUTILS} != "no"
1388 _binutils= gnu/usr.bin/binutils
1391 # If an full path to an external cross compiler is given, don't build
1393 .if ${XCC:M/*} == "" && ${MK_CROSS_COMPILER} != "no"
1394 .if ${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang"
1395 _clang= usr.bin/clang
1396 _clang_libs= lib/clang
1401 # The boot2 for pc98 requires gcc.
1402 .if ${TARGET} == "pc98"
1413 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
1417 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1418 cd ${.CURDIR}/${_tool} && \
1419 ${MAKE} DIRPRFX=${_tool}/ obj && \
1420 ${MAKE} DIRPRFX=${_tool}/ depend && \
1421 ${MAKE} DIRPRFX=${_tool}/ all && \
1422 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
1426 # hierarchy - ensure that all the needed directories are present
1429 cd ${.CURDIR}/etc && ${HMAKE} distrib-dirs
1432 # libraries - build all libraries, and install them under ${DESTDIR}.
1434 # The list of libraries with dependents (${_prebuild_libs}) and their
1435 # interdependencies (__L) are built automatically by the
1436 # ${.CURDIR}/tools/make_libdeps.sh script.
1440 ${MAKE} -f Makefile.inc1 _prereq_libs && \
1441 ${MAKE} -f Makefile.inc1 _startup_libs && \
1442 ${MAKE} -f Makefile.inc1 _prebuild_libs && \
1443 ${MAKE} -f Makefile.inc1 _generic_libs
1446 # static libgcc.a prerequisite for shared libc
1448 _prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc lib/libcompiler_rt
1450 # These dependencies are not automatically generated:
1452 # gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before
1453 # all shared libraries for ELF.
1455 _startup_libs= gnu/lib/csu
1456 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
1457 _startup_libs+= lib/csu/${MACHINE_ARCH}-elf
1458 .elif exists(${.CURDIR}/lib/csu/${MACHINE_ARCH})
1459 _startup_libs+= lib/csu/${MACHINE_ARCH}
1461 _startup_libs+= lib/csu/${MACHINE_CPUARCH}
1463 _startup_libs+= gnu/lib/libgcc
1464 _startup_libs+= lib/libcompiler_rt
1465 _startup_libs+= lib/libc
1466 _startup_libs+= lib/libc_nonshared
1467 .if ${MK_LIBCPLUSPLUS} != "no"
1468 _startup_libs+= lib/libcxxrt
1471 gnu/lib/libgcc__L: lib/libc__L
1472 gnu/lib/libgcc__L: lib/libc_nonshared__L
1473 .if ${MK_LIBCPLUSPLUS} != "no"
1474 lib/libcxxrt__L: gnu/lib/libgcc__L
1477 _prebuild_libs= ${_kerberos5_lib_libasn1} \
1478 ${_kerberos5_lib_libhdb} \
1479 ${_kerberos5_lib_libheimbase} \
1480 ${_kerberos5_lib_libheimntlm} \
1481 ${_kerberos5_lib_libheimsqlite} \
1482 ${_kerberos5_lib_libheimipcc} \
1483 ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \
1484 ${_kerberos5_lib_libroken} \
1485 ${_kerberos5_lib_libwind} \
1487 lib/libbz2 ${_libcom_err} lib/libcrypt \
1488 lib/libelf lib/libexpat \
1489 ${_lib_libgssapi} ${_lib_libipx} \
1490 lib/libkiconv lib/libkvm lib/liblzma lib/libmd lib/libnv \
1491 ${_lib_libcapsicum} \
1492 lib/ncurses/ncurses lib/ncurses/ncursesw \
1493 lib/libopie lib/libpam ${_lib_libthr} \
1494 lib/libradius lib/libsbuf lib/libtacplus \
1495 ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \
1496 ${_cddl_lib_libzfs_core} \
1497 lib/libutil lib/libpjdlog ${_lib_libypclnt} lib/libz lib/msun \
1498 ${_secure_lib_libcrypto} ${_lib_libldns} \
1499 ${_secure_lib_libssh} ${_secure_lib_libssl}
1501 .if defined(WITH_ATF) || ${MK_TESTS} != "no"
1502 .if !defined(WITH_ATF)
1503 # Ensure that the ATF libraries will be built during make libraries, even
1504 # though they will have -DNO_TESTS
1510 .if ${MK_LIBTHR} != "no"
1511 _lib_libthr= lib/libthr
1514 .if ${MK_OFED} != "no"
1515 _ofed_lib= contrib/ofed/usr.lib/
1518 .if ${MK_CASPER} != "no"
1519 _lib_libcapsicum=lib/libcapsicum
1522 lib/libcapsicum__L: lib/libnv__L
1523 lib/libpjdlog__L: lib/libutil__L
1525 _generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib}
1526 .for _DIR in ${LOCAL_LIB_DIRS}
1527 .if exists(${.CURDIR}/${_DIR}/Makefile)
1528 _generic_libs+= ${_DIR}
1532 lib/libopie__L lib/libtacplus__L: lib/libmd__L
1534 .if ${MK_CDDL} != "no"
1535 _cddl_lib_libumem= cddl/lib/libumem
1536 _cddl_lib_libnvpair= cddl/lib/libnvpair
1537 _cddl_lib_libzfs_core= cddl/lib/libzfs_core
1539 cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L
1542 .if ${MK_CRYPT} != "no"
1543 .if ${MK_OPENSSL} != "no"
1544 _secure_lib_libcrypto= secure/lib/libcrypto
1545 _secure_lib_libssl= secure/lib/libssl
1546 lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L
1547 .if ${MK_LDNS} != "no"
1548 _lib_libldns= lib/libldns
1549 lib/libldns__L: secure/lib/libcrypto__L
1551 .if ${MK_OPENSSH} != "no"
1552 _secure_lib_libssh= secure/lib/libssh
1553 secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
1554 .if ${MK_LDNS} != "no"
1555 secure/lib/libssh__L: lib/libldns__L
1557 .if ${MK_KERBEROS_SUPPORT} != "no"
1558 secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \
1559 kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \
1560 lib/libmd__L kerberos5/lib/libroken__L
1564 _secure_lib= secure/lib
1567 .if ${MK_KERBEROS} != "no"
1568 kerberos5/lib/libasn1__L: lib/libcom_err__L kerberos5/lib/libroken__L
1569 kerberos5/lib/libhdb__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1570 kerberos5/lib/libkrb5__L kerberos5/lib/libroken__L \
1571 kerberos5/lib/libwind__L kerberos5/lib/libheimsqlite__L
1572 kerberos5/lib/libheimntlm__L: secure/lib/libcrypto__L kerberos5/lib/libkrb5__L \
1573 kerberos5/lib/libroken__L lib/libcom_err__L
1574 kerberos5/lib/libhx509__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1575 secure/lib/libcrypto__L kerberos5/lib/libroken__L kerberos5/lib/libwind__L
1576 kerberos5/lib/libkrb5__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1577 lib/libcrypt__L secure/lib/libcrypto__L kerberos5/lib/libhx509__L \
1578 kerberos5/lib/libroken__L kerberos5/lib/libwind__L \
1579 kerberos5/lib/libheimbase__L kerberos5/lib/libheimipcc__L
1580 kerberos5/lib/libroken__L: lib/libcrypt__L
1581 kerberos5/lib/libwind__L: kerberos5/lib/libroken__L lib/libcom_err__L
1582 kerberos5/lib/libheimbase__L: lib/libthr__L
1583 kerberos5/lib/libheimipcc__L: kerberos5/lib/libroken__L kerberos5/lib/libheimbase__L lib/libthr__L
1584 kerberos5/lib/libheimsqlite__L: lib/libthr__L
1587 .if ${MK_GSSAPI} != "no"
1588 _lib_libgssapi= lib/libgssapi
1591 .if ${MK_IPX} != "no"
1592 _lib_libipx= lib/libipx
1595 .if ${MK_KERBEROS} != "no"
1596 _kerberos5_lib= kerberos5/lib
1597 _kerberos5_lib_libasn1= kerberos5/lib/libasn1
1598 _kerberos5_lib_libhdb= kerberos5/lib/libhdb
1599 _kerberos5_lib_libheimbase= kerberos5/lib/libheimbase
1600 _kerberos5_lib_libkrb5= kerberos5/lib/libkrb5
1601 _kerberos5_lib_libhx509= kerberos5/lib/libhx509
1602 _kerberos5_lib_libroken= kerberos5/lib/libroken
1603 _kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm
1604 _kerberos5_lib_libheimsqlite= kerberos5/lib/libheimsqlite
1605 _kerberos5_lib_libheimipcc= kerberos5/lib/libheimipcc
1606 _kerberos5_lib_libwind= kerberos5/lib/libwind
1607 _libcom_err= lib/libcom_err
1610 .if ${MK_NIS} != "no"
1611 _lib_libypclnt= lib/libypclnt
1614 .if ${MK_OPENSSL} == "no"
1615 lib/libradius__L: lib/libmd__L
1618 .for _lib in ${_prereq_libs}
1619 ${_lib}__PL: .PHONY .MAKE
1620 .if exists(${.CURDIR}/${_lib})
1621 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1622 cd ${.CURDIR}/${_lib} && \
1623 ${MAKE} -DNO_TESTS DIRPRFX=${_lib}/ obj && \
1624 ${MAKE} -DNO_TESTS DIRPRFX=${_lib}/ depend && \
1625 ${MAKE} -DNO_TESTS -DNO_PROFILE -DNO_PIC \
1626 DIRPRFX=${_lib}/ all && \
1627 ${MAKE} -DNO_TESTS -DNO_PROFILE -DNO_PIC \
1628 DIRPRFX=${_lib}/ install
1632 .for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
1633 ${_lib}__L: .PHONY .MAKE
1634 .if exists(${.CURDIR}/${_lib})
1635 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1636 cd ${.CURDIR}/${_lib} && \
1637 ${MAKE} -DNO_TESTS DIRPRFX=${_lib}/ obj && \
1638 ${MAKE} -DNO_TESTS DIRPRFX=${_lib}/ depend && \
1639 ${MAKE} -DNO_TESTS DIRPRFX=${_lib}/ all && \
1640 ${MAKE} -DNO_TESTS DIRPRFX=${_lib}/ install
1644 # libpam is special: we need to build static PAM modules before
1645 # static PAM library, and dynamic PAM library before dynamic PAM
1647 lib/libpam__L: .PHONY .MAKE
1648 ${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \
1649 cd ${.CURDIR}/lib/libpam && \
1650 ${MAKE} -DNO_TESTS DIRPRFX=lib/libpam/ obj && \
1651 ${MAKE} -DNO_TESTS DIRPRFX=lib/libpam/ depend && \
1652 ${MAKE} -DNO_TESTS DIRPRFX=lib/libpam/ \
1653 -D_NO_LIBPAM_SO_YET all && \
1654 ${MAKE} -DNO_TESTS DIRPRFX=lib/libpam/ \
1655 -D_NO_LIBPAM_SO_YET install
1657 _prereq_libs: ${_prereq_libs:S/$/__PL/}
1658 _startup_libs: ${_startup_libs:S/$/__L/}
1659 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
1660 _generic_libs: ${_generic_libs:S/$/__L/}
1662 .for __target in all clean cleandepend cleandir depend includes obj
1663 .for entry in ${SUBDIR}
1664 ${entry}.${__target}__D: .PHONY .MAKE
1665 ${_+_}@set -e; if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
1666 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \
1667 edir=${entry}.${MACHINE_ARCH}; \
1668 cd ${.CURDIR}/$${edir}; \
1670 ${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \
1672 cd ${.CURDIR}/$${edir}; \
1674 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
1676 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
1679 .include <bsd.subdir.mk>
1681 .if make(check-old) || make(check-old-dirs) || \
1682 make(check-old-files) || make(check-old-libs) || \
1683 make(delete-old) || make(delete-old-dirs) || \
1684 make(delete-old-files) || make(delete-old-libs)
1687 # check for / delete old files section
1690 .include "ObsoleteFiles.inc"
1692 OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \
1693 else you can not start such an application. Consult UPDATING for more \
1694 information regarding how to cope with the removal/revision bump of a \
1697 .if !defined(BATCH_DELETE_OLD_FILES)
1704 @echo ">>> Removing old files (only deletes safe to delete libs)"
1705 # Ask for every old file if the user really wants to remove it.
1706 # It's annoying, but better safe than sorry.
1707 # NB: We cannot pass the list of OLD_FILES as a parameter because the
1708 # argument list will get too long. Using .for/.endfor make "loops" will make
1709 # the Makefile parser segfault.
1712 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1713 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1714 while read file; do \
1715 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1716 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1717 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1720 # Remove catpages without corresponding manpages.
1722 find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1723 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1724 while read catpage; do \
1726 if [ ! -e "$${manpage}" ]; then \
1727 rm ${RM_I} $${catpage} <&3; \
1730 @echo ">>> Old files removed"
1733 @echo ">>> Checking for old files"
1735 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1736 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1737 while read file; do \
1738 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1739 echo "${DESTDIR}/$${file}"; \
1742 # Check for catpages without corresponding manpages.
1743 @find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1744 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1745 while read catpage; do \
1747 if [ ! -e "$${manpage}" ]; then \
1753 @echo ">>> Removing old libraries"
1754 @echo "${OLD_LIBS_MESSAGE}" | fmt
1757 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1758 -V OLD_LIBS | xargs -n1 | \
1759 while read file; do \
1760 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1761 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1762 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1764 for ext in debug symbols; do \
1765 if ! [ -e "${DESTDIR}/$${file}" ] && [ -f \
1766 "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \
1767 rm ${RM_I} "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" \
1772 @echo ">>> Old libraries removed"
1775 @echo ">>> Checking for old libraries"
1777 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1778 -V OLD_LIBS | xargs -n1 | \
1779 while read file; do \
1780 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1781 echo "${DESTDIR}/$${file}"; \
1783 for ext in debug symbols; do \
1784 if [ -f "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \
1785 echo "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}"; \
1791 @echo ">>> Removing old directories"
1793 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1794 -V OLD_DIRS | xargs -n1 | sort -r | \
1795 while read dir; do \
1796 if [ -d "${DESTDIR}/$${dir}" ]; then \
1797 rmdir -v "${DESTDIR}/$${dir}" || true; \
1798 elif [ -L "${DESTDIR}/$${dir}" ]; then \
1799 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1802 @echo ">>> Old directories removed"
1805 @echo ">>> Checking for old directories"
1807 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1808 -V OLD_DIRS | xargs -n1 | \
1809 while read dir; do \
1810 if [ -d "${DESTDIR}/$${dir}" ]; then \
1811 echo "${DESTDIR}/$${dir}"; \
1812 elif [ -L "${DESTDIR}/$${dir}" ]; then \
1813 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1817 delete-old: delete-old-files delete-old-dirs
1818 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1820 check-old: check-old-files check-old-libs check-old-dirs
1821 @echo "To remove old files and directories run '${MAKE} delete-old'."
1822 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1827 # showconfig - show build configuration.
1830 @${MAKE} -n -f bsd.own.mk -V dummy -dg1 2>&1 | grep ^MK_ | sort
1832 .if !empty(KRNLOBJDIR) && !empty(KERNCONF)
1833 DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/
1835 .if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE)
1836 .if exists(${KERNCONFDIR}/${KERNCONF})
1837 FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \
1838 ${KERNCONFDIR}/${KERNCONF} ; echo
1844 .if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH})
1845 DTBOUTPUTPATH= ${.CURDIR}
1849 # Build 'standalone' Device Tree Blob
1852 @if [ "${FDT_DTS_FILE}" = "" ]; then \
1853 echo "ERROR: FDT_DTS_FILE must be specified!"; \
1856 if [ ! -f ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE} ]; then \
1857 echo "ERROR: Specified DTS file (${FDT_DTS_FILE}) does not \
1861 if [ "${DTBOUTPUTPATH}" = "${.CURDIR}" ]; then \
1862 echo "WARNING: DTB will be placed in the current working \
1867 ${DTBOUTPUTPATH}/`echo ${FDT_DTS_FILE} | cut -d. -f1`.dtb -b 0 \
1868 -p 1024 ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE}
1872 .if defined(XDEV) && defined(XDEV_ARCH)
1874 .if ${XDEV} == ${MACHINE} && ${XDEV_ARCH} == ${MACHINE_ARCH}
1875 XDEV_CPUTYPE?=${CPUTYPE}
1877 XDEV_CPUTYPE?=${TARGET_CPUTYPE}
1880 NOFUN=-DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
1881 -DWITHOUT_MAN -DWITHOUT_NLS -DNO_PROFILE \
1882 -DWITHOUT_KERBEROS -DWITHOUT_RESCUE -DNO_TESTS -DNO_WARNS \
1883 TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH} \
1884 CPUTYPE=${XDEV_CPUTYPE}
1886 XDDIR=${XDEV_ARCH}-freebsd
1888 CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \
1889 INSTALL="sh ${.CURDIR}/tools/install.sh"
1891 _SHLIBDIRPREFIX=${XDDESTDIR} \
1892 TOOLS_PREFIX=${XDDESTDIR}
1893 CD2CFLAGS=-isystem ${XDDESTDIR}/usr/include -L${XDDESTDIR}/usr/lib \
1894 -B${XDDESTDIR}/usr/lib
1895 CD2ENV=${CDENV} CC="${CC} ${CD2CFLAGS}" \
1896 MACHINE=${XDEV} MACHINE_ARCH=${XDEV_ARCH}
1898 CDTMP= ${MAKEOBJDIRPREFIX}/${XDDIR}/${.CURDIR}/tmp
1899 CDMAKE=${CDENV} PATH=${CDTMP}/usr/bin:${PATH} ${MAKE} ${NOFUN}
1900 CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDDESTDIR}/usr/bin:${PATH} ${MAKE} ${NOFUN}
1901 XDDESTDIR=${DESTDIR}/${XDTP}
1903 OSREL!= uname -r | sed -e 's/[-(].*//'
1906 .ORDER: xdev-build xdev-install
1907 xdev: xdev-build xdev-install
1909 .ORDER: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools
1910 xdev-build: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools
1913 mkdir -p ${CDTMP}/usr
1914 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1915 -p ${CDTMP}/usr >/dev/null
1917 _xb-bootstrap-tools:
1920 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1921 cd ${.CURDIR}/${_tool} && \
1922 ${CDMAKE} DIRPRFX=${_tool}/ obj && \
1923 ${CDMAKE} DIRPRFX=${_tool}/ depend && \
1924 ${CDMAKE} DIRPRFX=${_tool}/ all && \
1925 ${CDMAKE} DIRPRFX=${_tool}/ DESTDIR=${CDTMP} install
1929 ${_+_}@cd ${.CURDIR}; \
1930 ${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools
1934 gnu/usr.bin/binutils \
1939 ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \
1940 cd ${.CURDIR}/${_tool} && \
1941 ${CDMAKE} DIRPRFX=${_tool}/ obj && \
1942 ${CDMAKE} DIRPRFX=${_tool}/ depend && \
1943 ${CDMAKE} DIRPRFX=${_tool}/ all
1947 ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}"
1948 mkdir -p ${XDDESTDIR}
1949 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
1950 -p ${XDDESTDIR} >/dev/null
1951 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1952 -p ${XDDESTDIR}/usr >/dev/null
1953 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
1954 -p ${XDDESTDIR}/usr/include >/dev/null
1956 .ORDER: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
1957 xdev-install: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
1960 @echo "_xi-cross-tools"
1962 gnu/usr.bin/binutils \
1966 ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \
1967 cd ${.CURDIR}/${_tool}; \
1968 ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR}
1972 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 par-includes \
1973 DESTDIR=${XDDESTDIR}
1976 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \
1977 DESTDIR=${XDDESTDIR}
1980 ${_+_}cd ${XDDESTDIR}/usr/bin; \
1981 mkdir -p ../../../../usr/bin; \
1983 ln -sf ../../${XDTP}/usr/bin/$$i \
1984 ../../../../usr/bin/${XDDIR}-$$i; \
1985 ln -sf ../../${XDTP}/usr/bin/$$i \
1986 ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \
1989 xdev xdev-build xdev-install:
1990 @echo "*** Error: Both XDEV and XDEV_ARCH must be defined for \"${.TARGET}\" target"
1993 buildkernel ${WMAKE_TGTS} ${.ALLTARGETS:M_*}: .MAKE