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_KERNELCONFIG, NO_KERNELCLEAN and NO_KERNELDEPEND
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_PORTSUPDATE do not update ports in ${MAKE} update
13 # -DNO_DOCUPDATE do not update doc in ${MAKE} update
14 # -DNO_CTF do not run the DTrace CTF conversion tools on built objects
15 # LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
16 # TARGET="machine" to crossbuild world for a different machine type
19 # The intended user-driven targets are:
20 # buildworld - rebuild *everything*, including glue to help do upgrades
21 # installworld- install everything built by "buildworld"
22 # doxygen - build API documentation of the kernel
23 # update - convenient way to update your source tree (eg: cvsup/cvs)
25 # Standard targets (not defined here) are documented in the makefiles in
26 # /usr/share/mk. These include:
27 # obj depend all install clean cleandepend cleanobj
31 .if ${MACHINE_ARCH} == "mips"
32 MK_RESCUE=no # not yet
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"
53 .if ${MK_KERBEROS} != "no"
56 .if ${MK_RESCUE} != "no"
60 .if ${MK_CRYPT} != "no"
63 .if !defined(NO_SHARE)
66 SUBDIR+=sys usr.bin usr.sbin
68 # We must do etc/ last for install/distribute to work.
72 # These are last, since it is nice to at least get the base system
73 # rebuilt before you do them.
74 .for _DIR in ${LOCAL_DIRS}
75 .if exists(${.CURDIR}/${_DIR}/Makefile)
80 .if defined(SUBDIR_OVERRIDE)
81 SUBDIR= ${SUBDIR_OVERRIDE}
87 .if defined(NO_CLEANDIR)
88 CLEANDIR= clean cleandepend
94 CVSFLAGS?= -r RELENG_8 -P -d -I!
100 SUPFLAGS+= -h ${SUPHOST}
103 MAKEOBJDIRPREFIX?= /usr/obj
104 .if !defined(OSRELDATE)
105 .if exists(/usr/include/osreldate.h)
106 OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
107 /usr/include/osreldate.h
113 .if !defined(VERSION)
115 VERSION+= ${OSRELDATE}
118 # Guess machine architecture from machine type, and vice versa.
119 .if !defined(TARGET_ARCH) && defined(TARGET)
120 TARGET_ARCH= ${TARGET:S/pc98/i386/:S/sun4v/sparc64/}
121 .elif !defined(TARGET) && defined(TARGET_ARCH) && \
122 ${TARGET_ARCH} != ${MACHINE_ARCH}
123 TARGET= ${TARGET_ARCH}
125 # Otherwise, default to current machine type and architecture.
127 TARGET_ARCH?= ${MACHINE_ARCH}
129 KNOWN_ARCHES?= amd64 arm i386 i386/pc98 ia64 mips powerpc sparc64 sparc64/sun4v
130 .if ${TARGET} == ${TARGET_ARCH}
133 _t= ${TARGET_ARCH}/${TARGET}
136 .if empty(KNOWN_ARCHES:M${_t})
137 .error Unknown target ${TARGET_ARCH}:${TARGET}.
141 .if ${TARGET} == ${MACHINE}
142 TARGET_CPUTYPE?=${CPUTYPE}
147 .if !empty(TARGET_CPUTYPE)
148 _TARGET_CPUTYPE=${TARGET_CPUTYPE}
150 _TARGET_CPUTYPE=dummy
152 _CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} \
153 -f /dev/null -m ${.CURDIR}/share/mk -V CPUTYPE
154 .if ${_CPUTYPE} != ${_TARGET_CPUTYPE}
155 .error CPUTYPE global should be set with ?=.
158 BUILD_ARCH!= uname -p
159 .if ${MACHINE_ARCH} != ${BUILD_ARCH}
160 .error To cross-build, set TARGET_ARCH.
163 .if ${MACHINE} == ${TARGET} && !defined(CROSS_BUILD_TESTING)
164 OBJTREE= ${MAKEOBJDIRPREFIX}
166 OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}
168 WORLDTMP= ${OBJTREE}${.CURDIR}/tmp
169 # /usr/games added for fortune which depend on strfile
170 BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games
171 XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
172 STRICTTMPPATH= ${BPATH}:${XPATH}
173 TMPPATH= ${STRICTTMPPATH}:${PATH}
176 # Avoid running mktemp(1) unless actually needed.
177 # It may not be functional, e.g., due to new ABI
178 # when in the middle of installing over this system.
180 .if make(distributeworld) || make(installworld)
181 INSTALLTMP!= /usr/bin/mktemp -d -u -t install
185 # Building a world goes through the following stages
187 # 1. legacy stage [BMAKE]
188 # This stage is responsible for creating compatibility
189 # shims that are needed by the bootstrap-tools,
190 # build-tools and cross-tools stages.
191 # 1. bootstrap-tools stage [BMAKE]
192 # This stage is responsible for creating programs that
193 # are needed for backward compatibility reasons. They
194 # are not built as cross-tools.
195 # 2. build-tools stage [TMAKE]
196 # This stage is responsible for creating the object
197 # tree and building any tools that are needed during
199 # 3. cross-tools stage [XMAKE]
200 # This stage is responsible for creating any tools that
201 # are needed for cross-builds. A cross-compiler is one
203 # 4. world stage [WMAKE]
204 # This stage actually builds the world.
205 # 5. install stage (optional) [IMAKE]
206 # This stage installs a previously built world.
211 # Common environment for world related stages
212 CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \
213 MACHINE_ARCH=${TARGET_ARCH} \
215 CPUTYPE=${TARGET_CPUTYPE} \
216 GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
217 GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \
218 GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac
219 .if ${OSRELDATE} < 700044
220 CROSSENV+= AR=gnu-ar RANLIB=gnu-ranlib
223 # bootstrap-tools stage
224 BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
225 PATH=${BPATH}:${PATH} \
226 WORLDTMP=${WORLDTMP} \
227 VERSION="${VERSION}" \
228 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}"
229 BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
230 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
232 BOOTSTRAPPING=${OSRELDATE} \
234 -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \
235 -DNO_PIC -DWITHOUT_PROFILE -DNO_SHARED \
236 -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF
239 TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
240 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
241 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
244 BOOTSTRAPPING=${OSRELDATE} -DNO_LINT -DNO_CPU_CFLAGS \
248 XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \
249 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
253 WMAKEENV= ${CROSSENV} \
254 _SHLIBDIRPREFIX=${WORLDTMP} \
256 VERSION="${VERSION}" \
257 INSTALL="sh ${.CURDIR}/tools/install.sh" \
259 .if ${MK_CDDL} == "no" || defined(NO_CTF)
262 WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1 DESTDIR=${WORLDTMP}
264 .if ${TARGET_ARCH} == "amd64"
266 LIB32TMP= ${OBJTREE}${.CURDIR}/lib32
268 .if empty(TARGET_CPUTYPE)
269 LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2
271 LIB32CPUFLAGS= -march=${TARGET_CPUTYPE}
273 LIB32FLAGS= -m32 ${LIB32CPUFLAGS} -mfancy-math-387 -DCOMPAT_32BIT \
274 -iprefix ${LIB32TMP}/usr/ \
275 -L${LIB32TMP}/usr/lib32 \
276 -B${LIB32TMP}/usr/lib32
278 # Yes, the flags are redundant.
279 LIB32WMAKEENV= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \
280 _SHLIBDIRPREFIX=${LIB32TMP} \
281 _LDSCRIPTROOT=${LIB32TMP} \
282 VERSION="${VERSION}" \
285 MACHINE_CPU="i686 mmx sse sse2" \
286 INSTALL="sh ${.CURDIR}/tools/install.sh" \
288 CC="${CC} ${LIB32FLAGS}" \
289 CXX="${CXX} ${LIB32FLAGS}" \
290 OBJC="${OBJC} ${LIB32FLAGS}" \
291 LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" \
296 LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} -DNO_CPU_CFLAGS -DCOMPAT_32BIT \
297 -DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO \
298 -DWITHOUT_HTML -DNO_CTF DESTDIR=${LIB32TMP}
299 LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} -DNO_INCS
303 IMAKEENV= ${CROSSENV:N_LDSCRIPTROOT=*}
304 IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1
305 .if empty(.MAKEFLAGS:M-n)
306 IMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMP} \
307 LD_LIBRARY_PATH=${INSTALLTMP} \
308 PATH_LOCALE=${INSTALLTMP}/locale
309 IMAKE+= __MAKE_SHELL=${INSTALLTMP}/sh
311 IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP}
315 KMAKEENV= ${WMAKEENV}
316 KMAKE= ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME}
321 # Attempt to rebuild the entire system, with reasonable chance of
322 # success, regardless of how old your existing system is.
325 .if ${.CURDIR:C/[^,]//g} != ""
326 # The m4 build of sendmail files doesn't like it if ',' is used
327 # anywhere in the path of it's files.
329 @echo "*** Error: path to source tree contains a comma ','"
334 @echo "--------------------------------------------------------------"
335 @echo ">>> Rebuilding the temporary build tree"
336 @echo "--------------------------------------------------------------"
337 .if !defined(NO_CLEAN)
339 .if ${TARGET_ARCH} == "amd64"
343 rm -rf ${WORLDTMP}/legacy/usr/include
344 # XXX - These three can depend on any header file.
345 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
346 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c
347 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
351 mkdir -p ${WORLDTMP}/${_dir}
353 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
354 -p ${WORLDTMP}/legacy/usr >/dev/null
355 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
356 -p ${WORLDTMP}/usr >/dev/null
357 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
358 -p ${WORLDTMP}/usr/include >/dev/null
359 ln -sf ${.CURDIR}/sys ${WORLDTMP}
360 .if ${MK_BIND_LIBS} != "no"
361 mtree -deU -f ${.CURDIR}/etc/mtree/BIND.include.dist \
362 -p ${WORLDTMP}/usr/include >/dev/null
366 @echo "--------------------------------------------------------------"
367 @echo ">>> stage 1.1: legacy release compatibility shims"
368 @echo "--------------------------------------------------------------"
369 ${_+_}cd ${.CURDIR}; ${BMAKE} legacy
372 @echo "--------------------------------------------------------------"
373 @echo ">>> stage 1.2: bootstrap tools"
374 @echo "--------------------------------------------------------------"
375 ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools
377 .if !defined(NO_CLEAN)
379 @echo "--------------------------------------------------------------"
380 @echo ">>> stage 2.1: cleaning up the object tree"
381 @echo "--------------------------------------------------------------"
382 ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
383 .if ${TARGET_ARCH} == "amd64"
384 ${_+_}cd ${.CURDIR}; ${LIB32WMAKE} -f Makefile.inc1 ${CLEANDIR:S/^/par-/}
389 @echo "--------------------------------------------------------------"
390 @echo ">>> stage 2.2: rebuilding the object tree"
391 @echo "--------------------------------------------------------------"
392 ${_+_}cd ${.CURDIR}; ${WMAKE} par-obj
395 @echo "--------------------------------------------------------------"
396 @echo ">>> stage 2.3: build tools"
397 @echo "--------------------------------------------------------------"
398 ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools
401 @echo "--------------------------------------------------------------"
402 @echo ">>> stage 3: cross tools"
403 @echo "--------------------------------------------------------------"
404 ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools
407 @echo "--------------------------------------------------------------"
408 @echo ">>> stage 4.1: building includes"
409 @echo "--------------------------------------------------------------"
410 ${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
413 @echo "--------------------------------------------------------------"
414 @echo ">>> stage 4.2: building libraries"
415 @echo "--------------------------------------------------------------"
416 ${_+_}cd ${.CURDIR}; \
417 ${WMAKE} -DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
418 -DWITHOUT_MAN -DWITHOUT_PROFILE libraries
421 @echo "--------------------------------------------------------------"
422 @echo ">>> stage 4.3: make dependencies"
423 @echo "--------------------------------------------------------------"
424 ${_+_}cd ${.CURDIR}; ${WMAKE} par-depend
427 @echo "--------------------------------------------------------------"
428 @echo ">>> stage 4.4: building everything"
429 @echo "--------------------------------------------------------------"
430 ${_+_}cd ${.CURDIR}; ${WMAKE} par-all
431 .if ${TARGET_ARCH} == "amd64"
434 @echo "--------------------------------------------------------------"
435 @echo ">>> stage 5.1: building 32 bit shim libraries"
436 @echo "--------------------------------------------------------------"
437 mkdir -p ${LIB32TMP}/usr/lib32
438 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
439 -p ${LIB32TMP}/usr >/dev/null
440 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
441 -p ${LIB32TMP}/usr/include >/dev/null
443 ln -sf ${.CURDIR}/sys ${WORLDTMP}
444 .if ${MK_KERBEROS} != "no"
445 .for _t in obj depend all
446 cd ${.CURDIR}/kerberos5/tools; \
447 MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \
448 DIRPRFX=kerberos5/tools/ ${_t}
451 .for _t in obj includes
452 cd ${.CURDIR}/include; ${LIB32WMAKE} DIRPRFX=include/ ${_t}
453 cd ${.CURDIR}/lib; ${LIB32WMAKE} DIRPRFX=lib/ ${_t}
454 .if ${MK_CDDL} != "no"
455 cd ${.CURDIR}/cddl/lib; ${LIB32WMAKE} DIRPRFX=cddl/lib/ ${_t}
457 cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} DIRPRFX=gnu/lib/ ${_t}
458 .if ${MK_CRYPT} != "no"
459 cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} DIRPRFX=secure/lib/ ${_t}
461 .if ${MK_KERBEROS} != "no"
462 cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} DIRPRFX=kerberos5/lib ${_t}
465 .for _dir in usr.bin/lex/lib
466 cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} DIRPRFX=${_dir}/ obj
468 .for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic
469 cd ${.CURDIR}/${_dir}; \
470 MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \
471 DIRPRFX=${_dir}/ build-tools
474 ${LIB32WMAKE} -f Makefile.inc1 libraries
475 .for _t in obj depend all
476 cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32WMAKE} \
477 DIRPRFX=libexec/rtld-elf/ ${_t}
478 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32WMAKE} \
479 DIRPRFX=usr.bin/ldd ${_t}
482 distribute32 install32:
483 .if make(distribute32)
484 mkdir -p ${DISTDIR}/${DISTRIBUTION}/usr/lib32 # XXX add to mtree
485 mkdir -p ${DISTDIR}/${DISTRIBUTION}/usr/lib32/dtrace # XXX add to mtree
487 mkdir -p ${DESTDIR}/usr/lib32 # XXX add to mtree
488 mkdir -p ${DESTDIR}/usr/lib32/dtrace # XXX add to mtree
490 cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
491 .if ${MK_CDDL} != "no"
492 cd ${.CURDIR}/cddl/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
494 cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
495 .if ${MK_CRYPT} != "no"
496 cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
498 .if ${MK_KERBEROS} != "no"
499 cd ${.CURDIR}/kerberos5/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
501 cd ${.CURDIR}/libexec/rtld-elf; \
502 PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//}
503 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32IMAKE} ${.TARGET:S/32$//}
507 .if !defined(SUBDIR_OVERRIDE)
508 WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools
510 WMAKE_TGTS+= _cleanobj _obj _build-tools
511 .if !defined(SUBDIR_OVERRIDE)
512 WMAKE_TGTS+= _cross-tools
514 WMAKE_TGTS+= _includes _libraries _depend everything
515 .if ${TARGET_ARCH} == "amd64" && ${MK_LIB32} != "no"
519 buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
520 .ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
523 @echo "--------------------------------------------------------------"
524 @echo ">>> World build started on `LC_ALL=C date`"
525 @echo "--------------------------------------------------------------"
529 @echo "--------------------------------------------------------------"
530 @echo ">>> World build completed on `LC_ALL=C date`"
531 @echo "--------------------------------------------------------------"
534 # We need to have this as a target because the indirection between Makefile
535 # and Makefile.inc1 causes the correct PATH to be used, rather than a
536 # modification of the current environment's PATH. In addition, we need
537 # to quote multiword values.
543 @echo Entering world for ${TARGET_ARCH}:${TARGET}
544 @cd ${.CURDIR} && env ${WMAKEENV} sh || true
546 TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything:Nbuild32}
547 toolchain: ${TOOLCHAIN_TGTS}
548 kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries}
553 # Checks to be sure system is ready for installworld/installkernel.
558 # Require DESTDIR to be set if installing for a different architecture.
560 .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE}
561 .if !make(distributeworld)
562 installcheck: installcheck_DESTDIR
563 installcheck_DESTDIR:
564 .if !defined(DESTDIR) || empty(DESTDIR)
565 @echo "ERROR: Please set DESTDIR!"; \
572 # Check for missing UIDs/GIDs.
576 .if ${MK_SENDMAIL} != "no"
582 CHECK_GIDS+= proxy authpf
584 installcheck: installcheck_UGID
586 .for uid in ${CHECK_UIDS}
587 @if ! `id -u ${uid} >/dev/null 2>&1`; then \
588 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \
592 .for gid in ${CHECK_GIDS}
593 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \
594 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \
600 # Required install tools to be saved in a scratch dir for safety.
602 .if ${MK_INFO} != "no"
603 _install-info= install-info
606 ITOOLS= [ awk cap_mkdb cat chflags chmod chown \
607 date echo egrep find grep ${_install-info} \
608 ln lockf make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
609 test true uname wc zic
614 # Distributes everything compiled by a `buildworld'.
618 # Installs everything compiled by a 'buildworld'.
620 distributeworld installworld: installcheck
621 mkdir -p ${INSTALLTMP}
622 progs=$$(for prog in ${ITOOLS}; do \
623 if progpath=`which $$prog`; then \
626 echo "Required tool $$prog not found in PATH." >&2; \
630 libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | \
631 while read line; do \
633 if [ "$$2 $$3" != "not found" ]; then \
636 echo "Required library $$1 not found." >&2; \
640 cp $$libs $$progs ${INSTALLTMP}
641 cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale
642 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \
643 ${IMAKEENV} rm -rf ${INSTALLTMP}
648 # If you have a build server, you can NFS mount the source and obj directories
649 # and do a 'make reinstall' on the *client* to install new binaries from the
650 # most recent server build.
653 @echo "--------------------------------------------------------------"
654 @echo ">>> Making hierarchy"
655 @echo "--------------------------------------------------------------"
656 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
658 @echo "--------------------------------------------------------------"
659 @echo ">>> Installing everything"
660 @echo "--------------------------------------------------------------"
661 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
662 .if ${TARGET_ARCH} == "amd64" && ${MK_LIB32} != "no"
663 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32
667 @echo "--------------------------------------------------------------"
668 @echo ">>> Distributing everything"
669 @echo "--------------------------------------------------------------"
670 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
671 .if ${TARGET_ARCH} == "amd64" && ${MK_LIB32} != "no"
672 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 \
676 distrib-dirs distribution:
677 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} ${.TARGET}
680 # buildkernel and installkernel
682 # Which kernels to build and/or install is specified by setting
683 # KERNCONF. If not defined a GENERIC kernel is built/installed.
684 # Only the existing (depending TARGET) config files are used
685 # for building kernels and only the first of these is designated
686 # as the one being installed.
688 # Note that we have to use TARGET instead of TARGET_ARCH when
689 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
690 # be set to cross-build, we have to make sure TARGET is set
693 .if defined(KERNFAST)
697 # Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah
698 .if !defined(KERNCONF) && ${KERNFAST} != "1"
702 .if !defined(KERNCONF) && defined(KERNEL)
708 INSTKERNNAME?= kernel
710 KERNSRCDIR?= ${.CURDIR}/sys
711 KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf
712 KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR}
713 KERNCONFDIR?= ${KRNLCONFDIR}
717 .for _kernel in ${KERNCONF}
718 .if exists(${KERNCONFDIR}/${_kernel})
719 BUILDKERNELS+= ${_kernel}
720 .if empty(INSTALLKERNEL)
721 INSTALLKERNEL= ${_kernel}
729 # Builds all kernels defined by BUILDKERNELS.
732 .if empty(BUILDKERNELS)
733 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \
736 .if defined(KERNWARN)
737 @echo "--------------------------------------------------------------"
738 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
739 @echo "--------------------------------------------------------------"
743 .for _kernel in ${BUILDKERNELS}
744 @echo "--------------------------------------------------------------"
745 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
746 @echo "--------------------------------------------------------------"
747 @echo "===> ${_kernel}"
748 mkdir -p ${KRNLOBJDIR}
749 .if !defined(NO_KERNELCONFIG)
751 @echo "--------------------------------------------------------------"
752 @echo ">>> stage 1: configuring the kernel"
753 @echo "--------------------------------------------------------------"
756 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
757 ${KERNCONFDIR}/${_kernel}
759 .if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN)
761 @echo "--------------------------------------------------------------"
762 @echo ">>> stage 2.1: cleaning up the object tree"
763 @echo "--------------------------------------------------------------"
764 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR}
767 @echo "--------------------------------------------------------------"
768 @echo ">>> stage 2.2: rebuilding the object tree"
769 @echo "--------------------------------------------------------------"
770 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj
772 @echo "--------------------------------------------------------------"
773 @echo ">>> stage 2.3: build tools"
774 @echo "--------------------------------------------------------------"
775 cd ${KRNLOBJDIR}/${_kernel}; \
776 PATH=${BPATH}:${PATH} \
777 MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \
778 ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF \
779 -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
780 # XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case.
781 .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules)
782 .for target in obj depend all
783 cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \
784 PATH=${BPATH}:${PATH} \
785 MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
786 ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF ${target}
789 .if !defined(NO_KERNELDEPEND)
791 @echo "--------------------------------------------------------------"
792 @echo ">>> stage 3.1: making dependencies"
793 @echo "--------------------------------------------------------------"
794 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ
797 @echo "--------------------------------------------------------------"
798 @echo ">>> stage 3.2: building everything"
799 @echo "--------------------------------------------------------------"
800 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ
801 @echo "--------------------------------------------------------------"
802 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
803 @echo "--------------------------------------------------------------"
807 # installkernel, etc.
809 # Install the kernel defined by INSTALLKERNEL
811 installkernel installkernel.debug \
812 reinstallkernel reinstallkernel.debug: installcheck
813 .if empty(INSTALLKERNEL)
814 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
817 @echo "--------------------------------------------------------------"
818 @echo ">>> Installing kernel ${INSTALLKERNEL}"
819 @echo "--------------------------------------------------------------"
820 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
821 ${CROSSENV} PATH=${TMPPATH} \
822 ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
827 # Build the API documentation with doxygen
830 @if [ ! -x `/usr/bin/which doxygen` ]; then \
831 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \
834 cd ${.CURDIR}/tools/kerneldoc/subsys && ${MAKE} obj all
839 # Update the source tree, by running cvsup and/or running cvs to update to the
843 .if defined(SUP_UPDATE)
844 @echo "--------------------------------------------------------------"
845 @echo ">>> Running ${SUP}"
846 @echo "--------------------------------------------------------------"
847 @echo "!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING !!"
848 @echo "!! Update methods with ${SUP} are deprecated."
849 @echo "!! Please see http://www.freebsd.org/handbook/svn.html"
850 @echo "!! and convert your update method to SVN_UPDATE or"
851 @echo "!! freebsd-update(8)."
852 @echo "!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING !!"
855 @${SUP} ${SUPFLAGS} ${SUPFILE}
857 .if defined(SUPFILE1)
858 @${SUP} ${SUPFLAGS} ${SUPFILE1}
860 .if defined(SUPFILE2)
861 @${SUP} ${SUPFLAGS} ${SUPFILE2}
863 .if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
864 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
866 .if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
867 @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
870 .if defined(CVS_UPDATE)
872 if [ -d CVS ] ; then \
873 echo "--------------------------------------------------------------" ; \
874 echo ">>> Updating ${.CURDIR} from CVS repository" ${CVSROOT} ; \
875 echo "--------------------------------------------------------------" ; \
876 echo "!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING !!" ; \
877 echo "!! Update methods with ${SUP} are deprecated." ; \
878 echo "!! Please see http://www.freebsd.org/handbook/svn.html" ; \
879 echo "!! and convert your update method to SVN_UPDATE or" ; \
880 echo "!! freebsd-update(8)." ; \
881 echo "!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING !!" ; \
883 echo ${CVS} -R -q update ${CVSFLAGS} ; \
884 ${CVS} -R -q update ${CVSFLAGS} ; \
887 .if defined(SVN_UPDATE)
889 if [ -d .svn ] ; then \
890 echo "--------------------------------------------------------------" ; \
891 echo ">>> Updating ${.CURDIR} using Subversion" ; \
892 echo "--------------------------------------------------------------" ; \
893 echo ${SVN} update ${SVNFLAGS} ; \
894 ${SVN} update ${SVNFLAGS} ; \
899 # ------------------------------------------------------------------------
901 # From here onwards are utility targets used by the 'make world' and
902 # related targets. If your 'world' breaks, you may like to try to fix
903 # the problem and manually run the following targets to attempt to
904 # complete the build. Beware, this is *not* guaranteed to work, you
905 # need to have a pretty good grip on the current state of the system
906 # to attempt to manually finish it. If in doubt, 'make world' again.
910 # legacy: Build compatibility shims for the next three targets
913 .if ${BOOTSTRAPPING} < 600034 && ${BOOTSTRAPPING} != 0
914 @echo "ERROR: Source upgrades from versions prior to 6.0 not supported."; \
917 .for _tool in tools/build
918 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \
919 cd ${.CURDIR}/${_tool}; \
920 ${MAKE} DIRPRFX=${_tool}/ obj; \
921 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \
922 ${MAKE} DIRPRFX=${_tool}/ depend; \
923 ${MAKE} DIRPRFX=${_tool}/ all; \
924 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
928 # bootstrap-tools: Build tools needed for compatibility
930 .if ${MK_GAMES} != "no"
931 _strfile= games/fortune/strfile
934 .if ${MK_CXX} != "no"
935 _gperf= gnu/usr.bin/gperf
936 .if ${BOOTSTRAPPING} < 700004
937 _groff= gnu/usr.bin/groff
939 _groff= gnu/usr.bin/groff/tmac
943 .if ${BOOTSTRAPPING} >= 700044 && ${BOOTSTRAPPING} < 800022
947 .if ${BOOTSTRAPPING} < 802000
951 .if ${BOOTSTRAPPING} >= 1000013
955 .if ${BOOTSTRAPPING} < 800013
956 _mklocale= usr.bin/mklocale
959 .if ${BOOTSTRAPPING} < 700018
960 _gensnmptree= usr.sbin/bsnmpd/gensnmptree
963 .if ${MK_RESCUE} != "no" && \
964 ${BOOTSTRAPPING} < 700026
965 _crunchgen= usr.sbin/crunch/crunchgen
968 .if ${MK_CDDL} != "no"
969 _dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \
970 lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge
990 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
991 cd ${.CURDIR}/${_tool}; \
992 ${MAKE} DIRPRFX=${_tool}/ obj; \
993 ${MAKE} DIRPRFX=${_tool}/ depend; \
994 ${MAKE} DIRPRFX=${_tool}/ all; \
995 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
999 # build-tools: Build special purpose build tools
1001 .if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules)
1002 _aicasm= sys/modules/aic7xxx/aicasm
1005 .if !defined(NO_SHARE)
1006 _share= share/syscons/scrnmaps
1009 .if ${MK_KERBEROS} != "no"
1010 _kerberos5_tools= kerberos5/tools
1013 .if ${MK_RESCUE} != "no"
1014 _rescue= rescue/rescue
1022 lib/ncurses/ncurses \
1023 lib/ncurses/ncursesw \
1029 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \
1030 cd ${.CURDIR}/${_tool}; \
1031 ${MAKE} DIRPRFX=${_tool}/ obj; \
1032 ${MAKE} DIRPRFX=${_tool}/ build-tools
1035 gnu/usr.bin/cc/cc_tools \
1037 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \
1038 cd ${.CURDIR}/${_tool}; \
1039 ${MAKE} DIRPRFX=${_tool}/ obj; \
1040 ${MAKE} DIRPRFX=${_tool}/ depend; \
1041 ${MAKE} DIRPRFX=${_tool}/ all
1045 # cross-tools: Build cross-building tools
1047 .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 800035
1048 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386"
1049 _btxld= usr.sbin/btxld
1052 .if ${TARGET_ARCH} != ${MACHINE_ARCH}
1053 .if ${MK_RESCUE} != "no" || defined(RELEASEDIR)
1054 _crunchide= usr.sbin/crunch/crunchide
1056 .if ${TARGET_ARCH} == "i386" && defined(RELEASEDIR)
1057 _kgzip= usr.sbin/kgzip
1061 .if ${MK_BINUTILS} != "no"
1062 _binutils= gnu/usr.bin/binutils
1065 .if ${MK_GCC} != "no"
1074 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
1078 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1079 cd ${.CURDIR}/${_tool}; \
1080 ${MAKE} DIRPRFX=${_tool}/ obj; \
1081 ${MAKE} DIRPRFX=${_tool}/ depend; \
1082 ${MAKE} DIRPRFX=${_tool}/ all; \
1083 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
1087 # hierarchy - ensure that all the needed directories are present
1090 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs
1093 # libraries - build all libraries, and install them under ${DESTDIR}.
1095 # The list of libraries with dependents (${_prebuild_libs}) and their
1096 # interdependencies (__L) are built automatically by the
1097 # ${.CURDIR}/tools/make_libdeps.sh script.
1101 ${MAKE} -f Makefile.inc1 _prereq_libs; \
1102 ${MAKE} -f Makefile.inc1 _startup_libs; \
1103 ${MAKE} -f Makefile.inc1 _prebuild_libs; \
1104 ${MAKE} -f Makefile.inc1 _generic_libs;
1107 # static libgcc.a prerequisite for shared libc
1109 _prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc
1111 # These dependencies are not automatically generated:
1113 # gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before
1114 # all shared libraries for ELF.
1116 _startup_libs= gnu/lib/csu
1117 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
1118 _startup_libs+= lib/csu/${MACHINE_ARCH}-elf
1120 _startup_libs+= lib/csu/${MACHINE_ARCH}
1122 _startup_libs+= gnu/lib/libgcc
1123 _startup_libs+= lib/libc
1125 gnu/lib/libgcc__L: lib/libc__L
1127 _prebuild_libs= ${_kerberos5_lib_libasn1} ${_kerberos5_lib_libheimntlm} \
1128 ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \
1129 ${_kerberos5_lib_libroken} \
1130 lib/libbz2 lib/libcom_err lib/libcrypt \
1132 ${_lib_libgssapi} ${_lib_libipx} \
1133 lib/libkiconv lib/libkvm lib/liblzma lib/libmd \
1134 lib/ncurses/ncurses lib/ncurses/ncursesw \
1135 lib/libopie lib/libpam ${_lib_libthr} \
1136 lib/libradius lib/libsbuf lib/libtacplus \
1137 ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \
1138 lib/libutil ${_lib_libypclnt} lib/libz lib/msun \
1139 ${_secure_lib_libcrypto} ${_secure_lib_libssh} \
1140 ${_secure_lib_libssl}
1142 .if ${MK_LIBTHR} != "no"
1143 _lib_libthr= lib/libthr
1146 _generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib
1148 lib/libopie__L lib/libtacplus__L: lib/libmd__L
1150 .if ${MK_CDDL} != "no"
1151 _cddl_lib_libumem= cddl/lib/libumem
1152 _cddl_lib_libnvpair= cddl/lib/libnvpair
1156 .if ${MK_CRYPT} != "no"
1157 .if ${MK_OPENSSL} != "no"
1158 _secure_lib_libcrypto= secure/lib/libcrypto
1159 _secure_lib_libssl= secure/lib/libssl
1160 lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L
1161 .if ${MK_OPENSSH} != "no"
1162 _secure_lib_libssh= secure/lib/libssh
1163 secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
1164 .if ${MK_KERBEROS_SUPPORT} != "no"
1165 secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \
1166 kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \
1167 lib/libmd__L kerberos5/lib/libroken__L
1171 _secure_lib= secure/lib
1174 .if ${MK_GSSAPI} != "no"
1175 _lib_libgssapi= lib/libgssapi
1178 .if ${MK_IPX} != "no"
1179 _lib_libipx= lib/libipx
1182 .if ${MK_KERBEROS} != "no"
1183 _kerberos5_lib= kerberos5/lib
1184 _kerberos5_lib_libasn1= kerberos5/lib/libasn1
1185 _kerberos5_lib_libkrb5= kerberos5/lib/libkrb5
1186 _kerberos5_lib_libhx509= kerberos5/lib/libhx509
1187 _kerberos5_lib_libroken= kerberos5/lib/libroken
1188 _kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm
1191 .if ${MK_NIS} != "no"
1192 _lib_libypclnt= lib/libypclnt
1195 .if ${MK_OPENSSL} == "no"
1196 lib/libradius__L: lib/libmd__L
1199 .for _lib in ${_prereq_libs}
1201 .if exists(${.CURDIR}/${_lib})
1202 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1203 cd ${.CURDIR}/${_lib}; \
1204 ${MAKE} DIRPRFX=${_lib}/ obj; \
1205 ${MAKE} DIRPRFX=${_lib}/ depend; \
1206 ${MAKE} -DWITHOUT_PROFILE -DNO_PIC DIRPRFX=${_lib}/ all; \
1207 ${MAKE} -DWITHOUT_PROFILE -DNO_PIC DIRPRFX=${_lib}/ install
1211 .for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
1213 .if exists(${.CURDIR}/${_lib})
1214 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1215 cd ${.CURDIR}/${_lib}; \
1216 ${MAKE} DIRPRFX=${_lib}/ obj; \
1217 ${MAKE} DIRPRFX=${_lib}/ depend; \
1218 ${MAKE} DIRPRFX=${_lib}/ all; \
1219 ${MAKE} DIRPRFX=${_lib}/ install
1223 # libpam is special: we need to build static PAM modules before
1224 # static PAM library, and dynamic PAM library before dynamic PAM
1226 lib/libpam__L: .PHONY
1227 ${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \
1228 cd ${.CURDIR}/lib/libpam; \
1229 ${MAKE} DIRPRFX=lib/libpam/ obj; \
1230 ${MAKE} DIRPRFX=lib/libpam/ depend; \
1231 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \
1232 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install
1234 _prereq_libs: ${_prereq_libs:S/$/__PL/}
1235 _startup_libs: ${_startup_libs:S/$/__L/}
1236 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
1237 _generic_libs: ${_generic_libs:S/$/__L/}
1239 .for __target in all clean cleandepend cleandir depend includes obj
1240 .for entry in ${SUBDIR}
1241 ${entry}.${__target}__D: .PHONY
1242 ${_+_}@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
1243 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \
1244 edir=${entry}.${MACHINE_ARCH}; \
1245 cd ${.CURDIR}/$${edir}; \
1247 ${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \
1249 cd ${.CURDIR}/$${edir}; \
1251 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
1253 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
1256 .include <bsd.subdir.mk>
1258 .if make(check-old) || make(check-old-dirs) || \
1259 make(check-old-files) || make(check-old-libs) || \
1260 make(delete-old) || make(delete-old-dirs) || \
1261 make(delete-old-files) || make(delete-old-libs)
1264 # check for / delete old files section
1267 .include "ObsoleteFiles.inc"
1269 OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \
1270 else you can not start such an application. Consult UPDATING for more \
1271 information regarding how to cope with the removal/revision bump of a \
1274 .if !defined(BATCH_DELETE_OLD_FILES)
1281 @echo ">>> Removing old files (only deletes safe to delete libs)"
1282 # Ask for every old file if the user really wants to remove it.
1283 # It's annoying, but better safe than sorry.
1284 @for file in ${OLD_FILES}; do \
1285 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1286 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1287 rm ${RM_I} "${DESTDIR}/$${file}"; \
1290 # Remove catpages without corresponding manpages.
1292 find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1293 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1294 while read catpage; do \
1296 if [ ! -e "$${manpage}" ]; then \
1297 rm ${RM_I} $${catpage} <&3 ; \
1300 @echo ">>> Old files removed"
1303 @echo ">>> Checking for old files"
1304 @for file in ${OLD_FILES}; do \
1305 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1306 echo "${DESTDIR}/$${file}"; \
1309 # Check for catpages without corresponding manpages.
1310 @find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1311 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1312 while read catpage; do \
1314 if [ ! -e "$${manpage}" ]; then \
1315 echo $${catpage} ; \
1320 @echo ">>> Removing old libraries"
1321 @echo "${OLD_LIBS_MESSAGE}" | fmt
1322 @for file in ${OLD_LIBS}; do \
1323 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1324 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1325 rm ${RM_I} "${DESTDIR}/$${file}"; \
1328 @echo ">>> Old libraries removed"
1331 @echo ">>> Checking for old libraries"
1332 @for file in ${OLD_LIBS}; do \
1333 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1334 echo "${DESTDIR}/$${file}"; \
1339 @echo ">>> Removing old directories"
1340 @for dir in ${OLD_DIRS}; do \
1341 if [ -d "${DESTDIR}/$${dir}" ]; then \
1342 rmdir -v "${DESTDIR}/$${dir}" || true; \
1343 elif [ -L "${DESTDIR}/$${dir}" ]; then \
1344 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1347 @echo ">>> Old directories removed"
1350 @echo ">>> Checking for old directories"
1351 @for dir in ${OLD_DIRS}; do \
1352 if [ -d "${DESTDIR}/$${dir}" ]; then \
1353 echo "${DESTDIR}/$${dir}"; \
1354 elif [ -L "${DESTDIR}/$${dir}" ]; then \
1355 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1359 delete-old: delete-old-files delete-old-dirs
1360 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1362 check-old: check-old-files check-old-libs check-old-dirs
1363 @echo "To remove old files and directories run '${MAKE} delete-old'."
1364 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1369 # showconfig - show build configuration.
1372 @${MAKE} -n -f bsd.own.mk -V dummy -dg1 | grep ^MK_ | sort
1377 .if defined(XDEV) && defined(XDEV_ARCH)
1379 NOFUN=-DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
1380 -DWITHOUT_MAN -DWITHOUT_NLS -DWITHOUT_PROFILE \
1381 -DWITHOUT_KERBEROS -DWITHOUT_RESCUE -DNO_WARNS
1383 XDDIR=${XDEV}-freebsd
1385 CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \
1386 TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH}
1388 _SHLIBDIRPREFIX=${XDTP} \
1389 TOOLS_PREFIX=${XDTP}
1391 MACHINE=${XDEV} MACHINE_ARCH=${XDEV_ARCH}
1393 CDTMP= ${MAKEOBJDIRPREFIX}/${XDEV}/${.CURDIR}/tmp
1394 CDMAKE=${CDENV} ${MAKE} ${NOFUN}
1395 CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDTP}/usr/bin:${PATH} ${MAKE} ${NOFUN}
1396 XDDESTDIR=${DESTDIR}${XDTP}
1398 OSREL!= uname -r | sed -e 's/[-(].*//'
1401 .ORDER: xdev-build xdev-install
1402 xdev: xdev-build xdev-install
1404 .ORDER: _xb-build-tools _xb-cross-tools
1405 xdev-build: _xb-build-tools _xb-cross-tools
1408 ${_+_}cd ${.CURDIR}; \
1409 ${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools
1413 gnu/usr.bin/binutils \
1415 ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \
1416 cd ${.CURDIR}/${_tool}; \
1417 ${CDMAKE} DIRPRFX=${_tool}/ obj; \
1418 ${CDMAKE} DIRPRFX=${_tool}/ depend; \
1419 ${CDMAKE} DIRPRFX=${_tool}/ all
1423 ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}"
1424 mkdir -p ${XDDESTDIR}
1425 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
1426 -p ${XDDESTDIR} >/dev/null
1427 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1428 -p ${XDDESTDIR}/usr >/dev/null
1429 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
1430 -p ${XDDESTDIR}/usr/include >/dev/null
1432 .ORDER: _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
1433 xdev-install: _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
1436 @echo "_xi-cross-tools"
1438 gnu/usr.bin/binutils \
1440 ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \
1441 cd ${.CURDIR}/${_tool}; \
1442 ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR}
1446 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 par-includes \
1447 DESTDIR=${XDDESTDIR}
1450 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \
1451 DESTDIR=${XDDESTDIR}
1454 ${_+_}cd ${XDDESTDIR}/usr/bin; \
1456 ln -sf ../../${XDTP}/usr/bin/$$i \
1457 ../../../../usr/bin/${XDDIR}-$$i; \
1458 ln -sf ../../${XDTP}/usr/bin/$$i \
1459 ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \