4 # Make command line options:
5 # -DNO_CLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
6 # -DNO_CLEAN do not clean at all
7 # -DDB_FROM_SRC use the user/group databases in src/etc instead of
8 # the system database when installing.
9 # -DNO_SHARE do not go into share subdir
10 # -DKERNFAST define NO_KERNEL{CONFIG,CLEAN,DEPEND,OBJ}
11 # -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel
12 # -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel
13 # -DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel
14 # -DNO_KERNELOBJ do not run ${MAKE} obj in ${MAKE} buildkernel
15 # -DNO_PORTSUPDATE do not update ports in ${MAKE} update
16 # -DNO_ROOT install without using root privilege
17 # -DNO_DOCUPDATE do not update doc in ${MAKE} update
18 # -DWITHOUT_CTF do not run the DTrace CTF conversion tools on built objects
19 # LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
20 # LOCAL_ITOOLS="list of tools" to add additional tools to the ITOOLS list
21 # LOCAL_LIB_DIRS="list of dirs" to add additional dirs to libraries target
22 # LOCAL_MTREE="list of mtree files" to process to allow local directories
23 # to be created before files are installed
24 # LOCAL_TOOL_DIRS="list of dirs" to add additional dirs to the build-tools
26 # METALOG="path to metadata log" to write permission and ownership
27 # when NO_ROOT is set. (default: ${DESTDIR}/METALOG)
28 # TARGET="machine" to crossbuild world for a different machine type
29 # TARGET_ARCH= may be required when a TARGET supports multiple endians
30 # BUILDENV_SHELL= shell to launch for the buildenv target (def:/bin/sh)
31 # WORLD_FLAGS= additional flags to pass to make(1) during buildworld
32 # KERNEL_FLAGS= additional flags to pass to make(1) during buildkernel
35 # The intended user-driven targets are:
36 # buildworld - rebuild *everything*, including glue to help do upgrades
37 # installworld- install everything built by "buildworld"
38 # doxygen - build API documentation of the kernel
39 # update - convenient way to update your source tree (eg: svn/svnup)
41 # Standard targets (not defined here) are documented in the makefiles in
42 # /usr/share/mk. These include:
43 # obj depend all install clean cleandepend cleanobj
45 .if !defined(TARGET) || !defined(TARGET_ARCH)
46 .error "Both TARGET and TARGET_ARCH must be defined."
49 .include "share/mk/src.opts.mk"
50 .include <bsd.arch.inc.mk>
51 .include <bsd.compiler.mk>
53 # We must do share/info early so that installation of info `dir'
54 # entries works correctly. Do it first since it is less likely to
55 # grow dependencies on include and lib than vice versa.
57 # We must do lib/ and libexec/ before bin/, because if installworld
58 # installs a new /bin/sh, the 'make' command will *immediately*
59 # use that new version. And the new (dynamically-linked) /bin/sh
60 # will expect to find appropriate libraries in /lib and /libexec.
63 .if defined(SUBDIR_OVERRIDE)
64 SUBDIR= ${SUBDIR_OVERRIDE}
66 SUBDIR= share/info lib libexec
68 .if ${MK_GAMES} != "no"
71 .if ${MK_CDDL} != "no"
75 .if ${MK_KERBEROS} != "no"
78 .if ${MK_RESCUE} != "no"
82 .if ${MK_CRYPT} != "no"
85 .if !defined(NO_SHARE)
88 SUBDIR+=sys usr.bin usr.sbin
89 .if ${MK_TESTS} != "no"
92 .if ${MK_OFED} != "no"
96 # We must do etc/ last for install/distribute to work.
100 # These are last, since it is nice to at least get the base system
101 # rebuilt before you do them.
102 .for _DIR in ${LOCAL_LIB_DIRS} ${LOCAL_DIRS}
103 .if exists(${.CURDIR}/${_DIR}/Makefile)
112 .if defined(NO_CLEANDIR)
113 CLEANDIR= clean cleandepend
120 BUILDENV_SHELL?=/bin/sh
122 SVN?= /usr/local/bin/svn
125 MAKEOBJDIRPREFIX?= /usr/obj
126 .if !defined(OSRELDATE)
127 .if exists(/usr/include/osreldate.h)
128 OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
129 /usr/include/osreldate.h
135 .if !defined(VERSION)
136 REVISION!= ${MAKE} -C ${SRCDIR}/release -V REVISION
137 BRANCH!= ${MAKE} -C ${SRCDIR}/release -V BRANCH
138 SRCRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
139 ${SRCDIR}/sys/sys/param.h
140 VERSION= FreeBSD ${REVISION}-${BRANCH:C/-p[0-9]+$//} ${TARGET_ARCH} ${SRCRELDATE}
143 KNOWN_ARCHES?= amd64 arm armeb/arm armv6/arm armv6hf/arm i386 i386/pc98 mips mipsel/mips mips64el/mips mips64/mips mipsn32el/mips mipsn32/mips powerpc powerpc64/powerpc sparc64
144 .if ${TARGET} == ${TARGET_ARCH}
147 _t= ${TARGET_ARCH}/${TARGET}
150 .if empty(KNOWN_ARCHES:M${_t})
151 .error Unknown target ${TARGET_ARCH}:${TARGET}.
155 .if ${TARGET} == ${MACHINE}
156 TARGET_CPUTYPE?=${CPUTYPE}
161 .if !empty(TARGET_CPUTYPE)
162 _TARGET_CPUTYPE=${TARGET_CPUTYPE}
164 _TARGET_CPUTYPE=dummy
166 _CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} \
167 -f /dev/null -m ${.CURDIR}/share/mk -V CPUTYPE
168 .if ${_CPUTYPE} != ${_TARGET_CPUTYPE}
169 .error CPUTYPE global should be set with ?=.
172 BUILD_ARCH!= uname -p
173 .if ${MACHINE_ARCH} != ${BUILD_ARCH}
174 .error To cross-build, set TARGET_ARCH.
177 .if ${MACHINE} == ${TARGET} && ${MACHINE_ARCH} == ${TARGET_ARCH} && !defined(CROSS_BUILD_TESTING)
178 OBJTREE= ${MAKEOBJDIRPREFIX}
180 OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH}
182 WORLDTMP= ${OBJTREE}${.CURDIR}/tmp
183 # /usr/games added for fortune which depend on strfile
184 BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games:${WORLDTMP}/legacy/bin
185 XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
186 STRICTTMPPATH= ${BPATH}:${XPATH}
187 TMPPATH= ${STRICTTMPPATH}:${PATH}
190 # Avoid running mktemp(1) unless actually needed.
191 # It may not be functional, e.g., due to new ABI
192 # when in the middle of installing over this system.
194 .if make(distributeworld) || make(installworld)
195 INSTALLTMP!= /usr/bin/mktemp -d -u -t install
199 # Building a world goes through the following stages
201 # 1. legacy stage [BMAKE]
202 # This stage is responsible for creating compatibility
203 # shims that are needed by the bootstrap-tools,
204 # build-tools and cross-tools stages.
205 # 1. bootstrap-tools stage [BMAKE]
206 # This stage is responsible for creating programs that
207 # are needed for backward compatibility reasons. They
208 # are not built as cross-tools.
209 # 2. build-tools stage [TMAKE]
210 # This stage is responsible for creating the object
211 # tree and building any tools that are needed during
213 # 3. cross-tools stage [XMAKE]
214 # This stage is responsible for creating any tools that
215 # are needed for cross-builds. A cross-compiler is one
217 # 4. world stage [WMAKE]
218 # This stage actually builds the world.
219 # 5. install stage (optional) [IMAKE]
220 # This stage installs a previously built world.
225 # Common environment for world related stages
226 CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \
227 MACHINE_ARCH=${TARGET_ARCH} \
229 CPUTYPE=${TARGET_CPUTYPE}
230 .if ${MK_GROFF} != "no"
231 CROSSENV+= GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
232 GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \
233 GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac
235 .if defined(TARGET_CFLAGS)
236 CROSSENV+= ${TARGET_CFLAGS}
239 # bootstrap-tools stage
240 BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
241 PATH=${BPATH}:${PATH} \
242 WORLDTMP=${WORLDTMP} \
243 VERSION="${VERSION}" \
244 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}"
245 BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
246 ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
248 BOOTSTRAPPING=${OSRELDATE} \
250 MK_HTML=no MK_INFO=no NO_LINT=yes MK_MAN=no \
251 -DNO_PIC MK_PROFILE=no -DNO_SHARED \
252 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
253 MK_CLANG_FULL=no MK_LLDB=no MK_TESTS=no
256 TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
257 ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
258 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
260 BOOTSTRAPPING=${OSRELDATE} \
263 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no MK_CLANG_FULL=no MK_LLDB=no MK_TESTS=no
266 XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \
267 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
268 MK_GDB=no MK_TESTS=no
271 KTMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
272 PATH=${BPATH}:${PATH} \
273 WORLDTMP=${WORLDTMP} \
275 KTMAKE= TOOLS_PREFIX=${WORLDTMP} MAKEOBJDIRPREFIX=${WORLDTMP} \
276 ${KTMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
278 BOOTSTRAPPING=${OSRELDATE} \
280 MK_HTML=no MK_INFO=no -DNO_LINT MK_MAN=no \
281 -DNO_PIC MK_PROFILE=no -DNO_SHARED \
282 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no
285 WMAKEENV= ${CROSSENV} \
286 _SHLIBDIRPREFIX=${WORLDTMP} \
288 VERSION="${VERSION}" \
289 INSTALL="sh ${.CURDIR}/tools/install.sh" \
293 HMAKE= PATH=${TMPPATH} ${MAKE} LOCAL_MTREE=${LOCAL_MTREE:Q}
295 HMAKE+= PATH=${TMPPATH} METALOG=${METALOG} -DNO_ROOT
298 .if ${MK_CDDL} == "no"
302 .if defined(CROSS_TOOLCHAIN)
303 LOCALBASE?= /usr/local
304 .include "${LOCALBASE}/share/toolchains/${CROSS_TOOLCHAIN}.mk"
306 .if defined(CROSS_TOOLCHAIN_PREFIX)
307 CROSS_COMPILER_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
308 CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
310 XCOMPILERS= CC CXX CPP
311 .for COMPILER in ${XCOMPILERS}
312 .if defined(CROSS_COMPILER_PREFIX)
313 X${COMPILER}?= ${CROSS_COMPILER_PREFIX}${${COMPILER}}
315 X${COMPILER}?= ${${COMPILER}}
318 XBINUTILS= AS AR LD NM OBJCOPY OBJDUMP RANLIB STRINGS
319 .for BINUTIL in ${XBINUTILS}
320 .if defined(CROSS_BINUTILS_PREFIX)
321 X${BINUTIL}?= ${CROSS_BINUTILS_PREFIX}${${BINUTIL}}
323 X${BINUTIL}?= ${${BINUTIL}}
326 WMAKEENV+= CC="${XCC} ${XFLAGS}" CXX="${XCXX} ${XFLAGS}" \
327 CPP="${XCPP} ${XFLAGS}" \
328 AS="${XAS}" AR="${XAR}" LD="${XLD}" NM=${XNM} \
329 OBJDUMP=${XOBJDUMP} OBJCOPY="${OBJCOPY}" \
330 RANLIB=${XRANLIB} STRINGS=${XSTRINGS}
333 XFLAGS= --sysroot=${WORLDTMP}
334 .if defined(CROSS_BINUTILS_PREFIX)
335 # In the case of xdev-build tools, CROSS_BINUTILS_PREFIX won't be a
336 # directory, but the compiler will look in the right place for it's
337 # tools so we don't need to tell it where to look.
338 .if exists(${CROSS_BINUTILS_PREFIX})
339 XFLAGS+= -B${CROSS_BINUTILS_PREFIX}
342 XFLAGS+= -B${WORLDTMP}/usr/bin
344 .if ${TARGET} == "arm"
345 .if ${TARGET_ARCH:M*hf*} != ""
346 TARGET_ABI= gnueabihf
351 .if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc
352 XFLAGS+= -isystem ${WORLDTMP}/usr/include -L${WORLDTMP}/usr/lib
355 TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0
356 XFLAGS+= -target ${TARGET_TRIPLE}
360 WMAKE= ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 DESTDIR=${WORLDTMP}
362 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
364 LIB32_OBJTREE= ${OBJTREE}${.CURDIR}/world32
365 LIB32TMP= ${OBJTREE}${.CURDIR}/lib32
367 .if ${TARGET_ARCH} == "amd64"
368 .if empty(TARGET_CPUTYPE)
369 LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2
371 LIB32CPUFLAGS= -march=${TARGET_CPUTYPE}
373 LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \
374 MACHINE_CPU="i686 mmx sse sse2"
377 LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32"
379 .elif ${TARGET_ARCH} == "powerpc64"
380 .if empty(TARGET_CPUTYPE)
381 LIB32CPUFLAGS= -mcpu=powerpc
383 LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE}
385 LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc
387 LD="${LD} -m elf32ppc_fbsd"
391 LIB32FLAGS= -m32 ${LIB32CPUFLAGS} -DCOMPAT_32BIT \
392 -isystem ${LIB32TMP}/usr/include/ \
393 -L${LIB32TMP}/usr/lib32 \
394 -B${LIB32TMP}/usr/lib32
396 LIB32FLAGS+= --sysroot=${WORLDTMP}
399 # Yes, the flags are redundant.
400 LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${LIB32_OBJTREE} \
401 _SHLIBDIRPREFIX=${LIB32TMP} \
402 _LDSCRIPTROOT=${LIB32TMP} \
403 VERSION="${VERSION}" \
404 INSTALL="sh ${.CURDIR}/tools/install.sh" \
407 SHLIBDIR=/usr/lib32 \
408 LIBPRIVATEDIR=/usr/lib32/private \
409 DTRACE="${DTRACE} -32"
410 LIB32WMAKEFLAGS+= CC="${XCC} ${LIB32FLAGS}" \
411 CXX="${XCXX} ${LIB32FLAGS}" \
412 DESTDIR=${LIB32TMP} \
420 LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} ${LIB32WMAKEFLAGS} \
421 MK_MAN=no MK_INFO=no MK_HTML=no
422 LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} \
423 MK_TOOLCHAIN=no ${IMAKE_INSTALL}
426 IMAKEENV= ${CROSSENV:N_LDSCRIPTROOT=*}
427 IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 \
428 ${IMAKE_INSTALL} ${IMAKE_MTREE}
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 MK_HTML=no MK_INFO=no -DNO_LINT MK_MAN=no \
573 MK_PROFILE=no MK_TESTS=no 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=${LIB32_OBJTREE} ${MAKE} SSP_CFLAGS= DESTDIR= \
625 DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
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} \
777 # Distributes everything compiled by a `buildworld'.
781 # Installs everything compiled by a 'buildworld'.
784 # Non-base distributions produced by the base system
785 EXTRA_DISTRIBUTIONS= doc
786 .if ${MK_GAMES} != "no"
787 EXTRA_DISTRIBUTIONS+= games
789 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
790 EXTRA_DISTRIBUTIONS+= lib32
792 .if ${MK_TESTS} != "no"
793 EXTRA_DISTRIBUTIONS+= tests
797 .if ${MK_DEBUG_FILES} != "no"
798 DEBUG_DISTRIBUTIONS+= base ${EXTRA_DISTRIBUTIONS:S,doc,,}
801 MTREE_MAGIC?= mtree 2.0
803 distributeworld installworld: _installcheck_world
804 mkdir -p ${INSTALLTMP}
805 progs=$$(for prog in ${ITOOLS}; do \
806 if progpath=`which $$prog`; then \
809 echo "Required tool $$prog not found in PATH." >&2; \
813 libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | \
814 while read line; do \
816 if [ "$$2 $$3" != "not found" ]; then \
819 echo "Required library $$1 not found." >&2; \
823 cp $$libs $$progs ${INSTALLTMP}
824 cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale
826 echo "#${MTREE_MAGIC}" > ${METALOG}
828 .if make(distributeworld)
829 .for dist in ${EXTRA_DISTRIBUTIONS}
830 -mkdir ${DESTDIR}/${DISTDIR}/${dist}
831 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
832 -p ${DESTDIR}/${DISTDIR}/${dist} >/dev/null
833 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
834 -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null
835 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
836 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/include >/dev/null
837 .if ${MK_DEBUG_FILES} != "no"
838 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
839 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib >/dev/null
841 .if ${MK_TESTS} != "no" && ${dist} == "tests"
842 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
843 -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null
846 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \
847 sed -e 's#^\./#./${dist}/#' >> ${METALOG}
848 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.usr.dist | \
849 sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG}
850 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.include.dist | \
851 sed -e 's#^\./#./${dist}/usr/include/#' >> ${METALOG}
854 -mkdir ${DESTDIR}/${DISTDIR}/base
855 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
856 METALOG=${METALOG} ${IMAKE_INSTALL} ${IMAKE_MTREE} \
857 DISTBASE=/base DESTDIR=${DESTDIR}/${DISTDIR}/base \
858 LOCAL_MTREE=${LOCAL_MTREE:Q} distrib-dirs
860 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \
861 ${IMAKEENV} rm -rf ${INSTALLTMP}
862 .if make(distributeworld)
863 .for dist in ${EXTRA_DISTRIBUTIONS}
864 find ${DESTDIR}/${DISTDIR}/${dist} -mindepth 1 -empty -delete
867 .for dist in base ${EXTRA_DISTRIBUTIONS}
868 @# For each file that exists in this dist, print the corresponding
869 @# line from the METALOG. This relies on the fact that
870 @# a line containing only the filename will sort immediatly before
871 @# the relevant mtree line.
872 cd ${DESTDIR}/${DISTDIR}; \
873 find ./${dist} | sort -u ${METALOG} - | \
874 awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \
875 ${DESTDIR}/${DISTDIR}/${dist}.meta
877 .for dist in ${DEBUG_DISTRIBUTIONS}
878 @# For each file that exists in this dist, print the corresponding
879 @# line from the METALOG. This relies on the fact that
880 @# a line containing only the filename will sort immediatly before
881 @# the relevant mtree line.
882 cd ${DESTDIR}/${DISTDIR}; \
883 find ./${dist}/usr/lib/debug | sort -u ${METALOG} - | \
884 awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \
885 ${DESTDIR}/${DISTDIR}/${dist}.debug.meta
891 .for dist in base ${EXTRA_DISTRIBUTIONS}
893 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
894 tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz \
895 --exclude usr/lib/debug \
896 @${DESTDIR}/${DISTDIR}/${dist}.meta
898 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
899 tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz \
900 --exclude usr/lib/debug .
904 .for dist in ${DEBUG_DISTRIBUTIONS}
905 . if defined(NO_ROOT)
906 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
907 tar cvJf ${DESTDIR}/${DISTDIR}/${dist}-dbg.txz \
908 @${DESTDIR}/${DISTDIR}/${dist}.debug.meta
910 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
911 tar cvJfL ${DESTDIR}/${DISTDIR}/${dist}-dbg.txz \
919 # If you have a build server, you can NFS mount the source and obj directories
920 # and do a 'make reinstall' on the *client* to install new binaries from the
921 # most recent server build.
924 @echo "--------------------------------------------------------------"
925 @echo ">>> Making hierarchy"
926 @echo "--------------------------------------------------------------"
927 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 \
928 LOCAL_MTREE=${LOCAL_MTREE:Q} hierarchy
930 @echo "--------------------------------------------------------------"
931 @echo ">>> Installing everything"
932 @echo "--------------------------------------------------------------"
933 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
934 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
935 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32
939 @echo "--------------------------------------------------------------"
940 @echo ">>> Distributing everything"
941 @echo "--------------------------------------------------------------"
942 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
943 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
944 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 \
948 distrib-dirs distribution: .MAKE
949 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
950 ${IMAKE_INSTALL} ${IMAKE_MTREE} METALOG=${METALOG} ${.TARGET}
953 # buildkernel and installkernel
955 # Which kernels to build and/or install is specified by setting
956 # KERNCONF. If not defined a GENERIC kernel is built/installed.
957 # Only the existing (depending TARGET) config files are used
958 # for building kernels and only the first of these is designated
959 # as the one being installed.
961 # Note that we have to use TARGET instead of TARGET_ARCH when
962 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
963 # be set to cross-build, we have to make sure TARGET is set
966 .if defined(KERNFAST)
971 # Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah
972 .if !defined(KERNCONF) && ${KERNFAST} != "1"
976 .if ${TARGET_ARCH} == "powerpc64"
981 INSTKERNNAME?= kernel
983 KERNSRCDIR?= ${.CURDIR}/sys
984 KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf
985 KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR}
986 KERNCONFDIR?= ${KRNLCONFDIR}
990 .for _kernel in ${KERNCONF}
991 .if exists(${KERNCONFDIR}/${_kernel})
992 BUILDKERNELS+= ${_kernel}
993 .if empty(INSTALLKERNEL)
994 INSTALLKERNEL= ${_kernel}
999 buildkernel ${WMAKE_TGTS} ${.ALLTARGETS:M_*}: .MAKE
1004 # Builds all kernels defined by BUILDKERNELS.
1007 .if empty(BUILDKERNELS)
1008 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \
1012 .for _kernel in ${BUILDKERNELS}
1013 @echo "--------------------------------------------------------------"
1014 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
1015 @echo "--------------------------------------------------------------"
1016 @echo "===> ${_kernel}"
1017 mkdir -p ${KRNLOBJDIR}
1018 .if !defined(NO_KERNELCONFIG)
1020 @echo "--------------------------------------------------------------"
1021 @echo ">>> stage 1: configuring the kernel"
1022 @echo "--------------------------------------------------------------"
1023 cd ${KRNLCONFDIR}; \
1025 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
1026 -I '${KERNCONFDIR}' '${KERNCONFDIR}/${_kernel}'
1028 .if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN)
1030 @echo "--------------------------------------------------------------"
1031 @echo ">>> stage 2.1: cleaning up the object tree"
1032 @echo "--------------------------------------------------------------"
1033 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR}
1035 .if !defined(NO_KERNELOBJ)
1037 @echo "--------------------------------------------------------------"
1038 @echo ">>> stage 2.2: rebuilding the object tree"
1039 @echo "--------------------------------------------------------------"
1040 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj
1043 @echo "--------------------------------------------------------------"
1044 @echo ">>> stage 2.3: build tools"
1045 @echo "--------------------------------------------------------------"
1046 ${_+_}cd ${.CURDIR}; ${KTMAKE} kernel-tools
1047 .if !defined(NO_KERNELDEPEND)
1049 @echo "--------------------------------------------------------------"
1050 @echo ">>> stage 3.1: making dependencies"
1051 @echo "--------------------------------------------------------------"
1052 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ
1055 @echo "--------------------------------------------------------------"
1056 @echo ">>> stage 3.2: building everything"
1057 @echo "--------------------------------------------------------------"
1058 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ
1059 @echo "--------------------------------------------------------------"
1060 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
1061 @echo "--------------------------------------------------------------"
1065 # installkernel, etc.
1067 # Install the kernel defined by INSTALLKERNEL
1069 installkernel installkernel.debug \
1070 reinstallkernel reinstallkernel.debug: _installcheck_kernel
1071 .if empty(INSTALLKERNEL)
1072 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
1075 @echo "--------------------------------------------------------------"
1076 @echo ">>> Installing kernel ${INSTALLKERNEL}"
1077 @echo "--------------------------------------------------------------"
1078 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
1079 ${CROSSENV} PATH=${TMPPATH} \
1080 ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
1082 distributekernel distributekernel.debug:
1083 .if empty(INSTALLKERNEL)
1084 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
1087 mkdir -p ${DESTDIR}/${DISTDIR}
1088 .if defined(NO_ROOT)
1089 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.premeta
1091 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
1092 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.premeta/} \
1093 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} KERNEL=${INSTKERNNAME} \
1094 DESTDIR=${INSTALL_DDIR}/kernel \
1095 ${.TARGET:S/distributekernel/install/}
1096 .if defined(NO_ROOT)
1097 sed -e 's|^./kernel|.|' ${DESTDIR}/${DISTDIR}/kernel.premeta > \
1098 ${DESTDIR}/${DISTDIR}/kernel.meta
1100 .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
1101 .if defined(NO_ROOT)
1102 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta
1104 cd ${KRNLOBJDIR}/${_kernel}; \
1105 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.${_kernel}.premeta/} \
1106 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} \
1107 KERNEL=${INSTKERNNAME}.${_kernel} \
1108 DESTDIR=${INSTALL_DDIR}/kernel.${_kernel} \
1109 ${.TARGET:S/distributekernel/install/}
1110 .if defined(NO_ROOT)
1111 sed -e 's|^./kernel|.|' \
1112 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta > \
1113 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta
1118 .if defined(NO_ROOT)
1119 cd ${DESTDIR}/${DISTDIR}/kernel; \
1120 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz \
1121 @${DESTDIR}/${DISTDIR}/kernel.meta
1122 .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
1123 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
1124 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz \
1125 @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta
1128 cd ${DESTDIR}/${DISTDIR}/kernel; \
1129 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz .
1130 .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
1131 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
1132 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz .
1139 # Build the API documentation with doxygen
1142 @if [ ! -x `/usr/bin/which doxygen` ]; then \
1143 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \
1146 cd ${.CURDIR}/tools/kerneldoc/subsys && ${MAKE} obj all
1151 # Update the source tree(s), by running svn/svnup to update to the
1155 .if (defined(CVS_UPDATE) || defined(SUP_UPDATE)) && !defined(SVN_UPDATE)
1156 @echo "--------------------------------------------------------------"
1157 @echo "CVS_UPDATE and SUP_UPDATE are no longer supported."
1158 @echo "Please see: https://wiki.freebsd.org/CvsIsDeprecated"
1159 @echo "--------------------------------------------------------------"
1162 .if defined(SVN_UPDATE)
1163 @echo "--------------------------------------------------------------"
1164 @echo ">>> Updating ${.CURDIR} using Subversion"
1165 @echo "--------------------------------------------------------------"
1166 @(cd ${.CURDIR} && ${SVN} update ${SVNFLAGS})
1170 # ------------------------------------------------------------------------
1172 # From here onwards are utility targets used by the 'make world' and
1173 # related targets. If your 'world' breaks, you may like to try to fix
1174 # the problem and manually run the following targets to attempt to
1175 # complete the build. Beware, this is *not* guaranteed to work, you
1176 # need to have a pretty good grip on the current state of the system
1177 # to attempt to manually finish it. If in doubt, 'make world' again.
1181 # legacy: Build compatibility shims for the next three targets
1184 .if ${BOOTSTRAPPING} < 800107 && ${BOOTSTRAPPING} != 0
1185 @echo "ERROR: Source upgrades from versions prior to 8.0 not supported."; \
1188 .for _tool in tools/build
1189 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \
1190 cd ${.CURDIR}/${_tool} && \
1191 ${MAKE} DIRPRFX=${_tool}/ obj && \
1192 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes && \
1193 ${MAKE} DIRPRFX=${_tool}/ depend && \
1194 ${MAKE} DIRPRFX=${_tool}/ all && \
1195 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
1199 # bootstrap-tools: Build tools needed for compatibility
1201 .if ${MK_GAMES} != "no"
1202 _strfile= games/fortune/strfile
1205 .if ${MK_CXX} != "no"
1206 _gperf= gnu/usr.bin/gperf
1209 .if ${MK_GROFF} != "no"
1210 _groff= gnu/usr.bin/groff
1213 .if ${MK_VT} != "no"
1214 _vtfontcvt= usr.bin/vtfontcvt
1217 .if ${BOOTSTRAPPING} < 900002
1221 .if ${BOOTSTRAPPING} < 1000002
1226 .if ${BOOTSTRAPPING} < 1000013
1231 .if ${BOOTSTRAPPING} < 1000014
1232 _crunch= usr.sbin/crunch
1235 .if ${BOOTSTRAPPING} < 1000026
1236 _nmtree= lib/libnetbsd \
1240 .if ${BOOTSTRAPPING} < 1000027
1244 .if ${BOOTSTRAPPING} < 1000033
1248 .if ${BOOTSTRAPPING} >= 900040 && ${BOOTSTRAPPING} < 900041
1252 .if ${MK_BSNMP} != "no"
1253 _gensnmptree= usr.sbin/bsnmpd/gensnmptree
1256 # We need to build tblgen when we're building clang either as
1257 # the bootstrap compiler, or as the part of the normal build.
1258 .if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_CLANG} != "no"
1260 lib/clang/libllvmsupport \
1261 lib/clang/libllvmtablegen \
1262 usr.bin/clang/tblgen \
1263 usr.bin/clang/clang-tblgen
1266 # dtrace tools are required for older bootstrap env and cross-build
1268 .if ${MK_CDDL} != "no" && (${BOOTSTRAPPING} < 1100006 \
1269 || (${MACHINE} != ${TARGET} || ${MACHINE_ARCH} != ${TARGET_ARCH}))
1270 _dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \
1271 lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge
1274 # Default to building the GPL DTC, but build the BSDL one if users explicitly
1277 .if ${MK_GPL_DTC} != "no"
1278 _dtc= gnu/usr.bin/dtc
1281 .if ${MK_KERBEROS} != "no"
1282 _kerberos5_bootstrap_tools= \
1283 kerberos5/tools/make-roken \
1284 kerberos5/lib/libroken \
1285 kerberos5/lib/libvers \
1286 kerberos5/tools/asn1_compile \
1287 kerberos5/tools/slc \
1291 # Please document (add comment) why something is in 'bootstrap-tools'.
1292 # Try to bound the building of the bootstrap-tool to just the
1293 # FreeBSD versions that need the tool built at this stage of the build.
1294 bootstrap-tools: .MAKE
1297 ${_kerberos5_bootstrap_tools} \
1306 usr.bin/makewhatis \
1319 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1320 cd ${.CURDIR}/${_tool} && \
1321 ${MAKE} DIRPRFX=${_tool}/ obj && \
1322 ${MAKE} DIRPRFX=${_tool}/ depend && \
1323 ${MAKE} DIRPRFX=${_tool}/ all && \
1324 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
1328 # build-tools: Build special purpose build tools
1330 .if !defined(NO_SHARE)
1331 _share= share/syscons/scrnmaps
1334 .if ${MK_GCC} != "no"
1335 _gcc_tools= gnu/usr.bin/cc/cc_tools
1338 .if ${MK_RESCUE} != "no"
1339 _rescue= rescue/rescue
1347 ${LOCAL_TOOL_DIRS} \
1348 lib/ncurses/ncurses \
1349 lib/ncurses/ncursesw \
1353 usr.bin/mkesdb_static \
1354 usr.bin/mkcsmapper_static \
1356 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \
1357 cd ${.CURDIR}/${_tool} && \
1358 ${MAKE} DIRPRFX=${_tool}/ obj && \
1359 ${MAKE} DIRPRFX=${_tool}/ build-tools
1363 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \
1364 cd ${.CURDIR}/${_tool} && \
1365 ${MAKE} DIRPRFX=${_tool}/ obj && \
1366 ${MAKE} DIRPRFX=${_tool}/ depend && \
1367 ${MAKE} DIRPRFX=${_tool}/ all
1371 # kernel-tools: Build kernel-building tools
1374 mkdir -p ${MAKEOBJDIRPREFIX}/usr
1375 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1376 -p ${MAKEOBJDIRPREFIX}/usr >/dev/null
1379 # cross-tools: Build cross-building tools
1381 .if ${TARGET_ARCH} != ${MACHINE_ARCH}
1382 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386"
1383 _btxld= usr.sbin/btxld
1386 .if ${TARGET_ARCH} != ${MACHINE_ARCH}
1387 .if ${MK_RESCUE} != "no" || defined(RELEASEDIR)
1388 _crunchide= usr.sbin/crunch/crunchide
1390 .if ${TARGET_ARCH} == "i386" && defined(RELEASEDIR)
1391 _kgzip= usr.sbin/kgzip
1395 # If we're given an XAS, don't build binutils.
1396 .if ${XAS:M/*} == "" && ${MK_BINUTILS_BOOTSTRAP} != "no"
1397 _binutils= gnu/usr.bin/binutils
1400 # If an full path to an external cross compiler is given, don't build
1402 .if ${XCC:M/*} == "" && ${MK_CROSS_COMPILER} != "no"
1403 .if ${MK_CLANG_BOOTSTRAP} != "no"
1404 _clang= usr.bin/clang
1405 _clang_libs= lib/clang
1407 .if ${MK_GCC_BOOTSTRAP} != "no"
1418 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
1423 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1424 cd ${.CURDIR}/${_tool} && \
1425 ${MAKE} DIRPRFX=${_tool}/ obj && \
1426 ${MAKE} DIRPRFX=${_tool}/ depend && \
1427 ${MAKE} DIRPRFX=${_tool}/ all && \
1428 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
1431 NXBENV= MAKEOBJDIRPREFIX=${OBJTREE}/nxb \
1432 INSTALL="sh ${.CURDIR}/tools/install.sh" \
1433 VERSION="${VERSION}"
1434 NXBMAKE= ${NXBENV} ${MAKE} \
1435 TBLGEN=${OBJTREE}/nxb-bin/usr/bin/tblgen \
1436 CLANG_TBLGEN=${OBJTREE}/nxb-bin/usr/bin/clang-tblgen \
1437 MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH} \
1438 MK_GDB=no MK_TESTS=no \
1440 MK_HTML=no MK_INFO=no NO_LINT=yes MK_MAN=no \
1441 -DNO_PIC MK_PROFILE=no -DNO_SHARED \
1442 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
1443 MK_CLANG_FULL=no MK_LLDB=no
1445 native-xtools: .MAKE
1446 mkdir -p ${OBJTREE}/nxb-bin/usr
1447 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1448 -p ${OBJTREE}/nxb-bin/usr >/dev/null
1449 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
1450 -p ${OBJTREE}/nxb-bin/usr/include >/dev/null
1465 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1466 cd ${.CURDIR}/${_tool} && \
1467 ${NXBMAKE} DIRPRFX=${_tool}/ obj && \
1468 ${NXBMAKE} DIRPRFX=${_tool}/ depend && \
1469 ${NXBMAKE} DIRPRFX=${_tool}/ all && \
1470 ${NXBMAKE} DIRPRFX=${_tool}/ DESTDIR=${OBJTREE}/nxb-bin install
1474 # hierarchy - ensure that all the needed directories are present
1476 hierarchy hier: .MAKE
1477 cd ${.CURDIR}/etc && ${HMAKE} distrib-dirs
1480 # libraries - build all libraries, and install them under ${DESTDIR}.
1482 # The list of libraries with dependents (${_prebuild_libs}) and their
1483 # interdependencies (__L) are built automatically by the
1484 # ${.CURDIR}/tools/make_libdeps.sh script.
1488 ${MAKE} -f Makefile.inc1 _prereq_libs && \
1489 ${MAKE} -f Makefile.inc1 _startup_libs && \
1490 ${MAKE} -f Makefile.inc1 _prebuild_libs && \
1491 ${MAKE} -f Makefile.inc1 _generic_libs
1494 # static libgcc.a prerequisite for shared libc
1496 _prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc lib/libcompiler_rt
1498 # These dependencies are not automatically generated:
1500 # gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before
1501 # all shared libraries for ELF.
1503 _startup_libs= gnu/lib/csu
1504 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
1505 _startup_libs+= lib/csu/${MACHINE_ARCH}-elf
1506 .elif exists(${.CURDIR}/lib/csu/${MACHINE_ARCH})
1507 _startup_libs+= lib/csu/${MACHINE_ARCH}
1509 _startup_libs+= lib/csu/${MACHINE_CPUARCH}
1511 _startup_libs+= gnu/lib/libgcc
1512 _startup_libs+= lib/libcompiler_rt
1513 _startup_libs+= lib/libc
1514 _startup_libs+= lib/libc_nonshared
1515 .if ${MK_LIBCPLUSPLUS} != "no"
1516 _startup_libs+= lib/libcxxrt
1519 gnu/lib/libgcc__L: lib/libc__L
1520 gnu/lib/libgcc__L: lib/libc_nonshared__L
1521 .if ${MK_LIBCPLUSPLUS} != "no"
1522 lib/libcxxrt__L: gnu/lib/libgcc__L
1525 _prebuild_libs= ${_kerberos5_lib_libasn1} \
1526 ${_kerberos5_lib_libhdb} \
1527 ${_kerberos5_lib_libheimbase} \
1528 ${_kerberos5_lib_libheimntlm} \
1529 ${_kerberos5_lib_libheimsqlite} \
1530 ${_kerberos5_lib_libheimipcc} \
1531 ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \
1532 ${_kerberos5_lib_libroken} \
1533 ${_kerberos5_lib_libwind} \
1535 lib/libbz2 ${_libcom_err} lib/libcrypt \
1536 lib/libelf lib/libexpat \
1538 lib/libkiconv lib/libkvm lib/liblzma lib/libmd lib/libnv \
1539 ${_lib_libcapsicum} \
1540 lib/ncurses/ncurses lib/ncurses/ncursesw \
1541 lib/libopie lib/libpam ${_lib_libthr} \
1542 lib/libradius lib/libsbuf lib/libtacplus \
1544 ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \
1545 ${_cddl_lib_libuutil} \
1546 ${_cddl_lib_libavl} \
1547 ${_cddl_lib_libzfs_core} \
1548 ${_cddl_lib_libctf} \
1549 lib/libutil lib/libpjdlog ${_lib_libypclnt} lib/libz lib/msun \
1550 ${_secure_lib_libcrypto} ${_lib_libldns} \
1551 ${_secure_lib_libssh} ${_secure_lib_libssl}
1552 .if ${MK_GNUCXX} != "no"
1553 _prebuild_libs+= gnu/lib/libstdc++ gnu/lib/libsupc++
1554 gnu/lib/libstdc++__L: lib/msun__L
1555 gnu/lib/libsupc++__L: gnu/lib/libstdc++__L
1558 lib/libgeom__L: lib/libexpat__L
1560 .if defined(WITH_ATF) || ${MK_TESTS} != "no"
1561 .if !defined(WITH_ATF)
1562 # Ensure that the ATF libraries will be built during make libraries, even
1563 # though they will have WITHOUT_TESTS
1569 .if ${MK_LIBTHR} != "no"
1570 _lib_libthr= lib/libthr
1573 .if ${MK_OFED} != "no"
1574 _ofed_lib= contrib/ofed/usr.lib/
1577 .if ${MK_CASPER} != "no"
1578 _lib_libcapsicum=lib/libcapsicum
1581 lib/libcapsicum__L: lib/libnv__L
1582 lib/libpjdlog__L: lib/libutil__L
1584 _generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib}
1585 .for _DIR in ${LOCAL_LIB_DIRS}
1586 .if exists(${.CURDIR}/${_DIR}/Makefile)
1587 _generic_libs+= ${_DIR}
1591 lib/libopie__L lib/libtacplus__L: lib/libmd__L
1593 .if ${MK_CDDL} != "no"
1594 _cddl_lib_libumem= cddl/lib/libumem
1595 _cddl_lib_libnvpair= cddl/lib/libnvpair
1596 _cddl_lib_libavl= cddl/lib/libavl
1597 _cddl_lib_libuutil= cddl/lib/libuutil
1598 _cddl_lib_libzfs_core= cddl/lib/libzfs_core
1599 _cddl_lib_libctf= cddl/lib/libctf
1601 cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L
1602 cddl/lib/libzfs__L: lib/libgeom__L
1603 cddl/lib/libctf__L: lib/libz__L
1606 .if ${MK_CRYPT} != "no"
1607 .if ${MK_OPENSSL} != "no"
1608 _secure_lib_libcrypto= secure/lib/libcrypto
1609 _secure_lib_libssl= secure/lib/libssl
1610 lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L
1611 .if ${MK_LDNS} != "no"
1612 _lib_libldns= lib/libldns
1613 lib/libldns__L: secure/lib/libcrypto__L
1615 .if ${MK_OPENSSH} != "no"
1616 _secure_lib_libssh= secure/lib/libssh
1617 secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
1618 .if ${MK_LDNS} != "no"
1619 secure/lib/libssh__L: lib/libldns__L
1621 .if ${MK_KERBEROS_SUPPORT} != "no"
1622 secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \
1623 kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \
1624 lib/libmd__L kerberos5/lib/libroken__L
1628 _secure_lib= secure/lib
1631 .if ${MK_KERBEROS} != "no"
1632 kerberos5/lib/libasn1__L: lib/libcom_err__L kerberos5/lib/libroken__L
1633 kerberos5/lib/libhdb__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1634 kerberos5/lib/libkrb5__L kerberos5/lib/libroken__L \
1635 kerberos5/lib/libwind__L kerberos5/lib/libheimsqlite__L
1636 kerberos5/lib/libheimntlm__L: secure/lib/libcrypto__L kerberos5/lib/libkrb5__L \
1637 kerberos5/lib/libroken__L lib/libcom_err__L
1638 kerberos5/lib/libhx509__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1639 secure/lib/libcrypto__L kerberos5/lib/libroken__L kerberos5/lib/libwind__L
1640 kerberos5/lib/libkrb5__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1641 lib/libcrypt__L secure/lib/libcrypto__L kerberos5/lib/libhx509__L \
1642 kerberos5/lib/libroken__L kerberos5/lib/libwind__L \
1643 kerberos5/lib/libheimbase__L kerberos5/lib/libheimipcc__L
1644 kerberos5/lib/libroken__L: lib/libcrypt__L
1645 kerberos5/lib/libwind__L: kerberos5/lib/libroken__L lib/libcom_err__L
1646 kerberos5/lib/libheimbase__L: lib/libthr__L
1647 kerberos5/lib/libheimipcc__L: kerberos5/lib/libroken__L kerberos5/lib/libheimbase__L lib/libthr__L
1648 kerberos5/lib/libheimsqlite__L: lib/libthr__L
1651 .if ${MK_GSSAPI} != "no"
1652 _lib_libgssapi= lib/libgssapi
1655 .if ${MK_KERBEROS} != "no"
1656 _kerberos5_lib= kerberos5/lib
1657 _kerberos5_lib_libasn1= kerberos5/lib/libasn1
1658 _kerberos5_lib_libhdb= kerberos5/lib/libhdb
1659 _kerberos5_lib_libheimbase= kerberos5/lib/libheimbase
1660 _kerberos5_lib_libkrb5= kerberos5/lib/libkrb5
1661 _kerberos5_lib_libhx509= kerberos5/lib/libhx509
1662 _kerberos5_lib_libroken= kerberos5/lib/libroken
1663 _kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm
1664 _kerberos5_lib_libheimsqlite= kerberos5/lib/libheimsqlite
1665 _kerberos5_lib_libheimipcc= kerberos5/lib/libheimipcc
1666 _kerberos5_lib_libwind= kerberos5/lib/libwind
1667 _libcom_err= lib/libcom_err
1670 .if ${MK_NIS} != "no"
1671 _lib_libypclnt= lib/libypclnt
1674 .if ${MK_OPENSSL} == "no"
1675 lib/libradius__L: lib/libmd__L
1678 .for _lib in ${_prereq_libs}
1679 ${_lib}__PL: .PHONY .MAKE
1680 .if exists(${.CURDIR}/${_lib})
1681 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1682 cd ${.CURDIR}/${_lib} && \
1683 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj && \
1684 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ depend && \
1685 ${MAKE} MK_TESTS=no MK_PROFILE=no -DNO_PIC \
1686 DIRPRFX=${_lib}/ all && \
1687 ${MAKE} MK_TESTS=no MK_PROFILE=no -DNO_PIC \
1688 DIRPRFX=${_lib}/ install
1692 .for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
1693 ${_lib}__L: .PHONY .MAKE
1694 .if exists(${.CURDIR}/${_lib})
1695 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1696 cd ${.CURDIR}/${_lib} && \
1697 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj && \
1698 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ depend && \
1699 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ all && \
1700 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ install
1704 # libpam is special: we need to build static PAM modules before
1705 # static PAM library, and dynamic PAM library before dynamic PAM
1707 lib/libpam__L: .PHONY .MAKE
1708 ${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \
1709 cd ${.CURDIR}/lib/libpam && \
1710 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ obj && \
1711 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ depend && \
1712 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ \
1713 -D_NO_LIBPAM_SO_YET all && \
1714 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ \
1715 -D_NO_LIBPAM_SO_YET install
1717 _prereq_libs: ${_prereq_libs:S/$/__PL/}
1718 _startup_libs: ${_startup_libs:S/$/__L/}
1719 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
1720 _generic_libs: ${_generic_libs:S/$/__L/}
1722 .for __target in all clean cleandepend cleandir depend includes obj
1723 .for entry in ${SUBDIR}
1724 ${entry}.${__target}__D: .PHONY .MAKE
1725 ${_+_}@set -e; if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
1726 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \
1727 edir=${entry}.${MACHINE_ARCH}; \
1728 cd ${.CURDIR}/$${edir}; \
1730 ${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \
1732 cd ${.CURDIR}/$${edir}; \
1734 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
1736 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
1739 .include <bsd.subdir.mk>
1741 .if make(check-old) || make(check-old-dirs) || \
1742 make(check-old-files) || make(check-old-libs) || \
1743 make(delete-old) || make(delete-old-dirs) || \
1744 make(delete-old-files) || make(delete-old-libs)
1747 # check for / delete old files section
1750 .include "ObsoleteFiles.inc"
1752 OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \
1753 else you can not start such an application. Consult UPDATING for more \
1754 information regarding how to cope with the removal/revision bump of a \
1757 .if !defined(BATCH_DELETE_OLD_FILES)
1764 @echo ">>> Removing old files (only deletes safe to delete libs)"
1765 # Ask for every old file if the user really wants to remove it.
1766 # It's annoying, but better safe than sorry.
1767 # NB: We cannot pass the list of OLD_FILES as a parameter because the
1768 # argument list will get too long. Using .for/.endfor make "loops" will make
1769 # the Makefile parser segfault.
1772 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1773 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1774 while read file; do \
1775 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1776 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1777 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1780 # Remove catpages without corresponding manpages.
1782 find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1783 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1784 while read catpage; do \
1786 if [ ! -e "$${manpage}" ]; then \
1787 rm ${RM_I} $${catpage} <&3; \
1790 @echo ">>> Old files removed"
1793 @echo ">>> Checking for old files"
1795 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1796 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1797 while read file; do \
1798 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1799 echo "${DESTDIR}/$${file}"; \
1802 # Check for catpages without corresponding manpages.
1803 @find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1804 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1805 while read catpage; do \
1807 if [ ! -e "$${manpage}" ]; then \
1813 @echo ">>> Removing old libraries"
1814 @echo "${OLD_LIBS_MESSAGE}" | fmt
1817 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1818 -V OLD_LIBS | xargs -n1 | \
1819 while read file; do \
1820 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1821 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1822 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1824 for ext in debug symbols; do \
1825 if ! [ -e "${DESTDIR}/$${file}" ] && [ -f \
1826 "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \
1827 rm ${RM_I} "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" \
1832 @echo ">>> Old libraries removed"
1835 @echo ">>> Checking for old libraries"
1837 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1838 -V OLD_LIBS | xargs -n1 | \
1839 while read file; do \
1840 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1841 echo "${DESTDIR}/$${file}"; \
1843 for ext in debug symbols; do \
1844 if [ -f "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \
1845 echo "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}"; \
1851 @echo ">>> Removing old directories"
1853 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1854 -V OLD_DIRS | xargs -n1 | sort -r | \
1855 while read dir; do \
1856 if [ -d "${DESTDIR}/$${dir}" ]; then \
1857 rmdir -v "${DESTDIR}/$${dir}" || true; \
1858 elif [ -L "${DESTDIR}/$${dir}" ]; then \
1859 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1862 @echo ">>> Old directories removed"
1865 @echo ">>> Checking for old directories"
1867 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1868 -V OLD_DIRS | xargs -n1 | \
1869 while read dir; do \
1870 if [ -d "${DESTDIR}/$${dir}" ]; then \
1871 echo "${DESTDIR}/$${dir}"; \
1872 elif [ -L "${DESTDIR}/$${dir}" ]; then \
1873 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1877 delete-old: delete-old-files delete-old-dirs
1878 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1880 check-old: check-old-files check-old-libs check-old-dirs
1881 @echo "To remove old files and directories run '${MAKE} delete-old'."
1882 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1887 # showconfig - show build configuration.
1890 @${MAKE} -n -f src.opts.mk -V dummy -dg1 2>&1 | grep ^MK_ | sort
1892 .if !empty(KRNLOBJDIR) && !empty(KERNCONF)
1893 DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/
1895 .if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE)
1896 .if exists(${KERNCONFDIR}/${KERNCONF})
1897 FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \
1898 '${KERNCONFDIR}/${KERNCONF}' ; echo
1904 .if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH})
1905 DTBOUTPUTPATH= ${.CURDIR}
1909 # Build 'standalone' Device Tree Blob
1912 @PATH=${TMPPATH} MACHINE=${TARGET} \
1913 ${.CURDIR}/sys/tools/fdt/make_dtb.sh ${.CURDIR}/sys \
1914 "${FDT_DTS_FILE}" ${DTBOUTPUTPATH}
1918 .if defined(TARGET) && defined(TARGET_ARCH)
1920 .if ${TARGET} == ${MACHINE} && ${TARGET_ARCH} == ${MACHINE_ARCH}
1921 XDEV_CPUTYPE?=${CPUTYPE}
1923 XDEV_CPUTYPE?=${TARGET_CPUTYPE}
1926 NOFUN=-DNO_FSCHG MK_HTML=no MK_INFO=no -DNO_LINT \
1927 MK_MAN=no MK_NLS=no MK_PROFILE=no \
1928 MK_KERBEROS=no MK_RESCUE=no MK_TESTS=no MK_WARNS=no \
1929 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
1930 CPUTYPE=${XDEV_CPUTYPE}
1932 XDDIR=${TARGET_ARCH}-freebsd
1935 .error XDTP variable should be an absolute path
1938 CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \
1939 INSTALL="sh ${.CURDIR}/tools/install.sh"
1941 _SHLIBDIRPREFIX=${XDDESTDIR} \
1942 TOOLS_PREFIX=${XDTP}
1943 CD2CFLAGS=-isystem ${XDDESTDIR}/usr/include -L${XDDESTDIR}/usr/lib \
1944 --sysroot=${XDDESTDIR}/ -B${XDDESTDIR}/usr/libexec \
1945 -B${XDDESTDIR}/usr/bin -B${XDDESTDIR}/usr/lib
1946 CD2ENV=${CDENV} CC="${CC} ${CD2CFLAGS}" CXX="${CXX} ${CD2CFLAGS}" \
1947 CPP="${CPP} ${CD2CFLAGS}" \
1948 MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH}
1950 CDTMP= ${MAKEOBJDIRPREFIX}/${XDDIR}/${.CURDIR}/tmp
1951 CDMAKE=${CDENV} PATH=${CDTMP}/usr/bin:${PATH} ${MAKE} ${NOFUN}
1952 CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDDESTDIR}/usr/bin:${PATH} ${MAKE} ${NOFUN}
1953 XDDESTDIR=${DESTDIR}/${XDTP}
1955 OSREL!= uname -r | sed -e 's/[-(].*//'
1958 .ORDER: xdev-build xdev-install xdev-links
1959 xdev: xdev-build xdev-install
1961 .ORDER: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools
1962 xdev-build: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools
1965 mkdir -p ${CDTMP}/usr
1966 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1967 -p ${CDTMP}/usr >/dev/null
1969 _xb-bootstrap-tools:
1972 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1973 cd ${.CURDIR}/${_tool} && \
1974 ${CDMAKE} DIRPRFX=${_tool}/ obj && \
1975 ${CDMAKE} DIRPRFX=${_tool}/ depend && \
1976 ${CDMAKE} DIRPRFX=${_tool}/ all && \
1977 ${CDMAKE} DIRPRFX=${_tool}/ DESTDIR=${CDTMP} install
1981 ${_+_}@cd ${.CURDIR}; \
1982 ${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools
1991 ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \
1992 cd ${.CURDIR}/${_tool} && \
1993 ${CDMAKE} DIRPRFX=${_tool}/ obj && \
1994 ${CDMAKE} DIRPRFX=${_tool}/ depend && \
1995 ${CDMAKE} DIRPRFX=${_tool}/ all
1999 ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}"
2000 mkdir -p ${XDDESTDIR}
2001 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
2002 -p ${XDDESTDIR} >/dev/null
2003 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
2004 -p ${XDDESTDIR}/usr >/dev/null
2005 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
2006 -p ${XDDESTDIR}/usr/include >/dev/null
2007 .if ${MK_TESTS} != "no"
2008 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
2009 -p ${XDDESTDIR}/usr >/dev/null
2012 .ORDER: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries
2013 xdev-install: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries
2016 @echo "_xi-cross-tools"
2023 ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \
2024 cd ${.CURDIR}/${_tool}; \
2025 ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR}
2029 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 par-includes \
2030 DESTDIR=${XDDESTDIR}
2033 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \
2034 DESTDIR=${XDDESTDIR}
2037 ${_+_}cd ${XDDESTDIR}/usr/bin; \
2038 mkdir -p ../../../../usr/bin; \
2040 ln -sf ../../${XDTP}/usr/bin/$$i \
2041 ../../../../usr/bin/${XDDIR}-$$i; \
2042 ln -sf ../../${XDTP}/usr/bin/$$i \
2043 ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \
2046 xdev xdev-build xdev-install xdev-links:
2047 @echo "*** Error: Both TARGET and TARGET_ARCH must be defined for \"${.TARGET}\" target"