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 SUBDIR+=sys usr.bin usr.sbin etc
67 # These are last, since it is nice to at least get the base system
68 # rebuilt before you do them.
69 .for _DIR in ${LOCAL_DIRS}
70 .if exists(${.CURDIR}/${_DIR}/Makefile)
75 .if defined(SUBDIR_OVERRIDE)
76 SUBDIR= ${SUBDIR_OVERRIDE}
79 .if defined(NOCLEANDIR)
80 CLEANDIR= clean cleandepend
86 SUP?= /usr/local/bin/cvsup
87 SUPFLAGS?= -g -L 2 -P -
89 SUPFLAGS+= -h ${SUPHOST}
92 MAKEOBJDIRPREFIX?= /usr/obj
93 .if !defined(OSRELDATE)
94 .if exists(/usr/include/osreldate.h)
95 OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
96 /usr/include/osreldate.h
101 TARGET_ARCH?= ${MACHINE_ARCH}
102 .if ${TARGET_ARCH} == ${MACHINE_ARCH}
104 TARGET_CPUTYPE?=${CPUTYPE}
106 TARGET?= ${TARGET_ARCH}
109 .if !empty(TARGET_CPUTYPE)
110 _TARGET_CPUTYPE=${TARGET_CPUTYPE}
112 _TARGET_CPUTYPE=dummy
114 _CPUTYPE!= ${MAKE} -f /dev/null -m ${.CURDIR}/share/mk \
115 CPUTYPE=${_TARGET_CPUTYPE} -V CPUTYPE
116 .if ${_CPUTYPE} != ${_TARGET_CPUTYPE}
117 .error CPUTYPE global should be set with ?=.
120 BUILD_ARCH!= sysctl -n hw.machine_arch
121 .if ${MACHINE_ARCH} != ${BUILD_ARCH}
122 .error To cross-build, set TARGET_ARCH.
125 .if ${MACHINE} == ${TARGET}
126 OBJTREE= ${MAKEOBJDIRPREFIX}
128 OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}
130 WORLDTMP= ${OBJTREE}${.CURDIR}/${MACHINE_ARCH}
131 # /usr/games added for fortune which depend on strfile
132 BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games
133 XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
134 STRICTTMPPATH= ${BPATH}:${XPATH}
135 TMPPATH= ${STRICTTMPPATH}:${PATH}
137 INSTALLTMP!= /usr/bin/mktemp -d -u -t install
140 # Building a world goes through the following stages
142 # 1. legacy stage [BMAKE]
143 # This stage is responsible for creating compatibility
144 # shims that are needed by the bootstrap-tools,
145 # build-tools and cross-tools stages.
146 # 1. bootstrap-tools stage [BMAKE]
147 # This stage is responsible for creating programs that
148 # are needed for backward compatibility reasons. They
149 # are not built as cross-tools.
150 # 2. build-tools stage [TMAKE]
151 # This stage is responsible for creating the object
152 # tree and building any tools that are needed during
154 # 3. cross-tools stage [XMAKE]
155 # This stage is responsible for creating any tools that
156 # are needed for cross-builds. A cross-compiler is one
158 # 4. world stage [WMAKE]
159 # This stage actually builds the world.
160 # 5. install stage (optional) [IMAKE]
161 # This stage installs a previously built world.
166 # Common environment for world related stages
167 CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \
168 MACHINE_ARCH=${TARGET_ARCH} \
170 CPUTYPE=${TARGET_CPUTYPE} \
171 GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
172 GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \
173 GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac
175 # bootstrap-tools stage
177 INSTALL="sh ${.CURDIR}/tools/install.sh" \
178 PATH=${BPATH}:${PATH} \
179 WORLDTMP=${WORLDTMP} \
180 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}"
181 BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
182 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
183 BOOTSTRAPPING=${OSRELDATE} \
184 -DNOHTML -DNOINFO -DNOLINT -DNOMAN -DNOPIC -DNOPROFILE \
185 -DNOSHARED -DNO_CPU_CFLAGS -DNO_WARNS
188 TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
189 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
190 BOOTSTRAPPING=${OSRELDATE} -DNOLINT -DNO_CPU_CFLAGS -DNO_WARNS
193 XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} -DNO_FORTRAN -DNO_GDB
196 WMAKEENV= ${CROSSENV} \
197 DESTDIR=${WORLDTMP} \
198 _SHLIBDIRPREFIX=${WORLDTMP} \
199 INSTALL="sh ${.CURDIR}/tools/install.sh" \
201 WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1
204 IMAKEENV= ${CROSSENV} \
205 PATH=${STRICTTMPPATH}:${INSTALLTMP}
206 IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1
209 KMAKEENV= ${WMAKEENV}
214 # Attempt to rebuild the entire system, with reasonable chance of
215 # success, regardless of how old your existing system is.
218 .if ${.CURDIR:C/[^,]//g} != ""
219 # The m4 build of sendmail files doesn't like it if ',' is used
220 # anywhere in the path of it's files.
222 @echo "*** Error: path to source tree contains a comma ','"
227 @echo "--------------------------------------------------------------"
228 @echo ">>> Rebuilding the temporary build tree"
229 @echo "--------------------------------------------------------------"
230 .if !defined(NOCLEAN)
233 rm -rf ${WORLDTMP}/legacy/usr/include
234 # XXX - These two can depend on any header file.
235 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
236 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
239 usr/bin usr/games usr/include/c++/3.3 usr/include/sys usr/lib \
240 usr/libexec usr/sbin usr/share/dict \
241 usr/share/groff_font/devX100 \
242 usr/share/groff_font/devX100-12 \
243 usr/share/groff_font/devX75 \
244 usr/share/groff_font/devX75-12 \
245 usr/share/groff_font/devascii \
246 usr/share/groff_font/devcp1047 \
247 usr/share/groff_font/devdvi \
248 usr/share/groff_font/devhtml \
249 usr/share/groff_font/devkoi8-r \
250 usr/share/groff_font/devlatin1 \
251 usr/share/groff_font/devlbp \
252 usr/share/groff_font/devlj4 \
253 usr/share/groff_font/devps \
254 usr/share/groff_font/devutf8 \
255 usr/share/tmac/mdoc usr/share/tmac/mm
256 mkdir -p ${WORLDTMP}/legacy/${_dir}
259 lib usr/bin usr/include usr/lib/compat/aout usr/libdata/ldscripts \
260 usr/libexec usr/sbin usr/share/misc \
261 usr/share/bsnmp/defs usr/share/bsnmp/mibs
262 mkdir -p ${WORLDTMP}/${_dir}
264 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
265 -p ${WORLDTMP}/usr/include >/dev/null
266 ln -sf ${.CURDIR}/sys ${WORLDTMP}
269 @echo "--------------------------------------------------------------"
270 @echo ">>> stage 1.1: legacy release compatibility shims"
271 @echo "--------------------------------------------------------------"
272 cd ${.CURDIR}; ${BMAKE} legacy
275 @echo "--------------------------------------------------------------"
276 @echo ">>> stage 1.2: bootstrap tools"
277 @echo "--------------------------------------------------------------"
278 cd ${.CURDIR}; ${BMAKE} bootstrap-tools
280 .if !defined(NOCLEAN)
282 @echo "--------------------------------------------------------------"
283 @echo ">>> stage 2.1: cleaning up the object tree"
284 @echo "--------------------------------------------------------------"
285 cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
289 @echo "--------------------------------------------------------------"
290 @echo ">>> stage 2.2: rebuilding the object tree"
291 @echo "--------------------------------------------------------------"
292 cd ${.CURDIR}; ${WMAKE} par-obj
295 @echo "--------------------------------------------------------------"
296 @echo ">>> stage 2.3: build tools"
297 @echo "--------------------------------------------------------------"
298 cd ${.CURDIR}; ${TMAKE} build-tools
301 @echo "--------------------------------------------------------------"
302 @echo ">>> stage 3: cross tools"
303 @echo "--------------------------------------------------------------"
304 cd ${.CURDIR}; ${XMAKE} cross-tools
307 @echo "--------------------------------------------------------------"
308 @echo ">>> stage 4.1: building includes"
309 @echo "--------------------------------------------------------------"
310 cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
313 @echo "--------------------------------------------------------------"
314 @echo ">>> stage 4.2: building libraries"
315 @echo "--------------------------------------------------------------"
317 ${WMAKE} -DNOFSCHG -DNOHTML -DNOINFO -DNOLINT -DNOMAN -DNOPROFILE \
321 @echo "--------------------------------------------------------------"
322 @echo ">>> stage 4.3: make dependencies"
323 @echo "--------------------------------------------------------------"
324 cd ${.CURDIR}; ${WMAKE} par-depend
327 @echo "--------------------------------------------------------------"
328 @echo ">>> stage 4.4: building everything.."
329 @echo "--------------------------------------------------------------"
330 cd ${.CURDIR}; ${WMAKE} par-all
334 .if !defined(SUBDIR_OVERRIDE)
335 WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools
337 WMAKE_TGTS+= _cleanobj _obj _build-tools
338 .if !defined(SUBDIR_OVERRIDE)
339 WMAKE_TGTS+= _cross-tools
341 WMAKE_TGTS+= _includes _libraries _depend everything
343 buildworld: ${WMAKE_TGTS}
344 .ORDER: ${WMAKE_TGTS}
347 # Use this to add checks to installworld/installkernel targets.
349 SPECIAL_INSTALLCHECKS=
352 # The following install-time check will see if the installation will
353 # change the type used for time_t, and if it will, the target makes
354 # sure that the user is expecting to make that change.
356 .if ${TARGET_ARCH} == "sparc64"
357 SPECIAL_INSTALLCHECKS+=sparc64_installcheck
359 CUR_TIMET!= grep __time_t /usr/include/machine/_types.h | awk '{print $$2}'
360 SRC_TIMET!= grep __time_t ${.CURDIR}/sys/sparc64/include/_types.h | \
362 NEWSPARC_TIMETYPE?=${CUR_TIMET}
363 THISHOST!= hostname -s
365 THISHOST="name not set yet"
368 sparc64_installcheck:
369 .if ${CUR_TIMET} != ${SRC_TIMET}
371 .if ${NEWSPARC_TIMETYPE} != ${SRC_TIMET}
372 @echo "*** ERROR: This target would change the type used for time_t!"
374 @echo "* Note: This installation changes the type used for time_t."
377 @echo "* This host (${THISHOST}) has time_t defined as ${CUR_TIMET},"
378 @echo "* and this installation would change that to type ${SRC_TIMET}."
379 .if ${NEWSPARC_TIMETYPE} != ${SRC_TIMET}
381 @echo "* If that is *NOT* what you wanted, then you need to change the"
382 @echo "* typedef of __time_t in ${.CURDIR}/sys/sparc64/include/_types.h"
383 @echo "* from '${SRC_TIMET}' to '${CUR_TIMET}'. After that you *MUST*"
384 @echo "* do a complete cleanworld, buildworld, buildkernel before you"
385 @echo "* retry the 'make' command. Also read /usr/src/UPDATING.64BTT."
387 @echo "* If that *is* what you want, then enter the commands:"
388 @echo " NEWSPARC_TIMETYPE=${SRC_TIMET}"
389 @echo " export NEWSPARC_TIMETYPE"
390 @echo "* and repeat your 'make' command."
395 .elif ${NEWSPARC_TIMETYPE} != ${SRC_TIMET}
397 @echo "*** ERROR: NEWSPARC_TIMETYPE is set to '${NEWSPARC_TIMETYPE}'"
398 @echo "*** but ${.CURDIR}/sys/sparc64/include/_types.h"
399 @echo "*** has __time_t defined as '${SRC_TIMET}'."
402 @# in sparc64_installcheck, all TIMETYPEs == '${CUR_TIMET}'
409 # Checks to be sure system is ready for installworld
413 .if !defined(NO_SENDMAIL)
419 CHECK_GIDS+= proxy authpf
421 installcheck: ${SPECIAL_INSTALLCHECKS}
422 .for uid in ${CHECK_UIDS}
423 @if ! `id -u ${uid} >/dev/null 2>&1`; then \
424 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \
428 .for gid in ${CHECK_GIDS}
429 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \
430 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \
438 # Distributes everything compiled by a `buildworld'.
442 # Installs everything compiled by a 'buildworld'.
444 distributeworld installworld: installcheck
445 mkdir -p ${INSTALLTMP}
446 for prog in [ awk cap_mkdb cat chflags chmod chown \
447 date echo egrep find grep \
448 ln make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
449 test true uname wc zic; do \
450 cp `which $$prog` ${INSTALLTMP}; \
452 cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}
458 # If you have a build server, you can NFS mount the source and obj directories
459 # and do a 'make reinstall' on the *client* to install new binaries from the
460 # most recent server build.
462 reinstall: ${SPECIAL_INSTALLCHECKS}
463 @echo "--------------------------------------------------------------"
464 @echo ">>> Making hierarchy"
465 @echo "--------------------------------------------------------------"
466 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
468 @echo "--------------------------------------------------------------"
469 @echo ">>> Installing everything.."
470 @echo "--------------------------------------------------------------"
471 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
474 @echo "--------------------------------------------------------------"
475 @echo ">>> Distributing everything.."
476 @echo "--------------------------------------------------------------"
477 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
480 # buildkernel and installkernel
482 # Which kernels to build and/or install is specified by setting
483 # KERNCONF. If not defined a GENERIC kernel is built/installed.
484 # Only the existing (depending TARGET) config files are used
485 # for building kernels and only the first of these is designated
486 # as the one being installed.
488 # Note that we have to use TARGET instead of TARGET_ARCH when
489 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
490 # be set to cross-build, we have to make sure TARGET is set
493 .if !defined(KERNCONF) && defined(KERNEL)
499 INSTKERNNAME?= kernel
501 KERNSRCDIR?= ${.CURDIR}/sys
502 KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf
503 KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR}
504 KERNCONFDIR?= ${KRNLCONFDIR}
508 .for _kernel in ${KERNCONF}
509 .if exists(${KERNCONFDIR}/${_kernel})
510 BUILDKERNELS+= ${_kernel}
511 .if empty(INSTALLKERNEL)
512 INSTALLKERNEL= ${_kernel}
520 # Builds all kernels defined by BUILDKERNELS.
523 .if empty(BUILDKERNELS)
524 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF}).";
527 .if defined(KERNWARN)
528 @echo "--------------------------------------------------------------"
529 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
530 @echo "--------------------------------------------------------------"
534 .for _kernel in ${BUILDKERNELS}
535 @echo "--------------------------------------------------------------"
536 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
537 @echo "--------------------------------------------------------------"
538 @echo "===> ${_kernel}"
539 mkdir -p ${KRNLOBJDIR}
540 .if !defined(NO_KERNELCONFIG)
542 @echo "--------------------------------------------------------------"
543 @echo ">>> stage 1: configuring the kernel"
544 @echo "--------------------------------------------------------------"
547 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
548 ${KERNCONFDIR}/${_kernel}
550 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
552 @echo "--------------------------------------------------------------"
553 @echo ">>> stage 2.1: cleaning up the object tree"
554 @echo "--------------------------------------------------------------"
555 cd ${KRNLOBJDIR}/${_kernel}; \
556 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} ${CLEANDIR}
559 @echo "--------------------------------------------------------------"
560 @echo ">>> stage 2.2: rebuilding the object tree"
561 @echo "--------------------------------------------------------------"
562 cd ${KRNLOBJDIR}/${_kernel}; \
563 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} obj
565 @echo "--------------------------------------------------------------"
566 @echo ">>> stage 2.3: build tools"
567 @echo "--------------------------------------------------------------"
568 cd ${KRNLOBJDIR}/${_kernel}; \
569 MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \
570 ${MAKE} -DNO_CPU_CFLAGS -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
571 # XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case.
572 .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules)
573 .for target in obj depend all
574 cd ${.CURDIR}/sys/modules/aic7xxx/aicasm; \
575 MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
576 ${MAKE} -DNO_CPU_CFLAGS ${target}
579 .if !defined(NO_KERNELDEPEND)
581 @echo "--------------------------------------------------------------"
582 @echo ">>> stage 3.1: making dependencies"
583 @echo "--------------------------------------------------------------"
584 cd ${KRNLOBJDIR}/${_kernel}; \
585 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend -DNO_MODULES_OBJ
588 @echo "--------------------------------------------------------------"
589 @echo ">>> stage 3.2: building everything"
590 @echo "--------------------------------------------------------------"
591 cd ${KRNLOBJDIR}/${_kernel}; \
592 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all -DNO_MODULES_OBJ
593 @echo "--------------------------------------------------------------"
594 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
595 @echo "--------------------------------------------------------------"
599 # installkernel, etc.
601 # Install the kernel defined by INSTALLKERNEL
603 installkernel installkernel.debug \
604 reinstallkernel reinstallkernel.debug: ${SPECIAL_INSTALLCHECKS}
605 .if empty(INSTALLKERNEL)
606 @echo "ERROR: No kernel \"${KERNCONF}\" to install."
609 @echo "--------------------------------------------------------------"
610 @echo ">>> Making hierarchy"
611 @echo "--------------------------------------------------------------"
613 ${CROSSENV} PATH=${TMPPATH} ${MAKE} -f Makefile.inc1 hierarchy
615 @echo "--------------------------------------------------------------"
616 @echo ">>> Installing kernel"
617 @echo "--------------------------------------------------------------"
618 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
619 ${CROSSENV} PATH=${TMPPATH} \
620 ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
625 # Update the source tree, by running sup and/or running cvs to update to the
629 .if defined(SUP_UPDATE)
630 @echo "--------------------------------------------------------------"
631 @echo ">>> Running ${SUP}"
632 @echo "--------------------------------------------------------------"
634 @${SUP} ${SUPFLAGS} ${SUPFILE}
636 .if defined(SUPFILE1)
637 @${SUP} ${SUPFLAGS} ${SUPFILE1}
639 .if defined(SUPFILE2)
640 @${SUP} ${SUPFLAGS} ${SUPFILE2}
642 .if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
643 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
645 .if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
646 @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
649 .if defined(CVS_UPDATE)
650 @echo "--------------------------------------------------------------"
651 @echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT}
652 @echo "--------------------------------------------------------------"
653 cd ${.CURDIR}; ${CVS} -R -q update -A -P -d
657 # ------------------------------------------------------------------------
659 # From here onwards are utility targets used by the 'make world' and
660 # related targets. If your 'world' breaks, you may like to try to fix
661 # the problem and manually run the following targets to attempt to
662 # complete the build. Beware, this is *not* guaranteed to work, you
663 # need to have a pretty good grip on the current state of the system
664 # to attempt to manually finish it. If in doubt, 'make world' again.
668 # legacy: Build compatibility shims for the next three targets
671 .for _tool in tools/build
672 @${ECHODIR} "===> ${_tool}"; \
673 cd ${.CURDIR}/${_tool}; \
674 ${MAKE} DIRPRFX=${_tool}/ obj; \
675 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \
676 ${MAKE} DIRPRFX=${_tool}/ depend; \
677 ${MAKE} DIRPRFX=${_tool}/ all; \
678 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
682 # bootstrap-tools: Build tools needed for compatibility
684 .if !defined(NOGAMES)
685 _strfile= games/fortune/strfile
689 _gperf= gnu/usr.bin/gperf
690 .if ${BOOTSTRAPPING} < 500113
691 _groff= gnu/usr.bin/groff
693 _groff= gnu/usr.bin/groff/tmac
697 .if ${BOOTSTRAPPING} < 502102
701 .if ${BOOTSTRAPPING} < 450005 || \
702 ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500034
703 _uudecode= usr.bin/uudecode
706 .if ${BOOTSTRAPPING} < 430002 || \
707 ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500019
708 _xargs= usr.bin/xargs
711 .if ${BOOTSTRAPPING} < 430002 || \
712 ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500018
716 .if !defined(NO_RESCUE) && \
717 ${BOOTSTRAPPING} < 501100
718 _crunchgen= usr.sbin/crunch/crunchgen
721 .if ${BOOTSTRAPPING} < 501114
722 _gensnmptree= usr.sbin/bsnmpd/gensnmptree
725 .if ${BOOTSTRAPPING} < 500019
726 _kbdcontrol= usr.sbin/kbdcontrol
734 gnu/usr.bin/texinfo \
747 @${ECHODIR} "===> ${_tool}"; \
748 cd ${.CURDIR}/${_tool}; \
749 ${MAKE} DIRPRFX=${_tool}/ obj; \
750 ${MAKE} DIRPRFX=${_tool}/ depend; \
751 ${MAKE} DIRPRFX=${_tool}/ all; \
752 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
756 # build-tools: Build special purpose build tools
758 .if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules)
759 _aicasm= sys/modules/aic7xxx/aicasm
762 .if !defined(NOSHARE)
763 _share= share/syscons/scrnmaps
766 .if !defined(NO_FORTRAN)
767 _fortran= gnu/usr.bin/cc/f771
770 .if !defined(NO_KERBEROS) && !defined(NOCRYPT) && !defined(NO_OPENSSL)
771 _kerberos5_tools= kerberos5/tools
774 .if !defined(NO_RESCUE)
775 _rescue= rescue/rescue
783 gnu/usr.bin/cc/cc_tools \
791 @${ECHODIR} "===> ${_tool}"; \
792 cd ${.CURDIR}/${_tool}; \
793 ${MAKE} DIRPRFX=${_tool}/ obj; \
794 ${MAKE} DIRPRFX=${_tool}/ build-tools
798 @${ECHODIR} "===> ${_tool}"; \
799 cd ${.CURDIR}/${_tool}; \
800 ${MAKE} DIRPRFX=${_tool}/ obj; \
801 ${MAKE} DIRPRFX=${_tool}/ depend; \
802 ${MAKE} DIRPRFX=${_tool}/ all
806 # cross-tools: Build cross-building tools
808 .if ${TARGET_ARCH} == "sparc64" && ${TARGET_ARCH} != ${MACHINE_ARCH} && \
809 ${BOOTSTRAPPING} < 500037
810 _elf2aout= usr.bin/elf2aout
813 .if ${TARGET_ARCH} == "i386" && ${TARGET_ARCH} != ${MACHINE_ARCH}
814 _btxld= usr.sbin/btxld
817 .if (!defined(NO_RESCUE) || \
818 defined(RELEASEDIR)) && \
819 (${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 501101)
820 _crunchide= usr.sbin/crunch/crunchide
823 .if ${TARGET_ARCH} == "alpha" && ${TARGET_ARCH} != ${MACHINE_ARCH}
824 _elf2exe= usr.sbin/elf2exe
827 .if ${TARGET_ARCH} == "i386" && ${TARGET_ARCH} != ${MACHINE_ARCH} && \
829 _kgzip= usr.sbin/kgzip
834 gnu/usr.bin/binutils \
837 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
842 @${ECHODIR} "===> ${_tool}"; \
843 cd ${.CURDIR}/${_tool}; \
844 ${MAKE} DIRPRFX=${_tool}/ obj; \
845 ${MAKE} DIRPRFX=${_tool}/ depend; \
846 ${MAKE} DIRPRFX=${_tool}/ all; \
847 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
851 # hierarchy - ensure that all the needed directories are present
854 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs
857 # libraries - build all libraries, and install them under ${DESTDIR}.
859 # The list of libraries with dependents (${_prebuild_libs}) and their
860 # interdependencies (__L) are built automatically by the
861 # ${.CURDIR}/tools/make_libdeps.sh script.
865 ${MAKE} -f Makefile.inc1 _startup_libs; \
866 ${MAKE} -f Makefile.inc1 _prebuild_libs; \
867 ${MAKE} -f Makefile.inc1 _generic_libs;
869 # These dependencies are not automatically generated:
871 # gnu/lib/csu, gnu/lib/libgcc and lib/csu must be built before all
872 # shared libraries for ELF.
874 _startup_libs= gnu/lib/csu gnu/lib/libgcc
875 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
876 _startup_libs+= lib/csu/${MACHINE_ARCH}-elf
878 _startup_libs+= lib/csu/${MACHINE_ARCH}
883 _generic_libs= gnu/lib
885 .if !defined(NO_KERBEROS) && !defined(NOCRYPT) && !defined(NO_OPENSSL)
886 _prebuild_libs+= kerberos5/lib/libasn1
887 _prebuild_libs+= kerberos5/lib/libgssapi
888 _prebuild_libs+= kerberos5/lib/libkrb5
889 _prebuild_libs+= kerberos5/lib/libroken
890 _generic_libs+= kerberos5/lib
893 _prebuild_libs+= lib/libcom_err lib/libcrypt lib/libexpat \
894 lib/libkvm lib/libmd \
895 lib/libncurses lib/libnetgraph lib/libopie lib/libpam \
896 lib/libradius lib/librpcsvc \
897 lib/libsbuf lib/libtacplus lib/libutil lib/libypclnt \
900 lib/libopie__L lib/libradius__L lib/libtacplus__L: lib/libmd__L
901 lib/libypclnt__L: lib/librpcsvc__L
905 .if !defined(NOCRYPT)
906 .if !defined(NO_OPENSSL)
907 _prebuild_libs+= secure/lib/libcrypto secure/lib/libssl
908 .if !defined(NO_OPENSSH)
909 _prebuild_libs+= secure/lib/libssh
910 secure/lib/libssh__L: secure/lib/libcrypto__L lib/libz__L
913 _generic_libs+= secure/lib
916 _generic_libs+= usr.bin/lex/lib
918 .if ${MACHINE_ARCH} == "i386"
919 _generic_libs+= usr.sbin/pcvt/keycap
922 .for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
924 .if exists(${.CURDIR}/${_lib})
925 @${ECHODIR} "===> ${_lib}"; \
926 cd ${.CURDIR}/${_lib}; \
927 ${MAKE} DIRPRFX=${_lib}/ depend; \
928 ${MAKE} DIRPRFX=${_lib}/ all; \
929 ${MAKE} DIRPRFX=${_lib}/ install
933 # libpam is special: we need to build static PAM modules before
934 # static PAM library, and dynamic PAM library before dynamic PAM
936 lib/libpam__L: .PHONY
937 @${ECHODIR} "===> lib/libpam"; \
938 cd ${.CURDIR}/lib/libpam; \
939 ${MAKE} DIRPRFX=lib/libpam/ depend; \
940 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \
941 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install
943 _startup_libs: ${_startup_libs:S/$/__L/}
944 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
945 _generic_libs: ${_generic_libs:S/$/__L/}
947 .for __target in all clean cleandepend cleandir depend includes obj
948 .for entry in ${SUBDIR}
949 ${entry}.${__target}__D: .PHONY
950 @if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
951 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
952 edir=${entry}.${MACHINE_ARCH}; \
953 cd ${.CURDIR}/$${edir}; \
955 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \
957 cd ${.CURDIR}/$${edir}; \
959 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
961 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
964 .include <bsd.subdir.mk>