4 # Make command line options:
5 # -DNO_DYNAMICROOT do not link /bin and /sbin dynamically
6 # -DNO_KERBEROS Do not build Heimdal (Kerberos 5)
7 # -DNO_RESCUE do not build rescue binaries
8 # -DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
9 # -DNOCLEAN do not clean at all
10 # -DNOCRYPT will prevent building of crypt versions
11 # -DNOMAN do not build the manual pages
12 # -DNOPROFILE do not build profiled libraries
13 # -DNOGAMES do not go into games subdir
14 # -DNOSHARE do not go into share subdir
15 # -DNOINFO do not make or install info files
16 # -DNOLIBC_R do not build libc_r.
17 # -DNO_FORTRAN do not build g77 and related libraries.
18 # -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel
19 # -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel
20 # -DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel
21 # -DNO_PORTSUPDATE do not update ports in ${MAKE} update
22 # -DNO_DOCUPDATE do not update doc in ${MAKE} update
23 # LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
24 # TARGET_ARCH="arch" to crossbuild world to a different arch
27 # The intended user-driven targets are:
28 # buildworld - rebuild *everything*, including glue to help do upgrades
29 # installworld- install everything built by "buildworld"
30 # update - convenient way to update your source tree (eg: sup/cvs)
32 # Standard targets (not defined here) are documented in the makefiles in
33 # /usr/share/mk. These include:
34 # obj depend all install clean cleandepend cleanobj
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 # We must do etc last for install/distribute to work.
47 SUBDIR= share/info include lib libexec bin
52 .if !defined(NO_KERBEROS) && !defined(NOCRYPT) && !defined(NO_OPENSSL)
55 .if !defined(NO_RESCUE)
65 .if ${MACHINE_ARCH} != "alpha"
68 SUBDIR+=usr.bin usr.sbin etc
70 # These are last, since it is nice to at least get the base system
71 # rebuilt before you do them.
72 .for _DIR in ${LOCAL_DIRS}
73 .if exists(${.CURDIR}/${_DIR}/Makefile)
78 .if defined(SUBDIR_OVERRIDE)
79 SUBDIR= ${SUBDIR_OVERRIDE}
82 .if defined(NOCLEANDIR)
83 CLEANDIR= clean cleandepend
89 SUP?= /usr/local/bin/cvsup
90 SUPFLAGS?= -g -L 2 -P -
92 SUPFLAGS+= -h ${SUPHOST}
95 MAKEOBJDIRPREFIX?= /usr/obj
96 .if !defined(OSRELDATE)
97 .if exists(/usr/include/osreldate.h)
98 OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
99 /usr/include/osreldate.h
104 TARGET_ARCH?= ${MACHINE_ARCH}
105 .if ${TARGET_ARCH} == ${MACHINE_ARCH}
107 TARGET_CPUTYPE?=${CPUTYPE}
109 TARGET?= ${TARGET_ARCH}
112 .if !empty(TARGET_CPUTYPE)
113 _TARGET_CPUTYPE=${TARGET_CPUTYPE}
115 _TARGET_CPUTYPE=dummy
117 _CPUTYPE!= MAKEFLAGS= ${MAKE} -f /dev/null -m ${.CURDIR}/share/mk \
118 CPUTYPE=${_TARGET_CPUTYPE} -V CPUTYPE
119 .if ${_CPUTYPE} != ${_TARGET_CPUTYPE}
120 .error CPUTYPE global should be set with ?=.
123 BUILD_ARCH!= sysctl -n hw.machine_arch
124 .if ${MACHINE_ARCH} != ${BUILD_ARCH}
125 .error To cross-build, set TARGET_ARCH.
128 .if ${MACHINE} == ${TARGET}
129 OBJTREE= ${MAKEOBJDIRPREFIX}
131 OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}
133 WORLDTMP= ${OBJTREE}${.CURDIR}/${MACHINE_ARCH}
134 # /usr/games added for fortune which depend on strfile
135 BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games
136 XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
137 STRICTTMPPATH= ${BPATH}:${XPATH}
138 TMPPATH= ${STRICTTMPPATH}:${PATH}
140 INSTALLTMP!= /usr/bin/mktemp -d -u -t install
143 # Building a world goes through the following stages
145 # 1. legacy stage [BMAKE]
146 # This stage is responsible for creating compatibility
147 # shims that are needed by the bootstrap-tools,
148 # build-tools and cross-tools stages.
149 # 1. bootstrap-tools stage [BMAKE]
150 # This stage is responsible for creating programs that
151 # are needed for backward compatibility reasons. They
152 # are not built as cross-tools.
153 # 2. build-tools stage [TMAKE]
154 # This stage is responsible for creating the object
155 # tree and building any tools that are needed during
157 # 3. cross-tools stage [XMAKE]
158 # This stage is responsible for creating any tools that
159 # are needed for cross-builds. A cross-compiler is one
161 # 4. world stage [WMAKE]
162 # This stage actually builds the world.
163 # 5. install stage (optional) [IMAKE]
164 # This stage installs a previously built world.
169 # Common environment for world related stages
170 CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \
171 MACHINE_ARCH=${TARGET_ARCH} \
173 CPUTYPE=${TARGET_CPUTYPE} \
174 GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
175 GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \
176 GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac
178 # bootstrap-tools stage
180 INSTALL="sh ${.CURDIR}/tools/install.sh" \
181 PATH=${BPATH}:${PATH} \
182 WORLDTMP=${WORLDTMP} \
183 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}"
184 BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
185 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
186 BOOTSTRAPPING=${OSRELDATE} \
187 -DNOHTML -DNOINFO -DNOLINT -DNOMAN -DNOPIC -DNOPROFILE \
188 -DNOSHARED -DNO_CPU_CFLAGS -DNO_WARNS
191 TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
192 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
193 BOOTSTRAPPING=${OSRELDATE} -DNOLINT -DNO_CPU_CFLAGS -DNO_WARNS
196 XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} -DNO_FORTRAN -DNO_GDB
199 WMAKEENV= ${CROSSENV} \
200 DESTDIR=${WORLDTMP} \
201 _SHLIBDIRPREFIX=${WORLDTMP} \
202 INSTALL="sh ${.CURDIR}/tools/install.sh" \
204 WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1
207 IMAKEENV= ${CROSSENV} \
208 PATH=${STRICTTMPPATH}:${INSTALLTMP}
209 IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1
212 KMAKEENV= ${WMAKEENV}
217 # Attempt to rebuild the entire system, with reasonable chance of
218 # success, regardless of how old your existing system is.
221 .if ${.CURDIR:C/[^,]//g} != ""
222 # The m4 build of sendmail files doesn't like it if ',' is used
223 # anywhere in the path of it's files.
225 @echo "*** Error: path to source tree contains a comma ','"
230 @echo "--------------------------------------------------------------"
231 @echo ">>> Rebuilding the temporary build tree"
232 @echo "--------------------------------------------------------------"
233 .if !defined(NOCLEAN)
236 rm -rf ${WORLDTMP}/legacy/usr/include
237 # XXX - These two can depend on any header file.
238 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
239 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
242 usr/bin usr/games usr/include/c++/3.3 usr/include/sys usr/lib \
243 usr/libexec usr/sbin usr/share/dict \
244 usr/share/groff_font/devX100 \
245 usr/share/groff_font/devX100-12 \
246 usr/share/groff_font/devX75 \
247 usr/share/groff_font/devX75-12 \
248 usr/share/groff_font/devascii \
249 usr/share/groff_font/devcp1047 \
250 usr/share/groff_font/devdvi \
251 usr/share/groff_font/devhtml \
252 usr/share/groff_font/devkoi8-r \
253 usr/share/groff_font/devlatin1 \
254 usr/share/groff_font/devlbp \
255 usr/share/groff_font/devlj4 \
256 usr/share/groff_font/devps \
257 usr/share/groff_font/devutf8 \
258 usr/share/tmac/mdoc usr/share/tmac/mm
259 mkdir -p ${WORLDTMP}/legacy/${_dir}
262 lib usr/bin usr/include usr/lib/compat/aout usr/libdata/ldscripts \
263 usr/libexec usr/sbin usr/share/misc \
264 usr/share/snmp/defs usr/share/snmp/mibs
265 mkdir -p ${WORLDTMP}/${_dir}
267 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
268 -p ${WORLDTMP}/usr/include >/dev/null
269 ln -sf ${.CURDIR}/sys ${WORLDTMP}
272 @echo "--------------------------------------------------------------"
273 @echo ">>> stage 1.1: legacy release compatibility shims"
274 @echo "--------------------------------------------------------------"
275 cd ${.CURDIR}; ${BMAKE} legacy
278 @echo "--------------------------------------------------------------"
279 @echo ">>> stage 1.2: bootstrap tools"
280 @echo "--------------------------------------------------------------"
281 cd ${.CURDIR}; ${BMAKE} bootstrap-tools
283 .if !defined(NOCLEAN)
285 @echo "--------------------------------------------------------------"
286 @echo ">>> stage 2.1: cleaning up the object tree"
287 @echo "--------------------------------------------------------------"
288 cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
292 @echo "--------------------------------------------------------------"
293 @echo ">>> stage 2.2: rebuilding the object tree"
294 @echo "--------------------------------------------------------------"
295 cd ${.CURDIR}; ${WMAKE} par-obj
298 @echo "--------------------------------------------------------------"
299 @echo ">>> stage 2.3: build tools"
300 @echo "--------------------------------------------------------------"
301 cd ${.CURDIR}; ${TMAKE} build-tools
304 @echo "--------------------------------------------------------------"
305 @echo ">>> stage 3: cross tools"
306 @echo "--------------------------------------------------------------"
307 cd ${.CURDIR}; ${XMAKE} cross-tools
310 @echo "--------------------------------------------------------------"
311 @echo ">>> stage 4.1: building includes"
312 @echo "--------------------------------------------------------------"
313 cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
316 @echo "--------------------------------------------------------------"
317 @echo ">>> stage 4.2: building libraries"
318 @echo "--------------------------------------------------------------"
320 ${WMAKE} -DNOFSCHG -DNOHTML -DNOINFO -DNOLINT -DNOMAN -DNOPROFILE \
324 @echo "--------------------------------------------------------------"
325 @echo ">>> stage 4.3: make dependencies"
326 @echo "--------------------------------------------------------------"
327 cd ${.CURDIR}; ${WMAKE} par-depend
330 @echo "--------------------------------------------------------------"
331 @echo ">>> stage 4.4: building everything"
332 @echo "--------------------------------------------------------------"
333 cd ${.CURDIR}; ${WMAKE} par-all
337 .if !defined(SUBDIR_OVERRIDE)
338 WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools
340 WMAKE_TGTS+= _cleanobj _obj _build-tools
341 .if !defined(SUBDIR_OVERRIDE)
342 WMAKE_TGTS+= _cross-tools
344 WMAKE_TGTS+= _includes _libraries _depend everything
346 buildworld: ${WMAKE_TGTS}
347 .ORDER: ${WMAKE_TGTS}
349 TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything}
350 toolchain: ${TOOLCHAIN_TGTS}
351 kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries}
354 # Use this to add checks to installworld/installkernel targets.
356 SPECIAL_INSTALLCHECKS=
359 # The following install-time check will see if the installation will
360 # change the type used for time_t, and if it will, the target makes
361 # sure that the user is expecting to make that change.
363 .if ${TARGET_ARCH} == "sparc64"
364 SPECIAL_INSTALLCHECKS+=sparc64_installcheck
366 CUR_TIMET!= grep __time_t /usr/include/machine/_types.h | awk '{print $$2}'
367 SRC_TIMET!= grep __time_t ${.CURDIR}/sys/sparc64/include/_types.h | \
369 NEWSPARC_TIMETYPE?=${CUR_TIMET}
370 THISHOST!= hostname -s
372 THISHOST="name not set yet"
375 sparc64_installcheck:
376 .if ${CUR_TIMET} != ${SRC_TIMET}
378 .if ${NEWSPARC_TIMETYPE} != ${SRC_TIMET}
379 @echo "*** ERROR: This target would change the type used for time_t!"
381 @echo "* Note: This installation changes the type used for time_t."
384 @echo "* This host (${THISHOST}) has time_t defined as ${CUR_TIMET},"
385 @echo "* and this installation would change that to type ${SRC_TIMET}."
386 .if ${NEWSPARC_TIMETYPE} != ${SRC_TIMET}
388 @echo "* If that is *NOT* what you wanted, then you need to change the"
389 @echo "* typedef of __time_t in ${.CURDIR}/sys/sparc64/include/_types.h"
390 @echo "* from '${SRC_TIMET}' to '${CUR_TIMET}'. After that you *MUST*"
391 @echo "* do a complete cleanworld, buildworld, buildkernel before you"
392 @echo "* retry the 'make' command. Also read /usr/src/UPDATING.64BTT."
394 @echo "* If that *is* what you want, then enter the commands:"
395 @echo " NEWSPARC_TIMETYPE=${SRC_TIMET}"
396 @echo " export NEWSPARC_TIMETYPE"
397 @echo "* and repeat your 'make' command."
402 .elif ${NEWSPARC_TIMETYPE} != ${SRC_TIMET}
404 @echo "*** ERROR: NEWSPARC_TIMETYPE is set to '${NEWSPARC_TIMETYPE}'"
405 @echo "*** but ${.CURDIR}/sys/sparc64/include/_types.h"
406 @echo "*** has __time_t defined as '${SRC_TIMET}'."
409 @# in sparc64_installcheck, all TIMETYPEs == '${CUR_TIMET}'
416 # Checks to be sure system is ready for installworld
420 .if !defined(NO_SENDMAIL)
426 CHECK_GIDS+= proxy authpf
428 installcheck: ${SPECIAL_INSTALLCHECKS}
429 .for uid in ${CHECK_UIDS}
430 @if ! `id -u ${uid} >/dev/null 2>&1`; then \
431 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \
435 .for gid in ${CHECK_GIDS}
436 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \
437 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \
445 # Distributes everything compiled by a `buildworld'.
449 # Installs everything compiled by a 'buildworld'.
451 distributeworld installworld: installcheck
452 mkdir -p ${INSTALLTMP}
453 for prog in [ awk cap_mkdb cat chflags chmod chown \
454 date echo egrep find grep \
455 ln make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
456 test true uname wc zic; do \
457 cp `which $$prog` ${INSTALLTMP}; \
459 cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}
465 # If you have a build server, you can NFS mount the source and obj directories
466 # and do a 'make reinstall' on the *client* to install new binaries from the
467 # most recent server build.
469 reinstall: ${SPECIAL_INSTALLCHECKS}
470 @echo "--------------------------------------------------------------"
471 @echo ">>> Making hierarchy"
472 @echo "--------------------------------------------------------------"
473 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
475 @echo "--------------------------------------------------------------"
476 @echo ">>> Installing everything"
477 @echo "--------------------------------------------------------------"
478 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
481 @echo "--------------------------------------------------------------"
482 @echo ">>> Distributing everything"
483 @echo "--------------------------------------------------------------"
484 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
487 # buildkernel and installkernel
489 # Which kernels to build and/or install is specified by setting
490 # KERNCONF. If not defined a GENERIC kernel is built/installed.
491 # Only the existing (depending TARGET) config files are used
492 # for building kernels and only the first of these is designated
493 # as the one being installed.
495 # Note that we have to use TARGET instead of TARGET_ARCH when
496 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
497 # be set to cross-build, we have to make sure TARGET is set
500 .if !defined(KERNCONF) && defined(KERNEL)
506 INSTKERNNAME?= kernel
508 KERNSRCDIR?= ${.CURDIR}/sys
509 KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf
510 KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR}
511 KERNCONFDIR?= ${KRNLCONFDIR}
515 .for _kernel in ${KERNCONF}
516 .if exists(${KERNCONFDIR}/${_kernel})
517 BUILDKERNELS+= ${_kernel}
518 .if empty(INSTALLKERNEL)
519 INSTALLKERNEL= ${_kernel}
527 # Builds all kernels defined by BUILDKERNELS.
530 .if empty(BUILDKERNELS)
531 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF}).";
534 .if defined(KERNWARN)
535 @echo "--------------------------------------------------------------"
536 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
537 @echo "--------------------------------------------------------------"
541 .for _kernel in ${BUILDKERNELS}
542 @echo "--------------------------------------------------------------"
543 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
544 @echo "--------------------------------------------------------------"
545 @echo "===> ${_kernel}"
546 mkdir -p ${KRNLOBJDIR}
547 .if !defined(NO_KERNELCONFIG)
549 @echo "--------------------------------------------------------------"
550 @echo ">>> stage 1: configuring the kernel"
551 @echo "--------------------------------------------------------------"
554 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
555 ${KERNCONFDIR}/${_kernel}
557 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
559 @echo "--------------------------------------------------------------"
560 @echo ">>> stage 2.1: cleaning up the object tree"
561 @echo "--------------------------------------------------------------"
562 cd ${KRNLOBJDIR}/${_kernel}; \
563 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} ${CLEANDIR}
566 @echo "--------------------------------------------------------------"
567 @echo ">>> stage 2.2: rebuilding the object tree"
568 @echo "--------------------------------------------------------------"
569 cd ${KRNLOBJDIR}/${_kernel}; \
570 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} obj
572 @echo "--------------------------------------------------------------"
573 @echo ">>> stage 2.3: build tools"
574 @echo "--------------------------------------------------------------"
575 cd ${KRNLOBJDIR}/${_kernel}; \
576 MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \
577 ${MAKE} -DNO_CPU_CFLAGS -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
578 # XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case.
579 .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules)
580 .for target in obj depend all
581 cd ${.CURDIR}/sys/modules/aic7xxx/aicasm; \
582 MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
583 ${MAKE} -DNO_CPU_CFLAGS ${target}
586 .if !defined(NO_KERNELDEPEND)
588 @echo "--------------------------------------------------------------"
589 @echo ">>> stage 3.1: making dependencies"
590 @echo "--------------------------------------------------------------"
591 cd ${KRNLOBJDIR}/${_kernel}; \
592 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend -DNO_MODULES_OBJ
595 @echo "--------------------------------------------------------------"
596 @echo ">>> stage 3.2: building everything"
597 @echo "--------------------------------------------------------------"
598 cd ${KRNLOBJDIR}/${_kernel}; \
599 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all -DNO_MODULES_OBJ
600 @echo "--------------------------------------------------------------"
601 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
602 @echo "--------------------------------------------------------------"
606 # installkernel, etc.
608 # Install the kernel defined by INSTALLKERNEL
610 installkernel installkernel.debug \
611 reinstallkernel reinstallkernel.debug: ${SPECIAL_INSTALLCHECKS}
612 .if empty(INSTALLKERNEL)
613 @echo "ERROR: No kernel \"${KERNCONF}\" to install."
616 @echo "--------------------------------------------------------------"
617 @echo ">>> Making hierarchy"
618 @echo "--------------------------------------------------------------"
620 ${CROSSENV} PATH=${TMPPATH} ${MAKE} -f Makefile.inc1 hierarchy
622 @echo "--------------------------------------------------------------"
623 @echo ">>> Installing kernel"
624 @echo "--------------------------------------------------------------"
625 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
626 ${CROSSENV} PATH=${TMPPATH} \
627 ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
632 # Update the source tree, by running sup and/or running cvs to update to the
636 .if defined(SUP_UPDATE)
637 @echo "--------------------------------------------------------------"
638 @echo ">>> Running ${SUP}"
639 @echo "--------------------------------------------------------------"
641 @${SUP} ${SUPFLAGS} ${SUPFILE}
643 .if defined(SUPFILE1)
644 @${SUP} ${SUPFLAGS} ${SUPFILE1}
646 .if defined(SUPFILE2)
647 @${SUP} ${SUPFLAGS} ${SUPFILE2}
649 .if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
650 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
652 .if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
653 @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
656 .if defined(CVS_UPDATE)
657 @echo "--------------------------------------------------------------"
658 @echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT}
659 @echo "--------------------------------------------------------------"
660 cd ${.CURDIR}; ${CVS} -R -q update -A -P -d
664 # ------------------------------------------------------------------------
666 # From here onwards are utility targets used by the 'make world' and
667 # related targets. If your 'world' breaks, you may like to try to fix
668 # the problem and manually run the following targets to attempt to
669 # complete the build. Beware, this is *not* guaranteed to work, you
670 # need to have a pretty good grip on the current state of the system
671 # to attempt to manually finish it. If in doubt, 'make world' again.
675 # legacy: Build compatibility shims for the next three targets
678 .for _tool in tools/build
679 @${ECHODIR} "===> ${_tool}"; \
680 cd ${.CURDIR}/${_tool}; \
681 ${MAKE} DIRPRFX=${_tool}/ obj; \
682 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \
683 ${MAKE} DIRPRFX=${_tool}/ depend; \
684 ${MAKE} DIRPRFX=${_tool}/ all; \
685 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
689 # bootstrap-tools: Build tools needed for compatibility
691 .if !defined(NOGAMES)
692 _strfile= games/fortune/strfile
696 _gperf= gnu/usr.bin/gperf
697 .if ${BOOTSTRAPPING} < 500113
698 _groff= gnu/usr.bin/groff
700 _groff= gnu/usr.bin/groff/tmac
704 .if ${BOOTSTRAPPING} < 502102
708 .if ${BOOTSTRAPPING} < 450005 || \
709 ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500034
710 _uudecode= usr.bin/uudecode
713 .if ${BOOTSTRAPPING} < 430002 || \
714 ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500019
715 _xargs= usr.bin/xargs
718 .if ${BOOTSTRAPPING} < 430002 || \
719 ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500018
723 .if !defined(NO_RESCUE) && \
724 ${BOOTSTRAPPING} < 501100
725 _crunchgen= usr.sbin/crunch/crunchgen
728 .if ${BOOTSTRAPPING} < 501114
729 _gensnmptree= usr.sbin/bsnmpd/gensnmptree
732 .if ${BOOTSTRAPPING} < 500019
733 _kbdcontrol= usr.sbin/kbdcontrol
741 gnu/usr.bin/texinfo \
754 @${ECHODIR} "===> ${_tool}"; \
755 cd ${.CURDIR}/${_tool}; \
756 ${MAKE} DIRPRFX=${_tool}/ obj; \
757 ${MAKE} DIRPRFX=${_tool}/ depend; \
758 ${MAKE} DIRPRFX=${_tool}/ all; \
759 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
763 # build-tools: Build special purpose build tools
765 .if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules)
766 _aicasm= sys/modules/aic7xxx/aicasm
769 .if !defined(NOSHARE)
770 _share= share/syscons/scrnmaps
773 .if !defined(NO_FORTRAN)
774 _fortran= gnu/usr.bin/cc/f771
777 .if !defined(NO_KERBEROS) && !defined(NOCRYPT) && !defined(NO_OPENSSL)
778 _kerberos5_tools= kerberos5/tools
781 .if !defined(NO_RESCUE)
782 _rescue= rescue/rescue
790 gnu/usr.bin/cc/cc_tools \
798 @${ECHODIR} "===> ${_tool}"; \
799 cd ${.CURDIR}/${_tool}; \
800 ${MAKE} DIRPRFX=${_tool}/ obj; \
801 ${MAKE} DIRPRFX=${_tool}/ build-tools
805 @${ECHODIR} "===> ${_tool}"; \
806 cd ${.CURDIR}/${_tool}; \
807 ${MAKE} DIRPRFX=${_tool}/ obj; \
808 ${MAKE} DIRPRFX=${_tool}/ depend; \
809 ${MAKE} DIRPRFX=${_tool}/ all
813 # cross-tools: Build cross-building tools
815 .if ${TARGET_ARCH} == "sparc64" && ${TARGET_ARCH} != ${MACHINE_ARCH} && \
816 ${BOOTSTRAPPING} < 500037
817 _elf2aout= usr.bin/elf2aout
820 .if ${TARGET_ARCH} == "i386" && ${TARGET_ARCH} != ${MACHINE_ARCH}
821 _btxld= usr.sbin/btxld
824 .if (!defined(NO_RESCUE) || \
825 defined(RELEASEDIR)) && \
826 (${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 501101)
827 _crunchide= usr.sbin/crunch/crunchide
830 .if ${TARGET_ARCH} == "alpha" && ${TARGET_ARCH} != ${MACHINE_ARCH}
831 _elf2exe= usr.sbin/elf2exe
834 .if ${TARGET_ARCH} == "i386" && ${TARGET_ARCH} != ${MACHINE_ARCH} && \
836 _kgzip= usr.sbin/kgzip
841 gnu/usr.bin/binutils \
844 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
849 @${ECHODIR} "===> ${_tool}"; \
850 cd ${.CURDIR}/${_tool}; \
851 ${MAKE} DIRPRFX=${_tool}/ obj; \
852 ${MAKE} DIRPRFX=${_tool}/ depend; \
853 ${MAKE} DIRPRFX=${_tool}/ all; \
854 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
858 # hierarchy - ensure that all the needed directories are present
861 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs
864 # libraries - build all libraries, and install them under ${DESTDIR}.
866 # The list of libraries with dependents (${_prebuild_libs}) and their
867 # interdependencies (__L) are built automatically by the
868 # ${.CURDIR}/tools/make_libdeps.sh script.
872 ${MAKE} -f Makefile.inc1 _startup_libs; \
873 ${MAKE} -f Makefile.inc1 _prebuild_libs; \
874 ${MAKE} -f Makefile.inc1 _generic_libs;
876 # These dependencies are not automatically generated:
878 # gnu/lib/csu, gnu/lib/libgcc and lib/csu must be built before all
879 # shared libraries for ELF.
881 _startup_libs= gnu/lib/csu gnu/lib/libgcc
882 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
883 _startup_libs+= lib/csu/${MACHINE_ARCH}-elf
885 _startup_libs+= lib/csu/${MACHINE_ARCH}
890 _generic_libs= gnu/lib
892 .if !defined(NO_KERBEROS) && !defined(NOCRYPT) && !defined(NO_OPENSSL)
893 _prebuild_libs+= kerberos5/lib/libasn1
894 _prebuild_libs+= kerberos5/lib/libgssapi
895 _prebuild_libs+= kerberos5/lib/libkrb5
896 _prebuild_libs+= kerberos5/lib/libroken
897 _generic_libs+= kerberos5/lib
900 _prebuild_libs+= lib/libcom_err lib/libcrypt lib/libexpat \
901 lib/libkvm lib/libmd \
902 lib/libncurses lib/libnetgraph lib/libopie lib/libpam \
904 lib/libsbuf lib/libtacplus lib/libutil lib/libypclnt \
907 lib/libopie__L lib/libtacplus__L: lib/libmd__L
911 .if !defined(NOCRYPT)
912 .if !defined(NO_OPENSSL)
913 _prebuild_libs+= secure/lib/libcrypto secure/lib/libssl
914 lib/libradius__L: secure/lib/libssl__L
915 secure/lib/libssl__L: secure/lib/libcrypto__L
916 .if !defined(NO_OPENSSH)
917 _prebuild_libs+= secure/lib/libssh
918 secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
919 .if !defined(NO_KERBEROS)
920 secure/lib/libssh__L: kerberos5/lib/libgssapi__L kerberos5/lib/libkrb5__L \
921 kerberos5/lib/libasn1__L lib/libcom_err__L lib/libmd__L \
922 kerberos5/lib/libroken__L
926 _generic_libs+= secure/lib
929 .if defined(NOCRYPT) || defined(NO_OPENSSL)
930 lib/libradius__L: lib/libmd__L
933 _generic_libs+= usr.bin/lex/lib
935 .if ${MACHINE_ARCH} == "i386"
936 _generic_libs+= usr.sbin/pcvt/keycap
939 .for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
941 .if exists(${.CURDIR}/${_lib})
942 @${ECHODIR} "===> ${_lib}"; \
943 cd ${.CURDIR}/${_lib}; \
944 ${MAKE} DIRPRFX=${_lib}/ depend; \
945 ${MAKE} DIRPRFX=${_lib}/ all; \
946 ${MAKE} DIRPRFX=${_lib}/ install
950 # libpam is special: we need to build static PAM modules before
951 # static PAM library, and dynamic PAM library before dynamic PAM
953 lib/libpam__L: .PHONY
954 @${ECHODIR} "===> lib/libpam"; \
955 cd ${.CURDIR}/lib/libpam; \
956 ${MAKE} DIRPRFX=lib/libpam/ depend; \
957 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \
958 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install
960 _startup_libs: ${_startup_libs:S/$/__L/}
961 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
962 _generic_libs: ${_generic_libs:S/$/__L/}
964 .for __target in all clean cleandepend cleandir depend includes obj
965 .for entry in ${SUBDIR}
966 ${entry}.${__target}__D: .PHONY
967 @if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
968 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
969 edir=${entry}.${MACHINE_ARCH}; \
970 cd ${.CURDIR}/$${edir}; \
972 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \
974 cd ${.CURDIR}/$${edir}; \
976 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
978 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
981 .include <bsd.subdir.mk>