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
87 SUP?= /usr/local/bin/cvsup
88 SUPFLAGS?= -g -L 2 -P -
90 SUPFLAGS+= -h ${SUPHOST}
93 MAKEOBJDIRPREFIX?= /usr/obj
94 .if !defined(OSRELDATE)
95 .if exists(/usr/include/osreldate.h)
96 OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
97 /usr/include/osreldate.h
102 TARGET_ARCH?= ${MACHINE_ARCH}
103 .if ${TARGET_ARCH} == ${MACHINE_ARCH}
105 TARGET_CPUTYPE?=${CPUTYPE}
107 TARGET?= ${TARGET_ARCH}
110 .if !empty(TARGET_CPUTYPE)
111 _TARGET_CPUTYPE=${TARGET_CPUTYPE}
113 _TARGET_CPUTYPE=dummy
115 _CPUTYPE!= MAKEFLAGS= ${MAKE} -f /dev/null -m ${.CURDIR}/share/mk \
116 CPUTYPE=${_TARGET_CPUTYPE} -V CPUTYPE
117 .if ${_CPUTYPE} != ${_TARGET_CPUTYPE}
118 .error CPUTYPE global should be set with ?=.
121 BUILD_ARCH!= sysctl -n hw.machine_arch
122 .if ${MACHINE_ARCH} != ${BUILD_ARCH}
123 .error To cross-build, set TARGET_ARCH.
126 .if ${MACHINE} == ${TARGET}
127 OBJTREE= ${MAKEOBJDIRPREFIX}
129 OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}
131 WORLDTMP= ${OBJTREE}${.CURDIR}/${MACHINE_ARCH}
132 # /usr/games added for fortune which depend on strfile
133 BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games
134 XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
135 STRICTTMPPATH= ${BPATH}:${XPATH}
136 TMPPATH= ${STRICTTMPPATH}:${PATH}
138 INSTALLTMP!= /usr/bin/mktemp -d -u -t install
141 # Building a world goes through the following stages
143 # 1. legacy stage [BMAKE]
144 # This stage is responsible for creating compatibility
145 # shims that are needed by the bootstrap-tools,
146 # build-tools and cross-tools stages.
147 # 1. bootstrap-tools stage [BMAKE]
148 # This stage is responsible for creating programs that
149 # are needed for backward compatibility reasons. They
150 # are not built as cross-tools.
151 # 2. build-tools stage [TMAKE]
152 # This stage is responsible for creating the object
153 # tree and building any tools that are needed during
155 # 3. cross-tools stage [XMAKE]
156 # This stage is responsible for creating any tools that
157 # are needed for cross-builds. A cross-compiler is one
159 # 4. world stage [WMAKE]
160 # This stage actually builds the world.
161 # 5. install stage (optional) [IMAKE]
162 # This stage installs a previously built world.
167 # Common environment for world related stages
168 CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \
169 MACHINE_ARCH=${TARGET_ARCH} \
171 CPUTYPE=${TARGET_CPUTYPE} \
172 GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
173 GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \
174 GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac
176 # bootstrap-tools stage
177 BMAKEENV= 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 \
184 BOOTSTRAPPING=${OSRELDATE} \
185 -DNOHTML -DNOINFO -DNOLINT -DNOMAN -DNOPIC -DNOPROFILE \
186 -DNOSHARED -DNO_CPU_CFLAGS -DNO_WARNS
189 TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
190 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
192 BOOTSTRAPPING=${OSRELDATE} -DNOLINT -DNO_CPU_CFLAGS -DNO_WARNS
195 XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} -DNO_FORTRAN -DNO_GDB
198 WMAKEENV= ${CROSSENV} \
199 _SHLIBDIRPREFIX=${WORLDTMP} \
200 INSTALL="sh ${.CURDIR}/tools/install.sh" \
202 WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1 DESTDIR=${WORLDTMP}
205 .if empty(.MAKEFLAGS:M-n)
206 IMAKEENV= ${CROSSENV} \
207 PATH=${STRICTTMPPATH}:${INSTALLTMP}
209 IMAKEENV= ${CROSSENV} \
210 PATH=${TMPPATH}:${INSTALLTMP}
212 IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1
215 KMAKEENV= ${WMAKEENV}
220 # Attempt to rebuild the entire system, with reasonable chance of
221 # success, regardless of how old your existing system is.
224 .if ${.CURDIR:C/[^,]//g} != ""
225 # The m4 build of sendmail files doesn't like it if ',' is used
226 # anywhere in the path of it's files.
228 @echo "*** Error: path to source tree contains a comma ','"
233 @echo "--------------------------------------------------------------"
234 @echo ">>> Rebuilding the temporary build tree"
235 @echo "--------------------------------------------------------------"
236 .if !defined(NOCLEAN)
239 rm -rf ${WORLDTMP}/legacy/usr/include
240 # XXX - These two can depend on any header file.
241 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
242 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
245 usr/bin usr/games usr/include/c++/3.3 usr/include/sys usr/lib \
246 usr/libexec usr/sbin usr/share/dict \
247 usr/share/groff_font/devX100 \
248 usr/share/groff_font/devX100-12 \
249 usr/share/groff_font/devX75 \
250 usr/share/groff_font/devX75-12 \
251 usr/share/groff_font/devascii \
252 usr/share/groff_font/devcp1047 \
253 usr/share/groff_font/devdvi \
254 usr/share/groff_font/devhtml \
255 usr/share/groff_font/devkoi8-r \
256 usr/share/groff_font/devlatin1 \
257 usr/share/groff_font/devlbp \
258 usr/share/groff_font/devlj4 \
259 usr/share/groff_font/devps \
260 usr/share/groff_font/devutf8 \
261 usr/share/tmac/mdoc usr/share/tmac/mm
262 mkdir -p ${WORLDTMP}/legacy/${_dir}
265 lib usr/bin usr/include usr/lib/compat/aout usr/libdata/ldscripts \
266 usr/libexec usr/sbin usr/share/misc \
267 usr/share/snmp/defs usr/share/snmp/mibs
268 mkdir -p ${WORLDTMP}/${_dir}
270 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
271 -p ${WORLDTMP}/usr/include >/dev/null
272 ln -sf ${.CURDIR}/sys ${WORLDTMP}
275 @echo "--------------------------------------------------------------"
276 @echo ">>> stage 1.1: legacy release compatibility shims"
277 @echo "--------------------------------------------------------------"
278 ${_+_}cd ${.CURDIR}; ${BMAKE} legacy
281 @echo "--------------------------------------------------------------"
282 @echo ">>> stage 1.2: bootstrap tools"
283 @echo "--------------------------------------------------------------"
284 ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools
286 .if !defined(NOCLEAN)
288 @echo "--------------------------------------------------------------"
289 @echo ">>> stage 2.1: cleaning up the object tree"
290 @echo "--------------------------------------------------------------"
291 ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
295 @echo "--------------------------------------------------------------"
296 @echo ">>> stage 2.2: rebuilding the object tree"
297 @echo "--------------------------------------------------------------"
298 ${_+_}cd ${.CURDIR}; ${WMAKE} par-obj
301 @echo "--------------------------------------------------------------"
302 @echo ">>> stage 2.3: build tools"
303 @echo "--------------------------------------------------------------"
304 ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools
307 @echo "--------------------------------------------------------------"
308 @echo ">>> stage 3: cross tools"
309 @echo "--------------------------------------------------------------"
310 ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools
313 @echo "--------------------------------------------------------------"
314 @echo ">>> stage 4.1: building includes"
315 @echo "--------------------------------------------------------------"
316 ${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
319 @echo "--------------------------------------------------------------"
320 @echo ">>> stage 4.2: building libraries"
321 @echo "--------------------------------------------------------------"
322 ${_+_}cd ${.CURDIR}; \
323 ${WMAKE} -DNOFSCHG -DNOHTML -DNOINFO -DNOLINT -DNOMAN -DNOPROFILE \
327 @echo "--------------------------------------------------------------"
328 @echo ">>> stage 4.3: make dependencies"
329 @echo "--------------------------------------------------------------"
330 ${_+_}cd ${.CURDIR}; ${WMAKE} par-depend
333 @echo "--------------------------------------------------------------"
334 @echo ">>> stage 4.4: building everything"
335 @echo "--------------------------------------------------------------"
336 ${_+_}cd ${.CURDIR}; ${WMAKE} par-all
340 .if !defined(SUBDIR_OVERRIDE)
341 WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools
343 WMAKE_TGTS+= _cleanobj _obj _build-tools
344 .if !defined(SUBDIR_OVERRIDE)
345 WMAKE_TGTS+= _cross-tools
347 WMAKE_TGTS+= _includes _libraries _depend everything
349 buildworld: ${WMAKE_TGTS}
350 .ORDER: ${WMAKE_TGTS}
352 TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything}
353 toolchain: ${TOOLCHAIN_TGTS}
354 kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries}
357 # Use this to add checks to installworld/installkernel targets.
359 SPECIAL_INSTALLCHECKS=
362 # The following install-time check will see if the installation will
363 # change the type used for time_t, and if it will, the target makes
364 # sure that the user is expecting to make that change.
366 .if ${TARGET_ARCH} == "sparc64"
367 SPECIAL_INSTALLCHECKS+=sparc64_installcheck
369 CUR_TIMET!= grep __time_t /usr/include/machine/_types.h | awk '{print $$2}'
370 SRC_TIMET!= grep __time_t ${.CURDIR}/sys/sparc64/include/_types.h | \
372 NEWSPARC_TIMETYPE?=${CUR_TIMET}
374 sparc64_installcheck:
375 .if ${CUR_TIMET} != ${SRC_TIMET}
377 .if ${NEWSPARC_TIMETYPE} != ${SRC_TIMET}
378 @echo "*** ERROR: This target would change the type used for time_t!"
380 @echo "* Note: This installation changes the type used for time_t."
383 @echo "* This host has time_t defined as ${CUR_TIMET},"
384 @echo "* and this installation would change that to type ${SRC_TIMET}."
385 .if ${NEWSPARC_TIMETYPE} != ${SRC_TIMET}
387 @echo "* If that is *NOT* what you wanted, then you need to change the"
388 @echo "* typedef of __time_t in ${.CURDIR}/sys/sparc64/include/_types.h"
389 @echo "* from '${SRC_TIMET}' to '${CUR_TIMET}'. After that you *MUST*"
390 @echo "* do a complete cleanworld, buildworld, buildkernel before you"
391 @echo "* retry the 'make' command. Also read /usr/src/UPDATING.64BTT."
393 @echo "* If that *is* what you want, then enter the commands:"
394 @echo " NEWSPARC_TIMETYPE=${SRC_TIMET}"
395 @echo " export NEWSPARC_TIMETYPE"
396 @echo "* and repeat your 'make' command."
401 .elif ${NEWSPARC_TIMETYPE} != ${SRC_TIMET}
403 @echo "*** ERROR: NEWSPARC_TIMETYPE is set to '${NEWSPARC_TIMETYPE}'"
404 @echo "*** but ${.CURDIR}/sys/sparc64/include/_types.h"
405 @echo "*** has __time_t defined as '${SRC_TIMET}'."
408 @# in sparc64_installcheck, all TIMETYPEs == '${CUR_TIMET}'
415 # Checks to be sure system is ready for installworld
419 .if !defined(NO_SENDMAIL)
425 CHECK_GIDS+= proxy authpf
427 installcheck: ${SPECIAL_INSTALLCHECKS}
428 .for uid in ${CHECK_UIDS}
429 @if ! `id -u ${uid} >/dev/null 2>&1`; then \
430 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \
434 .for gid in ${CHECK_GIDS}
435 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \
436 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \
444 # Distributes everything compiled by a `buildworld'.
448 # Installs everything compiled by a 'buildworld'.
450 distributeworld installworld: installcheck
451 mkdir -p ${INSTALLTMP}
452 for prog in [ awk cap_mkdb cat chflags chmod chown \
453 date echo egrep find grep \
454 ln make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
455 test true uname wc zic; do \
456 cp `which $$prog` ${INSTALLTMP}; \
458 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}
464 # If you have a build server, you can NFS mount the source and obj directories
465 # and do a 'make reinstall' on the *client* to install new binaries from the
466 # most recent server build.
468 reinstall: ${SPECIAL_INSTALLCHECKS}
469 @echo "--------------------------------------------------------------"
470 @echo ">>> Making hierarchy"
471 @echo "--------------------------------------------------------------"
472 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
474 @echo "--------------------------------------------------------------"
475 @echo ">>> Installing everything"
476 @echo "--------------------------------------------------------------"
477 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
480 @echo "--------------------------------------------------------------"
481 @echo ">>> Distributing everything"
482 @echo "--------------------------------------------------------------"
483 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
486 # buildkernel and installkernel
488 # Which kernels to build and/or install is specified by setting
489 # KERNCONF. If not defined a GENERIC kernel is built/installed.
490 # Only the existing (depending TARGET) config files are used
491 # for building kernels and only the first of these is designated
492 # as the one being installed.
494 # Note that we have to use TARGET instead of TARGET_ARCH when
495 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
496 # be set to cross-build, we have to make sure TARGET is set
499 .if !defined(KERNCONF) && defined(KERNEL)
505 INSTKERNNAME?= kernel
507 KERNSRCDIR?= ${.CURDIR}/sys
508 KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf
509 KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR}
510 KERNCONFDIR?= ${KRNLCONFDIR}
514 .for _kernel in ${KERNCONF}
515 .if exists(${KERNCONFDIR}/${_kernel})
516 BUILDKERNELS+= ${_kernel}
517 .if empty(INSTALLKERNEL)
518 INSTALLKERNEL= ${_kernel}
526 # Builds all kernels defined by BUILDKERNELS.
529 .if empty(BUILDKERNELS)
530 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF}).";
533 .if defined(KERNWARN)
534 @echo "--------------------------------------------------------------"
535 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
536 @echo "--------------------------------------------------------------"
540 .for _kernel in ${BUILDKERNELS}
541 @echo "--------------------------------------------------------------"
542 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
543 @echo "--------------------------------------------------------------"
544 @echo "===> ${_kernel}"
545 mkdir -p ${KRNLOBJDIR}
546 .if !defined(NO_KERNELCONFIG)
548 @echo "--------------------------------------------------------------"
549 @echo ">>> stage 1: configuring the kernel"
550 @echo "--------------------------------------------------------------"
553 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
554 ${KERNCONFDIR}/${_kernel}
556 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
558 @echo "--------------------------------------------------------------"
559 @echo ">>> stage 2.1: cleaning up the object tree"
560 @echo "--------------------------------------------------------------"
561 cd ${KRNLOBJDIR}/${_kernel}; \
562 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} ${CLEANDIR}
565 @echo "--------------------------------------------------------------"
566 @echo ">>> stage 2.2: rebuilding the object tree"
567 @echo "--------------------------------------------------------------"
568 cd ${KRNLOBJDIR}/${_kernel}; \
569 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} obj
571 @echo "--------------------------------------------------------------"
572 @echo ">>> stage 2.3: build tools"
573 @echo "--------------------------------------------------------------"
574 cd ${KRNLOBJDIR}/${_kernel}; \
575 MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \
576 ${MAKE} -DNO_CPU_CFLAGS -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
577 # XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case.
578 .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules)
579 .for target in obj depend all
580 cd ${.CURDIR}/sys/modules/aic7xxx/aicasm; \
581 MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
582 ${MAKE} -DNO_CPU_CFLAGS ${target}
585 .if !defined(NO_KERNELDEPEND)
587 @echo "--------------------------------------------------------------"
588 @echo ">>> stage 3.1: making dependencies"
589 @echo "--------------------------------------------------------------"
590 cd ${KRNLOBJDIR}/${_kernel}; \
591 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend -DNO_MODULES_OBJ
594 @echo "--------------------------------------------------------------"
595 @echo ">>> stage 3.2: building everything"
596 @echo "--------------------------------------------------------------"
597 cd ${KRNLOBJDIR}/${_kernel}; \
598 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all -DNO_MODULES_OBJ
599 @echo "--------------------------------------------------------------"
600 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
601 @echo "--------------------------------------------------------------"
605 # installkernel, etc.
607 # Install the kernel defined by INSTALLKERNEL
609 installkernel installkernel.debug \
610 reinstallkernel reinstallkernel.debug: ${SPECIAL_INSTALLCHECKS}
611 .if empty(INSTALLKERNEL)
612 @echo "ERROR: No kernel \"${KERNCONF}\" to install."
615 @echo "--------------------------------------------------------------"
616 @echo ">>> Making hierarchy"
617 @echo "--------------------------------------------------------------"
619 ${CROSSENV} PATH=${TMPPATH} ${MAKE} -f Makefile.inc1 hierarchy
621 @echo "--------------------------------------------------------------"
622 @echo ">>> Installing kernel"
623 @echo "--------------------------------------------------------------"
624 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
625 ${CROSSENV} PATH=${TMPPATH} \
626 ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
631 # Update the source tree, by running sup and/or running cvs to update to the
635 .if defined(SUP_UPDATE)
636 @echo "--------------------------------------------------------------"
637 @echo ">>> Running ${SUP}"
638 @echo "--------------------------------------------------------------"
640 @${SUP} ${SUPFLAGS} ${SUPFILE}
642 .if defined(SUPFILE1)
643 @${SUP} ${SUPFLAGS} ${SUPFILE1}
645 .if defined(SUPFILE2)
646 @${SUP} ${SUPFLAGS} ${SUPFILE2}
648 .if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
649 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
651 .if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
652 @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
655 .if defined(CVS_UPDATE)
656 @echo "--------------------------------------------------------------"
657 @echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT}
658 @echo "--------------------------------------------------------------"
659 cd ${.CURDIR}; ${CVS} -R -q update ${CVSFLAGS}
663 # ------------------------------------------------------------------------
665 # From here onwards are utility targets used by the 'make world' and
666 # related targets. If your 'world' breaks, you may like to try to fix
667 # the problem and manually run the following targets to attempt to
668 # complete the build. Beware, this is *not* guaranteed to work, you
669 # need to have a pretty good grip on the current state of the system
670 # to attempt to manually finish it. If in doubt, 'make world' again.
674 # legacy: Build compatibility shims for the next three targets
677 .for _tool in tools/build
678 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \
679 cd ${.CURDIR}/${_tool}; \
680 ${MAKE} DIRPRFX=${_tool}/ obj; \
681 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \
682 ${MAKE} DIRPRFX=${_tool}/ depend; \
683 ${MAKE} DIRPRFX=${_tool}/ all; \
684 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
688 # bootstrap-tools: Build tools needed for compatibility
690 .if !defined(NOGAMES)
691 _strfile= games/fortune/strfile
695 _gperf= gnu/usr.bin/gperf
696 .if ${BOOTSTRAPPING} < 500113
697 _groff= gnu/usr.bin/groff
699 _groff= gnu/usr.bin/groff/tmac
703 .if ${BOOTSTRAPPING} < 502102
707 .if ${BOOTSTRAPPING} < 450005 || \
708 ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500034
709 _uudecode= usr.bin/uudecode
712 .if ${BOOTSTRAPPING} < 430002 || \
713 ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500019
714 _xargs= usr.bin/xargs
717 .if ${BOOTSTRAPPING} < 430002 || \
718 ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500018
722 .if !defined(NO_RESCUE) && \
723 ${BOOTSTRAPPING} < 502128
724 _crunchgen= usr.sbin/crunch/crunchgen
727 .if ${BOOTSTRAPPING} < 502128
728 _gensnmptree= usr.sbin/bsnmpd/gensnmptree
731 .if ${BOOTSTRAPPING} < 500019
732 _kbdcontrol= usr.sbin/kbdcontrol
740 gnu/usr.bin/texinfo \
753 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
754 cd ${.CURDIR}/${_tool}; \
755 ${MAKE} DIRPRFX=${_tool}/ obj; \
756 ${MAKE} DIRPRFX=${_tool}/ depend; \
757 ${MAKE} DIRPRFX=${_tool}/ all; \
758 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
762 # build-tools: Build special purpose build tools
764 .if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules)
765 _aicasm= sys/modules/aic7xxx/aicasm
768 .if !defined(NOSHARE)
769 _share= share/syscons/scrnmaps
772 .if !defined(NO_KERBEROS) && !defined(NOCRYPT) && !defined(NO_OPENSSL)
773 _kerberos5_tools= kerberos5/tools
776 .if !defined(NO_RESCUE)
777 _rescue= rescue/rescue
791 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \
792 cd ${.CURDIR}/${_tool}; \
793 ${MAKE} DIRPRFX=${_tool}/ obj; \
794 ${MAKE} DIRPRFX=${_tool}/ build-tools
797 gnu/usr.bin/cc/cc_tools \
799 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \
800 cd ${.CURDIR}/${_tool}; \
801 ${MAKE} DIRPRFX=${_tool}/ obj; \
802 ${MAKE} DIRPRFX=${_tool}/ depend; \
803 ${MAKE} DIRPRFX=${_tool}/ all
807 # cross-tools: Build cross-building tools
809 .if ${TARGET_ARCH} == "sparc64" && ${TARGET_ARCH} != ${MACHINE_ARCH} && \
810 ${BOOTSTRAPPING} < 500037
811 _elf2aout= usr.bin/elf2aout
814 .if ${TARGET_ARCH} == "i386" && ${TARGET_ARCH} != ${MACHINE_ARCH}
815 _btxld= usr.sbin/btxld
818 .if (!defined(NO_RESCUE) || \
819 defined(RELEASEDIR)) && \
820 (${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 501101)
821 _crunchide= usr.sbin/crunch/crunchide
824 .if ${TARGET_ARCH} == "alpha" && ${TARGET_ARCH} != ${MACHINE_ARCH}
825 _elf2exe= usr.sbin/elf2exe
828 .if ${TARGET_ARCH} == "i386" && ${TARGET_ARCH} != ${MACHINE_ARCH} && \
830 _kgzip= usr.sbin/kgzip
835 gnu/usr.bin/binutils \
838 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
843 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
844 cd ${.CURDIR}/${_tool}; \
845 ${MAKE} DIRPRFX=${_tool}/ obj; \
846 ${MAKE} DIRPRFX=${_tool}/ depend; \
847 ${MAKE} DIRPRFX=${_tool}/ all; \
848 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
852 # hierarchy - ensure that all the needed directories are present
855 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs
858 # libraries - build all libraries, and install them under ${DESTDIR}.
860 # The list of libraries with dependents (${_prebuild_libs}) and their
861 # interdependencies (__L) are built automatically by the
862 # ${.CURDIR}/tools/make_libdeps.sh script.
866 ${MAKE} -f Makefile.inc1 _startup_libs; \
867 ${MAKE} -f Makefile.inc1 _prebuild_libs; \
868 ${MAKE} -f Makefile.inc1 _generic_libs;
870 # These dependencies are not automatically generated:
872 # gnu/lib/csu, gnu/lib/libgcc and lib/csu must be built before all
873 # shared libraries for ELF.
875 _startup_libs= gnu/lib/csu gnu/lib/libgcc
876 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
877 _startup_libs+= lib/csu/${MACHINE_ARCH}-elf
879 _startup_libs+= lib/csu/${MACHINE_ARCH}
884 _generic_libs= gnu/lib
886 .if !defined(NO_KERBEROS) && !defined(NOCRYPT) && !defined(NO_OPENSSL)
887 _prebuild_libs+= kerberos5/lib/libasn1
888 _prebuild_libs+= kerberos5/lib/libgssapi
889 _prebuild_libs+= kerberos5/lib/libkrb5
890 _prebuild_libs+= kerberos5/lib/libroken
891 _generic_libs+= kerberos5/lib
894 _prebuild_libs+= lib/libcom_err lib/libcrypt lib/libexpat \
895 lib/libkvm lib/libmd \
896 lib/libncurses lib/libnetgraph lib/libopie lib/libpam \
898 lib/libsbuf lib/libtacplus lib/libutil lib/libypclnt \
901 lib/libopie__L lib/libtacplus__L: lib/libmd__L
903 .if !defined(NO_BIND)
904 .if ${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH} == "sparc64"
905 _prebuild_libs+= lib/libc_r
907 _prebuild_libs+= lib/libpthread
913 .if !defined(NOCRYPT)
914 .if !defined(NO_OPENSSL)
915 _prebuild_libs+= secure/lib/libcrypto secure/lib/libssl
916 lib/libradius__L: secure/lib/libssl__L
917 secure/lib/libssl__L: secure/lib/libcrypto__L
918 .if !defined(NO_OPENSSH)
919 _prebuild_libs+= secure/lib/libssh
920 secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
921 .if !defined(NO_KERBEROS)
922 secure/lib/libssh__L: kerberos5/lib/libgssapi__L kerberos5/lib/libkrb5__L \
923 kerberos5/lib/libasn1__L lib/libcom_err__L lib/libmd__L \
924 kerberos5/lib/libroken__L
928 _generic_libs+= secure/lib
931 .if defined(NOCRYPT) || defined(NO_OPENSSL)
932 lib/libradius__L: lib/libmd__L
935 _generic_libs+= usr.bin/lex/lib
937 .if ${MACHINE_ARCH} == "i386"
938 _generic_libs+= usr.sbin/pcvt/keycap
941 .for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
943 .if exists(${.CURDIR}/${_lib})
944 ${_+_}@${ECHODIR} "===> ${_lib} (depend,all,install)"; \
945 cd ${.CURDIR}/${_lib}; \
946 ${MAKE} DIRPRFX=${_lib}/ depend; \
947 ${MAKE} DIRPRFX=${_lib}/ all; \
948 ${MAKE} DIRPRFX=${_lib}/ install
952 # libpam is special: we need to build static PAM modules before
953 # static PAM library, and dynamic PAM library before dynamic PAM
955 lib/libpam__L: .PHONY
956 ${_+_}@${ECHODIR} "===> lib/libpam (depend,all,install)"; \
957 cd ${.CURDIR}/lib/libpam; \
958 ${MAKE} DIRPRFX=lib/libpam/ depend; \
959 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \
960 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install
962 _startup_libs: ${_startup_libs:S/$/__L/}
963 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
964 _generic_libs: ${_generic_libs:S/$/__L/}
966 .for __target in all clean cleandepend cleandir depend includes obj
967 .for entry in ${SUBDIR}
968 ${entry}.${__target}__D: .PHONY
969 ${_+_}@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
970 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \
971 edir=${entry}.${MACHINE_ARCH}; \
972 cd ${.CURDIR}/$${edir}; \
974 ${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \
976 cd ${.CURDIR}/$${edir}; \
978 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
980 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
983 .include <bsd.subdir.mk>