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"
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 -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 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=*} -DNO_INCS
303 IMAKEENV= ${CROSSENV}
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 MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \
777 ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF \
778 -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
779 # XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case.
780 .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules)
781 .for target in obj depend all
782 cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \
783 MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
784 ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF ${target}
787 .if !defined(NO_KERNELDEPEND)
789 @echo "--------------------------------------------------------------"
790 @echo ">>> stage 3.1: making dependencies"
791 @echo "--------------------------------------------------------------"
792 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ
795 @echo "--------------------------------------------------------------"
796 @echo ">>> stage 3.2: building everything"
797 @echo "--------------------------------------------------------------"
798 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ
799 @echo "--------------------------------------------------------------"
800 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
801 @echo "--------------------------------------------------------------"
805 # installkernel, etc.
807 # Install the kernel defined by INSTALLKERNEL
809 installkernel installkernel.debug \
810 reinstallkernel reinstallkernel.debug: installcheck
811 .if empty(INSTALLKERNEL)
812 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
815 @echo "--------------------------------------------------------------"
816 @echo ">>> Installing kernel ${INSTALLKERNEL}"
817 @echo "--------------------------------------------------------------"
818 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
819 ${CROSSENV} PATH=${TMPPATH} \
820 ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
825 # Build the API documentation with doxygen
828 @if [ ! -x `/usr/bin/which doxygen` ]; then \
829 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \
832 cd ${.CURDIR}/tools/kerneldoc/subsys && ${MAKE} obj all
837 # Update the source tree, by running cvsup and/or running cvs to update to the
841 .if defined(SUP_UPDATE)
842 @echo "--------------------------------------------------------------"
843 @echo ">>> Running ${SUP}"
844 @echo "--------------------------------------------------------------"
846 @${SUP} ${SUPFLAGS} ${SUPFILE}
848 .if defined(SUPFILE1)
849 @${SUP} ${SUPFLAGS} ${SUPFILE1}
851 .if defined(SUPFILE2)
852 @${SUP} ${SUPFLAGS} ${SUPFILE2}
854 .if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
855 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
857 .if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
858 @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
861 .if defined(CVS_UPDATE)
863 if [ -d CVS ] ; then \
864 echo "--------------------------------------------------------------" ; \
865 echo ">>> Updating ${.CURDIR} from CVS repository" ${CVSROOT} ; \
866 echo "--------------------------------------------------------------" ; \
867 echo ${CVS} -R -q update ${CVSFLAGS} ; \
868 ${CVS} -R -q update ${CVSFLAGS} ; \
871 .if defined(SVN_UPDATE)
873 if [ -d .svn ] ; then \
874 echo "--------------------------------------------------------------" ; \
875 echo ">>> Updating ${.CURDIR} using Subversion" ; \
876 echo "--------------------------------------------------------------" ; \
877 echo ${SVN} update ${SVNFLAGS} ; \
878 ${SVN} update ${SVNFLAGS} ; \
883 # ------------------------------------------------------------------------
885 # From here onwards are utility targets used by the 'make world' and
886 # related targets. If your 'world' breaks, you may like to try to fix
887 # the problem and manually run the following targets to attempt to
888 # complete the build. Beware, this is *not* guaranteed to work, you
889 # need to have a pretty good grip on the current state of the system
890 # to attempt to manually finish it. If in doubt, 'make world' again.
894 # legacy: Build compatibility shims for the next three targets
897 .if ${BOOTSTRAPPING} < 600034 && ${BOOTSTRAPPING} != 0
898 @echo "ERROR: Source upgrades from versions prior to 6.0 not supported."; \
901 .for _tool in tools/build
902 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \
903 cd ${.CURDIR}/${_tool}; \
904 ${MAKE} DIRPRFX=${_tool}/ obj; \
905 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \
906 ${MAKE} DIRPRFX=${_tool}/ depend; \
907 ${MAKE} DIRPRFX=${_tool}/ all; \
908 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
912 # bootstrap-tools: Build tools needed for compatibility
914 .if ${MK_GAMES} != "no"
915 _strfile= games/fortune/strfile
918 .if ${MK_CXX} != "no"
919 _gperf= gnu/usr.bin/gperf
920 .if ${BOOTSTRAPPING} < 700004
921 _groff= gnu/usr.bin/groff
923 _groff= gnu/usr.bin/groff/tmac
927 .if ${BOOTSTRAPPING} >= 700044 && ${BOOTSTRAPPING} < 800022
931 .if ${BOOTSTRAPPING} < 802000
935 .if ${BOOTSTRAPPING} < 800013
936 _mklocale= usr.bin/mklocale
939 .if ${BOOTSTRAPPING} < 700018
940 _gensnmptree= usr.sbin/bsnmpd/gensnmptree
943 .if ${MK_RESCUE} != "no" && \
944 ${BOOTSTRAPPING} < 700026
945 _crunchgen= usr.sbin/crunch/crunchgen
948 .if ${MK_CDDL} != "no"
949 _dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \
950 lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge
969 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
970 cd ${.CURDIR}/${_tool}; \
971 ${MAKE} DIRPRFX=${_tool}/ obj; \
972 ${MAKE} DIRPRFX=${_tool}/ depend; \
973 ${MAKE} DIRPRFX=${_tool}/ all; \
974 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
978 # build-tools: Build special purpose build tools
980 .if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules)
981 _aicasm= sys/modules/aic7xxx/aicasm
984 .if !defined(NO_SHARE)
985 _share= share/syscons/scrnmaps
988 .if ${MK_KERBEROS} != "no"
989 _kerberos5_tools= kerberos5/tools
992 .if ${MK_RESCUE} != "no"
993 _rescue= rescue/rescue
1001 lib/ncurses/ncurses \
1002 lib/ncurses/ncursesw \
1008 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \
1009 cd ${.CURDIR}/${_tool}; \
1010 ${MAKE} DIRPRFX=${_tool}/ obj; \
1011 ${MAKE} DIRPRFX=${_tool}/ build-tools
1014 gnu/usr.bin/cc/cc_tools \
1016 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \
1017 cd ${.CURDIR}/${_tool}; \
1018 ${MAKE} DIRPRFX=${_tool}/ obj; \
1019 ${MAKE} DIRPRFX=${_tool}/ depend; \
1020 ${MAKE} DIRPRFX=${_tool}/ all
1024 # cross-tools: Build cross-building tools
1026 .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 800035
1027 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386"
1028 _btxld= usr.sbin/btxld
1031 .if ${TARGET_ARCH} != ${MACHINE_ARCH}
1032 .if ${MK_RESCUE} != "no" || defined(RELEASEDIR)
1033 _crunchide= usr.sbin/crunch/crunchide
1035 .if ${TARGET_ARCH} == "i386" && defined(RELEASEDIR)
1036 _kgzip= usr.sbin/kgzip
1042 gnu/usr.bin/binutils \
1045 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
1049 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1050 cd ${.CURDIR}/${_tool}; \
1051 ${MAKE} DIRPRFX=${_tool}/ obj; \
1052 ${MAKE} DIRPRFX=${_tool}/ depend; \
1053 ${MAKE} DIRPRFX=${_tool}/ all; \
1054 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
1058 # hierarchy - ensure that all the needed directories are present
1061 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs
1064 # libraries - build all libraries, and install them under ${DESTDIR}.
1066 # The list of libraries with dependents (${_prebuild_libs}) and their
1067 # interdependencies (__L) are built automatically by the
1068 # ${.CURDIR}/tools/make_libdeps.sh script.
1072 ${MAKE} -f Makefile.inc1 _prereq_libs; \
1073 ${MAKE} -f Makefile.inc1 _startup_libs; \
1074 ${MAKE} -f Makefile.inc1 _prebuild_libs; \
1075 ${MAKE} -f Makefile.inc1 _generic_libs;
1078 # static libgcc.a prerequisite for shared libc
1080 _prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc
1082 # These dependencies are not automatically generated:
1084 # gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before
1085 # all shared libraries for ELF.
1087 _startup_libs= gnu/lib/csu
1088 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
1089 _startup_libs+= lib/csu/${MACHINE_ARCH}-elf
1091 _startup_libs+= lib/csu/${MACHINE_ARCH}
1093 _startup_libs+= gnu/lib/libgcc
1094 _startup_libs+= lib/libc
1096 gnu/lib/libgcc__L: lib/libc__L
1098 _prebuild_libs= ${_kerberos5_lib_libasn1} ${_kerberos5_lib_libheimntlm} \
1099 ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \
1100 ${_kerberos5_lib_libroken} \
1101 lib/libbz2 lib/libcom_err lib/libcrypt \
1103 ${_lib_libgssapi} ${_lib_libipx} \
1104 lib/libkiconv lib/libkvm lib/liblzma lib/libmd \
1105 lib/ncurses/ncurses lib/ncurses/ncursesw \
1106 lib/libopie lib/libpam ${_lib_libthr} \
1107 lib/libradius lib/libsbuf lib/libtacplus \
1108 ${_cddl_lib_libumem} \
1109 lib/libutil ${_lib_libypclnt} lib/libz lib/msun \
1110 ${_secure_lib_libcrypto} ${_secure_lib_libssh} \
1111 ${_secure_lib_libssl}
1113 .if ${MK_LIBTHR} != "no"
1114 _lib_libthr= lib/libthr
1117 _generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib
1119 lib/libopie__L lib/libtacplus__L: lib/libmd__L
1121 .if ${MK_CDDL} != "no"
1122 _cddl_lib_libumem= cddl/lib/libumem
1126 .if ${MK_CRYPT} != "no"
1127 .if ${MK_OPENSSL} != "no"
1128 _secure_lib_libcrypto= secure/lib/libcrypto
1129 _secure_lib_libssl= secure/lib/libssl
1130 lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L
1131 .if ${MK_OPENSSH} != "no"
1132 _secure_lib_libssh= secure/lib/libssh
1133 secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
1134 .if ${MK_KERBEROS_SUPPORT} != "no"
1135 secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \
1136 kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \
1137 lib/libmd__L kerberos5/lib/libroken__L
1141 _secure_lib= secure/lib
1144 .if ${MK_GSSAPI} != "no"
1145 _lib_libgssapi= lib/libgssapi
1148 .if ${MK_IPX} != "no"
1149 _lib_libipx= lib/libipx
1152 .if ${MK_KERBEROS} != "no"
1153 _kerberos5_lib= kerberos5/lib
1154 _kerberos5_lib_libasn1= kerberos5/lib/libasn1
1155 _kerberos5_lib_libkrb5= kerberos5/lib/libkrb5
1156 _kerberos5_lib_libhx509= kerberos5/lib/libhx509
1157 _kerberos5_lib_libroken= kerberos5/lib/libroken
1158 _kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm
1161 .if ${MK_NIS} != "no"
1162 _lib_libypclnt= lib/libypclnt
1165 .if ${MK_OPENSSL} == "no"
1166 lib/libradius__L: lib/libmd__L
1169 .for _lib in ${_prereq_libs}
1171 .if exists(${.CURDIR}/${_lib})
1172 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1173 cd ${.CURDIR}/${_lib}; \
1174 ${MAKE} DIRPRFX=${_lib}/ obj; \
1175 ${MAKE} DIRPRFX=${_lib}/ depend; \
1176 ${MAKE} -DWITHOUT_PROFILE -DNO_PIC DIRPRFX=${_lib}/ all; \
1177 ${MAKE} -DWITHOUT_PROFILE -DNO_PIC DIRPRFX=${_lib}/ install
1181 .for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
1183 .if exists(${.CURDIR}/${_lib})
1184 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1185 cd ${.CURDIR}/${_lib}; \
1186 ${MAKE} DIRPRFX=${_lib}/ obj; \
1187 ${MAKE} DIRPRFX=${_lib}/ depend; \
1188 ${MAKE} DIRPRFX=${_lib}/ all; \
1189 ${MAKE} DIRPRFX=${_lib}/ install
1193 # libpam is special: we need to build static PAM modules before
1194 # static PAM library, and dynamic PAM library before dynamic PAM
1196 lib/libpam__L: .PHONY
1197 ${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \
1198 cd ${.CURDIR}/lib/libpam; \
1199 ${MAKE} DIRPRFX=lib/libpam/ obj; \
1200 ${MAKE} DIRPRFX=lib/libpam/ depend; \
1201 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \
1202 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install
1204 _prereq_libs: ${_prereq_libs:S/$/__PL/}
1205 _startup_libs: ${_startup_libs:S/$/__L/}
1206 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
1207 _generic_libs: ${_generic_libs:S/$/__L/}
1209 .for __target in all clean cleandepend cleandir depend includes obj
1210 .for entry in ${SUBDIR}
1211 ${entry}.${__target}__D: .PHONY
1212 ${_+_}@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
1213 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \
1214 edir=${entry}.${MACHINE_ARCH}; \
1215 cd ${.CURDIR}/$${edir}; \
1217 ${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \
1219 cd ${.CURDIR}/$${edir}; \
1221 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
1223 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
1226 .include <bsd.subdir.mk>
1228 .if make(check-old) || make(check-old-dirs) || \
1229 make(check-old-files) || make(check-old-libs) || \
1230 make(delete-old) || make(delete-old-dirs) || \
1231 make(delete-old-files) || make(delete-old-libs)
1234 # check for / delete old files section
1237 .include "ObsoleteFiles.inc"
1239 OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \
1240 else you can not start such an application. Consult UPDATING for more \
1241 information regarding how to cope with the removal/revision bump of a \
1244 .if !defined(BATCH_DELETE_OLD_FILES)
1251 @echo ">>> Removing old files (only deletes safe to delete libs)"
1252 # Ask for every old file if the user really wants to remove it.
1253 # It's annoying, but better safe than sorry.
1254 @for file in ${OLD_FILES}; do \
1255 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1256 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1257 rm ${RM_I} "${DESTDIR}/$${file}"; \
1260 # Remove catpages without corresponding manpages.
1262 find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1263 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1264 while read catpage; do \
1266 if [ ! -e "$${manpage}" ]; then \
1267 rm ${RM_I} $${catpage} <&3 ; \
1270 @echo ">>> Old files removed"
1273 @echo ">>> Checking for old files"
1274 @for file in ${OLD_FILES}; do \
1275 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1276 echo "${DESTDIR}/$${file}"; \
1279 # Check for catpages without corresponding manpages.
1280 @find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1281 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1282 while read catpage; do \
1284 if [ ! -e "$${manpage}" ]; then \
1285 echo $${catpage} ; \
1290 @echo ">>> Removing old libraries"
1291 @echo "${OLD_LIBS_MESSAGE}" | fmt
1292 @for file in ${OLD_LIBS}; do \
1293 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1294 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1295 rm ${RM_I} "${DESTDIR}/$${file}"; \
1298 @echo ">>> Old libraries removed"
1301 @echo ">>> Checking for old libraries"
1302 @for file in ${OLD_LIBS}; do \
1303 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1304 echo "${DESTDIR}/$${file}"; \
1309 @echo ">>> Removing old directories"
1310 @for dir in ${OLD_DIRS}; do \
1311 if [ -d "${DESTDIR}/$${dir}" ]; then \
1312 rmdir -v "${DESTDIR}/$${dir}" || true; \
1313 elif [ -L "${DESTDIR}/$${dir}" ]; then \
1314 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1317 @echo ">>> Old directories removed"
1320 @echo ">>> Checking for old directories"
1321 @for dir in ${OLD_DIRS}; do \
1322 if [ -d "${DESTDIR}/$${dir}" ]; then \
1323 echo "${DESTDIR}/$${dir}"; \
1324 elif [ -L "${DESTDIR}/$${dir}" ]; then \
1325 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1329 delete-old: delete-old-files delete-old-dirs
1330 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1332 check-old: check-old-files check-old-libs check-old-dirs
1333 @echo "To remove old files and directories run '${MAKE} delete-old'."
1334 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1339 # showconfig - show build configuration.
1342 @${MAKE} -n -f bsd.own.mk -V dummy -dg1 | grep ^MK_ | sort
1347 .if defined(XDEV) && defined(XDEV_ARCH)
1349 NOFUN=-DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
1350 -DWITHOUT_MAN -DWITHOUT_NLS -DWITHOUT_PROFILE \
1351 -DWITHOUT_KERBEROS -DWITHOUT_RESCUE -DNO_WARNS
1353 XDDIR=${XDEV}-freebsd
1355 CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \
1356 TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH}
1358 _SHLIBDIRPREFIX=${XDTP} \
1359 TOOLS_PREFIX=${XDTP}
1361 MACHINE=${XDEV} MACHINE_ARCH=${XDEV_ARCH}
1363 CDTMP= ${MAKEOBJDIRPREFIX}/${XDEV}/${.CURDIR}/tmp
1364 CDMAKE=${CDENV} ${MAKE} ${NOFUN}
1365 CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDTP}/usr/bin:${PATH} ${MAKE} ${NOFUN}
1366 XDDESTDIR=${DESTDIR}${XDTP}
1368 OSREL!= uname -r | sed -e 's/[-(].*//'
1371 .ORDER: xdev-build xdev-install
1372 xdev: xdev-build xdev-install
1374 .ORDER: _xb-build-tools _xb-cross-tools
1375 xdev-build: _xb-build-tools _xb-cross-tools
1378 ${_+_}cd ${.CURDIR}; \
1379 ${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools
1383 gnu/usr.bin/binutils \
1385 ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \
1386 cd ${.CURDIR}/${_tool}; \
1387 ${CDMAKE} DIRPRFX=${_tool}/ obj; \
1388 ${CDMAKE} DIRPRFX=${_tool}/ depend; \
1389 ${CDMAKE} DIRPRFX=${_tool}/ all
1393 ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}"
1394 mkdir -p ${XDDESTDIR}
1395 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
1396 -p ${XDDESTDIR} >/dev/null
1397 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1398 -p ${XDDESTDIR}/usr >/dev/null
1399 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
1400 -p ${XDDESTDIR}/usr/include >/dev/null
1402 .ORDER: _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
1403 xdev-install: _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
1406 @echo "_xi-cross-tools"
1408 gnu/usr.bin/binutils \
1410 ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \
1411 cd ${.CURDIR}/${_tool}; \
1412 ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR}
1416 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 par-includes \
1417 DESTDIR=${XDDESTDIR}
1420 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \
1421 DESTDIR=${XDDESTDIR}
1424 ${_+_}cd ${XDDESTDIR}/usr/bin; \
1426 ln -sf ../../${XDTP}/usr/bin/$$i \
1427 ../../../../usr/bin/${XDDIR}-$$i; \
1428 ln -sf ../../${XDTP}/usr/bin/$$i \
1429 ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \