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_KERNELCONFIG
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"
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?= -r RELENG_8_0 -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 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}
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" || defined(NO_CTF)
263 WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1 DESTDIR=${WORLDTMP}
265 .if ${TARGET_ARCH} == "amd64"
267 LIB32TMP= ${OBJTREE}${.CURDIR}/lib32
269 .if empty(TARGET_CPUTYPE)
270 LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2
272 LIB32CPUFLAGS= -march=${TARGET_CPUTYPE}
274 LIB32FLAGS= -m32 ${LIB32CPUFLAGS} -mfancy-math-387 -DCOMPAT_32BIT \
275 -iprefix ${LIB32TMP}/usr/ \
276 -L${LIB32TMP}/usr/lib32 \
277 -B${LIB32TMP}/usr/lib32
279 # Yes, the flags are redundant.
280 LIB32WMAKEENV= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \
281 _SHLIBDIRPREFIX=${LIB32TMP} \
282 VERSION="${VERSION}" \
285 INSTALL="sh ${.CURDIR}/tools/install.sh" \
287 CC="${CC} ${LIB32FLAGS}" \
288 CXX="${CXX} ${LIB32FLAGS}" \
289 OBJC="${OBJC} ${LIB32FLAGS}" \
290 LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" \
295 LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} -DNO_CPU_CFLAGS -DCOMPAT_32BIT \
296 -DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO \
297 -DWITHOUT_HTML -DNO_CTF DESTDIR=${LIB32TMP}
298 LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*} -DNO_INCS
302 IMAKEENV= ${CROSSENV}
303 IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1
304 .if empty(.MAKEFLAGS:M-n)
305 IMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMP} \
306 LD_LIBRARY_PATH=${INSTALLTMP} \
307 PATH_LOCALE=${INSTALLTMP}/locale
308 IMAKE+= __MAKE_SHELL=${INSTALLTMP}/sh
310 IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP}
314 KMAKEENV= ${WMAKEENV}
315 KMAKE= ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME}
320 # Attempt to rebuild the entire system, with reasonable chance of
321 # success, regardless of how old your existing system is.
324 .if ${.CURDIR:C/[^,]//g} != ""
325 # The m4 build of sendmail files doesn't like it if ',' is used
326 # anywhere in the path of it's files.
328 @echo "*** Error: path to source tree contains a comma ','"
333 @echo "--------------------------------------------------------------"
334 @echo ">>> Rebuilding the temporary build tree"
335 @echo "--------------------------------------------------------------"
336 .if !defined(NO_CLEAN)
338 .if ${TARGET_ARCH} == "amd64"
342 rm -rf ${WORLDTMP}/legacy/usr/include
343 # XXX - These three can depend on any header file.
344 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
345 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c
346 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
350 mkdir -p ${WORLDTMP}/${_dir}
352 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
353 -p ${WORLDTMP}/legacy/usr >/dev/null
354 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
355 -p ${WORLDTMP}/usr >/dev/null
356 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
357 -p ${WORLDTMP}/usr/include >/dev/null
358 ln -sf ${.CURDIR}/sys ${WORLDTMP}
359 .if ${MK_BIND_LIBS} != "no"
360 mtree -deU -f ${.CURDIR}/etc/mtree/BIND.include.dist \
361 -p ${WORLDTMP}/usr/include >/dev/null
365 @echo "--------------------------------------------------------------"
366 @echo ">>> stage 1.1: legacy release compatibility shims"
367 @echo "--------------------------------------------------------------"
368 ${_+_}cd ${.CURDIR}; ${BMAKE} legacy
371 @echo "--------------------------------------------------------------"
372 @echo ">>> stage 1.2: bootstrap tools"
373 @echo "--------------------------------------------------------------"
374 ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools
376 .if !defined(NO_CLEAN)
378 @echo "--------------------------------------------------------------"
379 @echo ">>> stage 2.1: cleaning up the object tree"
380 @echo "--------------------------------------------------------------"
381 ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
382 .if ${TARGET_ARCH} == "amd64"
383 ${_+_}cd ${.CURDIR}; ${LIB32WMAKE} -f Makefile.inc1 ${CLEANDIR:S/^/par-/}
388 @echo "--------------------------------------------------------------"
389 @echo ">>> stage 2.2: rebuilding the object tree"
390 @echo "--------------------------------------------------------------"
391 ${_+_}cd ${.CURDIR}; ${WMAKE} par-obj
394 @echo "--------------------------------------------------------------"
395 @echo ">>> stage 2.3: build tools"
396 @echo "--------------------------------------------------------------"
397 ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools
400 @echo "--------------------------------------------------------------"
401 @echo ">>> stage 3: cross tools"
402 @echo "--------------------------------------------------------------"
403 ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools
406 @echo "--------------------------------------------------------------"
407 @echo ">>> stage 4.1: building includes"
408 @echo "--------------------------------------------------------------"
409 ${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
412 @echo "--------------------------------------------------------------"
413 @echo ">>> stage 4.2: building libraries"
414 @echo "--------------------------------------------------------------"
415 ${_+_}cd ${.CURDIR}; \
416 ${WMAKE} -DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
417 -DWITHOUT_MAN -DWITHOUT_PROFILE libraries
420 @echo "--------------------------------------------------------------"
421 @echo ">>> stage 4.3: make dependencies"
422 @echo "--------------------------------------------------------------"
423 ${_+_}cd ${.CURDIR}; ${WMAKE} par-depend
426 @echo "--------------------------------------------------------------"
427 @echo ">>> stage 4.4: building everything"
428 @echo "--------------------------------------------------------------"
429 ${_+_}cd ${.CURDIR}; ${WMAKE} par-all
430 .if ${TARGET_ARCH} == "amd64"
433 @echo "--------------------------------------------------------------"
434 @echo ">>> stage 5.1: building 32 bit shim libraries"
435 @echo "--------------------------------------------------------------"
436 mkdir -p ${LIB32TMP}/usr/lib32
437 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
438 -p ${LIB32TMP}/usr >/dev/null
439 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
440 -p ${LIB32TMP}/usr/include >/dev/null
442 ln -sf ${.CURDIR}/sys ${WORLDTMP}
443 .if ${MK_KERBEROS} != "no"
444 .for _t in obj depend all
445 cd ${.CURDIR}/kerberos5/tools; \
446 MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \
450 .for _t in obj includes
451 cd ${.CURDIR}/include; ${LIB32WMAKE} ${_t}
452 cd ${.CURDIR}/lib; ${LIB32WMAKE} ${_t}
453 .if ${MK_CDDL} != "no"
454 cd ${.CURDIR}/cddl/lib; ${LIB32WMAKE} ${_t}
456 cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} ${_t}
457 .if ${MK_CRYPT} != "no"
458 cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} ${_t}
460 .if ${MK_KERBEROS} != "no"
461 cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} ${_t}
464 .for _dir in usr.bin/lex/lib
465 cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} obj
467 .for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic
468 cd ${.CURDIR}/${_dir}; \
469 MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \
473 ${LIB32WMAKE} -f Makefile.inc1 libraries
474 .for _t in obj depend all
475 cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32WMAKE} ${_t}
476 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32WMAKE} ${_t}
479 distribute32 install32:
480 .if make(distribute32)
481 mkdir -p ${DISTDIR}/${DISTRIBUTION}/usr/lib32 # XXX add to mtree
482 mkdir -p ${DISTDIR}/${DISTRIBUTION}/usr/lib32/dtrace # XXX add to mtree
484 mkdir -p ${DESTDIR}/usr/lib32 # XXX add to mtree
485 mkdir -p ${DESTDIR}/usr/lib32/dtrace # XXX add to mtree
487 cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
488 .if ${MK_CDDL} != "no"
489 cd ${.CURDIR}/cddl/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
491 cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
492 .if ${MK_CRYPT} != "no"
493 cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
495 .if ${MK_KERBEROS} != "no"
496 cd ${.CURDIR}/kerberos5/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
498 cd ${.CURDIR}/libexec/rtld-elf; \
499 PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//}
500 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32IMAKE} ${.TARGET:S/32$//}
504 .if !defined(SUBDIR_OVERRIDE)
505 WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools
507 WMAKE_TGTS+= _cleanobj _obj _build-tools
508 .if !defined(SUBDIR_OVERRIDE)
509 WMAKE_TGTS+= _cross-tools
511 WMAKE_TGTS+= _includes _libraries _depend everything
512 .if ${TARGET_ARCH} == "amd64" && ${MK_LIB32} != "no"
516 buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
517 .ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
520 @echo "--------------------------------------------------------------"
521 @echo ">>> World build started on `LC_ALL=C date`"
522 @echo "--------------------------------------------------------------"
526 @echo "--------------------------------------------------------------"
527 @echo ">>> World build completed on `LC_ALL=C date`"
528 @echo "--------------------------------------------------------------"
531 # We need to have this as a target because the indirection between Makefile
532 # and Makefile.inc1 causes the correct PATH to be used, rather than a
533 # modification of the current environment's PATH. In addition, we need
534 # to quote multiword values.
540 @echo Entering world for ${TARGET_ARCH}:${TARGET}
541 @cd ${.CURDIR} && env ${WMAKEENV} sh || true
543 TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything:Nbuild32}
544 toolchain: ${TOOLCHAIN_TGTS}
545 kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries}
550 # Checks to be sure system is ready for installworld/installkernel.
555 # Require DESTDIR to be set if installing for a different architecture.
557 .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE}
558 .if !make(distributeworld)
559 installcheck: installcheck_DESTDIR
560 installcheck_DESTDIR:
561 .if !defined(DESTDIR) || empty(DESTDIR)
562 @echo "ERROR: Please set DESTDIR!"; \
569 # Check for missing UIDs/GIDs.
573 .if ${MK_SENDMAIL} != "no"
579 CHECK_GIDS+= proxy authpf
581 installcheck: installcheck_UGID
583 .for uid in ${CHECK_UIDS}
584 @if ! `id -u ${uid} >/dev/null 2>&1`; then \
585 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \
589 .for gid in ${CHECK_GIDS}
590 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \
591 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \
597 # Required install tools to be saved in a scratch dir for safety.
599 .if ${MK_INFO} != "no"
600 _install-info= install-info
603 ITOOLS= [ awk cap_mkdb cat chflags chmod chown \
604 date echo egrep find grep ${_install-info} \
605 ln lockf make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
606 test true uname wc zic
611 # Distributes everything compiled by a `buildworld'.
615 # Installs everything compiled by a 'buildworld'.
617 distributeworld installworld: installcheck
618 mkdir -p ${INSTALLTMP}
619 progs=$$(for prog in ${ITOOLS}; do \
620 if progpath=`which $$prog`; then \
623 echo "Required tool $$prog not found in PATH." >&2; \
627 libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | \
628 while read line; do \
630 if [ "$$2 $$3" != "not found" ]; then \
633 echo "Required library $$1 not found." >&2; \
637 cp $$libs $$progs ${INSTALLTMP}
638 cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale
639 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \
640 ${IMAKEENV} rm -rf ${INSTALLTMP}
645 # If you have a build server, you can NFS mount the source and obj directories
646 # and do a 'make reinstall' on the *client* to install new binaries from the
647 # most recent server build.
650 @echo "--------------------------------------------------------------"
651 @echo ">>> Making hierarchy"
652 @echo "--------------------------------------------------------------"
653 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
655 @echo "--------------------------------------------------------------"
656 @echo ">>> Installing everything"
657 @echo "--------------------------------------------------------------"
658 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
659 .if ${TARGET_ARCH} == "amd64" && ${MK_LIB32} != "no"
660 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32
664 @echo "--------------------------------------------------------------"
665 @echo ">>> Distributing everything"
666 @echo "--------------------------------------------------------------"
667 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
668 .if ${TARGET_ARCH} == "amd64" && ${MK_LIB32} != "no"
669 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 \
673 distrib-dirs distribution:
674 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} ${.TARGET}
677 # buildkernel and installkernel
679 # Which kernels to build and/or install is specified by setting
680 # KERNCONF. If not defined a GENERIC kernel is built/installed.
681 # Only the existing (depending TARGET) config files are used
682 # for building kernels and only the first of these is designated
683 # as the one being installed.
685 # Note that we have to use TARGET instead of TARGET_ARCH when
686 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
687 # be set to cross-build, we have to make sure TARGET is set
690 .if defined(KERNFAST)
694 # Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah
695 .if !defined(KERNCONF) && ${KERNFAST} != "1"
699 .if !defined(KERNCONF) && defined(KERNEL)
705 INSTKERNNAME?= kernel
707 KERNSRCDIR?= ${.CURDIR}/sys
708 KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf
709 KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR}
710 KERNCONFDIR?= ${KRNLCONFDIR}
714 .for _kernel in ${KERNCONF}
715 .if exists(${KERNCONFDIR}/${_kernel})
716 BUILDKERNELS+= ${_kernel}
717 .if empty(INSTALLKERNEL)
718 INSTALLKERNEL= ${_kernel}
726 # Builds all kernels defined by BUILDKERNELS.
729 .if empty(BUILDKERNELS)
730 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \
733 .if defined(KERNWARN)
734 @echo "--------------------------------------------------------------"
735 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
736 @echo "--------------------------------------------------------------"
740 .for _kernel in ${BUILDKERNELS}
741 @echo "--------------------------------------------------------------"
742 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
743 @echo "--------------------------------------------------------------"
744 @echo "===> ${_kernel}"
745 mkdir -p ${KRNLOBJDIR}
746 .if !defined(NO_KERNELCONFIG)
748 @echo "--------------------------------------------------------------"
749 @echo ">>> stage 1: configuring the kernel"
750 @echo "--------------------------------------------------------------"
753 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
754 ${KERNCONFDIR}/${_kernel}
756 .if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN)
758 @echo "--------------------------------------------------------------"
759 @echo ">>> stage 2.1: cleaning up the object tree"
760 @echo "--------------------------------------------------------------"
761 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR}
764 @echo "--------------------------------------------------------------"
765 @echo ">>> stage 2.2: rebuilding the object tree"
766 @echo "--------------------------------------------------------------"
767 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj
769 @echo "--------------------------------------------------------------"
770 @echo ">>> stage 2.3: build tools"
771 @echo "--------------------------------------------------------------"
772 cd ${KRNLOBJDIR}/${_kernel}; \
773 MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \
774 ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF \
775 -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
776 # XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case.
777 .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules)
778 .for target in obj depend all
779 cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \
780 MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
781 ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF ${target}
784 .if !defined(NO_KERNELDEPEND)
786 @echo "--------------------------------------------------------------"
787 @echo ">>> stage 3.1: making dependencies"
788 @echo "--------------------------------------------------------------"
789 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ
792 @echo "--------------------------------------------------------------"
793 @echo ">>> stage 3.2: building everything"
794 @echo "--------------------------------------------------------------"
795 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ
796 @echo "--------------------------------------------------------------"
797 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
798 @echo "--------------------------------------------------------------"
802 # installkernel, etc.
804 # Install the kernel defined by INSTALLKERNEL
806 installkernel installkernel.debug \
807 reinstallkernel reinstallkernel.debug: installcheck
808 .if empty(INSTALLKERNEL)
809 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
812 @echo "--------------------------------------------------------------"
813 @echo ">>> Installing kernel"
814 @echo "--------------------------------------------------------------"
815 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
816 ${CROSSENV} PATH=${TMPPATH} \
817 ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
822 # Build the API documentation with doxygen
825 @if [ ! -x `/usr/bin/which doxygen` ]; then \
826 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \
829 cd ${.CURDIR}/tools/kerneldoc/subsys && ${MAKE} obj all
834 # Update the source tree, by running cvsup and/or running cvs to update to the
838 .if defined(SUP_UPDATE)
839 @echo "--------------------------------------------------------------"
840 @echo ">>> Running ${SUP}"
841 @echo "--------------------------------------------------------------"
843 @${SUP} ${SUPFLAGS} ${SUPFILE}
845 .if defined(SUPFILE1)
846 @${SUP} ${SUPFLAGS} ${SUPFILE1}
848 .if defined(SUPFILE2)
849 @${SUP} ${SUPFLAGS} ${SUPFILE2}
851 .if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
852 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
854 .if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
855 @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
858 .if defined(CVS_UPDATE)
860 if [ -d CVS ] ; then \
861 echo "--------------------------------------------------------------" ; \
862 echo ">>> Updating ${.CURDIR} from CVS repository" ${CVSROOT} ; \
863 echo "--------------------------------------------------------------" ; \
864 echo ${CVS} -R -q update ${CVSFLAGS} ; \
865 ${CVS} -R -q update ${CVSFLAGS} ; \
868 .if defined(SVN_UPDATE)
870 if [ -d .svn ] ; then \
871 echo "--------------------------------------------------------------" ; \
872 echo ">>> Updating ${.CURDIR} using Subversion" ; \
873 echo "--------------------------------------------------------------" ; \
874 echo ${SVN} update ${SVNFLAGS} ; \
875 ${SVN} update ${SVNFLAGS} ; \
880 # ------------------------------------------------------------------------
882 # From here onwards are utility targets used by the 'make world' and
883 # related targets. If your 'world' breaks, you may like to try to fix
884 # the problem and manually run the following targets to attempt to
885 # complete the build. Beware, this is *not* guaranteed to work, you
886 # need to have a pretty good grip on the current state of the system
887 # to attempt to manually finish it. If in doubt, 'make world' again.
891 # legacy: Build compatibility shims for the next three targets
894 .if ${BOOTSTRAPPING} < 600034 && ${BOOTSTRAPPING} != 0
895 @echo "ERROR: Source upgrades from versions prior to 6.0 not supported."; \
898 .for _tool in tools/build
899 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \
900 cd ${.CURDIR}/${_tool}; \
901 ${MAKE} DIRPRFX=${_tool}/ obj; \
902 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \
903 ${MAKE} DIRPRFX=${_tool}/ depend; \
904 ${MAKE} DIRPRFX=${_tool}/ all; \
905 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
909 # bootstrap-tools: Build tools needed for compatibility
911 .if ${MK_GAMES} != "no"
912 _strfile= games/fortune/strfile
915 .if ${MK_CXX} != "no"
916 _gperf= gnu/usr.bin/gperf
917 .if ${BOOTSTRAPPING} < 700004
918 _groff= gnu/usr.bin/groff
920 _groff= gnu/usr.bin/groff/tmac
924 .if ${BOOTSTRAPPING} >= 700044 && ${BOOTSTRAPPING} < 800022
928 .if ${BOOTSTRAPPING} < 800013
929 _mklocale= usr.bin/mklocale
932 .if ${BOOTSTRAPPING} < 700018
933 _gensnmptree= usr.sbin/bsnmpd/gensnmptree
936 .if ${MK_RESCUE} != "no" && \
937 ${BOOTSTRAPPING} < 700026
938 _crunchgen= usr.sbin/crunch/crunchgen
941 .if ${MK_CDDL} != "no"
942 _dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \
943 lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge
961 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
962 cd ${.CURDIR}/${_tool}; \
963 ${MAKE} DIRPRFX=${_tool}/ obj; \
964 ${MAKE} DIRPRFX=${_tool}/ depend; \
965 ${MAKE} DIRPRFX=${_tool}/ all; \
966 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
970 # build-tools: Build special purpose build tools
972 .if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules)
973 _aicasm= sys/modules/aic7xxx/aicasm
976 .if !defined(NO_SHARE)
977 _share= share/syscons/scrnmaps
980 .if ${MK_KERBEROS} != "no"
981 _kerberos5_tools= kerberos5/tools
984 .if ${MK_RESCUE} != "no"
985 _rescue= rescue/rescue
993 lib/ncurses/ncurses \
994 lib/ncurses/ncursesw \
1000 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \
1001 cd ${.CURDIR}/${_tool}; \
1002 ${MAKE} DIRPRFX=${_tool}/ obj; \
1003 ${MAKE} DIRPRFX=${_tool}/ build-tools
1006 gnu/usr.bin/cc/cc_tools \
1008 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \
1009 cd ${.CURDIR}/${_tool}; \
1010 ${MAKE} DIRPRFX=${_tool}/ obj; \
1011 ${MAKE} DIRPRFX=${_tool}/ depend; \
1012 ${MAKE} DIRPRFX=${_tool}/ all
1016 # cross-tools: Build cross-building tools
1018 .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 800035
1019 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386"
1020 _btxld= usr.sbin/btxld
1023 .if ${TARGET_ARCH} != ${MACHINE_ARCH}
1024 .if ${MK_RESCUE} != "no" || defined(RELEASEDIR)
1025 _crunchide= usr.sbin/crunch/crunchide
1027 .if ${TARGET_ARCH} == "i386" && defined(RELEASEDIR)
1028 _kgzip= usr.sbin/kgzip
1034 gnu/usr.bin/binutils \
1037 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
1041 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1042 cd ${.CURDIR}/${_tool}; \
1043 ${MAKE} DIRPRFX=${_tool}/ obj; \
1044 ${MAKE} DIRPRFX=${_tool}/ depend; \
1045 ${MAKE} DIRPRFX=${_tool}/ all; \
1046 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
1050 # hierarchy - ensure that all the needed directories are present
1053 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs
1056 # libraries - build all libraries, and install them under ${DESTDIR}.
1058 # The list of libraries with dependents (${_prebuild_libs}) and their
1059 # interdependencies (__L) are built automatically by the
1060 # ${.CURDIR}/tools/make_libdeps.sh script.
1064 ${MAKE} -f Makefile.inc1 _prereq_libs; \
1065 ${MAKE} -f Makefile.inc1 _startup_libs; \
1066 ${MAKE} -f Makefile.inc1 _prebuild_libs; \
1067 ${MAKE} -f Makefile.inc1 _generic_libs;
1070 # static libgcc.a prerequisite for shared libc
1072 _prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc
1074 # These dependencies are not automatically generated:
1076 # gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before
1077 # all shared libraries for ELF.
1079 _startup_libs= gnu/lib/csu
1080 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
1081 _startup_libs+= lib/csu/${MACHINE_ARCH}-elf
1083 _startup_libs+= lib/csu/${MACHINE_ARCH}
1085 _startup_libs+= gnu/lib/libgcc
1086 _startup_libs+= lib/libc
1088 gnu/lib/libgcc__L: lib/libc__L
1090 _prebuild_libs= ${_kerberos5_lib_libasn1} ${_kerberos5_lib_libkrb5} \
1091 ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libroken} \
1092 ${_kerberos5_lib_libheimntlm} ${_kerberos5_lib_libgssapi_krb5} \
1093 lib/libbz2 lib/libcom_err lib/libcrypt lib/libelf \
1095 ${_lib_cddl} ${_lib_libgssapi} ${_lib_libipx} \
1096 lib/libkiconv lib/libkvm lib/libmd \
1097 lib/ncurses/ncurses lib/ncurses/ncursesw \
1098 lib/libopie lib/libpam ${_lib_libthr} \
1099 lib/libradius lib/libsbuf lib/libtacplus lib/libutil \
1100 ${_lib_libypclnt} lib/libz lib/msun \
1101 ${_secure_lib_libcrypto} ${_secure_lib_libssh} \
1102 ${_secure_lib_libssl} lib/libdwarf lib/libproc
1104 .if ${MK_LIBTHR} != "no"
1105 _lib_libthr= lib/libthr
1108 _generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib
1110 lib/libopie__L lib/libtacplus__L: lib/libmd__L
1112 .if ${MK_CDDL} != "no"
1116 .if ${MK_CRYPT} != "no"
1117 .if ${MK_OPENSSL} != "no"
1118 _secure_lib_libcrypto= secure/lib/libcrypto
1119 _secure_lib_libssl= secure/lib/libssl
1120 lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L
1121 .if ${MK_OPENSSH} != "no"
1122 _secure_lib_libssh= secure/lib/libssh
1123 secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
1124 .if ${MK_KERBEROS} != "no"
1125 kerberos5/lib/libgssapi_krb5__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \
1126 kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \
1127 lib/libmd__L kerberos5/lib/libroken__L secure/lib/libcrypto__L \
1129 secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libgssapi_krb5__L
1133 _secure_lib= secure/lib
1136 .if ${MK_IPX} != "no"
1137 _lib_libipx= lib/libipx
1140 .if ${MK_KERBEROS} != "no"
1141 _kerberos5_lib= kerberos5/lib
1142 _kerberos5_lib_libasn1= kerberos5/lib/libasn1
1143 _kerberos5_lib_libkrb5= kerberos5/lib/libkrb5
1144 _kerberos5_lib_libhx509= kerberos5/lib/libhx509
1145 _kerberos5_lib_libroken= kerberos5/lib/libroken
1146 _kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm
1147 _kerberos5_lib_libgssapi_krb5= kerberos5/lib/libgssapi_krb5
1148 _lib_libgssapi= lib/libgssapi
1151 .if ${MK_NIS} != "no"
1152 _lib_libypclnt= lib/libypclnt
1155 .if ${MK_OPENSSL} == "no"
1156 lib/libradius__L: lib/libmd__L
1159 .for _lib in ${_prereq_libs}
1161 .if exists(${.CURDIR}/${_lib})
1162 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1163 cd ${.CURDIR}/${_lib}; \
1164 ${MAKE} DIRPRFX=${_lib}/ obj; \
1165 ${MAKE} DIRPRFX=${_lib}/ depend; \
1166 ${MAKE} -DWITHOUT_PROFILE -DNO_PIC DIRPRFX=${_lib}/ all; \
1167 ${MAKE} -DWITHOUT_PROFILE -DNO_PIC DIRPRFX=${_lib}/ install
1171 .for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
1173 .if exists(${.CURDIR}/${_lib})
1174 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1175 cd ${.CURDIR}/${_lib}; \
1176 ${MAKE} DIRPRFX=${_lib}/ obj; \
1177 ${MAKE} DIRPRFX=${_lib}/ depend; \
1178 ${MAKE} DIRPRFX=${_lib}/ all; \
1179 ${MAKE} DIRPRFX=${_lib}/ install
1183 # libpam is special: we need to build static PAM modules before
1184 # static PAM library, and dynamic PAM library before dynamic PAM
1186 lib/libpam__L: .PHONY
1187 ${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \
1188 cd ${.CURDIR}/lib/libpam; \
1189 ${MAKE} DIRPRFX=lib/libpam/ obj; \
1190 ${MAKE} DIRPRFX=lib/libpam/ depend; \
1191 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \
1192 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install
1194 _prereq_libs: ${_prereq_libs:S/$/__PL/}
1195 _startup_libs: ${_startup_libs:S/$/__L/}
1196 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
1197 _generic_libs: ${_generic_libs:S/$/__L/}
1199 .for __target in all clean cleandepend cleandir depend includes obj
1200 .for entry in ${SUBDIR}
1201 ${entry}.${__target}__D: .PHONY
1202 ${_+_}@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
1203 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \
1204 edir=${entry}.${MACHINE_ARCH}; \
1205 cd ${.CURDIR}/$${edir}; \
1207 ${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \
1209 cd ${.CURDIR}/$${edir}; \
1211 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
1213 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
1216 .include <bsd.subdir.mk>
1218 .if make(check-old) || make(check-old-dirs) || \
1219 make(check-old-files) || make(check-old-libs) || \
1220 make(delete-old) || make(delete-old-dirs) || \
1221 make(delete-old-files) || make(delete-old-libs)
1224 # check for / delete old files section
1227 .include "ObsoleteFiles.inc"
1229 OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \
1230 else you can not start such an application. Consult UPDATING for more \
1231 information regarding how to cope with the removal/revision bump of a \
1234 .if !defined(BATCH_DELETE_OLD_FILES)
1241 @echo ">>> Removing old files (only deletes safe to delete libs)"
1242 # Ask for every old file if the user really wants to remove it.
1243 # It's annoying, but better safe than sorry.
1244 @for file in ${OLD_FILES}; do \
1245 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1246 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1247 rm ${RM_I} "${DESTDIR}/$${file}"; \
1250 # Remove catpages without corresponding manpages.
1252 find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1253 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1254 while read catpage; do \
1256 if [ ! -e "$${manpage}" ]; then \
1257 rm ${RM_I} $${catpage} <&3 ; \
1260 @echo ">>> Old files removed"
1263 @echo ">>> Checking for old files"
1264 @for file in ${OLD_FILES}; do \
1265 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1266 echo "${DESTDIR}/$${file}"; \
1269 # Check for catpages without corresponding manpages.
1270 @find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1271 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1272 while read catpage; do \
1274 if [ ! -e "$${manpage}" ]; then \
1275 echo $${catpage} ; \
1280 @echo ">>> Removing old libraries"
1281 @echo "${OLD_LIBS_MESSAGE}" | fmt
1282 @for file in ${OLD_LIBS}; do \
1283 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1284 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1285 rm ${RM_I} "${DESTDIR}/$${file}"; \
1288 @echo ">>> Old libraries removed"
1291 @echo ">>> Checking for old libraries"
1292 @for file in ${OLD_LIBS}; do \
1293 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1294 echo "${DESTDIR}/$${file}"; \
1299 @echo ">>> Removing old directories"
1300 @for dir in ${OLD_DIRS}; do \
1301 if [ -d "${DESTDIR}/$${dir}" ]; then \
1302 rmdir -v "${DESTDIR}/$${dir}" || true; \
1303 elif [ -L "${DESTDIR}/$${dir}" ]; then \
1304 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1307 @echo ">>> Old directories removed"
1310 @echo ">>> Checking for old directories"
1311 @for dir in ${OLD_DIRS}; do \
1312 if [ -d "${DESTDIR}/$${dir}" ]; then \
1313 echo "${DESTDIR}/$${dir}"; \
1314 elif [ -L "${DESTDIR}/$${dir}" ]; then \
1315 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1319 delete-old: delete-old-files delete-old-dirs
1320 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1322 check-old: check-old-files check-old-libs check-old-dirs
1323 @echo "To remove old files and directories run '${MAKE} delete-old'."
1324 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1329 # showconfig - show build configuration.
1332 @${MAKE} -n -f bsd.own.mk -V dummy -dg1 | grep ^MK_ | sort
1337 .if defined(XDEV) && defined(XDEV_ARCH)
1339 NOFUN=-DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
1340 -DWITHOUT_MAN -DWITHOUT_NLS -DWITHOUT_PROFILE \
1341 -DWITHOUT_KERBEROS -DWITHOUT_RESCUE -DNO_WARNS
1343 XDDIR=${XDEV}-freebsd
1345 CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \
1346 TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH}
1348 _SHLIBDIRPREFIX=${XDTP} \
1349 TOOLS_PREFIX=${XDTP}
1351 MACHINE=${XDEV} MACHINE_ARCH=${XDEV_ARCH}
1353 CDTMP= ${MAKEOBJDIRPREFIX}/${XDEV}/${.CURDIR}/tmp
1354 CDMAKE=${CDENV} ${MAKE} ${NOFUN}
1355 CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDTP}/usr/bin:${PATH} ${MAKE} ${NOFUN}
1356 XDDESTDIR=${DESTDIR}${XDTP}
1358 OSREL!= uname -r | sed -e 's/[-(].*//'
1361 .ORDER: xdev-build xdev-install
1362 xdev: xdev-build xdev-install
1364 .ORDER: _xb-build-tools _xb-cross-tools
1365 xdev-build: _xb-build-tools _xb-cross-tools
1368 ${_+_}cd ${.CURDIR}; \
1369 ${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools
1373 gnu/usr.bin/binutils \
1375 ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \
1376 cd ${.CURDIR}/${_tool}; \
1377 ${CDMAKE} DIRPRFX=${_tool}/ obj; \
1378 ${CDMAKE} DIRPRFX=${_tool}/ depend; \
1379 ${CDMAKE} DIRPRFX=${_tool}/ all
1383 ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}"
1384 mkdir -p ${XDDESTDIR}
1385 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
1386 -p ${XDDESTDIR} >/dev/null
1387 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1388 -p ${XDDESTDIR}/usr >/dev/null
1389 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
1390 -p ${XDDESTDIR}/usr/include >/dev/null
1392 .ORDER: _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
1393 xdev-install: _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
1396 @echo "_xi-cross-tools"
1398 gnu/usr.bin/binutils \
1400 ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \
1401 cd ${.CURDIR}/${_tool}; \
1402 ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR}
1406 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 par-includes \
1407 DESTDIR=${XDDESTDIR}
1410 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \
1411 DESTDIR=${XDDESTDIR}
1414 ${_+_}cd ${XDDESTDIR}/usr/bin; \
1416 ln -sf ../../${XDTP}/usr/bin/$$i \
1417 ../../../../usr/bin/${XDDIR}-$$i; \
1418 ln -sf ../../${XDTP}/usr/bin/$$i \
1419 ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \