4 # Make command line options:
5 # -DNO_KERBEROS Do not build Heimdal (Kerberos 5)
6 # -DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
7 # -DNOCLEAN do not clean at all
8 # -DNOCRYPT will prevent building of crypt versions
9 # -DNOMAN do not build the manual pages
10 # -DNOPROFILE do not build profiled libraries
11 # -DNOSECURE do not go into secure subdir
12 # -DNOGAMES do not go into games subdir
13 # -DNOSHARE do not go into share subdir
14 # -DNOINFO do not make or install info files
15 # -DNOLIBC_R do not build libc_r.
16 # -DNO_FORTRAN do not build g77 and related libraries.
17 # -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel
18 # -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel
19 # -DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel
20 # -DNO_PORTSUPDATE do not update ports in ${MAKE} update
21 # -DNO_DOCUPDATE do not update doc in ${MAKE} update
22 # LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
23 # TARGET_ARCH="arch" to crossbuild world to a different arch
26 # The intended user-driven targets are:
27 # buildworld - rebuild *everything*, including glue to help do upgrades
28 # installworld- install everything built by "buildworld"
29 # update - convenient way to update your source tree (eg: sup/cvs)
30 # most - build user commands, no libraries or include files
31 # installmost - install user commands, no libraries or include files
33 # Standard targets (not defined here) are documented in the makefiles in
34 # /usr/share/mk. These include:
35 # obj depend all install clean cleandepend cleanobj
37 # Put initial settings here.
40 # We must do share/info early so that installation of info `dir'
41 # entries works correctly. Do it first since it is less likely to
42 # grow dependencies on include and lib than vice versa.
43 .if exists(${.CURDIR}/share/info)
47 .if exists(${.CURDIR}/include)
50 .if exists(${.CURDIR}/lib)
54 .if exists(${.CURDIR}/bin)
57 .if exists(${.CURDIR}/games) && !defined(NOGAMES)
60 .if exists(${.CURDIR}/gnu)
63 .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
64 !defined(NOCRYPT) && !defined(NO_OPENSSL) && !defined(NO_KERBEROS)
67 .if exists(${.CURDIR}/libexec)
70 .if exists(${.CURDIR}/sbin)
73 .if exists(${.CURDIR}/secure) && !defined(NOCRYPT) && !defined(NOSECURE)
76 .if exists(${.CURDIR}/share) && !defined(NOSHARE)
79 .if exists(${.CURDIR}/sys)
82 .if exists(${.CURDIR}/usr.bin)
85 .if exists(${.CURDIR}/usr.sbin)
89 # etc must be last for "distribute" to work
90 .if exists(${.CURDIR}/etc)
94 # These are last, since it is nice to at least get the base system
95 # rebuilt before you do them.
96 .if defined(LOCAL_DIRS)
97 .for _DIR in ${LOCAL_DIRS}
98 .if exists(${.CURDIR}/${_DIR}) & exists(${.CURDIR}/${_DIR}/Makefile)
104 .if defined(SUBDIR_OVERRIDE)
105 SUBDIR= ${SUBDIR_OVERRIDE}
108 .if defined(NOCLEANDIR)
109 CLEANDIR= clean cleandepend
115 SUP?= /usr/local/bin/cvsup
116 SUPFLAGS?= -g -L 2 -P -
118 SUPFLAGS+= -h ${SUPHOST}
121 MAKEOBJDIRPREFIX?= /usr/obj
122 .if !defined(OSRELDATE)
123 OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
124 /usr/include/osreldate.h
126 TARGET_ARCH?= ${MACHINE_ARCH}
127 .if ${TARGET_ARCH} == ${MACHINE_ARCH}
129 TARGET_CPUTYPE?=${CPUTYPE}
131 TARGET?= ${TARGET_ARCH}
134 .if !empty(TARGET_CPUTYPE)
135 _TARGET_CPUTYPE=${TARGET_CPUTYPE}
137 _TARGET_CPUTYPE=dummy
139 _CPUTYPE!= ${MAKE} -f /dev/null -m ${.CURDIR}/share/mk \
140 CPUTYPE=${_TARGET_CPUTYPE} -V CPUTYPE
141 .if ${_CPUTYPE} != ${_TARGET_CPUTYPE}
142 .error CPUTYPE global should be set with ?=.
145 BUILD_ARCH!= sysctl -n hw.machine_arch
146 .if ${MACHINE_ARCH} != ${BUILD_ARCH}
147 .error To cross-build, set TARGET_ARCH.
150 .if ${MACHINE} == ${TARGET}
151 OBJTREE= ${MAKEOBJDIRPREFIX}
153 OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}
155 WORLDTMP= ${OBJTREE}${.CURDIR}/${MACHINE_ARCH}
156 # /usr/games added for fortune which depend on strfile
157 BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games
158 XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
159 STRICTTMPPATH= ${BPATH}:${XPATH}
160 TMPPATH= ${STRICTTMPPATH}:${PATH}
162 INSTALLTMP!= /usr/bin/mktemp -d -u -t install
165 # Building a world goes through the following stages
167 # 1. legacy stage [BMAKE]
168 # This stage is responsible for creating compatibility
169 # shims that are needed by the bootstrap-tools,
170 # build-tools and cross-tools stages.
171 # 1. bootstrap-tools stage [BMAKE]
172 # This stage is responsible for creating programs that
173 # are needed for backward compatibility reasons. They
174 # are not built as cross-tools.
175 # 2. build-tools stage [TMAKE]
176 # This stage is responsible for creating the object
177 # tree and building any tools that are needed during
179 # 3. cross-tools stage [XMAKE]
180 # This stage is responsible for creating any tools that
181 # are needed for cross-builds. A cross-compiler is one
183 # 4. world stage [WMAKE]
184 # This stage actually builds the world.
185 # 5. install stage (optional) [IMAKE]
186 # This stage installs a previously built world.
191 # Common environment for world related stages
192 CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \
193 MACHINE_ARCH=${TARGET_ARCH} \
195 CPUTYPE=${TARGET_CPUTYPE} \
196 GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
197 GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \
198 GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac
200 # bootstrap-tools stage
202 INSTALL="sh ${.CURDIR}/tools/install.sh" \
203 PATH=${BPATH}:${PATH} \
204 WORLDTMP=${WORLDTMP} \
205 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}"
206 BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
207 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
208 BOOTSTRAPPING=${OSRELDATE} \
209 -DNOHTML -DNOINFO -DNOLINT -DNOMAN -DNOPIC -DNOPROFILE \
210 -DNOSHARED -DNO_CPU_CFLAGS -DNO_WARNS
213 TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
214 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
215 BOOTSTRAPPING=${OSRELDATE} -DNOLINT -DNO_CPU_CFLAGS -DNO_WARNS
218 XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} -DNO_FORTRAN -DNO_GDB
221 WMAKEENV= ${CROSSENV} \
222 DESTDIR=${WORLDTMP} \
223 INSTALL="sh ${.CURDIR}/tools/install.sh" \
225 WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1
228 IMAKEENV= ${CROSSENV} \
229 PATH=${STRICTTMPPATH}:${INSTALLTMP}
230 IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1
233 KMAKEENV= ${WMAKEENV}
238 # Attempt to rebuild the entire system, with reasonable chance of
239 # success, regardless of how old your existing system is.
242 .if ${.CURDIR:C/[^,]//g} != ""
243 # The m4 build of sendmail files doesn't like it if ',' is used
244 # anywhere in the path of it's files.
246 @echo "*** Error: path to source tree contains a comma ','"
251 @echo "--------------------------------------------------------------"
252 @echo ">>> Rebuilding the temporary build tree"
253 @echo "--------------------------------------------------------------"
254 .if !defined(NOCLEAN)
257 rm -rf ${WORLDTMP}/legacy/usr/include
258 # XXX - These two can depend on any header file.
259 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
260 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
263 usr/bin usr/games usr/include/sys usr/lib \
264 usr/libexec usr/sbin usr/share/dict \
265 usr/share/groff_font/devX100 \
266 usr/share/groff_font/devX100-12 \
267 usr/share/groff_font/devX75 \
268 usr/share/groff_font/devX75-12 \
269 usr/share/groff_font/devascii \
270 usr/share/groff_font/devcp1047 \
271 usr/share/groff_font/devdvi \
272 usr/share/groff_font/devhtml \
273 usr/share/groff_font/devkoi8-r \
274 usr/share/groff_font/devlatin1 \
275 usr/share/groff_font/devlbp \
276 usr/share/groff_font/devlj4 \
277 usr/share/groff_font/devps \
278 usr/share/groff_font/devutf8 \
279 usr/share/tmac/mdoc usr/share/tmac/mm
280 mkdir -p ${WORLDTMP}/legacy/${_dir}
283 usr/bin usr/include usr/lib/compat/aout usr/libdata/ldscripts \
284 usr/libexec usr/share/misc
285 mkdir -p ${WORLDTMP}/${_dir}
287 ln -sf ${.CURDIR}/sys ${WORLDTMP}
290 @echo "--------------------------------------------------------------"
291 @echo ">>> stage 1: legacy release compatibility shims"
292 @echo "--------------------------------------------------------------"
293 cd ${.CURDIR}; ${BMAKE} legacy
296 @echo "--------------------------------------------------------------"
297 @echo ">>> stage 1: bootstrap tools"
298 @echo "--------------------------------------------------------------"
299 cd ${.CURDIR}; ${BMAKE} bootstrap-tools
301 .if !defined(NOCLEAN)
303 @echo "--------------------------------------------------------------"
304 @echo ">>> stage 2: cleaning up the object tree"
305 @echo "--------------------------------------------------------------"
306 cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
310 @echo "--------------------------------------------------------------"
311 @echo ">>> stage 2: rebuilding the object tree"
312 @echo "--------------------------------------------------------------"
313 cd ${.CURDIR}; ${WMAKE} par-obj
316 @echo "--------------------------------------------------------------"
317 @echo ">>> stage 2: build tools"
318 @echo "--------------------------------------------------------------"
319 cd ${.CURDIR}; ${TMAKE} build-tools
322 @echo "--------------------------------------------------------------"
323 @echo ">>> stage 3: cross tools"
324 @echo "--------------------------------------------------------------"
325 cd ${.CURDIR}; ${XMAKE} cross-tools
328 @echo "--------------------------------------------------------------"
329 @echo ">>> stage 4: populating ${WORLDTMP}/usr/include"
330 @echo "--------------------------------------------------------------"
331 cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
334 @echo "--------------------------------------------------------------"
335 @echo ">>> stage 4: building libraries"
336 @echo "--------------------------------------------------------------"
337 cd ${.CURDIR}; ${WMAKE} -DNOHTML -DNOINFO -DNOMAN -DNOFSCHG libraries
340 @echo "--------------------------------------------------------------"
341 @echo ">>> stage 4: make dependencies"
342 @echo "--------------------------------------------------------------"
343 cd ${.CURDIR}; ${WMAKE} par-depend
346 @echo "--------------------------------------------------------------"
347 @echo ">>> stage 4: building everything.."
348 @echo "--------------------------------------------------------------"
349 cd ${.CURDIR}; ${WMAKE} par-all
353 .if !defined(SUBDIR_OVERRIDE)
354 WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools
356 WMAKE_TGTS+= _cleanobj _obj _build-tools
357 .if !defined(SUBDIR_OVERRIDE)
358 WMAKE_TGTS+= _cross-tools
360 WMAKE_TGTS+= _includes _libraries _depend everything
362 buildworld: ${WMAKE_TGTS}
363 .ORDER: ${WMAKE_TGTS}
368 # Checks to be sure system is ready for installworld
371 .if !defined(NO_SENDMAIL)
372 @if ! `grep -q '^smmsp:' /etc/passwd`; then \
373 echo "ERROR: Required smmsp user is missing, see /usr/src/UPDATING."; \
376 @if ! `grep -q '^smmsp:' /etc/group`; then \
377 echo "ERROR: Required smmsp group is missing, see /usr/src/UPDATING."; \
381 .if ${TARGET_ARCH} == ${MACHINE_ARCH} && !defined(DISTDIR) && \
382 (!defined(DESTDIR) || empty(DESTDIR) || ${DESTDIR} == "/")
383 @echo "Checking to see if your booted kernel is fresh enough.."
384 ${.OBJDIR}/bin/sh/sh -c \
385 'echo "Testing installed kernel for new sigaction(2) syscall"'
392 # Distributes everything compiled by a `buildworld'.
396 # Installs everything compiled by a 'buildworld'.
398 distributeworld installworld: installcheck
399 mkdir -p ${INSTALLTMP}
400 for prog in [ awk cap_mkdb cat chflags chmod chown \
401 date echo egrep find grep \
402 ln make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
403 test true uname wc zic; do \
404 cp `which $$prog` ${INSTALLTMP}; \
406 cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}
412 # If you have a build server, you can NFS mount the source and obj directories
413 # and do a 'make reinstall' on the *client* to install new binaries from the
414 # most recent server build.
417 @echo "--------------------------------------------------------------"
418 @echo ">>> Making hierarchy"
419 @echo "--------------------------------------------------------------"
420 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
422 @echo "--------------------------------------------------------------"
423 @echo ">>> Installing everything.."
424 @echo "--------------------------------------------------------------"
425 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
426 .if !defined(NOMAN) && !defined(NO_MAKEDB_RUN)
428 @echo "--------------------------------------------------------------"
429 @echo ">>> Rebuilding man page indices"
430 @echo "--------------------------------------------------------------"
431 cd ${.CURDIR}/share/man; ${MAKE} makedb
435 @echo "--------------------------------------------------------------"
436 @echo ">>> Distributing everything.."
437 @echo "--------------------------------------------------------------"
438 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
441 # buildkernel and installkernel
443 # Which kernels to build and/or install is specified by setting
444 # KERNCONF. If not defined a GENERIC kernel is built/installed.
445 # Only the existing (depending TARGET) config files are used
446 # for building kernels and only the first of these is designated
447 # as the one being installed.
449 # Note that we have to use TARGET instead of TARGET_ARCH when
450 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
451 # be set to cross-build, we have to make sure TARGET is set
454 .if !defined(KERNCONF) && defined(KERNEL)
460 INSTKERNNAME?= kernel
462 KERNSRCDIR?= ${.CURDIR}/sys
463 KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf
464 KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR}
465 KERNCONFDIR?= ${KRNLCONFDIR}
469 .for _kernel in ${KERNCONF}
470 .if exists(${KERNCONFDIR}/${_kernel})
471 BUILDKERNELS+= ${_kernel}
472 .if empty(INSTALLKERNEL)
473 INSTALLKERNEL= ${_kernel}
481 # Builds all kernels defined by BUILDKERNELS.
484 .if empty(BUILDKERNELS)
485 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF}).";
488 .if defined(KERNWARN)
489 @echo "--------------------------------------------------------------"
490 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
491 @echo "--------------------------------------------------------------"
495 .for _kernel in ${BUILDKERNELS}
496 @echo "--------------------------------------------------------------"
497 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
498 @echo "--------------------------------------------------------------"
499 @echo "===> ${_kernel}"
500 mkdir -p ${KRNLOBJDIR}
501 .if !defined(NO_KERNELCONFIG)
504 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
505 ${KERNCONFDIR}/${_kernel}
507 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
508 cd ${KRNLOBJDIR}/${_kernel}; \
509 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} ${CLEANDIR}
511 cd ${KRNLOBJDIR}/${_kernel}; \
512 MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \
513 ${MAKE} -DNO_CPU_CFLAGS -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
514 cd ${KRNLOBJDIR}/${_kernel}; \
515 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} obj
516 # XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case.
517 .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules)
518 .for target in obj depend all
519 cd ${.CURDIR}/sys/modules/aic7xxx/aicasm; \
520 MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
521 ${MAKE} -DNO_CPU_CFLAGS ${target}
524 .if !defined(NO_KERNELDEPEND)
525 cd ${KRNLOBJDIR}/${_kernel}; \
526 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend -DNO_MODULES_OBJ
528 cd ${KRNLOBJDIR}/${_kernel}; \
529 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all -DNO_MODULES_OBJ
530 @echo "--------------------------------------------------------------"
531 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
532 @echo "--------------------------------------------------------------"
538 # Install the kernel defined by INSTALLKERNEL
540 installkernel reinstallkernel:
541 .if empty(INSTALLKERNEL)
542 @echo "ERROR: No kernel \"${KERNCONF}\" to install."
545 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
546 ${CROSSENV} PATH=${TMPPATH} \
547 ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//}
552 # Update the source tree, by running sup and/or running cvs to update to the
556 .if defined(SUP_UPDATE)
557 @echo "--------------------------------------------------------------"
558 @echo ">>> Running ${SUP}"
559 @echo "--------------------------------------------------------------"
561 @${SUP} ${SUPFLAGS} ${SUPFILE}
563 .if defined(SUPFILE1)
564 @${SUP} ${SUPFLAGS} ${SUPFILE1}
566 .if defined(SUPFILE2)
567 @${SUP} ${SUPFLAGS} ${SUPFILE2}
569 .if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
570 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
572 .if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
573 @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
576 .if defined(CVS_UPDATE)
577 @echo "--------------------------------------------------------------"
578 @echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT}
579 @echo "--------------------------------------------------------------"
580 cd ${.CURDIR}; ${CVS} -R -q update -A -P -d
586 # Build most of the user binaries on the existing system libs and includes.
589 @echo "--------------------------------------------------------------"
590 @echo ">>> Building programs only"
591 @echo "--------------------------------------------------------------"
592 .for _dir in bin sbin libexec usr.bin usr.sbin gnu/usr.bin gnu/usr.sbin
593 cd ${.CURDIR}/${_dir}; ${MAKE} DIRPRFX=${_dir}/ all
599 # Install the binaries built by the 'most' target. This does not include
600 # libraries or include files.
603 @echo "--------------------------------------------------------------"
604 @echo ">>> Installing programs only"
605 @echo "--------------------------------------------------------------"
606 .for _dir in bin sbin libexec usr.bin usr.sbin gnu/usr.bin gnu/usr.sbin
607 cd ${.CURDIR}/${_dir}; ${MAKE} DIRPRFX=${_dir}/ install
611 # ------------------------------------------------------------------------
613 # From here onwards are utility targets used by the 'make world' and
614 # related targets. If your 'world' breaks, you may like to try to fix
615 # the problem and manually run the following targets to attempt to
616 # complete the build. Beware, this is *not* guaranteed to work, you
617 # need to have a pretty good grip on the current state of the system
618 # to attempt to manually finish it. If in doubt, 'make world' again.
622 # legacy: Build compatibility shims for the next three targets
625 .for _tool in tools/build
626 @${ECHODIR} "===> ${_tool}"; \
627 cd ${.CURDIR}/${_tool}; \
628 ${MAKE} DIRPRFX=${_tool}/ obj; \
629 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \
630 ${MAKE} DIRPRFX=${_tool}/ depend; \
631 ${MAKE} DIRPRFX=${_tool}/ all; \
632 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
636 # bootstrap-tools: Build tools needed for compatibility
638 .if exists(${.CURDIR}/games) && !defined(NOGAMES)
639 _strfile= games/fortune/strfile
642 .if ${BOOTSTRAPPING} < 500113
643 _groff= gnu/usr.bin/groff
645 _groff= gnu/usr.bin/groff/tmac
648 .if ( ${BOOTSTRAPPING} < 450005 || \
649 ( ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500034 ))
650 _uudecode= usr.bin/uudecode
653 .if ( ${BOOTSTRAPPING} < 430002 || \
654 ( ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500019 ))
655 _xargs= usr.bin/xargs
658 .if ( ${BOOTSTRAPPING} < 430002 || \
659 ( ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500018 ))
663 .if ${BOOTSTRAPPING} < 500019
664 _kbdcontrol= usr.sbin/kbdcontrol
668 .for _tool in ${_strfile} usr.bin/colldef \
669 usr.bin/makewhatis usr.bin/rpcgen ${_uudecode} \
670 ${_xargs} usr.bin/xinstall ${_yacc} \
671 usr.sbin/config ${_kbdcontrol} \
672 gnu/usr.bin/gperf ${_groff} gnu/usr.bin/texinfo
673 @${ECHODIR} "===> ${_tool}"; \
674 cd ${.CURDIR}/${_tool}; \
675 ${MAKE} DIRPRFX=${_tool}/ obj; \
676 ${MAKE} DIRPRFX=${_tool}/ depend; \
677 ${MAKE} DIRPRFX=${_tool}/ all; \
678 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
682 # build-tools: Build special purpose build tools
684 .if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules)
685 _aicasm= sys/modules/aic7xxx/aicasm
688 .if exists(${.CURDIR}/share) && !defined(NOSHARE)
689 _share= share/syscons/scrnmaps
692 .if !defined(NO_FORTRAN)
693 _fortran= gnu/usr.bin/cc/f771
696 .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
697 !defined(NOCRYPT) && !defined(NO_KERBEROS)
698 _libkrb5= kerberos5/lib/libroken kerberos5/lib/libvers \
699 kerberos5/lib/libasn1 kerberos5/lib/libhdb kerberos5/lib/libsl
703 .for _tool in bin/csh bin/sh gnu/usr.bin/cc/cc_tools ${_fortran} \
704 ${_libkrb5} lib/libncurses ${_share} \
705 ${_aicasm} usr.bin/awk usr.bin/file usr.sbin/sysinstall
706 @${ECHODIR} "===> ${_tool}"; \
707 cd ${.CURDIR}/${_tool}; \
708 ${MAKE} DIRPRFX=${_tool}/ obj; \
709 ${MAKE} DIRPRFX=${_tool}/ build-tools
713 # cross-tools: Build cross-building tools
715 .if ${TARGET_ARCH} == "alpha" && ${TARGET_ARCH} != ${MACHINE_ARCH}
716 _elf2exe= usr.sbin/elf2exe
719 .if ${TARGET_ARCH} == "i386" && ${TARGET_ARCH} != ${MACHINE_ARCH}
720 _btxld= usr.sbin/btxld
721 .if defined(RELEASEDIR)
722 _kgzip= usr.sbin/kgzip
726 .if ${TARGET_ARCH} == "sparc64" && ${TARGET_ARCH} != ${MACHINE_ARCH} && \
727 ${BOOTSTRAPPING} < 500037
728 _elf2aout= usr.bin/elf2aout
731 .if defined(RELEASEDIR)
732 _crunchide= usr.sbin/crunch/crunchide
735 _xlint= usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint
738 .for _tool in ${_btxld} ${_elf2aout} ${_elf2exe} \
739 gnu/usr.bin/binutils ${_crunchide} \
740 gnu/usr.bin/cc ${_xlint} ${_kgzip}
741 @${ECHODIR} "===> ${_tool}"; \
742 cd ${.CURDIR}/${_tool}; \
743 ${MAKE} DIRPRFX=${_tool}/ obj; \
744 ${MAKE} DIRPRFX=${_tool}/ depend; \
745 ${MAKE} DIRPRFX=${_tool}/ all; \
746 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
750 # hierarchy - ensure that all the needed directories are present
753 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs
756 # libraries - build all libraries, and install them under ${DESTDIR}.
758 # The list of libraries with dependents (${_prebuild_libs}) and their
759 # interdependencies (__L) are built automatically by the
760 # ${.CURDIR}/tools/make_libdeps.sh script.
764 ${MAKE} -f Makefile.inc1 _startup_libs; \
765 ${MAKE} -f Makefile.inc1 _prebuild_libs; \
766 ${MAKE} -f Makefile.inc1 _generic_libs;
768 # These dependencies are not automatically generated:
770 # gnu/lib/csu, gnu/lib/libgcc and lib/csu must be built before all
771 # shared libraries for ELF.
773 _startup_libs= gnu/lib/csu gnu/lib/libgcc
774 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
775 _startup_libs+= lib/csu/${MACHINE_ARCH}-elf
777 _startup_libs+= lib/csu/${MACHINE_ARCH}
782 _generic_libs= gnu/lib
784 .if !defined(NOCRYPT) && !defined(NO_KERBEROS)
785 _prebuild_libs+= kerberos5/lib/libasn1
786 _prebuild_libs+= kerberos5/lib/libgssapi
787 _prebuild_libs+= kerberos5/lib/libkrb5
788 _prebuild_libs+= kerberos5/lib/libroken
789 _generic_libs+= kerberos5/lib
792 _prebuild_libs+= lib/libbsdxml lib/libcom_err lib/libcrypt \
793 lib/libkvm lib/libmd \
794 lib/libncurses lib/libopie lib/libpam lib/libradius \
796 lib/libsbuf lib/libtacplus lib/libutil lib/libypclnt \
799 lib/libopie__L lib/libradius__L lib/libtacplus__L: lib/libmd__L
800 lib/libypclnt__L: lib/librpcsvc__L
804 .if !defined(NOCRYPT) && !defined(NOSECURE)
805 .if !defined(NO_OPENSSL)
806 _prebuild_libs+= secure/lib/libcrypto secure/lib/libssl
807 .if !defined(NO_OPENSSH)
808 _prebuild_libs+= secure/lib/libssh
809 secure/lib/libssh__L: secure/lib/libcrypto__L lib/libz__L
812 _generic_libs+= secure/lib
815 _generic_libs+= usr.bin/lex/lib
817 .if ${MACHINE_ARCH} == "i386"
818 _generic_libs+= usr.sbin/pcvt/keycap
821 .for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
823 .if exists(${.CURDIR}/${_lib})
824 @${ECHODIR} "===> ${_lib}"; \
825 cd ${.CURDIR}/${_lib}; \
826 ${MAKE} DIRPRFX=${_lib}/ depend; \
827 ${MAKE} DIRPRFX=${_lib}/ all; \
828 ${MAKE} DIRPRFX=${_lib}/ install
832 # libpam is special: we need to build static PAM modules before
833 # static PAM library, and dynamic PAM library before dynamic PAM
835 lib/libpam__L: .PHONY
836 @${ECHODIR} "===> lib/libpam"; \
837 cd ${.CURDIR}/lib/libpam; \
838 ${MAKE} DIRPRFX=lib/libpam/ depend; \
839 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \
840 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install
842 _startup_libs: ${_startup_libs:S/$/__L/}
843 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
844 _generic_libs: ${_generic_libs:S/$/__L/}
846 .for __target in all clean cleandepend cleandir depend includes obj
847 .for entry in ${SUBDIR}
848 ${entry}.${__target}__D: .PHONY
849 @if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
850 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
851 edir=${entry}.${MACHINE_ARCH}; \
852 cd ${.CURDIR}/$${edir}; \
854 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \
856 cd ${.CURDIR}/$${edir}; \
858 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
860 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
863 .include <bsd.subdir.mk>