4 # Make command line options:
5 # -DNO_CLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
6 # -DNO_CLEAN do not clean at all
7 # -DNO_SHARE do not go into share subdir
8 # -DKERNFAST define NO_KERNEL{CONFIG,CLEAN,DEPEND,OBJ}
9 # -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel
10 # -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel
11 # -DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel
12 # -DNO_KERNELOBJ do not run ${MAKE} obj in ${MAKE} buildkernel
13 # -DNO_PORTSUPDATE do not update ports in ${MAKE} update
14 # -DNO_DOCUPDATE do not update doc in ${MAKE} update
15 # -DNO_CTF do not run the DTrace CTF conversion tools on built objects
16 # LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
17 # TARGET="machine" to crossbuild world for a different machine type
18 # TARGET_ARCH= may be required when a TARGET supports multiple endians
21 # The intended user-driven targets are:
22 # buildworld - rebuild *everything*, including glue to help do upgrades
23 # installworld- install everything built by "buildworld"
24 # doxygen - build API documentation of the kernel
25 # update - convenient way to update your source tree (eg: cvsup/cvs)
27 # Standard targets (not defined here) are documented in the makefiles in
28 # /usr/share/mk. These include:
29 # obj depend all install clean cleandepend cleanobj
33 .include <bsd.arch.inc.mk>
35 # We must do share/info early so that installation of info `dir'
36 # entries works correctly. Do it first since it is less likely to
37 # grow dependencies on include and lib than vice versa.
39 # We must do lib/ and libexec/ before bin/, because if installworld
40 # installs a new /bin/sh, the 'make' command will *immediately*
41 # use that new version. And the new (dynamically-linked) /bin/sh
42 # will expect to find appropriate libraries in /lib and /libexec.
44 SUBDIR= share/info lib libexec
46 .if ${MK_GAMES} != "no"
49 .if ${MK_CDDL} != "no"
55 .if ${MK_KERBEROS} != "no"
58 .if ${MK_RESCUE} != "no"
62 .if ${MK_CRYPT} != "no"
65 .if !defined(NO_SHARE)
68 SUBDIR+=sys usr.bin usr.sbin
70 # We must do etc/ last for install/distribute to work.
74 # These are last, since it is nice to at least get the base system
75 # rebuilt before you do them.
76 .for _DIR in ${LOCAL_DIRS}
77 .if exists(${.CURDIR}/${_DIR}/Makefile)
82 .if defined(SUBDIR_OVERRIDE)
83 SUBDIR= ${SUBDIR_OVERRIDE}
89 .if defined(NO_CLEANDIR)
90 CLEANDIR= clean cleandepend
96 CVSFLAGS?= -A -P -d -I!
102 SUPFLAGS+= -h ${SUPHOST}
105 MAKEOBJDIRPREFIX?= /usr/obj
106 .if !defined(OSRELDATE)
107 .if exists(/usr/include/osreldate.h)
108 OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
109 /usr/include/osreldate.h
115 .if !defined(VERSION)
117 VERSION+= ${OSRELDATE}
120 # Guess machine architecture from machine type, and vice versa.
121 .if !defined(TARGET_ARCH) && defined(TARGET)
122 TARGET_ARCH= ${TARGET:S/pc98/i386/:S/sun4v/sparc64/}
123 .elif !defined(TARGET) && defined(TARGET_ARCH) && \
124 ${TARGET_ARCH} != ${MACHINE_ARCH}
125 TARGET= ${TARGET_ARCH}
127 # Otherwise, default to current machine type and architecture.
129 TARGET_ARCH?= ${MACHINE_ARCH}
131 KNOWN_ARCHES?= amd64 arm i386 i386/pc98 ia64 mips powerpc powerpc64/powerpc sparc64 sparc64/sun4v
132 .if ${TARGET} == ${TARGET_ARCH}
135 _t= ${TARGET_ARCH}/${TARGET}
138 .if empty(KNOWN_ARCHES:M${_t})
139 .error Unknown target ${TARGET_ARCH}:${TARGET}.
143 .if ${TARGET} == ${MACHINE}
144 TARGET_CPUTYPE?=${CPUTYPE}
149 .if !empty(TARGET_CPUTYPE)
150 _TARGET_CPUTYPE=${TARGET_CPUTYPE}
152 _TARGET_CPUTYPE=dummy
154 _CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} \
155 -f /dev/null -m ${.CURDIR}/share/mk -V CPUTYPE
156 .if ${_CPUTYPE} != ${_TARGET_CPUTYPE}
157 .error CPUTYPE global should be set with ?=.
160 BUILD_ARCH!= uname -p
161 .if ${MACHINE_ARCH} != ${BUILD_ARCH}
162 .error To cross-build, set TARGET_ARCH.
165 .if ${MACHINE} == ${TARGET} && !defined(CROSS_BUILD_TESTING)
166 OBJTREE= ${MAKEOBJDIRPREFIX}
168 OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH}
170 WORLDTMP= ${OBJTREE}${.CURDIR}/tmp
171 # /usr/games added for fortune which depend on strfile
172 BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games
173 XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
174 STRICTTMPPATH= ${BPATH}:${XPATH}
175 TMPPATH= ${STRICTTMPPATH}:${PATH}
178 # Avoid running mktemp(1) unless actually needed.
179 # It may not be functional, e.g., due to new ABI
180 # when in the middle of installing over this system.
182 .if make(distributeworld) || make(installworld)
183 INSTALLTMP!= /usr/bin/mktemp -d -u -t install
187 # Building a world goes through the following stages
189 # 1. legacy stage [BMAKE]
190 # This stage is responsible for creating compatibility
191 # shims that are needed by the bootstrap-tools,
192 # build-tools and cross-tools stages.
193 # 1. bootstrap-tools stage [BMAKE]
194 # This stage is responsible for creating programs that
195 # are needed for backward compatibility reasons. They
196 # are not built as cross-tools.
197 # 2. build-tools stage [TMAKE]
198 # This stage is responsible for creating the object
199 # tree and building any tools that are needed during
201 # 3. cross-tools stage [XMAKE]
202 # This stage is responsible for creating any tools that
203 # are needed for cross-builds. A cross-compiler is one
205 # 4. world stage [WMAKE]
206 # This stage actually builds the world.
207 # 5. install stage (optional) [IMAKE]
208 # This stage installs a previously built world.
213 # Common environment for world related stages
214 CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \
215 MACHINE_ARCH=${TARGET_ARCH} \
217 CPUTYPE=${TARGET_CPUTYPE} \
218 GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
219 GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \
220 GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac
221 .if ${OSRELDATE} < 700044
222 CROSSENV+= AR=gnu-ar RANLIB=gnu-ranlib
225 # bootstrap-tools stage
226 BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
227 PATH=${BPATH}:${PATH} \
228 WORLDTMP=${WORLDTMP} \
229 VERSION="${VERSION}" \
230 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}"
231 BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
232 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
234 BOOTSTRAPPING=${OSRELDATE} \
236 -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \
237 -DNO_PIC -DWITHOUT_PROFILE -DNO_SHARED \
238 -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF
241 TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
242 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
243 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
246 BOOTSTRAPPING=${OSRELDATE} -DNO_LINT -DNO_CPU_CFLAGS \
250 XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \
251 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
255 WMAKEENV= ${CROSSENV} \
256 _SHLIBDIRPREFIX=${WORLDTMP} \
257 VERSION="${VERSION}" \
258 INSTALL="sh ${.CURDIR}/tools/install.sh" \
260 .if ${MK_CDDL} == "no"
263 WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1 DESTDIR=${WORLDTMP}
265 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
267 LIB32TMP= ${OBJTREE}${.CURDIR}/lib32
269 .if ${TARGET_ARCH} == "amd64"
270 .if empty(TARGET_CPUTYPE)
271 LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2
273 LIB32CPUFLAGS= -march=${TARGET_CPUTYPE}
275 LIB32CPUFLAGS+= -mfancy-math-387
276 LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \
277 MACHINE_CPU="i686 mmx sse sse2" \
278 LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" \
281 .elif ${TARGET_ARCH} == "powerpc64"
282 .if empty(TARGET_CPUTYPE)
283 LIB32CPUFLAGS= -mcpu=powerpc
285 LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE}
287 LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc \
288 LD="${LD} -m elf32ppc"
292 LIB32FLAGS= -m32 ${LIB32CPUFLAGS} -DCOMPAT_32BIT \
293 -isystem ${LIB32TMP}/usr/include/ \
294 -L${LIB32TMP}/usr/lib32 \
295 -B${LIB32TMP}/usr/lib32
297 # Yes, the flags are redundant.
298 LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \
299 _SHLIBDIRPREFIX=${LIB32TMP} \
300 VERSION="${VERSION}" \
301 INSTALL="sh ${.CURDIR}/tools/install.sh" \
303 CC="${CC} ${LIB32FLAGS}" \
304 CXX="${CXX} ${LIB32FLAGS}" \
305 OBJC="${OBJC} ${LIB32FLAGS}" \
309 LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} -DNO_CPU_CFLAGS -DCOMPAT_32BIT \
310 -DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO \
311 -DWITHOUT_HTML -DNO_CTF DESTDIR=${LIB32TMP}
312 LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*} -DNO_INCS
316 IMAKEENV= ${CROSSENV}
317 IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1
318 .if empty(.MAKEFLAGS:M-n)
319 IMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMP} \
320 LD_LIBRARY_PATH=${INSTALLTMP} \
321 PATH_LOCALE=${INSTALLTMP}/locale
322 IMAKE+= __MAKE_SHELL=${INSTALLTMP}/sh
324 IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP}
328 KMAKEENV= ${WMAKEENV}
329 KMAKE= ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME}
334 # Attempt to rebuild the entire system, with reasonable chance of
335 # success, regardless of how old your existing system is.
338 .if ${.CURDIR:C/[^,]//g} != ""
339 # The m4 build of sendmail files doesn't like it if ',' is used
340 # anywhere in the path of it's files.
342 @echo "*** Error: path to source tree contains a comma ','"
347 @echo "--------------------------------------------------------------"
348 @echo ">>> Rebuilding the temporary build tree"
349 @echo "--------------------------------------------------------------"
350 .if !defined(NO_CLEAN)
352 .if defined(LIB32TMP)
356 rm -rf ${WORLDTMP}/legacy/usr/include
357 # XXX - These three can depend on any header file.
358 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
359 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c
360 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
364 mkdir -p ${WORLDTMP}/${_dir}
366 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
367 -p ${WORLDTMP}/legacy/usr >/dev/null
368 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
369 -p ${WORLDTMP}/usr >/dev/null
370 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
371 -p ${WORLDTMP}/usr/include >/dev/null
372 ln -sf ${.CURDIR}/sys ${WORLDTMP}
373 .if ${MK_BIND_LIBS} != "no"
374 mtree -deU -f ${.CURDIR}/etc/mtree/BIND.include.dist \
375 -p ${WORLDTMP}/usr/include >/dev/null
379 @echo "--------------------------------------------------------------"
380 @echo ">>> stage 1.1: legacy release compatibility shims"
381 @echo "--------------------------------------------------------------"
382 ${_+_}cd ${.CURDIR}; ${BMAKE} legacy
385 @echo "--------------------------------------------------------------"
386 @echo ">>> stage 1.2: bootstrap tools"
387 @echo "--------------------------------------------------------------"
388 ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools
390 .if !defined(NO_CLEAN)
392 @echo "--------------------------------------------------------------"
393 @echo ">>> stage 2.1: cleaning up the object tree"
394 @echo "--------------------------------------------------------------"
395 ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
396 .if defined(LIB32TMP)
397 ${_+_}cd ${.CURDIR}; ${LIB32WMAKE} -f Makefile.inc1 ${CLEANDIR:S/^/par-/}
402 @echo "--------------------------------------------------------------"
403 @echo ">>> stage 2.2: rebuilding the object tree"
404 @echo "--------------------------------------------------------------"
405 ${_+_}cd ${.CURDIR}; ${WMAKE} par-obj
408 @echo "--------------------------------------------------------------"
409 @echo ">>> stage 2.3: build tools"
410 @echo "--------------------------------------------------------------"
411 ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools
414 @echo "--------------------------------------------------------------"
415 @echo ">>> stage 3: cross tools"
416 @echo "--------------------------------------------------------------"
417 ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools
420 @echo "--------------------------------------------------------------"
421 @echo ">>> stage 4.1: building includes"
422 @echo "--------------------------------------------------------------"
423 ${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
426 @echo "--------------------------------------------------------------"
427 @echo ">>> stage 4.2: building libraries"
428 @echo "--------------------------------------------------------------"
429 ${_+_}cd ${.CURDIR}; \
430 ${WMAKE} -DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
431 -DWITHOUT_MAN -DWITHOUT_PROFILE libraries
434 @echo "--------------------------------------------------------------"
435 @echo ">>> stage 4.3: make dependencies"
436 @echo "--------------------------------------------------------------"
437 ${_+_}cd ${.CURDIR}; ${WMAKE} par-depend
440 @echo "--------------------------------------------------------------"
441 @echo ">>> stage 4.4: building everything"
442 @echo "--------------------------------------------------------------"
443 ${_+_}cd ${.CURDIR}; ${WMAKE} par-all
444 .if defined(LIB32TMP)
447 @echo "--------------------------------------------------------------"
448 @echo ">>> stage 5.1: building 32 bit shim libraries"
449 @echo "--------------------------------------------------------------"
450 mkdir -p ${LIB32TMP}/usr/lib32
451 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
452 -p ${LIB32TMP}/usr >/dev/null
453 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
454 -p ${LIB32TMP}/usr/include >/dev/null
456 ln -sf ${.CURDIR}/sys ${WORLDTMP}
457 .if ${MK_KERBEROS} != "no"
458 .for _t in obj depend all
459 cd ${.CURDIR}/kerberos5/tools; \
460 MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \
464 .for _t in obj includes
465 cd ${.CURDIR}/include; ${LIB32WMAKE} ${_t}
466 cd ${.CURDIR}/lib; ${LIB32WMAKE} ${_t}
467 .if ${MK_CDDL} != "no"
468 cd ${.CURDIR}/cddl/lib; ${LIB32WMAKE} ${_t}
470 cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} ${_t}
471 .if ${MK_CRYPT} != "no"
472 cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} ${_t}
474 .if ${MK_KERBEROS} != "no"
475 cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} ${_t}
478 .for _dir in usr.bin/lex/lib
479 cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} obj
481 .for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic
482 cd ${.CURDIR}/${_dir}; \
483 MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \
487 ${LIB32WMAKE} -f Makefile.inc1 libraries
488 .for _t in obj depend all
489 cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32WMAKE} ${_t}
490 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32WMAKE} ${_t}
493 distribute32 install32:
494 .if make(distribute32)
495 mkdir -p ${DISTDIR}/${DISTRIBUTION}/usr/lib32 # XXX add to mtree
496 mkdir -p ${DISTDIR}/${DISTRIBUTION}/usr/lib32/dtrace # XXX add to mtree
498 mkdir -p ${DESTDIR}/usr/lib32 # XXX add to mtree
499 mkdir -p ${DESTDIR}/usr/lib32/dtrace # XXX add to mtree
501 cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
502 .if ${MK_CDDL} != "no"
503 cd ${.CURDIR}/cddl/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
505 cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
506 .if ${MK_CRYPT} != "no"
507 cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
509 .if ${MK_KERBEROS} != "no"
510 cd ${.CURDIR}/kerberos5/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
512 cd ${.CURDIR}/libexec/rtld-elf; \
513 PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//}
514 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32IMAKE} ${.TARGET:S/32$//}
518 .if !defined(SUBDIR_OVERRIDE)
519 WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools
521 WMAKE_TGTS+= _cleanobj _obj _build-tools
522 .if !defined(SUBDIR_OVERRIDE)
523 WMAKE_TGTS+= _cross-tools
525 WMAKE_TGTS+= _includes _libraries _depend everything
526 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
530 buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
531 .ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
534 @echo "--------------------------------------------------------------"
535 @echo ">>> World build started on `LC_ALL=C date`"
536 @echo "--------------------------------------------------------------"
540 @echo "--------------------------------------------------------------"
541 @echo ">>> World build completed on `LC_ALL=C date`"
542 @echo "--------------------------------------------------------------"
545 # We need to have this as a target because the indirection between Makefile
546 # and Makefile.inc1 causes the correct PATH to be used, rather than a
547 # modification of the current environment's PATH. In addition, we need
548 # to quote multiword values.
554 @echo Entering world for ${TARGET_ARCH}:${TARGET}
555 @cd ${.CURDIR} && env ${WMAKEENV} sh || true
557 TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything:Nbuild32}
558 toolchain: ${TOOLCHAIN_TGTS}
559 kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries}
564 # Checks to be sure system is ready for installworld/installkernel.
569 # Require DESTDIR to be set if installing for a different architecture.
571 .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE}
572 .if !make(distributeworld)
573 installcheck: installcheck_DESTDIR
574 installcheck_DESTDIR:
575 .if !defined(DESTDIR) || empty(DESTDIR)
576 @echo "ERROR: Please set DESTDIR!"; \
583 # Check for missing UIDs/GIDs.
587 .if ${MK_SENDMAIL} != "no"
593 CHECK_GIDS+= proxy authpf
595 installcheck: installcheck_UGID
597 .for uid in ${CHECK_UIDS}
598 @if ! `id -u ${uid} >/dev/null 2>&1`; then \
599 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \
603 .for gid in ${CHECK_GIDS}
604 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \
605 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \
611 # Required install tools to be saved in a scratch dir for safety.
613 .if ${MK_INFO} != "no"
614 _install-info= install-info
616 .if ${MK_ZONEINFO} != "no"
617 _zoneinfo= zic tzsetup
620 ITOOLS= [ awk cap_mkdb cat chflags chmod chown \
621 date echo egrep find grep ${_install-info} \
622 ln lockf make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
623 test true uname wc ${_zoneinfo}
628 # Distributes everything compiled by a `buildworld'.
632 # Installs everything compiled by a 'buildworld'.
634 distributeworld installworld: installcheck
635 mkdir -p ${INSTALLTMP}
636 progs=$$(for prog in ${ITOOLS}; do \
637 if progpath=`which $$prog`; then \
640 echo "Required tool $$prog not found in PATH." >&2; \
644 libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | \
645 while read line; do \
647 if [ "$$2 $$3" != "not found" ]; then \
650 echo "Required library $$1 not found." >&2; \
654 cp $$libs $$progs ${INSTALLTMP}
655 cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale
656 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \
657 ${IMAKEENV} rm -rf ${INSTALLTMP}
662 # If you have a build server, you can NFS mount the source and obj directories
663 # and do a 'make reinstall' on the *client* to install new binaries from the
664 # most recent server build.
667 @echo "--------------------------------------------------------------"
668 @echo ">>> Making hierarchy"
669 @echo "--------------------------------------------------------------"
670 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
672 @echo "--------------------------------------------------------------"
673 @echo ">>> Installing everything"
674 @echo "--------------------------------------------------------------"
675 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
676 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
677 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32
681 @echo "--------------------------------------------------------------"
682 @echo ">>> Distributing everything"
683 @echo "--------------------------------------------------------------"
684 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
685 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
686 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 \
690 distrib-dirs distribution:
691 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} ${.TARGET}
694 # buildkernel and installkernel
696 # Which kernels to build and/or install is specified by setting
697 # KERNCONF. If not defined a GENERIC kernel is built/installed.
698 # Only the existing (depending TARGET) config files are used
699 # for building kernels and only the first of these is designated
700 # as the one being installed.
702 # Note that we have to use TARGET instead of TARGET_ARCH when
703 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
704 # be set to cross-build, we have to make sure TARGET is set
707 .if defined(KERNFAST)
712 # Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah
713 .if !defined(KERNCONF) && ${KERNFAST} != "1"
717 .if !defined(KERNCONF) && defined(KERNEL)
721 .if ${TARGET_ARCH} == "powerpc64"
727 INSTKERNNAME?= kernel
729 KERNSRCDIR?= ${.CURDIR}/sys
730 KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf
731 KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR}
732 KERNCONFDIR?= ${KRNLCONFDIR}
736 .for _kernel in ${KERNCONF}
737 .if exists(${KERNCONFDIR}/${_kernel})
738 BUILDKERNELS+= ${_kernel}
739 .if empty(INSTALLKERNEL)
740 INSTALLKERNEL= ${_kernel}
748 # Builds all kernels defined by BUILDKERNELS.
751 .if empty(BUILDKERNELS)
752 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \
755 .if defined(KERNWARN)
756 @echo "--------------------------------------------------------------"
757 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
758 @echo "--------------------------------------------------------------"
762 .for _kernel in ${BUILDKERNELS}
763 @echo "--------------------------------------------------------------"
764 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
765 @echo "--------------------------------------------------------------"
766 @echo "===> ${_kernel}"
767 mkdir -p ${KRNLOBJDIR}
768 .if !defined(NO_KERNELCONFIG)
770 @echo "--------------------------------------------------------------"
771 @echo ">>> stage 1: configuring the kernel"
772 @echo "--------------------------------------------------------------"
775 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
776 ${KERNCONFDIR}/${_kernel}
778 .if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN)
780 @echo "--------------------------------------------------------------"
781 @echo ">>> stage 2.1: cleaning up the object tree"
782 @echo "--------------------------------------------------------------"
783 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR}
785 .if !defined(NO_KERNELOBJ)
787 @echo "--------------------------------------------------------------"
788 @echo ">>> stage 2.2: rebuilding the object tree"
789 @echo "--------------------------------------------------------------"
790 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj
793 @echo "--------------------------------------------------------------"
794 @echo ">>> stage 2.3: build tools"
795 @echo "--------------------------------------------------------------"
796 cd ${KRNLOBJDIR}/${_kernel}; \
797 MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \
798 ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS \
799 -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
800 # XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case.
801 .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules)
802 .for target in obj depend all
803 cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \
804 MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
805 ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF ${target}
808 .if !defined(NO_KERNELDEPEND)
810 @echo "--------------------------------------------------------------"
811 @echo ">>> stage 3.1: making dependencies"
812 @echo "--------------------------------------------------------------"
813 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ
816 @echo "--------------------------------------------------------------"
817 @echo ">>> stage 3.2: building everything"
818 @echo "--------------------------------------------------------------"
819 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ
820 @echo "--------------------------------------------------------------"
821 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
822 @echo "--------------------------------------------------------------"
826 # installkernel, etc.
828 # Install the kernel defined by INSTALLKERNEL
830 installkernel installkernel.debug \
831 reinstallkernel reinstallkernel.debug: installcheck
832 .if empty(INSTALLKERNEL)
833 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
836 @echo "--------------------------------------------------------------"
837 @echo ">>> Installing kernel"
838 @echo "--------------------------------------------------------------"
839 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
840 ${CROSSENV} PATH=${TMPPATH} \
841 ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
846 # Build the API documentation with doxygen
849 @if [ ! -x `/usr/bin/which doxygen` ]; then \
850 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \
853 cd ${.CURDIR}/tools/kerneldoc/subsys && ${MAKE} obj all
858 # Update the source tree, by running cvsup and/or running cvs to update to the
862 .if defined(SUP_UPDATE)
863 @echo "--------------------------------------------------------------"
864 @echo ">>> Running ${SUP}"
865 @echo "--------------------------------------------------------------"
867 @${SUP} ${SUPFLAGS} ${SUPFILE}
869 .if defined(SUPFILE1)
870 @${SUP} ${SUPFLAGS} ${SUPFILE1}
872 .if defined(SUPFILE2)
873 @${SUP} ${SUPFLAGS} ${SUPFILE2}
875 .if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
876 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
878 .if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
879 @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
882 .if defined(CVS_UPDATE)
884 if [ -d CVS ] ; then \
885 echo "--------------------------------------------------------------" ; \
886 echo ">>> Updating ${.CURDIR} from CVS repository" ${CVSROOT} ; \
887 echo "--------------------------------------------------------------" ; \
888 echo ${CVS} -R -q update ${CVSFLAGS} ; \
889 ${CVS} -R -q update ${CVSFLAGS} ; \
892 .if defined(SVN_UPDATE)
894 if [ -d .svn ] ; then \
895 echo "--------------------------------------------------------------" ; \
896 echo ">>> Updating ${.CURDIR} using Subversion" ; \
897 echo "--------------------------------------------------------------" ; \
898 echo ${SVN} update ${SVNFLAGS} ; \
899 ${SVN} update ${SVNFLAGS} ; \
904 # ------------------------------------------------------------------------
906 # From here onwards are utility targets used by the 'make world' and
907 # related targets. If your 'world' breaks, you may like to try to fix
908 # the problem and manually run the following targets to attempt to
909 # complete the build. Beware, this is *not* guaranteed to work, you
910 # need to have a pretty good grip on the current state of the system
911 # to attempt to manually finish it. If in doubt, 'make world' again.
915 # legacy: Build compatibility shims for the next three targets
918 .if ${BOOTSTRAPPING} < 600034 && ${BOOTSTRAPPING} != 0
919 @echo "ERROR: Source upgrades from versions prior to 6.0 not supported."; \
922 .for _tool in tools/build
923 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \
924 cd ${.CURDIR}/${_tool}; \
925 ${MAKE} DIRPRFX=${_tool}/ obj; \
926 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \
927 ${MAKE} DIRPRFX=${_tool}/ depend; \
928 ${MAKE} DIRPRFX=${_tool}/ all; \
929 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
933 # bootstrap-tools: Build tools needed for compatibility
935 .if ${MK_GAMES} != "no"
936 _strfile= games/fortune/strfile
939 .if ${MK_CXX} != "no"
940 _gperf= gnu/usr.bin/gperf
941 .if ${BOOTSTRAPPING} < 700004
942 _groff= gnu/usr.bin/groff
944 _groff= gnu/usr.bin/groff/tmac
948 .if ${BOOTSTRAPPING} >= 700044 && ${BOOTSTRAPPING} < 800022
952 .if ${BOOTSTRAPPING} < 800013
953 _mklocale= usr.bin/mklocale
956 .if ${BOOTSTRAPPING} < 900002
960 .if ${BOOTSTRAPPING} < 900006
965 .if ${BOOTSTRAPPING} < 700018
966 _gensnmptree= usr.sbin/bsnmpd/gensnmptree
969 .if ${MK_RESCUE} != "no" && \
970 ${BOOTSTRAPPING} < 700026
971 _crunchgen= usr.sbin/crunch/crunchgen
974 # XXX: There is no way to specify bootstrap tools depending on MK-flags
975 # with different per-architecture default values. Always build tblgen.
977 lib/clang/libllvmsupport \
978 lib/clang/libllvmsystem \
981 .if ${MK_CDDL} != "no"
982 _dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \
983 lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge
986 .if ${MK_FDT} != "no"
987 _dtc= gnu/usr.bin/dtc
1000 usr.bin/makewhatis \
1010 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1011 cd ${.CURDIR}/${_tool}; \
1012 ${MAKE} DIRPRFX=${_tool}/ obj; \
1013 ${MAKE} DIRPRFX=${_tool}/ depend; \
1014 ${MAKE} DIRPRFX=${_tool}/ all; \
1015 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
1019 # build-tools: Build special purpose build tools
1021 .if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules)
1022 _aicasm= sys/modules/aic7xxx/aicasm
1025 .if !defined(NO_SHARE)
1026 _share= share/syscons/scrnmaps
1029 .if ${MK_KERBEROS} != "no"
1030 _kerberos5_tools= kerberos5/tools
1033 .if ${MK_RESCUE} != "no"
1034 _rescue= rescue/rescue
1042 lib/ncurses/ncurses \
1043 lib/ncurses/ncursesw \
1049 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \
1050 cd ${.CURDIR}/${_tool}; \
1051 ${MAKE} DIRPRFX=${_tool}/ obj; \
1052 ${MAKE} DIRPRFX=${_tool}/ build-tools
1055 gnu/usr.bin/cc/cc_tools \
1057 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \
1058 cd ${.CURDIR}/${_tool}; \
1059 ${MAKE} DIRPRFX=${_tool}/ obj; \
1060 ${MAKE} DIRPRFX=${_tool}/ depend; \
1061 ${MAKE} DIRPRFX=${_tool}/ all
1065 # cross-tools: Build cross-building tools
1067 .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 800035
1068 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386"
1069 _btxld= usr.sbin/btxld
1072 .if ${TARGET_ARCH} != ${MACHINE_ARCH}
1073 .if ${MK_RESCUE} != "no" || defined(RELEASEDIR)
1074 _crunchide= usr.sbin/crunch/crunchide
1076 .if ${TARGET_ARCH} == "i386" && defined(RELEASEDIR)
1077 _kgzip= usr.sbin/kgzip
1083 gnu/usr.bin/binutils \
1085 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
1089 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1090 cd ${.CURDIR}/${_tool}; \
1091 ${MAKE} DIRPRFX=${_tool}/ obj; \
1092 ${MAKE} DIRPRFX=${_tool}/ depend; \
1093 ${MAKE} DIRPRFX=${_tool}/ all; \
1094 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
1098 # hierarchy - ensure that all the needed directories are present
1101 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs
1104 # libraries - build all libraries, and install them under ${DESTDIR}.
1106 # The list of libraries with dependents (${_prebuild_libs}) and their
1107 # interdependencies (__L) are built automatically by the
1108 # ${.CURDIR}/tools/make_libdeps.sh script.
1112 ${MAKE} -f Makefile.inc1 _prereq_libs; \
1113 ${MAKE} -f Makefile.inc1 _startup_libs; \
1114 ${MAKE} -f Makefile.inc1 _prebuild_libs; \
1115 ${MAKE} -f Makefile.inc1 _generic_libs;
1118 # static libgcc.a prerequisite for shared libc
1120 _prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc
1122 # These dependencies are not automatically generated:
1124 # gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before
1125 # all shared libraries for ELF.
1127 _startup_libs= gnu/lib/csu
1128 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
1129 _startup_libs+= lib/csu/${MACHINE_ARCH}-elf
1130 .elif exists(${.CURDIR}/lib/csu/${MACHINE_CPUARCH}-elf)
1131 _startup_libs+= lib/csu/${MACHINE_CPUARCH}-elf
1132 .elif exists(${.CURDIR}/lib/csu/${MACHINE_ARCH})
1133 _startup_libs+= lib/csu/${MACHINE_ARCH}
1135 _startup_libs+= lib/csu/${MACHINE_CPUARCH}
1137 _startup_libs+= gnu/lib/libgcc
1138 _startup_libs+= lib/libc
1140 gnu/lib/libgcc__L: lib/libc__L
1142 _prebuild_libs= ${_kerberos5_lib_libasn1} ${_kerberos5_lib_libheimntlm} \
1143 ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \
1144 ${_kerberos5_lib_libroken} \
1145 lib/libbz2 lib/libcom_err lib/libcrypt \
1146 lib/libexpat lib/libfetch \
1147 ${_lib_libgssapi} ${_lib_libipx} \
1148 lib/libkiconv lib/libkvm lib/liblzma lib/libmd \
1149 lib/ncurses/ncurses lib/ncurses/ncursesw \
1150 lib/libopie lib/libpam ${_lib_libthr} \
1151 lib/libradius lib/libsbuf lib/libtacplus \
1152 lib/libutil ${_lib_libypclnt} lib/libz lib/msun \
1153 ${_secure_lib_libcrypto} ${_secure_lib_libssh} \
1154 ${_secure_lib_libssl}
1156 .if ${MK_LIBTHR} != "no"
1157 _lib_libthr= lib/libthr
1160 _generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib
1162 lib/libopie__L lib/libtacplus__L: lib/libmd__L
1164 .if ${MK_CDDL} != "no"
1168 .if ${MK_CRYPT} != "no"
1169 .if ${MK_OPENSSL} != "no"
1170 _secure_lib_libcrypto= secure/lib/libcrypto
1171 _secure_lib_libssl= secure/lib/libssl
1172 lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L
1173 lib/libfetch__L: secure/lib/libcrypto__L secure/lib/libssl__L lib/libmd__L
1174 .if ${MK_OPENSSH} != "no"
1175 _secure_lib_libssh= secure/lib/libssh
1176 secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
1177 .if ${MK_KERBEROS_SUPPORT} != "no"
1178 secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \
1179 kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \
1180 lib/libmd__L kerberos5/lib/libroken__L
1184 _secure_lib= secure/lib
1187 .if ${MK_GSSAPI} != "no"
1188 _lib_libgssapi= lib/libgssapi
1191 .if ${MK_IPX} != "no"
1192 _lib_libipx= lib/libipx
1195 .if ${MK_KERBEROS} != "no"
1196 _kerberos5_lib= kerberos5/lib
1197 _kerberos5_lib_libasn1= kerberos5/lib/libasn1
1198 _kerberos5_lib_libkrb5= kerberos5/lib/libkrb5
1199 _kerberos5_lib_libhx509= kerberos5/lib/libhx509
1200 _kerberos5_lib_libroken= kerberos5/lib/libroken
1201 _kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm
1204 .if ${MK_NIS} != "no"
1205 _lib_libypclnt= lib/libypclnt
1208 .if ${MK_OPENSSL} == "no"
1209 lib/libfetch__L lib/libradius__L: lib/libmd__L
1212 .for _lib in ${_prereq_libs}
1214 .if exists(${.CURDIR}/${_lib})
1215 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1216 cd ${.CURDIR}/${_lib}; \
1217 ${MAKE} DIRPRFX=${_lib}/ obj; \
1218 ${MAKE} DIRPRFX=${_lib}/ depend; \
1219 ${MAKE} -DWITHOUT_PROFILE -DNO_PIC DIRPRFX=${_lib}/ all; \
1220 ${MAKE} -DWITHOUT_PROFILE -DNO_PIC DIRPRFX=${_lib}/ install
1224 .for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
1226 .if exists(${.CURDIR}/${_lib})
1227 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1228 cd ${.CURDIR}/${_lib}; \
1229 ${MAKE} DIRPRFX=${_lib}/ obj; \
1230 ${MAKE} DIRPRFX=${_lib}/ depend; \
1231 ${MAKE} DIRPRFX=${_lib}/ all; \
1232 ${MAKE} DIRPRFX=${_lib}/ install
1236 # libpam is special: we need to build static PAM modules before
1237 # static PAM library, and dynamic PAM library before dynamic PAM
1239 lib/libpam__L: .PHONY
1240 ${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \
1241 cd ${.CURDIR}/lib/libpam; \
1242 ${MAKE} DIRPRFX=lib/libpam/ obj; \
1243 ${MAKE} DIRPRFX=lib/libpam/ depend; \
1244 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \
1245 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install
1247 _prereq_libs: ${_prereq_libs:S/$/__PL/}
1248 _startup_libs: ${_startup_libs:S/$/__L/}
1249 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
1250 _generic_libs: ${_generic_libs:S/$/__L/}
1252 .for __target in all clean cleandepend cleandir depend includes obj
1253 .for entry in ${SUBDIR}
1254 ${entry}.${__target}__D: .PHONY
1255 ${_+_}@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
1256 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \
1257 edir=${entry}.${MACHINE_ARCH}; \
1258 cd ${.CURDIR}/$${edir}; \
1260 ${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \
1262 cd ${.CURDIR}/$${edir}; \
1264 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
1266 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
1269 .include <bsd.subdir.mk>
1271 .if make(check-old) || make(check-old-dirs) || \
1272 make(check-old-files) || make(check-old-libs) || \
1273 make(delete-old) || make(delete-old-dirs) || \
1274 make(delete-old-files) || make(delete-old-libs)
1277 # check for / delete old files section
1280 .include "ObsoleteFiles.inc"
1282 OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \
1283 else you can not start such an application. Consult UPDATING for more \
1284 information regarding how to cope with the removal/revision bump of a \
1287 .if !defined(BATCH_DELETE_OLD_FILES)
1294 @echo ">>> Removing old files (only deletes safe to delete libs)"
1295 # Ask for every old file if the user really wants to remove it.
1296 # It's annoying, but better safe than sorry.
1297 @for file in ${OLD_FILES} ${OLD_FILES:Musr/share/*.gz:R}; do \
1298 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1299 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1300 rm ${RM_I} "${DESTDIR}/$${file}"; \
1303 # Remove catpages without corresponding manpages.
1305 find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1306 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1307 while read catpage; do \
1309 if [ ! -e "$${manpage}" ]; then \
1310 rm ${RM_I} $${catpage} <&3 ; \
1313 @echo ">>> Old files removed"
1316 @echo ">>> Checking for old files"
1317 @for file in ${OLD_FILES} ${OLD_FILES:Musr/share/*.gz:R}; do \
1318 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1319 echo "${DESTDIR}/$${file}"; \
1322 # Check for catpages without corresponding manpages.
1323 @find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1324 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1325 while read catpage; do \
1327 if [ ! -e "$${manpage}" ]; then \
1328 echo $${catpage} ; \
1333 @echo ">>> Removing old libraries"
1334 @echo "${OLD_LIBS_MESSAGE}" | fmt
1335 @for file in ${OLD_LIBS}; do \
1336 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1337 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1338 rm ${RM_I} "${DESTDIR}/$${file}"; \
1341 @echo ">>> Old libraries removed"
1344 @echo ">>> Checking for old libraries"
1345 @for file in ${OLD_LIBS}; do \
1346 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1347 echo "${DESTDIR}/$${file}"; \
1352 @echo ">>> Removing old directories"
1353 @for dir in ${OLD_DIRS}; do \
1354 if [ -d "${DESTDIR}/$${dir}" ]; then \
1355 rmdir -v "${DESTDIR}/$${dir}" || true; \
1356 elif [ -L "${DESTDIR}/$${dir}" ]; then \
1357 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1360 @echo ">>> Old directories removed"
1363 @echo ">>> Checking for old directories"
1364 @for dir in ${OLD_DIRS}; do \
1365 if [ -d "${DESTDIR}/$${dir}" ]; then \
1366 echo "${DESTDIR}/$${dir}"; \
1367 elif [ -L "${DESTDIR}/$${dir}" ]; then \
1368 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1372 delete-old: delete-old-files delete-old-dirs
1373 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1375 check-old: check-old-files check-old-libs check-old-dirs
1376 @echo "To remove old files and directories run '${MAKE} delete-old'."
1377 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1382 # showconfig - show build configuration.
1385 @${MAKE} -n -f bsd.own.mk -V dummy -dg1 | grep ^MK_ | sort
1390 .if defined(XDEV) && defined(XDEV_ARCH)
1392 NOFUN=-DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
1393 -DWITHOUT_MAN -DWITHOUT_NLS -DWITHOUT_PROFILE \
1394 -DWITHOUT_KERBEROS -DWITHOUT_RESCUE -DNO_WARNS
1396 XDDIR=${XDEV}-freebsd
1398 CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \
1399 TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH}
1401 _SHLIBDIRPREFIX=${XDTP} \
1402 TOOLS_PREFIX=${XDTP}
1404 MACHINE=${XDEV} MACHINE_ARCH=${XDEV_ARCH}
1406 CDTMP= ${MAKEOBJDIRPREFIX}/${XDEV}/${.CURDIR}/tmp
1407 CDMAKE=${CDENV} ${MAKE} ${NOFUN}
1408 CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDTP}/usr/bin:${PATH} ${MAKE} ${NOFUN}
1409 XDDESTDIR=${DESTDIR}${XDTP}
1411 OSREL!= uname -r | sed -e 's/[-(].*//'
1414 .ORDER: xdev-build xdev-install
1415 xdev: xdev-build xdev-install
1417 .ORDER: _xb-build-tools _xb-cross-tools
1418 xdev-build: _xb-build-tools _xb-cross-tools
1421 ${_+_}cd ${.CURDIR}; \
1422 ${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools
1426 gnu/usr.bin/binutils \
1428 ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \
1429 cd ${.CURDIR}/${_tool}; \
1430 ${CDMAKE} DIRPRFX=${_tool}/ obj; \
1431 ${CDMAKE} DIRPRFX=${_tool}/ depend; \
1432 ${CDMAKE} DIRPRFX=${_tool}/ all
1436 ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}"
1437 mkdir -p ${XDDESTDIR}
1438 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
1439 -p ${XDDESTDIR} >/dev/null
1440 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1441 -p ${XDDESTDIR}/usr >/dev/null
1442 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
1443 -p ${XDDESTDIR}/usr/include >/dev/null
1445 .ORDER: _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
1446 xdev-install: _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
1449 @echo "_xi-cross-tools"
1451 gnu/usr.bin/binutils \
1453 ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \
1454 cd ${.CURDIR}/${_tool}; \
1455 ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR}
1459 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 par-includes \
1460 DESTDIR=${XDDESTDIR}
1463 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \
1464 DESTDIR=${XDDESTDIR}
1467 ${_+_}cd ${XDDESTDIR}/usr/bin; \
1469 ln -sf ../../${XDTP}/usr/bin/$$i \
1470 ../../../../usr/bin/${XDDIR}-$$i; \
1471 ln -sf ../../${XDTP}/usr/bin/$$i \
1472 ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \
1476 .if !empty(KRNLOBJDIR) && !empty(KERNCONF)
1477 DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/
1479 .if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE)
1480 .if exists(${KERNCONFDIR}/${KERNCONF})
1481 FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \
1482 ${KERNCONFDIR}/${KERNCONF}
1488 .if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH})
1489 DTBOUTPUTPATH= ${.CURDIR}
1493 # Build 'standalone' Device Tree Blob
1496 @if [ "${FDT_DTS_FILE}" = "" ]; then \
1497 echo "ERROR: FDT_DTS_FILE must be specified!"; \
1500 if [ ! -f ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE} ]; then \
1501 echo "ERROR: Specified DTS file (${FDT_DTS_FILE}) does not \
1505 if [ "${DTBOUTPUTPATH}" = "${.CURDIR}" ]; then \
1506 echo "WARNING: DTB will be placed in the current working \
1511 ${DTBOUTPUTPATH}/`echo ${FDT_DTS_FILE} | cut -d. -f1`.dtb -b 0 \
1512 -p 1024 ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE}