4 # Make command line options:
5 # -DNO_CLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
6 # -DNO_CLEAN do not clean at all
7 # -DNO_SHARE do not go into share subdir
8 # -DKERNFAST define NO_KERNEL{CONFIG,CLEAN,DEPEND,OBJ}
9 # -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel
10 # -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel
11 # -DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel
12 # -DNO_KERNELOBJ do not run ${MAKE} obj in ${MAKE} buildkernel
13 # -DNO_PORTSUPDATE do not update ports in ${MAKE} update
14 # -DNO_DOCUPDATE do not update doc in ${MAKE} update
15 # -DNO_CTF do not run the DTrace CTF conversion tools on built objects
16 # LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
17 # TARGET="machine" to crossbuild world for a different machine type
20 # The intended user-driven targets are:
21 # buildworld - rebuild *everything*, including glue to help do upgrades
22 # installworld- install everything built by "buildworld"
23 # doxygen - build API documentation of the kernel
24 # update - convenient way to update your source tree (eg: cvsup/cvs)
26 # Standard targets (not defined here) are documented in the makefiles in
27 # /usr/share/mk. These include:
28 # obj depend all install clean cleandepend cleanobj
32 .if ${MACHINE_ARCH} == "mips"
33 MK_RESCUE=no # not yet
36 # We must do share/info early so that installation of info `dir'
37 # entries works correctly. Do it first since it is less likely to
38 # grow dependencies on include and lib than vice versa.
40 # We must do lib/ and libexec/ before bin/, because if installworld
41 # installs a new /bin/sh, the 'make' command will *immediately*
42 # use that new version. And the new (dynamically-linked) /bin/sh
43 # will expect to find appropriate libraries in /lib and /libexec.
45 SUBDIR= share/info lib libexec
47 .if ${MK_GAMES} != "no"
50 .if ${MK_CDDL} != "no"
56 .if ${MK_KERBEROS} != "no"
59 .if ${MK_RESCUE} != "no"
63 .if ${MK_CRYPT} != "no"
66 .if !defined(NO_SHARE)
69 SUBDIR+=sys usr.bin usr.sbin
71 # We must do etc/ last for install/distribute to work.
75 # These are last, since it is nice to at least get the base system
76 # rebuilt before you do them.
77 .for _DIR in ${LOCAL_DIRS}
78 .if exists(${.CURDIR}/${_DIR}/Makefile)
83 .if defined(SUBDIR_OVERRIDE)
84 SUBDIR= ${SUBDIR_OVERRIDE}
90 .if defined(NO_CLEANDIR)
91 CLEANDIR= clean cleandepend
97 CVSFLAGS?= -A -P -d -I!
103 SUPFLAGS+= -h ${SUPHOST}
106 MAKEOBJDIRPREFIX?= /usr/obj
107 .if !defined(OSRELDATE)
108 .if exists(/usr/include/osreldate.h)
109 OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
110 /usr/include/osreldate.h
116 .if !defined(VERSION)
118 VERSION+= ${OSRELDATE}
121 # Guess machine architecture from machine type, and vice versa.
122 .if !defined(TARGET_ARCH) && defined(TARGET)
123 TARGET_ARCH= ${TARGET:S/pc98/i386/:S/sun4v/sparc64/}
124 .elif !defined(TARGET) && defined(TARGET_ARCH) && \
125 ${TARGET_ARCH} != ${MACHINE_ARCH}
126 TARGET= ${TARGET_ARCH}
128 # Otherwise, default to current machine type and architecture.
130 TARGET_ARCH?= ${MACHINE_ARCH}
132 KNOWN_ARCHES?= amd64 arm i386 i386/pc98 ia64 mips powerpc sparc64 sparc64/sun4v
133 .if ${TARGET} == ${TARGET_ARCH}
136 _t= ${TARGET_ARCH}/${TARGET}
139 .if empty(KNOWN_ARCHES:M${_t})
140 .error Unknown target ${TARGET_ARCH}:${TARGET}.
144 .if ${TARGET} == ${MACHINE}
145 TARGET_CPUTYPE?=${CPUTYPE}
150 .if !empty(TARGET_CPUTYPE)
151 _TARGET_CPUTYPE=${TARGET_CPUTYPE}
153 _TARGET_CPUTYPE=dummy
155 _CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} \
156 -f /dev/null -m ${.CURDIR}/share/mk -V CPUTYPE
157 .if ${_CPUTYPE} != ${_TARGET_CPUTYPE}
158 .error CPUTYPE global should be set with ?=.
161 BUILD_ARCH!= uname -p
162 .if ${MACHINE_ARCH} != ${BUILD_ARCH}
163 .error To cross-build, set TARGET_ARCH.
166 .if ${MACHINE} == ${TARGET} && !defined(CROSS_BUILD_TESTING)
167 OBJTREE= ${MAKEOBJDIRPREFIX}
169 OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}
171 WORLDTMP= ${OBJTREE}${.CURDIR}/tmp
172 # /usr/games added for fortune which depend on strfile
173 BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games
174 XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
175 STRICTTMPPATH= ${BPATH}:${XPATH}
176 TMPPATH= ${STRICTTMPPATH}:${PATH}
179 # Avoid running mktemp(1) unless actually needed.
180 # It may not be functional, e.g., due to new ABI
181 # when in the middle of installing over this system.
183 .if make(distributeworld) || make(installworld)
184 INSTALLTMP!= /usr/bin/mktemp -d -u -t install
188 # Building a world goes through the following stages
190 # 1. legacy stage [BMAKE]
191 # This stage is responsible for creating compatibility
192 # shims that are needed by the bootstrap-tools,
193 # build-tools and cross-tools stages.
194 # 1. bootstrap-tools stage [BMAKE]
195 # This stage is responsible for creating programs that
196 # are needed for backward compatibility reasons. They
197 # are not built as cross-tools.
198 # 2. build-tools stage [TMAKE]
199 # This stage is responsible for creating the object
200 # tree and building any tools that are needed during
202 # 3. cross-tools stage [XMAKE]
203 # This stage is responsible for creating any tools that
204 # are needed for cross-builds. A cross-compiler is one
206 # 4. world stage [WMAKE]
207 # This stage actually builds the world.
208 # 5. install stage (optional) [IMAKE]
209 # This stage installs a previously built world.
214 # Common environment for world related stages
215 CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \
216 MACHINE_ARCH=${TARGET_ARCH} \
218 CPUTYPE=${TARGET_CPUTYPE} \
219 GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
220 GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \
221 GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac
222 .if ${OSRELDATE} < 700044
223 CROSSENV+= AR=gnu-ar RANLIB=gnu-ranlib
226 # bootstrap-tools stage
227 BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
228 PATH=${BPATH}:${PATH} \
229 WORLDTMP=${WORLDTMP} \
230 VERSION="${VERSION}" \
231 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}"
232 BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
233 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
235 BOOTSTRAPPING=${OSRELDATE} \
237 -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \
238 -DNO_PIC -DWITHOUT_PROFILE -DNO_SHARED \
239 -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF
242 TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
243 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
244 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
247 BOOTSTRAPPING=${OSRELDATE} -DNO_LINT -DNO_CPU_CFLAGS \
251 XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \
252 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
256 WMAKEENV= ${CROSSENV} \
257 _SHLIBDIRPREFIX=${WORLDTMP} \
258 VERSION="${VERSION}" \
259 INSTALL="sh ${.CURDIR}/tools/install.sh" \
261 .if ${MK_CDDL} == "no" || defined(NO_CTF)
264 WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1 DESTDIR=${WORLDTMP}
266 .if ${TARGET_ARCH} == "amd64"
268 LIB32TMP= ${OBJTREE}${.CURDIR}/lib32
270 .if empty(TARGET_CPUTYPE)
271 LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2
273 LIB32CPUFLAGS= -march=${TARGET_CPUTYPE}
275 LIB32FLAGS= -m32 ${LIB32CPUFLAGS} -mfancy-math-387 -DCOMPAT_32BIT \
276 -isystem ${LIB32TMP}/usr/include/ \
277 -L${LIB32TMP}/usr/lib32 \
278 -B${LIB32TMP}/usr/lib32
280 # Yes, the flags are redundant.
281 LIB32WMAKEENV= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \
282 _SHLIBDIRPREFIX=${LIB32TMP} \
283 VERSION="${VERSION}" \
286 MACHINE_CPU="i686 mmx sse sse2" \
287 INSTALL="sh ${.CURDIR}/tools/install.sh" \
289 CC="${CC} ${LIB32FLAGS}" \
290 CXX="${CXX} ${LIB32FLAGS}" \
291 OBJC="${OBJC} ${LIB32FLAGS}" \
292 LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" \
297 LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} -DNO_CPU_CFLAGS -DCOMPAT_32BIT \
298 -DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO \
299 -DWITHOUT_HTML -DNO_CTF DESTDIR=${LIB32TMP}
300 LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*} -DNO_INCS
304 IMAKEENV= ${CROSSENV}
305 IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1
306 .if empty(.MAKEFLAGS:M-n)
307 IMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMP} \
308 LD_LIBRARY_PATH=${INSTALLTMP} \
309 PATH_LOCALE=${INSTALLTMP}/locale
310 IMAKE+= __MAKE_SHELL=${INSTALLTMP}/sh
312 IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP}
316 KMAKEENV= ${WMAKEENV}
317 KMAKE= ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME}
322 # Attempt to rebuild the entire system, with reasonable chance of
323 # success, regardless of how old your existing system is.
326 .if ${.CURDIR:C/[^,]//g} != ""
327 # The m4 build of sendmail files doesn't like it if ',' is used
328 # anywhere in the path of it's files.
330 @echo "*** Error: path to source tree contains a comma ','"
335 @echo "--------------------------------------------------------------"
336 @echo ">>> Rebuilding the temporary build tree"
337 @echo "--------------------------------------------------------------"
338 .if !defined(NO_CLEAN)
340 .if ${TARGET_ARCH} == "amd64"
344 rm -rf ${WORLDTMP}/legacy/usr/include
345 # XXX - These three can depend on any header file.
346 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
347 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c
348 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
352 mkdir -p ${WORLDTMP}/${_dir}
354 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
355 -p ${WORLDTMP}/legacy/usr >/dev/null
356 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
357 -p ${WORLDTMP}/usr >/dev/null
358 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
359 -p ${WORLDTMP}/usr/include >/dev/null
360 ln -sf ${.CURDIR}/sys ${WORLDTMP}
361 .if ${MK_BIND_LIBS} != "no"
362 mtree -deU -f ${.CURDIR}/etc/mtree/BIND.include.dist \
363 -p ${WORLDTMP}/usr/include >/dev/null
367 @echo "--------------------------------------------------------------"
368 @echo ">>> stage 1.1: legacy release compatibility shims"
369 @echo "--------------------------------------------------------------"
370 ${_+_}cd ${.CURDIR}; ${BMAKE} legacy
373 @echo "--------------------------------------------------------------"
374 @echo ">>> stage 1.2: bootstrap tools"
375 @echo "--------------------------------------------------------------"
376 ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools
378 .if !defined(NO_CLEAN)
380 @echo "--------------------------------------------------------------"
381 @echo ">>> stage 2.1: cleaning up the object tree"
382 @echo "--------------------------------------------------------------"
383 ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
384 .if ${TARGET_ARCH} == "amd64"
385 ${_+_}cd ${.CURDIR}; ${LIB32WMAKE} -f Makefile.inc1 ${CLEANDIR:S/^/par-/}
390 @echo "--------------------------------------------------------------"
391 @echo ">>> stage 2.2: rebuilding the object tree"
392 @echo "--------------------------------------------------------------"
393 ${_+_}cd ${.CURDIR}; ${WMAKE} par-obj
396 @echo "--------------------------------------------------------------"
397 @echo ">>> stage 2.3: build tools"
398 @echo "--------------------------------------------------------------"
399 ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools
402 @echo "--------------------------------------------------------------"
403 @echo ">>> stage 3: cross tools"
404 @echo "--------------------------------------------------------------"
405 ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools
408 @echo "--------------------------------------------------------------"
409 @echo ">>> stage 4.1: building includes"
410 @echo "--------------------------------------------------------------"
411 ${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
414 @echo "--------------------------------------------------------------"
415 @echo ">>> stage 4.2: building libraries"
416 @echo "--------------------------------------------------------------"
417 ${_+_}cd ${.CURDIR}; \
418 ${WMAKE} -DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
419 -DWITHOUT_MAN -DWITHOUT_PROFILE libraries
422 @echo "--------------------------------------------------------------"
423 @echo ">>> stage 4.3: make dependencies"
424 @echo "--------------------------------------------------------------"
425 ${_+_}cd ${.CURDIR}; ${WMAKE} par-depend
428 @echo "--------------------------------------------------------------"
429 @echo ">>> stage 4.4: building everything"
430 @echo "--------------------------------------------------------------"
431 ${_+_}cd ${.CURDIR}; ${WMAKE} par-all
432 .if ${TARGET_ARCH} == "amd64"
435 @echo "--------------------------------------------------------------"
436 @echo ">>> stage 5.1: building 32 bit shim libraries"
437 @echo "--------------------------------------------------------------"
438 mkdir -p ${LIB32TMP}/usr/lib32
439 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
440 -p ${LIB32TMP}/usr >/dev/null
441 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
442 -p ${LIB32TMP}/usr/include >/dev/null
444 ln -sf ${.CURDIR}/sys ${WORLDTMP}
445 .if ${MK_KERBEROS} != "no"
446 .for _t in obj depend all
447 cd ${.CURDIR}/kerberos5/tools; \
448 MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \
452 .for _t in obj includes
453 cd ${.CURDIR}/include; ${LIB32WMAKE} ${_t}
454 cd ${.CURDIR}/lib; ${LIB32WMAKE} ${_t}
455 .if ${MK_CDDL} != "no"
456 cd ${.CURDIR}/cddl/lib; ${LIB32WMAKE} ${_t}
458 cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} ${_t}
459 .if ${MK_CRYPT} != "no"
460 cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} ${_t}
462 .if ${MK_KERBEROS} != "no"
463 cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} ${_t}
466 .for _dir in usr.bin/lex/lib
467 cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} obj
469 .for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic
470 cd ${.CURDIR}/${_dir}; \
471 MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \
475 ${LIB32WMAKE} -f Makefile.inc1 libraries
476 .for _t in obj depend all
477 cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32WMAKE} ${_t}
478 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32WMAKE} ${_t}
481 distribute32 install32:
482 .if make(distribute32)
483 mkdir -p ${DISTDIR}/${DISTRIBUTION}/usr/lib32 # XXX add to mtree
484 mkdir -p ${DISTDIR}/${DISTRIBUTION}/usr/lib32/dtrace # XXX add to mtree
486 mkdir -p ${DESTDIR}/usr/lib32 # XXX add to mtree
487 mkdir -p ${DESTDIR}/usr/lib32/dtrace # XXX add to mtree
489 cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
490 .if ${MK_CDDL} != "no"
491 cd ${.CURDIR}/cddl/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
493 cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
494 .if ${MK_CRYPT} != "no"
495 cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
497 .if ${MK_KERBEROS} != "no"
498 cd ${.CURDIR}/kerberos5/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
500 cd ${.CURDIR}/libexec/rtld-elf; \
501 PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//}
502 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32IMAKE} ${.TARGET:S/32$//}
506 .if !defined(SUBDIR_OVERRIDE)
507 WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools
509 WMAKE_TGTS+= _cleanobj _obj _build-tools
510 .if !defined(SUBDIR_OVERRIDE)
511 WMAKE_TGTS+= _cross-tools
513 WMAKE_TGTS+= _includes _libraries _depend everything
514 .if ${TARGET_ARCH} == "amd64" && ${MK_LIB32} != "no"
518 buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
519 .ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
522 @echo "--------------------------------------------------------------"
523 @echo ">>> World build started on `LC_ALL=C date`"
524 @echo "--------------------------------------------------------------"
528 @echo "--------------------------------------------------------------"
529 @echo ">>> World build completed on `LC_ALL=C date`"
530 @echo "--------------------------------------------------------------"
533 # We need to have this as a target because the indirection between Makefile
534 # and Makefile.inc1 causes the correct PATH to be used, rather than a
535 # modification of the current environment's PATH. In addition, we need
536 # to quote multiword values.
542 @echo Entering world for ${TARGET_ARCH}:${TARGET}
543 @cd ${.CURDIR} && env ${WMAKEENV} sh || true
545 TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything:Nbuild32}
546 toolchain: ${TOOLCHAIN_TGTS}
547 kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries}
552 # Checks to be sure system is ready for installworld/installkernel.
557 # Require DESTDIR to be set if installing for a different architecture.
559 .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE}
560 .if !make(distributeworld)
561 installcheck: installcheck_DESTDIR
562 installcheck_DESTDIR:
563 .if !defined(DESTDIR) || empty(DESTDIR)
564 @echo "ERROR: Please set DESTDIR!"; \
571 # Check for missing UIDs/GIDs.
575 .if ${MK_SENDMAIL} != "no"
581 CHECK_GIDS+= proxy authpf
583 installcheck: installcheck_UGID
585 .for uid in ${CHECK_UIDS}
586 @if ! `id -u ${uid} >/dev/null 2>&1`; then \
587 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \
591 .for gid in ${CHECK_GIDS}
592 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \
593 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \
599 # Required install tools to be saved in a scratch dir for safety.
601 .if ${MK_INFO} != "no"
602 _install-info= install-info
604 .if ${MK_ZONEINFO} != "no"
605 _zoneinfo= zic tzsetup
608 ITOOLS= [ awk cap_mkdb cat chflags chmod chown \
609 date echo egrep find grep ${_install-info} \
610 ln lockf make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
611 test true uname wc ${_zoneinfo}
616 # Distributes everything compiled by a `buildworld'.
620 # Installs everything compiled by a 'buildworld'.
622 distributeworld installworld: installcheck
623 mkdir -p ${INSTALLTMP}
624 progs=$$(for prog in ${ITOOLS}; do \
625 if progpath=`which $$prog`; then \
628 echo "Required tool $$prog not found in PATH." >&2; \
632 libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | \
633 while read line; do \
635 if [ "$$2 $$3" != "not found" ]; then \
638 echo "Required library $$1 not found." >&2; \
642 cp $$libs $$progs ${INSTALLTMP}
643 cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale
644 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \
645 ${IMAKEENV} rm -rf ${INSTALLTMP}
650 # If you have a build server, you can NFS mount the source and obj directories
651 # and do a 'make reinstall' on the *client* to install new binaries from the
652 # most recent server build.
655 @echo "--------------------------------------------------------------"
656 @echo ">>> Making hierarchy"
657 @echo "--------------------------------------------------------------"
658 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
660 @echo "--------------------------------------------------------------"
661 @echo ">>> Installing everything"
662 @echo "--------------------------------------------------------------"
663 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
664 .if ${TARGET_ARCH} == "amd64" && ${MK_LIB32} != "no"
665 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32
669 @echo "--------------------------------------------------------------"
670 @echo ">>> Distributing everything"
671 @echo "--------------------------------------------------------------"
672 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
673 .if ${TARGET_ARCH} == "amd64" && ${MK_LIB32} != "no"
674 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 \
678 distrib-dirs distribution:
679 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} ${.TARGET}
682 # buildkernel and installkernel
684 # Which kernels to build and/or install is specified by setting
685 # KERNCONF. If not defined a GENERIC kernel is built/installed.
686 # Only the existing (depending TARGET) config files are used
687 # for building kernels and only the first of these is designated
688 # as the one being installed.
690 # Note that we have to use TARGET instead of TARGET_ARCH when
691 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
692 # be set to cross-build, we have to make sure TARGET is set
695 .if defined(KERNFAST)
700 # Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah
701 .if !defined(KERNCONF) && ${KERNFAST} != "1"
705 .if !defined(KERNCONF) && defined(KERNEL)
711 INSTKERNNAME?= kernel
713 KERNSRCDIR?= ${.CURDIR}/sys
714 KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf
715 KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR}
716 KERNCONFDIR?= ${KRNLCONFDIR}
720 .for _kernel in ${KERNCONF}
721 .if exists(${KERNCONFDIR}/${_kernel})
722 BUILDKERNELS+= ${_kernel}
723 .if empty(INSTALLKERNEL)
724 INSTALLKERNEL= ${_kernel}
732 # Builds all kernels defined by BUILDKERNELS.
735 .if empty(BUILDKERNELS)
736 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \
739 .if defined(KERNWARN)
740 @echo "--------------------------------------------------------------"
741 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
742 @echo "--------------------------------------------------------------"
746 .for _kernel in ${BUILDKERNELS}
747 @echo "--------------------------------------------------------------"
748 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
749 @echo "--------------------------------------------------------------"
750 @echo "===> ${_kernel}"
751 mkdir -p ${KRNLOBJDIR}
752 .if !defined(NO_KERNELCONFIG)
754 @echo "--------------------------------------------------------------"
755 @echo ">>> stage 1: configuring the kernel"
756 @echo "--------------------------------------------------------------"
759 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
760 ${KERNCONFDIR}/${_kernel}
762 .if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN)
764 @echo "--------------------------------------------------------------"
765 @echo ">>> stage 2.1: cleaning up the object tree"
766 @echo "--------------------------------------------------------------"
767 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR}
769 .if !defined(NO_KERNELOBJ)
771 @echo "--------------------------------------------------------------"
772 @echo ">>> stage 2.2: rebuilding the object tree"
773 @echo "--------------------------------------------------------------"
774 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj
777 @echo "--------------------------------------------------------------"
778 @echo ">>> stage 2.3: build tools"
779 @echo "--------------------------------------------------------------"
780 cd ${KRNLOBJDIR}/${_kernel}; \
781 MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \
782 ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF \
783 -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
784 # XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case.
785 .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules)
786 .for target in obj depend all
787 cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \
788 MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
789 ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF ${target}
792 .if !defined(NO_KERNELDEPEND)
794 @echo "--------------------------------------------------------------"
795 @echo ">>> stage 3.1: making dependencies"
796 @echo "--------------------------------------------------------------"
797 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ
800 @echo "--------------------------------------------------------------"
801 @echo ">>> stage 3.2: building everything"
802 @echo "--------------------------------------------------------------"
803 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ
804 @echo "--------------------------------------------------------------"
805 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
806 @echo "--------------------------------------------------------------"
810 # installkernel, etc.
812 # Install the kernel defined by INSTALLKERNEL
814 installkernel installkernel.debug \
815 reinstallkernel reinstallkernel.debug: installcheck
816 .if empty(INSTALLKERNEL)
817 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
820 @echo "--------------------------------------------------------------"
821 @echo ">>> Installing kernel"
822 @echo "--------------------------------------------------------------"
823 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
824 ${CROSSENV} PATH=${TMPPATH} \
825 ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
830 # Build the API documentation with doxygen
833 @if [ ! -x `/usr/bin/which doxygen` ]; then \
834 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \
837 cd ${.CURDIR}/tools/kerneldoc/subsys && ${MAKE} obj all
842 # Update the source tree, by running cvsup and/or running cvs to update to the
846 .if defined(SUP_UPDATE)
847 @echo "--------------------------------------------------------------"
848 @echo ">>> Running ${SUP}"
849 @echo "--------------------------------------------------------------"
851 @${SUP} ${SUPFLAGS} ${SUPFILE}
853 .if defined(SUPFILE1)
854 @${SUP} ${SUPFLAGS} ${SUPFILE1}
856 .if defined(SUPFILE2)
857 @${SUP} ${SUPFLAGS} ${SUPFILE2}
859 .if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
860 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
862 .if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
863 @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
866 .if defined(CVS_UPDATE)
868 if [ -d CVS ] ; then \
869 echo "--------------------------------------------------------------" ; \
870 echo ">>> Updating ${.CURDIR} from CVS repository" ${CVSROOT} ; \
871 echo "--------------------------------------------------------------" ; \
872 echo ${CVS} -R -q update ${CVSFLAGS} ; \
873 ${CVS} -R -q update ${CVSFLAGS} ; \
876 .if defined(SVN_UPDATE)
878 if [ -d .svn ] ; then \
879 echo "--------------------------------------------------------------" ; \
880 echo ">>> Updating ${.CURDIR} using Subversion" ; \
881 echo "--------------------------------------------------------------" ; \
882 echo ${SVN} update ${SVNFLAGS} ; \
883 ${SVN} update ${SVNFLAGS} ; \
888 # ------------------------------------------------------------------------
890 # From here onwards are utility targets used by the 'make world' and
891 # related targets. If your 'world' breaks, you may like to try to fix
892 # the problem and manually run the following targets to attempt to
893 # complete the build. Beware, this is *not* guaranteed to work, you
894 # need to have a pretty good grip on the current state of the system
895 # to attempt to manually finish it. If in doubt, 'make world' again.
899 # legacy: Build compatibility shims for the next three targets
902 .if ${BOOTSTRAPPING} < 600034 && ${BOOTSTRAPPING} != 0
903 @echo "ERROR: Source upgrades from versions prior to 6.0 not supported."; \
906 .for _tool in tools/build
907 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \
908 cd ${.CURDIR}/${_tool}; \
909 ${MAKE} DIRPRFX=${_tool}/ obj; \
910 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \
911 ${MAKE} DIRPRFX=${_tool}/ depend; \
912 ${MAKE} DIRPRFX=${_tool}/ all; \
913 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
917 # bootstrap-tools: Build tools needed for compatibility
919 .if ${MK_GAMES} != "no"
920 _strfile= games/fortune/strfile
923 .if ${MK_CXX} != "no"
924 _gperf= gnu/usr.bin/gperf
925 .if ${BOOTSTRAPPING} < 700004
926 _groff= gnu/usr.bin/groff
928 _groff= gnu/usr.bin/groff/tmac
932 .if ${BOOTSTRAPPING} >= 700044 && ${BOOTSTRAPPING} < 800022
936 .if ${BOOTSTRAPPING} < 800013
937 _mklocale= usr.bin/mklocale
940 .if ${BOOTSTRAPPING} < 900002
944 .if ${BOOTSTRAPPING} < 900006
949 .if ${BOOTSTRAPPING} < 700018
950 _gensnmptree= usr.sbin/bsnmpd/gensnmptree
953 .if ${MK_RESCUE} != "no" && \
954 ${BOOTSTRAPPING} < 700026
955 _crunchgen= usr.sbin/crunch/crunchgen
958 .if ${MK_CDDL} != "no"
959 _dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \
960 lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge
981 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
982 cd ${.CURDIR}/${_tool}; \
983 ${MAKE} DIRPRFX=${_tool}/ obj; \
984 ${MAKE} DIRPRFX=${_tool}/ depend; \
985 ${MAKE} DIRPRFX=${_tool}/ all; \
986 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
990 # build-tools: Build special purpose build tools
992 .if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules)
993 _aicasm= sys/modules/aic7xxx/aicasm
996 .if !defined(NO_SHARE)
997 _share= share/syscons/scrnmaps
1000 .if ${MK_KERBEROS} != "no"
1001 _kerberos5_tools= kerberos5/tools
1004 .if ${MK_RESCUE} != "no"
1005 _rescue= rescue/rescue
1013 lib/ncurses/ncurses \
1014 lib/ncurses/ncursesw \
1020 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \
1021 cd ${.CURDIR}/${_tool}; \
1022 ${MAKE} DIRPRFX=${_tool}/ obj; \
1023 ${MAKE} DIRPRFX=${_tool}/ build-tools
1026 gnu/usr.bin/cc/cc_tools \
1028 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \
1029 cd ${.CURDIR}/${_tool}; \
1030 ${MAKE} DIRPRFX=${_tool}/ obj; \
1031 ${MAKE} DIRPRFX=${_tool}/ depend; \
1032 ${MAKE} DIRPRFX=${_tool}/ all
1036 # cross-tools: Build cross-building tools
1038 .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 800035
1039 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386"
1040 _btxld= usr.sbin/btxld
1043 .if ${TARGET_ARCH} != ${MACHINE_ARCH}
1044 .if ${MK_RESCUE} != "no" || defined(RELEASEDIR)
1045 _crunchide= usr.sbin/crunch/crunchide
1047 .if ${TARGET_ARCH} == "i386" && defined(RELEASEDIR)
1048 _kgzip= usr.sbin/kgzip
1054 gnu/usr.bin/binutils \
1056 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
1060 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1061 cd ${.CURDIR}/${_tool}; \
1062 ${MAKE} DIRPRFX=${_tool}/ obj; \
1063 ${MAKE} DIRPRFX=${_tool}/ depend; \
1064 ${MAKE} DIRPRFX=${_tool}/ all; \
1065 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
1069 # hierarchy - ensure that all the needed directories are present
1072 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs
1075 # libraries - build all libraries, and install them under ${DESTDIR}.
1077 # The list of libraries with dependents (${_prebuild_libs}) and their
1078 # interdependencies (__L) are built automatically by the
1079 # ${.CURDIR}/tools/make_libdeps.sh script.
1083 ${MAKE} -f Makefile.inc1 _prereq_libs; \
1084 ${MAKE} -f Makefile.inc1 _startup_libs; \
1085 ${MAKE} -f Makefile.inc1 _prebuild_libs; \
1086 ${MAKE} -f Makefile.inc1 _generic_libs;
1089 # static libgcc.a prerequisite for shared libc
1091 _prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc
1093 # These dependencies are not automatically generated:
1095 # gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before
1096 # all shared libraries for ELF.
1098 _startup_libs= gnu/lib/csu
1099 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
1100 _startup_libs+= lib/csu/${MACHINE_ARCH}-elf
1102 _startup_libs+= lib/csu/${MACHINE_ARCH}
1104 _startup_libs+= gnu/lib/libgcc
1105 _startup_libs+= lib/libc
1107 gnu/lib/libgcc__L: lib/libc__L
1109 _prebuild_libs= ${_kerberos5_lib_libasn1} ${_kerberos5_lib_libheimntlm} \
1110 ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \
1111 ${_kerberos5_lib_libroken} \
1112 lib/libbz2 lib/libcom_err lib/libcrypt \
1114 ${_lib_libgssapi} ${_lib_libipx} \
1115 lib/libkiconv lib/libkvm lib/libmd \
1116 lib/ncurses/ncurses lib/ncurses/ncursesw \
1117 lib/libopie lib/libpam ${_lib_libthr} \
1118 lib/libradius lib/libsbuf lib/libtacplus \
1119 lib/libutil ${_lib_libypclnt} lib/libz lib/msun \
1120 ${_secure_lib_libcrypto} ${_secure_lib_libssh} \
1121 ${_secure_lib_libssl}
1123 .if ${MK_LIBTHR} != "no"
1124 _lib_libthr= lib/libthr
1127 _generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib
1129 lib/libopie__L lib/libtacplus__L: lib/libmd__L
1131 .if ${MK_CDDL} != "no"
1135 .if ${MK_CRYPT} != "no"
1136 .if ${MK_OPENSSL} != "no"
1137 _secure_lib_libcrypto= secure/lib/libcrypto
1138 _secure_lib_libssl= secure/lib/libssl
1139 lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L
1140 .if ${MK_OPENSSH} != "no"
1141 _secure_lib_libssh= secure/lib/libssh
1142 secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
1143 .if ${MK_KERBEROS_SUPPORT} != "no"
1144 secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \
1145 kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \
1146 lib/libmd__L kerberos5/lib/libroken__L
1150 _secure_lib= secure/lib
1153 .if ${MK_GSSAPI} != "no"
1154 _lib_libgssapi= lib/libgssapi
1157 .if ${MK_IPX} != "no"
1158 _lib_libipx= lib/libipx
1161 .if ${MK_KERBEROS} != "no"
1162 _kerberos5_lib= kerberos5/lib
1163 _kerberos5_lib_libasn1= kerberos5/lib/libasn1
1164 _kerberos5_lib_libkrb5= kerberos5/lib/libkrb5
1165 _kerberos5_lib_libhx509= kerberos5/lib/libhx509
1166 _kerberos5_lib_libroken= kerberos5/lib/libroken
1167 _kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm
1170 .if ${MK_NIS} != "no"
1171 _lib_libypclnt= lib/libypclnt
1174 .if ${MK_OPENSSL} == "no"
1175 lib/libradius__L: lib/libmd__L
1178 .for _lib in ${_prereq_libs}
1180 .if exists(${.CURDIR}/${_lib})
1181 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1182 cd ${.CURDIR}/${_lib}; \
1183 ${MAKE} DIRPRFX=${_lib}/ obj; \
1184 ${MAKE} DIRPRFX=${_lib}/ depend; \
1185 ${MAKE} -DWITHOUT_PROFILE -DNO_PIC DIRPRFX=${_lib}/ all; \
1186 ${MAKE} -DWITHOUT_PROFILE -DNO_PIC DIRPRFX=${_lib}/ install
1190 .for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
1192 .if exists(${.CURDIR}/${_lib})
1193 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1194 cd ${.CURDIR}/${_lib}; \
1195 ${MAKE} DIRPRFX=${_lib}/ obj; \
1196 ${MAKE} DIRPRFX=${_lib}/ depend; \
1197 ${MAKE} DIRPRFX=${_lib}/ all; \
1198 ${MAKE} DIRPRFX=${_lib}/ install
1202 # libpam is special: we need to build static PAM modules before
1203 # static PAM library, and dynamic PAM library before dynamic PAM
1205 lib/libpam__L: .PHONY
1206 ${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \
1207 cd ${.CURDIR}/lib/libpam; \
1208 ${MAKE} DIRPRFX=lib/libpam/ obj; \
1209 ${MAKE} DIRPRFX=lib/libpam/ depend; \
1210 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \
1211 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install
1213 _prereq_libs: ${_prereq_libs:S/$/__PL/}
1214 _startup_libs: ${_startup_libs:S/$/__L/}
1215 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
1216 _generic_libs: ${_generic_libs:S/$/__L/}
1218 .for __target in all clean cleandepend cleandir depend includes obj
1219 .for entry in ${SUBDIR}
1220 ${entry}.${__target}__D: .PHONY
1221 ${_+_}@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
1222 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \
1223 edir=${entry}.${MACHINE_ARCH}; \
1224 cd ${.CURDIR}/$${edir}; \
1226 ${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \
1228 cd ${.CURDIR}/$${edir}; \
1230 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
1232 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
1235 .include <bsd.subdir.mk>
1237 .if make(check-old) || make(check-old-dirs) || \
1238 make(check-old-files) || make(check-old-libs) || \
1239 make(delete-old) || make(delete-old-dirs) || \
1240 make(delete-old-files) || make(delete-old-libs)
1243 # check for / delete old files section
1246 .include "ObsoleteFiles.inc"
1248 OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \
1249 else you can not start such an application. Consult UPDATING for more \
1250 information regarding how to cope with the removal/revision bump of a \
1253 .if !defined(BATCH_DELETE_OLD_FILES)
1260 @echo ">>> Removing old files (only deletes safe to delete libs)"
1261 # Ask for every old file if the user really wants to remove it.
1262 # It's annoying, but better safe than sorry.
1263 @for file in ${OLD_FILES} ${OLD_FILES:Musr/share/*.gz:R}; do \
1264 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1265 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1266 rm ${RM_I} "${DESTDIR}/$${file}"; \
1269 # Remove catpages without corresponding manpages.
1271 find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1272 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1273 while read catpage; do \
1275 if [ ! -e "$${manpage}" ]; then \
1276 rm ${RM_I} $${catpage} <&3 ; \
1279 @echo ">>> Old files removed"
1282 @echo ">>> Checking for old files"
1283 @for file in ${OLD_FILES} ${OLD_FILES:Musr/share/*.gz:R}; do \
1284 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1285 echo "${DESTDIR}/$${file}"; \
1288 # Check for catpages without corresponding manpages.
1289 @find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1290 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1291 while read catpage; do \
1293 if [ ! -e "$${manpage}" ]; then \
1294 echo $${catpage} ; \
1299 @echo ">>> Removing old libraries"
1300 @echo "${OLD_LIBS_MESSAGE}" | fmt
1301 @for file in ${OLD_LIBS}; do \
1302 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1303 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1304 rm ${RM_I} "${DESTDIR}/$${file}"; \
1307 @echo ">>> Old libraries removed"
1310 @echo ">>> Checking for old libraries"
1311 @for file in ${OLD_LIBS}; do \
1312 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1313 echo "${DESTDIR}/$${file}"; \
1318 @echo ">>> Removing old directories"
1319 @for dir in ${OLD_DIRS}; do \
1320 if [ -d "${DESTDIR}/$${dir}" ]; then \
1321 rmdir -v "${DESTDIR}/$${dir}" || true; \
1322 elif [ -L "${DESTDIR}/$${dir}" ]; then \
1323 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1326 @echo ">>> Old directories removed"
1329 @echo ">>> Checking for old directories"
1330 @for dir in ${OLD_DIRS}; do \
1331 if [ -d "${DESTDIR}/$${dir}" ]; then \
1332 echo "${DESTDIR}/$${dir}"; \
1333 elif [ -L "${DESTDIR}/$${dir}" ]; then \
1334 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1338 delete-old: delete-old-files delete-old-dirs
1339 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1341 check-old: check-old-files check-old-libs check-old-dirs
1342 @echo "To remove old files and directories run '${MAKE} delete-old'."
1343 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1348 # showconfig - show build configuration.
1351 @${MAKE} -n -f bsd.own.mk -V dummy -dg1 | grep ^MK_ | sort
1356 .if defined(XDEV) && defined(XDEV_ARCH)
1358 NOFUN=-DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
1359 -DWITHOUT_MAN -DWITHOUT_NLS -DWITHOUT_PROFILE \
1360 -DWITHOUT_KERBEROS -DWITHOUT_RESCUE -DNO_WARNS
1362 XDDIR=${XDEV}-freebsd
1364 CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \
1365 TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH}
1367 _SHLIBDIRPREFIX=${XDTP} \
1368 TOOLS_PREFIX=${XDTP}
1370 MACHINE=${XDEV} MACHINE_ARCH=${XDEV_ARCH}
1372 CDTMP= ${MAKEOBJDIRPREFIX}/${XDEV}/${.CURDIR}/tmp
1373 CDMAKE=${CDENV} ${MAKE} ${NOFUN}
1374 CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDTP}/usr/bin:${PATH} ${MAKE} ${NOFUN}
1375 XDDESTDIR=${DESTDIR}${XDTP}
1377 OSREL!= uname -r | sed -e 's/[-(].*//'
1380 .ORDER: xdev-build xdev-install
1381 xdev: xdev-build xdev-install
1383 .ORDER: _xb-build-tools _xb-cross-tools
1384 xdev-build: _xb-build-tools _xb-cross-tools
1387 ${_+_}cd ${.CURDIR}; \
1388 ${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools
1392 gnu/usr.bin/binutils \
1394 ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \
1395 cd ${.CURDIR}/${_tool}; \
1396 ${CDMAKE} DIRPRFX=${_tool}/ obj; \
1397 ${CDMAKE} DIRPRFX=${_tool}/ depend; \
1398 ${CDMAKE} DIRPRFX=${_tool}/ all
1402 ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}"
1403 mkdir -p ${XDDESTDIR}
1404 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
1405 -p ${XDDESTDIR} >/dev/null
1406 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1407 -p ${XDDESTDIR}/usr >/dev/null
1408 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
1409 -p ${XDDESTDIR}/usr/include >/dev/null
1411 .ORDER: _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
1412 xdev-install: _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
1415 @echo "_xi-cross-tools"
1417 gnu/usr.bin/binutils \
1419 ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \
1420 cd ${.CURDIR}/${_tool}; \
1421 ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR}
1425 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 par-includes \
1426 DESTDIR=${XDDESTDIR}
1429 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \
1430 DESTDIR=${XDDESTDIR}
1433 ${_+_}cd ${XDDESTDIR}/usr/bin; \
1435 ln -sf ../../${XDTP}/usr/bin/$$i \
1436 ../../../../usr/bin/${XDDIR}-$$i; \
1437 ln -sf ../../${XDTP}/usr/bin/$$i \
1438 ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \