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.
61 .if defined(SUBDIR_OVERRIDE)
62 SUBDIR= ${SUBDIR_OVERRIDE}
64 SUBDIR= share/info lib libexec
66 .if ${MK_GAMES} != "no"
69 .if ${MK_CDDL} != "no"
73 .if ${MK_KERBEROS} != "no"
76 .if ${MK_RESCUE} != "no"
80 .if ${MK_CRYPT} != "no"
83 .if !defined(NO_SHARE)
86 SUBDIR+=sys usr.bin usr.sbin
87 .if ${MK_OFED} != "no"
91 # We must do etc/ last for install/distribute to work.
95 # These are last, since it is nice to at least get the base system
96 # rebuilt before you do them.
97 .for _DIR in ${LOCAL_LIB_DIRS} ${LOCAL_DIRS}
98 .if exists(${.CURDIR}/${_DIR}/Makefile)
107 .if defined(NO_CLEANDIR)
108 CLEANDIR= clean cleandepend
115 BUILDENV_SHELL?=/bin/sh
117 SVN?= /usr/local/bin/svn
120 MAKEOBJDIRPREFIX?= /usr/obj
121 .if !defined(OSRELDATE)
122 .if exists(/usr/include/osreldate.h)
123 OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
124 /usr/include/osreldate.h
130 .if !defined(VERSION)
132 VERSION+= ${OSRELDATE}
135 KNOWN_ARCHES?= amd64 arm armeb/arm armv6/arm armv6eb/arm i386 i386/pc98 ia64 mips mipsel/mips mips64el/mips mips64/mips mipsn32el/mips mipsn32/mips powerpc powerpc64/powerpc sparc64
136 .if ${TARGET} == ${TARGET_ARCH}
139 _t= ${TARGET_ARCH}/${TARGET}
142 .if empty(KNOWN_ARCHES:M${_t})
143 .error Unknown target ${TARGET_ARCH}:${TARGET}.
147 .if ${TARGET} == ${MACHINE}
148 TARGET_CPUTYPE?=${CPUTYPE}
153 .if !empty(TARGET_CPUTYPE)
154 _TARGET_CPUTYPE=${TARGET_CPUTYPE}
156 _TARGET_CPUTYPE=dummy
158 _CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} \
159 -f /dev/null -m ${.CURDIR}/share/mk -V CPUTYPE
160 .if ${_CPUTYPE} != ${_TARGET_CPUTYPE}
161 .error CPUTYPE global should be set with ?=.
164 BUILD_ARCH!= uname -p
165 .if ${MACHINE_ARCH} != ${BUILD_ARCH}
166 .error To cross-build, set TARGET_ARCH.
169 .if ${MACHINE} == ${TARGET} && ${MACHINE_ARCH} == ${TARGET_ARCH} && !defined(CROSS_BUILD_TESTING)
170 OBJTREE= ${MAKEOBJDIRPREFIX}
172 OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH}
174 WORLDTMP= ${OBJTREE}${.CURDIR}/tmp
175 # /usr/games added for fortune which depend on strfile
176 BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games:${WORLDTMP}/legacy/bin
177 XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
178 STRICTTMPPATH= ${BPATH}:${XPATH}
179 TMPPATH= ${STRICTTMPPATH}:${PATH}
182 # Avoid running mktemp(1) unless actually needed.
183 # It may not be functional, e.g., due to new ABI
184 # when in the middle of installing over this system.
186 .if make(distributeworld) || make(installworld)
187 INSTALLTMP!= /usr/bin/mktemp -d -u -t install
191 # Building a world goes through the following stages
193 # 1. legacy stage [BMAKE]
194 # This stage is responsible for creating compatibility
195 # shims that are needed by the bootstrap-tools,
196 # build-tools and cross-tools stages.
197 # 1. bootstrap-tools stage [BMAKE]
198 # This stage is responsible for creating programs that
199 # are needed for backward compatibility reasons. They
200 # are not built as cross-tools.
201 # 2. build-tools stage [TMAKE]
202 # This stage is responsible for creating the object
203 # tree and building any tools that are needed during
205 # 3. cross-tools stage [XMAKE]
206 # This stage is responsible for creating any tools that
207 # are needed for cross-builds. A cross-compiler is one
209 # 4. world stage [WMAKE]
210 # This stage actually builds the world.
211 # 5. install stage (optional) [IMAKE]
212 # This stage installs a previously built world.
217 # Common environment for world related stages
218 CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \
219 MACHINE_ARCH=${TARGET_ARCH} \
221 CPUTYPE=${TARGET_CPUTYPE}
222 .if ${MK_GROFF} != "no"
223 CROSSENV+= GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
224 GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \
225 GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac
228 # bootstrap-tools stage
229 BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
230 PATH=${BPATH}:${PATH} \
231 WORLDTMP=${WORLDTMP} \
232 VERSION="${VERSION}" \
233 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
234 COMPILER_TYPE=${COMPILER_TYPE}
235 BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
236 ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
238 BOOTSTRAPPING=${OSRELDATE} \
240 -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \
241 -DNO_PIC -DNO_PROFILE -DNO_SHARED \
242 -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD
245 TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
246 ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
247 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
249 BOOTSTRAPPING=${OSRELDATE} \
252 -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD
255 XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \
256 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
260 WMAKEENV= ${CROSSENV} \
261 _SHLIBDIRPREFIX=${WORLDTMP} \
263 VERSION="${VERSION}" \
264 INSTALL="sh ${.CURDIR}/tools/install.sh" \
268 HMAKE= PATH=${TMPPATH} ${MAKE} LOCAL_MTREE=${LOCAL_MTREE:Q}
270 HMAKE+= PATH=${TMPPATH} METALOG=${METALOG} -DNO_ROOT
273 .if ${MK_CDDL} == "no"
277 .if defined(CROSS_TOOLCHAIN_PREFIX)
278 CROSS_COMPILER_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
279 CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
281 XCOMPILERS= CC CXX CPP
282 .for COMPILER in ${XCOMPILERS}
283 .if defined(CROSS_COMPILER_PREFIX)
284 X${COMPILER}?= ${CROSS_COMPILER_PREFIX}${${COMPILER}}
286 X${COMPILER}?= ${${COMPILER}}
289 XBINUTILS= AS AR LD NM OBJDUMP RANLIB STRINGS
290 .for BINUTIL in ${XBINUTILS}
291 .if defined(CROSS_BINUTILS_PREFIX)
292 X${BINUTIL}?= ${CROSS_BINUTILS_PREFIX}${${BINUTIL}}
294 X${BINUTIL}?= ${${BINUTIL}}
297 WMAKEENV+= CC="${XCC} ${XFLAGS}" CXX="${XCXX} ${XFLAGS}" \
298 CPP="${XCPP} ${XFLAGS}" \
299 AS="${XAS}" AR="${XAR}" LD="${XLD}" NM=${XNM} \
300 OBJDUMP=${XOBJDUMP} RANLIB=${XRANLIB} STRINGS=${XSTRINGS}
302 .if ${XCC:T:Mgcc} == "gcc"
303 WMAKE_COMPILER_TYPE= gcc
304 .elif ${XCC:T:Mclang} == "clang"
305 WMAKE_COMPILER_TYPE= clang
306 .elif ${MK_CLANG_IS_CC} == "no"
307 WMAKE_COMPILER_TYPE= gcc
309 WMAKE_COMPILER_TYPE= clang
311 IMAKE_COMPILER_TYPE= COMPILER_TYPE=${WMAKE_COMPILER_TYPE}
314 XFLAGS= --sysroot=${WORLDTMP}
315 .if defined(CROSS_BINUTILS_PREFIX)
316 # In the case of xdev-build tools, CROSS_BINUTILS_PREFIX won't be a
317 # directory, but the compiler will look in the right place for it's
318 # tools so we don't need to tell it where to look.
319 .if exists(${CROSS_BINUTILS_PREFIX})
320 XFLAGS+= -B${CROSS_BINUTILS_PREFIX}
323 XFLAGS+= -B${WORLDTMP}/usr/bin
325 .if ${TARGET_ARCH} != ${MACHINE_ARCH} && ${WMAKE_COMPILER_TYPE} == "clang"
326 .if (${TARGET_ARCH} == "arm" || ${TARGET_ARCH} == "armv6") && \
327 ${MK_ARM_EABI} != "no"
332 TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd10.0
333 XFLAGS+= -target ${TARGET_TRIPLE}
337 WMAKEENV+= COMPILER_TYPE=${WMAKE_COMPILER_TYPE}
338 WMAKE= ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 DESTDIR=${WORLDTMP}
340 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
342 LIB32TMP= ${OBJTREE}${.CURDIR}/lib32
344 .if ${TARGET_ARCH} == "amd64"
345 .if empty(TARGET_CPUTYPE)
346 LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2
348 LIB32CPUFLAGS= -march=${TARGET_CPUTYPE}
350 LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \
351 MACHINE_CPU="i686 mmx sse sse2"
354 LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32"
356 .elif ${TARGET_ARCH} == "powerpc64"
357 .if empty(TARGET_CPUTYPE)
358 LIB32CPUFLAGS= -mcpu=powerpc
360 LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE}
362 LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc
364 LD="${LD} -m elf32ppc_fbsd"
368 LIB32FLAGS= -m32 ${LIB32CPUFLAGS} -DCOMPAT_32BIT \
369 -isystem ${LIB32TMP}/usr/include/ \
370 -L${LIB32TMP}/usr/lib32 \
371 -B${LIB32TMP}/usr/lib32
373 LIB32FLAGS+= --sysroot=${WORLDTMP}
376 # Yes, the flags are redundant.
377 LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \
378 _SHLIBDIRPREFIX=${LIB32TMP} \
379 _LDSCRIPTROOT=${LIB32TMP} \
380 VERSION="${VERSION}" \
381 INSTALL="sh ${.CURDIR}/tools/install.sh" \
384 SHLIBDIR=/usr/lib32 \
385 LIBPRIVATEDIR=/usr/lib32/private \
386 COMPILER_TYPE=${WMAKE_COMPILER_TYPE}
388 CC="${XCC} ${LIB32FLAGS}" \
389 CXX="${XCXX} ${LIB32FLAGS}" \
390 DESTDIR=${LIB32TMP} \
397 LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} ${LIB32WMAKEFLAGS} \
398 -DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO -DWITHOUT_HTML
399 LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} -DNO_INCS \
403 IMAKEENV= ${CROSSENV:N_LDSCRIPTROOT=*}
404 IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 \
405 ${IMAKE_INSTALL} ${IMAKE_MTREE} ${IMAKE_COMPILER_TYPE}
406 .if empty(.MAKEFLAGS:M-n)
407 IMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMP} \
408 LD_LIBRARY_PATH=${INSTALLTMP} \
409 PATH_LOCALE=${INSTALLTMP}/locale
410 IMAKE+= __MAKE_SHELL=${INSTALLTMP}/sh
412 IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP}
414 .if defined(DB_FROM_SRC)
415 INSTALLFLAGS+= -N ${.CURDIR}/etc
416 MTREEFLAGS+= -N ${.CURDIR}/etc
418 _INSTALL_DDIR= ${DESTDIR}/${DISTDIR}
419 INSTALL_DDIR= ${_INSTALL_DDIR:S://:/:g:C:/$::}
421 METALOG?= ${DESTDIR}/${DISTDIR}/METALOG
422 IMAKE+= -DNO_ROOT METALOG=${METALOG}
423 INSTALLFLAGS+= -U -M ${METALOG} -D ${INSTALL_DDIR}
426 .if defined(DB_FROM_SRC) || defined(NO_ROOT)
427 IMAKE_INSTALL= INSTALL="install ${INSTALLFLAGS}"
428 IMAKE_MTREE= MTREE_CMD="nmtree ${MTREEFLAGS}"
432 KMAKEENV= ${WMAKEENV}
433 KMAKE= ${KMAKEENV} ${MAKE} ${.MAKEFLAGS} ${KERNEL_FLAGS} KERNEL=${INSTKERNNAME}
438 # Attempt to rebuild the entire system, with reasonable chance of
439 # success, regardless of how old your existing system is.
442 .if ${.CURDIR:C/[^,]//g} != ""
443 # The m4 build of sendmail files doesn't like it if ',' is used
444 # anywhere in the path of it's files.
446 @echo "*** Error: path to source tree contains a comma ','"
451 @echo "--------------------------------------------------------------"
452 @echo ">>> Rebuilding the temporary build tree"
453 @echo "--------------------------------------------------------------"
454 .if !defined(NO_CLEAN)
456 .if defined(LIB32TMP)
460 rm -rf ${WORLDTMP}/legacy/usr/include
461 # XXX - These three can depend on any header file.
462 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
463 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c
464 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
467 lib usr legacy/bin legacy/usr
468 mkdir -p ${WORLDTMP}/${_dir}
470 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
471 -p ${WORLDTMP}/legacy/usr >/dev/null
472 .if ${MK_GROFF} != "no"
473 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.groff.dist \
474 -p ${WORLDTMP}/legacy/usr >/dev/null
476 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
477 -p ${WORLDTMP}/usr >/dev/null
478 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
479 -p ${WORLDTMP}/usr/include >/dev/null
480 ln -sf ${.CURDIR}/sys ${WORLDTMP}
481 .if ${MK_DEBUG_FILES} != "no"
482 # We could instead disable debug files for these build stages
483 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
484 -p ${WORLDTMP}/legacy/usr/lib >/dev/null
485 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
486 -p ${WORLDTMP}/usr/lib >/dev/null
488 .if ${MK_BIND_LIBS} != "no"
489 mtree -deU -f ${.CURDIR}/etc/mtree/BIND.include.dist \
490 -p ${WORLDTMP}/usr/include >/dev/null
492 .for _mtree in ${LOCAL_MTREE}
493 mtree -deU -f ${.CURDIR}/${_mtree} -p ${WORLDTMP} > /dev/null
497 @echo "--------------------------------------------------------------"
498 @echo ">>> stage 1.1: legacy release compatibility shims"
499 @echo "--------------------------------------------------------------"
500 ${_+_}cd ${.CURDIR}; ${BMAKE} legacy
503 @echo "--------------------------------------------------------------"
504 @echo ">>> stage 1.2: bootstrap tools"
505 @echo "--------------------------------------------------------------"
506 ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools
508 .if !defined(NO_CLEAN)
510 @echo "--------------------------------------------------------------"
511 @echo ">>> stage 2.1: cleaning up the object tree"
512 @echo "--------------------------------------------------------------"
513 ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
514 .if defined(LIB32TMP)
515 ${_+_}cd ${.CURDIR}; ${LIB32WMAKE} -f Makefile.inc1 ${CLEANDIR:S/^/par-/}
520 @echo "--------------------------------------------------------------"
521 @echo ">>> stage 2.2: rebuilding the object tree"
522 @echo "--------------------------------------------------------------"
523 ${_+_}cd ${.CURDIR}; ${WMAKE} par-obj
526 @echo "--------------------------------------------------------------"
527 @echo ">>> stage 2.3: build tools"
528 @echo "--------------------------------------------------------------"
529 ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools
532 @echo "--------------------------------------------------------------"
533 @echo ">>> stage 3: cross tools"
534 @echo "--------------------------------------------------------------"
535 ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools
538 @echo "--------------------------------------------------------------"
539 @echo ">>> stage 4.1: building includes"
540 @echo "--------------------------------------------------------------"
541 ${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
544 @echo "--------------------------------------------------------------"
545 @echo ">>> stage 4.2: building libraries"
546 @echo "--------------------------------------------------------------"
547 ${_+_}cd ${.CURDIR}; \
548 ${WMAKE} -DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
549 -DWITHOUT_MAN -DNO_PROFILE libraries
552 @echo "--------------------------------------------------------------"
553 @echo ">>> stage 4.3: make dependencies"
554 @echo "--------------------------------------------------------------"
555 ${_+_}cd ${.CURDIR}; ${WMAKE} par-depend
558 @echo "--------------------------------------------------------------"
559 @echo ">>> stage 4.4: building everything"
560 @echo "--------------------------------------------------------------"
561 ${_+_}cd ${.CURDIR}; ${WMAKE} par-all
562 .if defined(LIB32TMP)
565 @echo "--------------------------------------------------------------"
566 @echo ">>> stage 5.1: building 32 bit shim libraries"
567 @echo "--------------------------------------------------------------"
568 mkdir -p ${LIB32TMP}/usr/include
569 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
570 -p ${LIB32TMP}/usr >/dev/null
571 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
572 -p ${LIB32TMP}/usr/include >/dev/null
573 .if ${MK_DEBUG_FILES} != "no"
574 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
575 -p ${LIB32TMP}/usr/lib >/dev/null
578 ln -sf ${.CURDIR}/sys ${WORLDTMP}
579 .for _t in obj includes
580 cd ${.CURDIR}/include; ${LIB32WMAKE} DIRPRFX=include/ ${_t}
581 cd ${.CURDIR}/lib; ${LIB32WMAKE} DIRPRFX=lib/ ${_t}
582 .if ${MK_CDDL} != "no"
583 cd ${.CURDIR}/cddl/lib; ${LIB32WMAKE} DIRPRFX=cddl/lib/ ${_t}
585 cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} DIRPRFX=gnu/lib/ ${_t}
586 .if ${MK_CRYPT} != "no"
587 cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} DIRPRFX=secure/lib/ ${_t}
589 .if ${MK_KERBEROS} != "no"
590 cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} DIRPRFX=kerberos5/lib ${_t}
593 .for _dir in usr.bin/lex/lib
594 cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} DIRPRFX=${_dir}/ obj
596 .for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic
597 cd ${.CURDIR}/${_dir}; \
598 WORLDTMP=${WORLDTMP} \
599 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
600 MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \
601 DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF \
602 -DEARLY_BUILD build-tools
605 ${LIB32WMAKE} -f Makefile.inc1 libraries
606 .for _t in obj depend all
607 cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32WMAKE} \
608 DIRPRFX=libexec/rtld-elf/ ${_t}
609 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32WMAKE} \
610 DIRPRFX=usr.bin/ldd ${_t}
613 distribute32 install32:
614 cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
615 .if ${MK_CDDL} != "no"
616 cd ${.CURDIR}/cddl/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
618 cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
619 .if ${MK_CRYPT} != "no"
620 cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
622 .if ${MK_KERBEROS} != "no"
623 cd ${.CURDIR}/kerberos5/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
625 cd ${.CURDIR}/libexec/rtld-elf; \
626 PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//}
627 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32IMAKE} ${.TARGET:S/32$//}
631 .if !defined(SUBDIR_OVERRIDE)
632 WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools
634 WMAKE_TGTS+= _cleanobj _obj _build-tools
635 .if !defined(SUBDIR_OVERRIDE)
636 WMAKE_TGTS+= _cross-tools
638 WMAKE_TGTS+= _includes _libraries _depend everything
639 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
643 buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
644 .ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
647 @echo "--------------------------------------------------------------"
648 @echo ">>> World build started on `LC_ALL=C date`"
649 @echo "--------------------------------------------------------------"
653 @echo "--------------------------------------------------------------"
654 @echo ">>> World build completed on `LC_ALL=C date`"
655 @echo "--------------------------------------------------------------"
658 # We need to have this as a target because the indirection between Makefile
659 # and Makefile.inc1 causes the correct PATH to be used, rather than a
660 # modification of the current environment's PATH. In addition, we need
661 # to quote multiword values.
667 @echo Entering world for ${TARGET_ARCH}:${TARGET}
668 @cd ${.CURDIR} && env ${WMAKEENV} ${BUILDENV_SHELL} || true
670 TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything:Nbuild32}
671 toolchain: ${TOOLCHAIN_TGTS}
672 kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries}
677 # Checks to be sure system is ready for installworld/installkernel.
683 # Require DESTDIR to be set if installing for a different architecture or
684 # using the user/group database in the source tree.
686 .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE} || \
688 .if !make(distributeworld)
689 installcheck: installcheck_DESTDIR
690 installcheck_DESTDIR:
691 .if !defined(DESTDIR) || empty(DESTDIR)
692 @echo "ERROR: Please set DESTDIR!"; \
698 .if !defined(DB_FROM_SRC)
700 # Check for missing UIDs/GIDs.
702 CHECK_UIDS= auditdistd
704 .if ${MK_SENDMAIL} != "no"
710 CHECK_GIDS+= proxy authpf
713 .for uid in ${CHECK_UIDS}
714 @if ! `id -u ${uid} >/dev/null 2>&1`; then \
715 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \
719 .for gid in ${CHECK_GIDS}
720 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \
721 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \
728 # Required install tools to be saved in a scratch dir for safety.
730 .if ${MK_INFO} != "no"
731 _install-info= install-info
733 .if ${MK_ZONEINFO} != "no"
734 _zoneinfo= zic tzsetup
737 .if exists(/usr/sbin/nmtree)
738 _nmtree_itools= nmtree
741 ITOOLS= [ awk cap_mkdb cat chflags chmod chown \
742 date echo egrep find grep id install ${_install-info} \
743 ln lockf make mkdir mtree ${_nmtree_itools} mv pwd_mkdb \
744 rm sed sh sysctl test true uname wc ${_zoneinfo}
749 # Distributes everything compiled by a `buildworld'.
753 # Installs everything compiled by a 'buildworld'.
756 # Non-base distributions produced by the base system
757 EXTRA_DISTRIBUTIONS= doc
758 .if ${MK_GAMES} != "no"
759 EXTRA_DISTRIBUTIONS+= games
761 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
762 EXTRA_DISTRIBUTIONS+= lib32
765 MTREE_MAGIC?= mtree 2.0
767 distributeworld installworld: installcheck installcheck_UGID
768 mkdir -p ${INSTALLTMP}
769 progs=$$(for prog in ${ITOOLS}; do \
770 if progpath=`which $$prog`; then \
773 echo "Required tool $$prog not found in PATH." >&2; \
777 libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | \
778 while read line; do \
780 if [ "$$2 $$3" != "not found" ]; then \
783 echo "Required library $$1 not found." >&2; \
787 cp $$libs $$progs ${INSTALLTMP}
788 cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale
790 echo "#${MTREE_MAGIC}" > ${METALOG}
792 .if make(distributeworld)
793 .for dist in ${EXTRA_DISTRIBUTIONS}
794 -mkdir ${DESTDIR}/${DISTDIR}/${dist}
795 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
796 -p ${DESTDIR}/${DISTDIR}/${dist} >/dev/null
797 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
798 -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null
799 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
800 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/include >/dev/null
801 .if ${MK_DEBUG_FILES} != "no"
802 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
803 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib >/dev/null
806 ${IMAKEENV} nmtree -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \
807 sed -e 's#^\./#./${dist}/#' >> ${METALOG}
808 ${IMAKEENV} nmtree -C -f ${.CURDIR}/etc/mtree/BSD.usr.dist | \
809 sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG}
810 ${IMAKEENV} nmtree -C -f ${.CURDIR}/etc/mtree/BSD.include.dist | \
811 sed -e 's#^\./#./${dist}/usr/include/#' >> ${METALOG}
814 -mkdir ${DESTDIR}/${DISTDIR}/base
815 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
816 METALOG=${METALOG} ${IMAKE_INSTALL} ${IMAKE_MTREE} \
817 DISTBASE=/base DESTDIR=${DESTDIR}/${DISTDIR}/base \
818 LOCAL_MTREE=${LOCAL_MTREE:Q} distrib-dirs
820 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \
821 ${IMAKEENV} rm -rf ${INSTALLTMP}
822 .if make(distributeworld)
823 .for dist in ${EXTRA_DISTRIBUTIONS}
824 find ${DESTDIR}/${DISTDIR}/${dist} -mindepth 1 -empty -delete
827 .for dist in base ${EXTRA_DISTRIBUTIONS}
828 @# For each file that exists in this dist, print the corresponding
829 @# line from the METALOG. This relies on the fact that
830 @# a line containing only the filename will sort immediatly before
831 @# the relevant mtree line.
832 cd ${DESTDIR}/${DISTDIR}; \
833 find ./${dist} | sort -u ${METALOG} - | \
834 awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \
835 ${DESTDIR}/${DISTDIR}/${dist}.meta
837 .if ${MK_DEBUG_FILES} != "no"
838 . for dist in base ${EXTRA_DISTRIBUTIONS}
839 @# For each file that exists in this dist, print the corresponding
840 @# line from the METALOG. This relies on the fact that
841 @# a line containing only the filename will sort immediatly before
842 @# the relevant mtree line.
843 cd ${DESTDIR}/${DISTDIR}; \
844 find ./${dist}/usr/lib/debug | sort -u ${METALOG} - | \
845 awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \
846 ${DESTDIR}/${DISTDIR}/${dist}.debug.meta
853 .for dist in base ${EXTRA_DISTRIBUTIONS}
855 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
856 tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz \
857 --exclude usr/lib/debug \
858 @${DESTDIR}/${DISTDIR}/${dist}.meta
860 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
861 tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz \
862 --exclude usr/lib/debug .
866 .if ${MK_DEBUG_FILES} != "no"
867 . for dist in base ${EXTRA_DISTRIBUTIONS}
868 . if defined(NO_ROOT)
869 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
870 tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.debug.txz \
871 @${DESTDIR}/${DISTDIR}/${dist}.debug.meta
873 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
874 tar cvJfL ${DESTDIR}/${DISTDIR}/${dist}.debug.txz \
883 # If you have a build server, you can NFS mount the source and obj directories
884 # and do a 'make reinstall' on the *client* to install new binaries from the
885 # most recent server build.
888 @echo "--------------------------------------------------------------"
889 @echo ">>> Making hierarchy"
890 @echo "--------------------------------------------------------------"
891 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 \
892 LOCAL_MTREE=${LOCAL_MTREE:Q} hierarchy
894 @echo "--------------------------------------------------------------"
895 @echo ">>> Installing everything"
896 @echo "--------------------------------------------------------------"
897 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
898 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
899 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32
903 @echo "--------------------------------------------------------------"
904 @echo ">>> Distributing everything"
905 @echo "--------------------------------------------------------------"
906 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
907 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
908 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 \
912 distrib-dirs distribution:
913 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
914 ${IMAKE_INSTALL} ${IMAKE_MTREE} METALOG=${METALOG} ${.TARGET}
917 # buildkernel and installkernel
919 # Which kernels to build and/or install is specified by setting
920 # KERNCONF. If not defined a GENERIC kernel is built/installed.
921 # Only the existing (depending TARGET) config files are used
922 # for building kernels and only the first of these is designated
923 # as the one being installed.
925 # Note that we have to use TARGET instead of TARGET_ARCH when
926 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
927 # be set to cross-build, we have to make sure TARGET is set
930 .if defined(KERNFAST)
935 # Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah
936 .if !defined(KERNCONF) && ${KERNFAST} != "1"
940 .if ${TARGET_ARCH} == "powerpc64"
945 INSTKERNNAME?= kernel
947 KERNSRCDIR?= ${.CURDIR}/sys
948 KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf
949 KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR}
950 KERNCONFDIR?= ${KRNLCONFDIR}
954 .for _kernel in ${KERNCONF}
955 .if exists(${KERNCONFDIR}/${_kernel})
956 BUILDKERNELS+= ${_kernel}
957 .if empty(INSTALLKERNEL)
958 INSTALLKERNEL= ${_kernel}
966 # Builds all kernels defined by BUILDKERNELS.
969 .if empty(BUILDKERNELS)
970 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \
974 .for _kernel in ${BUILDKERNELS}
975 @echo "--------------------------------------------------------------"
976 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
977 @echo "--------------------------------------------------------------"
978 @echo "===> ${_kernel}"
979 mkdir -p ${KRNLOBJDIR}
980 .if !defined(NO_KERNELCONFIG)
982 @echo "--------------------------------------------------------------"
983 @echo ">>> stage 1: configuring the kernel"
984 @echo "--------------------------------------------------------------"
987 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
988 ${KERNCONFDIR}/${_kernel}
990 .if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN)
992 @echo "--------------------------------------------------------------"
993 @echo ">>> stage 2.1: cleaning up the object tree"
994 @echo "--------------------------------------------------------------"
995 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR}
997 .if !defined(NO_KERNELOBJ)
999 @echo "--------------------------------------------------------------"
1000 @echo ">>> stage 2.2: rebuilding the object tree"
1001 @echo "--------------------------------------------------------------"
1002 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj
1005 @echo "--------------------------------------------------------------"
1006 @echo ">>> stage 2.3: build tools"
1007 @echo "--------------------------------------------------------------"
1008 cd ${KRNLOBJDIR}/${_kernel}; \
1009 PATH=${BPATH}:${PATH} \
1010 MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \
1011 ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF -DEARLY_BUILD \
1012 -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
1013 # XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case.
1014 .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules)
1015 .for target in obj depend all
1016 cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \
1017 PATH=${BPATH}:${PATH} \
1018 MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
1019 ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF -DEARLY_BUILD ${target}
1022 .if !defined(NO_KERNELDEPEND)
1024 @echo "--------------------------------------------------------------"
1025 @echo ">>> stage 3.1: making dependencies"
1026 @echo "--------------------------------------------------------------"
1027 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ
1030 @echo "--------------------------------------------------------------"
1031 @echo ">>> stage 3.2: building everything"
1032 @echo "--------------------------------------------------------------"
1033 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ
1034 @echo "--------------------------------------------------------------"
1035 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
1036 @echo "--------------------------------------------------------------"
1040 # installkernel, etc.
1042 # Install the kernel defined by INSTALLKERNEL
1044 installkernel installkernel.debug \
1045 reinstallkernel reinstallkernel.debug: installcheck
1046 .if empty(INSTALLKERNEL)
1047 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
1050 @echo "--------------------------------------------------------------"
1051 @echo ">>> Installing kernel ${INSTALLKERNEL}"
1052 @echo "--------------------------------------------------------------"
1053 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
1054 ${CROSSENV} PATH=${TMPPATH} \
1055 ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
1057 distributekernel distributekernel.debug:
1058 .if empty(INSTALLKERNEL)
1059 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
1062 mkdir -p ${DESTDIR}/${DISTDIR}
1063 .if defined(NO_ROOT)
1064 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.premeta
1066 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
1067 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.premeta/} \
1068 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} KERNEL=${INSTKERNNAME} \
1069 DESTDIR=${INSTALL_DDIR}/kernel \
1070 ${.TARGET:S/distributekernel/install/}
1071 .if defined(NO_ROOT)
1072 sed -e 's|^./kernel|.|' ${DESTDIR}/${DISTDIR}/kernel.premeta > \
1073 ${DESTDIR}/${DISTDIR}/kernel.meta
1075 .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
1076 .if defined(NO_ROOT)
1077 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta
1079 cd ${KRNLOBJDIR}/${_kernel}; \
1080 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.${_kernel}.premeta/} \
1081 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} \
1082 KERNEL=${INSTKERNNAME}.${_kernel} \
1083 DESTDIR=${INSTALL_DDIR}/kernel.${_kernel} \
1084 ${.TARGET:S/distributekernel/install/}
1085 sed -e 's|^./kernel|.|' \
1086 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta > \
1087 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta
1091 .if defined(NO_ROOT)
1092 cd ${DESTDIR}/${DISTDIR}/kernel; \
1093 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz \
1094 @${DESTDIR}/${DISTDIR}/kernel.meta
1095 .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
1096 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
1097 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz \
1098 @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta
1101 cd ${DESTDIR}/${DISTDIR}/kernel; \
1102 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz .
1103 .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
1104 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
1105 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz .
1112 # Build the API documentation with doxygen
1115 @if [ ! -x `/usr/bin/which doxygen` ]; then \
1116 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \
1119 cd ${.CURDIR}/tools/kerneldoc/subsys && ${MAKE} obj all
1124 # Update the source tree(s), by running svn/svnup to update to the
1128 .if (defined(CVS_UPDATE) || defined(SUP_UPDATE)) && !defined(SVN_UPDATE)
1129 @echo "--------------------------------------------------------------"
1130 @echo "CVS_UPDATE and SUP_UPDATE are no longer supported."
1131 @echo "Please see: https://wiki.freebsd.org/CvsIsDeprecated"
1132 @echo "--------------------------------------------------------------"
1135 .if defined(SVN_UPDATE)
1136 @echo "--------------------------------------------------------------"
1137 @echo ">>> Updating ${.CURDIR} using Subversion"
1138 @echo "--------------------------------------------------------------"
1139 @(cd ${.CURDIR} && ${SVN} update ${SVNFLAGS})
1143 # ------------------------------------------------------------------------
1145 # From here onwards are utility targets used by the 'make world' and
1146 # related targets. If your 'world' breaks, you may like to try to fix
1147 # the problem and manually run the following targets to attempt to
1148 # complete the build. Beware, this is *not* guaranteed to work, you
1149 # need to have a pretty good grip on the current state of the system
1150 # to attempt to manually finish it. If in doubt, 'make world' again.
1154 # legacy: Build compatibility shims for the next three targets
1157 .if ${BOOTSTRAPPING} < 700055 && ${BOOTSTRAPPING} != 0
1158 @echo "ERROR: Source upgrades from versions prior to 7.0 not supported."; \
1161 .for _tool in tools/build
1162 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \
1163 cd ${.CURDIR}/${_tool} && \
1164 ${MAKE} DIRPRFX=${_tool}/ obj && \
1165 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes && \
1166 ${MAKE} DIRPRFX=${_tool}/ depend && \
1167 ${MAKE} DIRPRFX=${_tool}/ all && \
1168 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
1172 # bootstrap-tools: Build tools needed for compatibility
1174 .if ${MK_GAMES} != "no"
1175 _strfile= games/fortune/strfile
1178 .if ${MK_CXX} != "no"
1179 _gperf= gnu/usr.bin/gperf
1182 .if ${MK_GROFF} != "no"
1183 _groff= gnu/usr.bin/groff
1186 .if ${BOOTSTRAPPING} < 800022
1190 .if ${BOOTSTRAPPING} < 800013
1191 _mklocale= usr.bin/mklocale
1194 .if ${BOOTSTRAPPING} < 900002
1198 .if ${BOOTSTRAPPING} < 900006
1202 .if ${BOOTSTRAPPING} < 1000002
1206 .if ${BOOTSTRAPPING} < 1000013
1211 .if ${BOOTSTRAPPING} < 1000014
1212 _crunch= usr.sbin/crunch
1215 .if ${BOOTSTRAPPING} < 1000026
1216 _nmtree= lib/libnetbsd \
1220 .if ${BOOTSTRAPPING} < 1000027
1224 .if ${BOOTSTRAPPING} >= 900040 && ${BOOTSTRAPPING} < 900041
1228 .if ${MK_BSNMP} != "no" && !exists(/usr/sbin/gensnmptree)
1229 _gensnmptree= usr.sbin/bsnmpd/gensnmptree
1232 .if ${MK_CLANG} != "no"
1234 lib/clang/libllvmsupport \
1235 lib/clang/libllvmtablegen \
1236 usr.bin/clang/tblgen \
1237 usr.bin/clang/clang-tblgen
1240 # dtrace tools are required for older bootstrap env and cross-build
1241 .if ${MK_CDDL} != "no" && \
1242 ((${BOOTSTRAPPING} < 1000034 && \
1243 !(${BOOTSTRAPPING} >= 901505 && ${BOOTSTRAPPING} < 999999)) \
1244 || (${MACHINE} != ${TARGET} || ${MACHINE_ARCH} != ${TARGET_ARCH}))
1245 _dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \
1246 lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge
1249 # Default to building the BSDL DTC, but build the GPL one if users explicitly
1252 .if ${MK_GPL_DTC} != "no"
1253 _dtc= gnu/usr.bin/dtc
1256 .if ${MK_KERBEROS} != "no"
1257 _kerberos5_bootstrap_tools= \
1258 kerberos5/tools/make-roken \
1259 kerberos5/lib/libroken \
1260 kerberos5/lib/libvers \
1261 kerberos5/tools/asn1_compile \
1262 kerberos5/tools/slc \
1266 # Please document (add comment) why something is in 'bootstrap-tools'.
1267 # Try to bound the building of the bootstrap-tool to just the
1268 # FreeBSD versions that need the tool built at this stage of the build.
1269 bootstrap-tools: .MAKE
1272 ${_kerberos5_bootstrap_tools} \
1282 usr.bin/makewhatis \
1295 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1296 cd ${.CURDIR}/${_tool} && \
1297 ${MAKE} DIRPRFX=${_tool}/ obj && \
1298 ${MAKE} DIRPRFX=${_tool}/ depend && \
1299 ${MAKE} DIRPRFX=${_tool}/ all && \
1300 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
1304 # build-tools: Build special purpose build tools
1306 .if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules)
1307 _aicasm= sys/modules/aic7xxx/aicasm
1310 .if !defined(NO_SHARE)
1311 _share= share/syscons/scrnmaps
1314 .if ${MK_GCC} != "no"
1315 _gcc_tools= gnu/usr.bin/cc/cc_tools
1318 .if ${MK_RESCUE} != "no"
1319 _rescue= rescue/rescue
1327 ${LOCAL_TOOL_DIRS} \
1328 lib/ncurses/ncurses \
1329 lib/ncurses/ncursesw \
1334 usr.bin/mkesdb_static \
1335 usr.bin/mkcsmapper_static \
1337 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \
1338 cd ${.CURDIR}/${_tool} && \
1339 ${MAKE} DIRPRFX=${_tool}/ obj && \
1340 ${MAKE} DIRPRFX=${_tool}/ build-tools
1344 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \
1345 cd ${.CURDIR}/${_tool} && \
1346 ${MAKE} DIRPRFX=${_tool}/ obj && \
1347 ${MAKE} DIRPRFX=${_tool}/ depend && \
1348 ${MAKE} DIRPRFX=${_tool}/ all
1352 # cross-tools: Build cross-building tools
1354 .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 800035
1355 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386"
1356 _btxld= usr.sbin/btxld
1359 .if ${TARGET_ARCH} != ${MACHINE_ARCH}
1360 .if ${MK_RESCUE} != "no" || defined(RELEASEDIR)
1361 _crunchide= usr.sbin/crunch/crunchide
1363 .if ${TARGET_ARCH} == "i386" && defined(RELEASEDIR)
1364 _kgzip= usr.sbin/kgzip
1368 .if ${XAS:M/*} == "" && ${MK_BINUTILS} != "no"
1369 _binutils= gnu/usr.bin/binutils
1372 # If an full path to an external cross compiler is given, don't build
1374 .if ${XCC:M/*} == "" && ${MK_CROSS_COMPILER} != "no"
1375 .if ${MK_CLANG} != "no" && (${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang")
1376 _clang= usr.bin/clang
1377 _clang_libs= lib/clang
1380 .if ${MK_GCC} != "no" && (${MK_CLANG_IS_CC} == "no" || ${TARGET} == "pc98")
1391 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
1395 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1396 cd ${.CURDIR}/${_tool} && \
1397 ${MAKE} DIRPRFX=${_tool}/ obj && \
1398 ${MAKE} DIRPRFX=${_tool}/ depend && \
1399 ${MAKE} DIRPRFX=${_tool}/ all && \
1400 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
1404 # hierarchy - ensure that all the needed directories are present
1407 cd ${.CURDIR}/etc && ${HMAKE} distrib-dirs
1410 # libraries - build all libraries, and install them under ${DESTDIR}.
1412 # The list of libraries with dependents (${_prebuild_libs}) and their
1413 # interdependencies (__L) are built automatically by the
1414 # ${.CURDIR}/tools/make_libdeps.sh script.
1418 ${MAKE} -f Makefile.inc1 _prereq_libs && \
1419 ${MAKE} -f Makefile.inc1 _startup_libs && \
1420 ${MAKE} -f Makefile.inc1 _prebuild_libs && \
1421 ${MAKE} -f Makefile.inc1 _generic_libs
1424 # static libgcc.a prerequisite for shared libc
1426 _prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc lib/libcompiler_rt
1428 # These dependencies are not automatically generated:
1430 # gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before
1431 # all shared libraries for ELF.
1433 _startup_libs= gnu/lib/csu
1434 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
1435 _startup_libs+= lib/csu/${MACHINE_ARCH}-elf
1436 .elif exists(${.CURDIR}/lib/csu/${MACHINE_ARCH})
1437 _startup_libs+= lib/csu/${MACHINE_ARCH}
1439 _startup_libs+= lib/csu/${MACHINE_CPUARCH}
1441 _startup_libs+= gnu/lib/libgcc
1442 _startup_libs+= lib/libcompiler_rt
1443 _startup_libs+= lib/libc
1444 .if ${MK_LIBCPLUSPLUS} != "no"
1445 _startup_libs+= lib/libcxxrt
1448 gnu/lib/libgcc__L: lib/libc__L
1449 .if ${MK_LIBCPLUSPLUS} != "no"
1450 lib/libcxxrt__L: gnu/lib/libgcc__L
1453 _prebuild_libs= ${_kerberos5_lib_libasn1} \
1454 ${_kerberos5_lib_libhdb} \
1455 ${_kerberos5_lib_libheimbase} \
1456 ${_kerberos5_lib_libheimntlm} \
1457 ${_kerberos5_lib_libheimsqlite} \
1458 ${_kerberos5_lib_libheimipcc} \
1459 ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \
1460 ${_kerberos5_lib_libroken} \
1461 ${_kerberos5_lib_libwind} \
1462 ${_lib_atf_libatf_c} \
1463 lib/libbz2 ${_libcom_err} lib/libcrypt \
1464 lib/libelf lib/libexpat \
1465 ${_lib_libgssapi} ${_lib_libipx} \
1466 lib/libkiconv lib/libkvm lib/liblzma lib/libmd \
1467 lib/ncurses/ncurses lib/ncurses/ncursesw \
1468 lib/libopie lib/libpam ${_lib_libthr} \
1469 lib/libradius lib/libsbuf lib/libtacplus \
1470 ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \
1471 ${_cddl_lib_libzfs_core} \
1472 lib/libutil ${_lib_libypclnt} lib/libz lib/msun \
1473 ${_secure_lib_libcrypto} ${_secure_lib_libssh} \
1474 ${_secure_lib_libssl}
1476 .if ${MK_ATF} != "no"
1477 _lib_atf_libatf_c= lib/atf/libatf-c
1480 .if ${MK_LIBTHR} != "no"
1481 _lib_libthr= lib/libthr
1484 .if ${MK_OFED} != "no"
1485 _ofed_lib= contrib/ofed/usr.lib/
1488 _generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib}
1489 .for _DIR in ${LOCAL_LIB_DIRS}
1490 .if exists(${.CURDIR}/${_DIR}/Makefile)
1491 _generic_libs+= ${_DIR}
1495 lib/libopie__L lib/libtacplus__L: lib/libmd__L
1497 .if ${MK_CDDL} != "no"
1498 _cddl_lib_libumem= cddl/lib/libumem
1499 _cddl_lib_libnvpair= cddl/lib/libnvpair
1500 _cddl_lib_libzfs_core= cddl/lib/libzfs_core
1502 cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L
1505 .if ${MK_CRYPT} != "no"
1506 .if ${MK_OPENSSL} != "no"
1507 _secure_lib_libcrypto= secure/lib/libcrypto
1508 _secure_lib_libssl= secure/lib/libssl
1509 lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L
1510 .if ${MK_OPENSSH} != "no"
1511 _secure_lib_libssh= secure/lib/libssh
1512 secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
1513 .if ${MK_KERBEROS_SUPPORT} != "no"
1514 secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \
1515 kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \
1516 lib/libmd__L kerberos5/lib/libroken__L
1520 _secure_lib= secure/lib
1523 .if ${MK_KERBEROS} != "no"
1524 kerberos5/lib/libasn1__L: lib/libcom_err__L kerberos5/lib/libroken__L
1525 kerberos5/lib/libhdb__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1526 kerberos5/lib/libkrb5__L kerberos5/lib/libroken__L \
1527 kerberos5/lib/libwind__L kerberos5/lib/libheimsqlite__L
1528 kerberos5/lib/libheimntlm__L: secure/lib/libcrypto__L kerberos5/lib/libkrb5__L \
1529 kerberos5/lib/libroken__L lib/libcom_err__L
1530 kerberos5/lib/libhx509__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1531 secure/lib/libcrypto__L kerberos5/lib/libroken__L kerberos5/lib/libwind__L
1532 kerberos5/lib/libkrb5__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1533 lib/libcrypt__L secure/lib/libcrypto__L kerberos5/lib/libhx509__L \
1534 kerberos5/lib/libroken__L kerberos5/lib/libwind__L \
1535 kerberos5/lib/libheimbase__L kerberos5/lib/libheimipcc__L
1536 kerberos5/lib/libroken__L: lib/libcrypt__L
1537 kerberos5/lib/libwind__L: kerberos5/lib/libroken__L lib/libcom_err__L
1538 kerberos5/lib/libheimbase__L: lib/libthr__L
1539 kerberos5/lib/libheimipcc__L: kerberos5/lib/libroken__L kerberos5/lib/libheimbase__L lib/libthr__L
1540 kerberos5/lib/libheimsqlite__L: lib/libthr__L
1543 .if ${MK_GSSAPI} != "no"
1544 _lib_libgssapi= lib/libgssapi
1547 .if ${MK_IPX} != "no"
1548 _lib_libipx= lib/libipx
1551 .if ${MK_KERBEROS} != "no"
1552 _kerberos5_lib= kerberos5/lib
1553 _kerberos5_lib_libasn1= kerberos5/lib/libasn1
1554 _kerberos5_lib_libhdb= kerberos5/lib/libhdb
1555 _kerberos5_lib_libheimbase= kerberos5/lib/libheimbase
1556 _kerberos5_lib_libkrb5= kerberos5/lib/libkrb5
1557 _kerberos5_lib_libhx509= kerberos5/lib/libhx509
1558 _kerberos5_lib_libroken= kerberos5/lib/libroken
1559 _kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm
1560 _kerberos5_lib_libheimsqlite= kerberos5/lib/libheimsqlite
1561 _kerberos5_lib_libheimipcc= kerberos5/lib/libheimipcc
1562 _kerberos5_lib_libwind= kerberos5/lib/libwind
1563 _libcom_err= lib/libcom_err
1566 .if ${MK_NIS} != "no"
1567 _lib_libypclnt= lib/libypclnt
1570 .if ${MK_OPENSSL} == "no"
1571 lib/libradius__L: lib/libmd__L
1574 .for _lib in ${_prereq_libs}
1575 ${_lib}__PL: .PHONY .MAKE
1576 .if exists(${.CURDIR}/${_lib})
1577 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1578 cd ${.CURDIR}/${_lib} && \
1579 ${MAKE} DIRPRFX=${_lib}/ obj && \
1580 ${MAKE} DIRPRFX=${_lib}/ depend && \
1581 ${MAKE} -DNO_PROFILE -DNO_PIC DIRPRFX=${_lib}/ all && \
1582 ${MAKE} -DNO_PROFILE -DNO_PIC DIRPRFX=${_lib}/ install
1586 .for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
1587 ${_lib}__L: .PHONY .MAKE
1588 .if exists(${.CURDIR}/${_lib})
1589 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1590 cd ${.CURDIR}/${_lib} && \
1591 ${MAKE} DIRPRFX=${_lib}/ obj && \
1592 ${MAKE} DIRPRFX=${_lib}/ depend && \
1593 ${MAKE} DIRPRFX=${_lib}/ all && \
1594 ${MAKE} DIRPRFX=${_lib}/ install
1598 # libpam is special: we need to build static PAM modules before
1599 # static PAM library, and dynamic PAM library before dynamic PAM
1601 lib/libpam__L: .PHONY .MAKE
1602 ${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \
1603 cd ${.CURDIR}/lib/libpam && \
1604 ${MAKE} DIRPRFX=lib/libpam/ obj && \
1605 ${MAKE} DIRPRFX=lib/libpam/ depend && \
1606 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all && \
1607 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install
1609 _prereq_libs: ${_prereq_libs:S/$/__PL/}
1610 _startup_libs: ${_startup_libs:S/$/__L/}
1611 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
1612 _generic_libs: ${_generic_libs:S/$/__L/}
1614 .for __target in all clean cleandepend cleandir depend includes obj
1615 .for entry in ${SUBDIR}
1616 ${entry}.${__target}__D: .PHONY .MAKE
1617 ${_+_}@set -e; if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
1618 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \
1619 edir=${entry}.${MACHINE_ARCH}; \
1620 cd ${.CURDIR}/$${edir}; \
1622 ${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \
1624 cd ${.CURDIR}/$${edir}; \
1626 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
1628 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
1631 .include <bsd.subdir.mk>
1633 .if make(check-old) || make(check-old-dirs) || \
1634 make(check-old-files) || make(check-old-libs) || \
1635 make(delete-old) || make(delete-old-dirs) || \
1636 make(delete-old-files) || make(delete-old-libs)
1639 # check for / delete old files section
1642 .include "ObsoleteFiles.inc"
1644 OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \
1645 else you can not start such an application. Consult UPDATING for more \
1646 information regarding how to cope with the removal/revision bump of a \
1649 .if !defined(BATCH_DELETE_OLD_FILES)
1656 @echo ">>> Removing old files (only deletes safe to delete libs)"
1657 # Ask for every old file if the user really wants to remove it.
1658 # It's annoying, but better safe than sorry.
1659 # NB: We cannot pass the list of OLD_FILES as a parameter because the
1660 # argument list will get too long. Using .for/.endfor make "loops" will make
1661 # the Makefile parser segfault.
1663 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1664 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1665 while read file; do \
1666 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1667 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1668 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1671 # Remove catpages without corresponding manpages.
1673 find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1674 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1675 while read catpage; do \
1677 if [ ! -e "$${manpage}" ]; then \
1678 rm ${RM_I} $${catpage} <&3; \
1681 @echo ">>> Old files removed"
1684 @echo ">>> Checking for old files"
1685 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1686 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1687 while read file; do \
1688 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1689 echo "${DESTDIR}/$${file}"; \
1692 # Check for catpages without corresponding manpages.
1693 @find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1694 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1695 while read catpage; do \
1697 if [ ! -e "$${manpage}" ]; then \
1703 @echo ">>> Removing old libraries"
1704 @echo "${OLD_LIBS_MESSAGE}" | fmt
1706 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1707 -V OLD_LIBS | xargs -n1 | \
1708 while read file; do \
1709 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1710 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1711 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1714 @echo ">>> Old libraries removed"
1717 @echo ">>> Checking for old libraries"
1718 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1719 -V OLD_LIBS | xargs -n1 | \
1720 while read file; do \
1721 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1722 echo "${DESTDIR}/$${file}"; \
1727 @echo ">>> Removing old directories"
1728 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1729 -V OLD_DIRS | xargs -n1 | \
1730 while read dir; do \
1731 if [ -d "${DESTDIR}/$${dir}" ]; then \
1732 rmdir -v "${DESTDIR}/$${dir}" || true; \
1733 elif [ -L "${DESTDIR}/$${dir}" ]; then \
1734 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1737 @echo ">>> Old directories removed"
1740 @echo ">>> Checking for old directories"
1741 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1742 -V OLD_DIRS | xargs -n1 | \
1743 while read dir; do \
1744 if [ -d "${DESTDIR}/$${dir}" ]; then \
1745 echo "${DESTDIR}/$${dir}"; \
1746 elif [ -L "${DESTDIR}/$${dir}" ]; then \
1747 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1751 delete-old: delete-old-files delete-old-dirs
1752 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1754 check-old: check-old-files check-old-libs check-old-dirs
1755 @echo "To remove old files and directories run '${MAKE} delete-old'."
1756 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1761 # showconfig - show build configuration.
1764 @${MAKE} -n -f bsd.own.mk -V dummy -dg1 2>&1 | grep ^MK_ | sort
1766 .if !empty(KRNLOBJDIR) && !empty(KERNCONF)
1767 DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/
1769 .if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE)
1770 .if exists(${KERNCONFDIR}/${KERNCONF})
1771 FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \
1772 ${KERNCONFDIR}/${KERNCONF} ; echo
1778 .if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH})
1779 DTBOUTPUTPATH= ${.CURDIR}
1783 # Build 'standalone' Device Tree Blob
1786 @if [ "${FDT_DTS_FILE}" = "" ]; then \
1787 echo "ERROR: FDT_DTS_FILE must be specified!"; \
1790 if [ ! -f ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE} ]; then \
1791 echo "ERROR: Specified DTS file (${FDT_DTS_FILE}) does not \
1795 if [ "${DTBOUTPUTPATH}" = "${.CURDIR}" ]; then \
1796 echo "WARNING: DTB will be placed in the current working \
1801 ${DTBOUTPUTPATH}/`echo ${FDT_DTS_FILE} | cut -d. -f1`.dtb -b 0 \
1802 -p 1024 ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE}
1806 .if defined(XDEV) && defined(XDEV_ARCH)
1808 .if ${XDEV} == ${MACHINE} && ${XDEV_ARCH} == ${MACHINE_ARCH}
1809 XDEV_CPUTYPE?=${CPUTYPE}
1811 XDEV_CPUTYPE?=${TARGET_CPUTYPE}
1814 NOFUN=-DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
1815 -DWITHOUT_MAN -DWITHOUT_NLS -DNO_PROFILE \
1816 -DWITHOUT_KERBEROS -DWITHOUT_RESCUE -DNO_WARNS \
1817 TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH} \
1818 CPUTYPE=${XDEV_CPUTYPE}
1820 XDDIR=${XDEV_ARCH}-freebsd
1822 CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \
1823 INSTALL="sh ${.CURDIR}/tools/install.sh"
1825 _SHLIBDIRPREFIX=${XDDESTDIR} \
1826 TOOLS_PREFIX=${XDDESTDIR}
1827 CD2CFLAGS=-isystem ${XDDESTDIR}/usr/include -L${XDDESTDIR}/usr/lib \
1828 -B${XDDESTDIR}/usr/lib
1829 CD2ENV=${CDENV} CC="${CC} ${CD2CFLAGS}" \
1830 MACHINE=${XDEV} MACHINE_ARCH=${XDEV_ARCH}
1832 CDTMP= ${MAKEOBJDIRPREFIX}/${XDDIR}/${.CURDIR}/tmp
1833 CDMAKE=${CDENV} PATH=${CDTMP}/usr/bin:${PATH} ${MAKE} ${NOFUN}
1834 CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDTP}/usr/bin:${PATH} ${MAKE} ${NOFUN}
1835 XDDESTDIR=${DESTDIR}${XDTP}
1837 OSREL!= uname -r | sed -e 's/[-(].*//'
1840 .ORDER: xdev-build xdev-install
1841 xdev: xdev-build xdev-install
1843 .ORDER: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools
1844 xdev-build: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools
1847 mkdir -p ${CDTMP}/usr
1848 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1849 -p ${CDTMP}/usr >/dev/null
1851 _xb-bootstrap-tools:
1854 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1855 cd ${.CURDIR}/${_tool} && \
1856 ${CDMAKE} DIRPRFX=${_tool}/ obj && \
1857 ${CDMAKE} DIRPRFX=${_tool}/ depend && \
1858 ${CDMAKE} DIRPRFX=${_tool}/ all && \
1859 ${CDMAKE} DIRPRFX=${_tool}/ DESTDIR=${CDTMP} install
1863 ${_+_}@cd ${.CURDIR}; \
1864 ${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools
1868 gnu/usr.bin/binutils \
1873 ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \
1874 cd ${.CURDIR}/${_tool} && \
1875 ${CDMAKE} DIRPRFX=${_tool}/ obj && \
1876 ${CDMAKE} DIRPRFX=${_tool}/ depend && \
1877 ${CDMAKE} DIRPRFX=${_tool}/ all
1881 ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}"
1882 mkdir -p ${XDDESTDIR}
1883 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
1884 -p ${XDDESTDIR} >/dev/null
1885 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1886 -p ${XDDESTDIR}/usr >/dev/null
1887 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
1888 -p ${XDDESTDIR}/usr/include >/dev/null
1890 .ORDER: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
1891 xdev-install: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
1894 @echo "_xi-cross-tools"
1896 gnu/usr.bin/binutils \
1900 ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \
1901 cd ${.CURDIR}/${_tool}; \
1902 ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR}
1906 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 par-includes \
1907 DESTDIR=${XDDESTDIR}
1910 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \
1911 DESTDIR=${XDDESTDIR}
1914 ${_+_}cd ${XDDESTDIR}/usr/bin; \
1916 ln -sf ../../${XDTP}/usr/bin/$$i \
1917 ../../../../usr/bin/${XDDIR}-$$i; \
1918 ln -sf ../../${XDTP}/usr/bin/$$i \
1919 ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \
1922 xdev xdev-build xdev-install:
1923 @echo "*** Error: Both XDEV and XDEV_ARCH must be defined for \"${.TARGET}\" target"
1926 buildkernel ${WMAKE_TGTS} ${.ALLTARGETS:M_*}: .MAKE