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 # -DNOGAMES do not go into games subdir
12 # -DNOSHARE do not go into share subdir
13 # -DNOINFO do not make or install info files
14 # -DNOLIBC_R do not build libc_r.
15 # -DNO_FORTRAN do not build g77 and related libraries.
16 # -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel
17 # -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel
18 # -DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel
19 # -DNO_PORTSUPDATE do not update ports in ${MAKE} update
20 # -DNO_DOCUPDATE do not update doc in ${MAKE} update
21 # LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
22 # TARGET_ARCH="arch" to crossbuild world to a different arch
25 # The intended user-driven targets are:
26 # buildworld - rebuild *everything*, including glue to help do upgrades
27 # installworld- install everything built by "buildworld"
28 # update - convenient way to update your source tree (eg: sup/cvs)
29 # most - build user commands, no libraries or include files
30 # installmost - install user commands, no libraries or include files
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 # Put initial settings here.
39 # We must do share/info early so that installation of info `dir'
40 # entries works correctly. Do it first since it is less likely to
41 # grow dependencies on include and lib than vice versa.
42 .if exists(${.CURDIR}/share/info)
46 .if exists(${.CURDIR}/include)
49 .if exists(${.CURDIR}/lib)
53 .if exists(${.CURDIR}/bin)
56 .if exists(${.CURDIR}/games) && !defined(NOGAMES)
59 .if exists(${.CURDIR}/gnu)
62 .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
63 !defined(NOCRYPT) && !defined(NO_OPENSSL) && !defined(NO_KERBEROS)
66 .if exists(${.CURDIR}/libexec)
69 .if exists(${.CURDIR}/sbin)
72 .if exists(${.CURDIR}/secure) && !defined(NOCRYPT)
75 .if exists(${.CURDIR}/share) && !defined(NOSHARE)
78 .if exists(${.CURDIR}/sys)
81 .if exists(${.CURDIR}/usr.bin)
84 .if exists(${.CURDIR}/usr.sbin)
88 # etc must be last for "distribute" to work
89 .if exists(${.CURDIR}/etc)
93 # These are last, since it is nice to at least get the base system
94 # rebuilt before you do them.
95 .if defined(LOCAL_DIRS)
96 .for _DIR in ${LOCAL_DIRS}
97 .if exists(${.CURDIR}/${_DIR}) & exists(${.CURDIR}/${_DIR}/Makefile)
103 .if defined(SUBDIR_OVERRIDE)
104 SUBDIR= ${SUBDIR_OVERRIDE}
107 .if defined(NOCLEANDIR)
108 CLEANDIR= clean cleandepend
114 SUP?= /usr/local/bin/cvsup
115 SUPFLAGS?= -g -L 2 -P -
117 SUPFLAGS+= -h ${SUPHOST}
120 MAKEOBJDIRPREFIX?= /usr/obj
121 .if !defined(OSRELDATE)
122 OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
123 /usr/include/osreldate.h
125 TARGET_ARCH?= ${MACHINE_ARCH}
126 .if ${TARGET_ARCH} == ${MACHINE_ARCH}
128 TARGET_CPUTYPE?=${CPUTYPE}
130 TARGET?= ${TARGET_ARCH}
133 .if !empty(TARGET_CPUTYPE)
134 _TARGET_CPUTYPE=${TARGET_CPUTYPE}
136 _TARGET_CPUTYPE=dummy
138 _CPUTYPE!= ${MAKE} -f /dev/null -m ${.CURDIR}/share/mk \
139 CPUTYPE=${_TARGET_CPUTYPE} -V CPUTYPE
140 .if ${_CPUTYPE} != ${_TARGET_CPUTYPE}
141 .error CPUTYPE global should be set with ?=.
144 BUILD_ARCH!= sysctl -n hw.machine_arch
145 .if ${MACHINE_ARCH} != ${BUILD_ARCH}
146 .error To cross-build, set TARGET_ARCH.
149 .if ${MACHINE} == ${TARGET}
150 OBJTREE= ${MAKEOBJDIRPREFIX}
152 OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}
154 WORLDTMP= ${OBJTREE}${.CURDIR}/${MACHINE_ARCH}
155 # /usr/games added for fortune which depend on strfile
156 BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games
157 XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
158 STRICTTMPPATH= ${BPATH}:${XPATH}
159 TMPPATH= ${STRICTTMPPATH}:${PATH}
161 INSTALLTMP!= /usr/bin/mktemp -d -u -t install
164 # Building a world goes through the following stages
166 # 1. legacy stage [BMAKE]
167 # This stage is responsible for creating compatibility
168 # shims that are needed by the bootstrap-tools,
169 # build-tools and cross-tools stages.
170 # 1. bootstrap-tools stage [BMAKE]
171 # This stage is responsible for creating programs that
172 # are needed for backward compatibility reasons. They
173 # are not built as cross-tools.
174 # 2. build-tools stage [TMAKE]
175 # This stage is responsible for creating the object
176 # tree and building any tools that are needed during
178 # 3. cross-tools stage [XMAKE]
179 # This stage is responsible for creating any tools that
180 # are needed for cross-builds. A cross-compiler is one
182 # 4. world stage [WMAKE]
183 # This stage actually builds the world.
184 # 5. install stage (optional) [IMAKE]
185 # This stage installs a previously built world.
190 # Common environment for world related stages
191 CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \
192 MACHINE_ARCH=${TARGET_ARCH} \
194 CPUTYPE=${TARGET_CPUTYPE} \
195 GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
196 GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \
197 GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac
199 # bootstrap-tools stage
201 INSTALL="sh ${.CURDIR}/tools/install.sh" \
202 PATH=${BPATH}:${PATH} \
203 WORLDTMP=${WORLDTMP} \
204 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}"
205 BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
206 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
207 BOOTSTRAPPING=${OSRELDATE} \
208 -DNOHTML -DNOINFO -DNOLINT -DNOMAN -DNOPIC -DNOPROFILE \
209 -DNOSHARED -DNO_CPU_CFLAGS -DNO_WARNS
212 TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
213 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
214 BOOTSTRAPPING=${OSRELDATE} -DNOLINT -DNO_CPU_CFLAGS -DNO_WARNS
217 XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} -DNO_FORTRAN -DNO_GDB
220 WMAKEENV= ${CROSSENV} \
221 DESTDIR=${WORLDTMP} \
222 INSTALL="sh ${.CURDIR}/tools/install.sh" \
224 WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1
227 IMAKEENV= ${CROSSENV} \
228 PATH=${STRICTTMPPATH}:${INSTALLTMP}
229 IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1
232 KMAKEENV= ${WMAKEENV}
237 # Attempt to rebuild the entire system, with reasonable chance of
238 # success, regardless of how old your existing system is.
241 .if ${.CURDIR:C/[^,]//g} != ""
242 # The m4 build of sendmail files doesn't like it if ',' is used
243 # anywhere in the path of it's files.
245 @echo "*** Error: path to source tree contains a comma ','"
250 @echo "--------------------------------------------------------------"
251 @echo ">>> Rebuilding the temporary build tree"
252 @echo "--------------------------------------------------------------"
253 .if !defined(NOCLEAN)
256 rm -rf ${WORLDTMP}/legacy/usr/include
257 # XXX - These two can depend on any header file.
258 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
259 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
262 usr/bin usr/games usr/include/sys usr/lib \
263 usr/libexec usr/sbin usr/share/dict \
264 usr/share/groff_font/devX100 \
265 usr/share/groff_font/devX100-12 \
266 usr/share/groff_font/devX75 \
267 usr/share/groff_font/devX75-12 \
268 usr/share/groff_font/devascii \
269 usr/share/groff_font/devcp1047 \
270 usr/share/groff_font/devdvi \
271 usr/share/groff_font/devhtml \
272 usr/share/groff_font/devkoi8-r \
273 usr/share/groff_font/devlatin1 \
274 usr/share/groff_font/devlbp \
275 usr/share/groff_font/devlj4 \
276 usr/share/groff_font/devps \
277 usr/share/groff_font/devutf8 \
278 usr/share/tmac/mdoc usr/share/tmac/mm
279 mkdir -p ${WORLDTMP}/legacy/${_dir}
282 usr/bin usr/include usr/lib/compat/aout usr/libdata/ldscripts \
283 usr/libexec usr/share/misc
284 mkdir -p ${WORLDTMP}/${_dir}
286 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
287 -p ${WORLDTMP}/usr/include
288 ln -sf ${.CURDIR}/sys ${WORLDTMP}
291 @echo "--------------------------------------------------------------"
292 @echo ">>> stage 1: legacy release compatibility shims"
293 @echo "--------------------------------------------------------------"
294 cd ${.CURDIR}; ${BMAKE} legacy
297 @echo "--------------------------------------------------------------"
298 @echo ">>> stage 1: bootstrap tools"
299 @echo "--------------------------------------------------------------"
300 cd ${.CURDIR}; ${BMAKE} bootstrap-tools
302 .if !defined(NOCLEAN)
304 @echo "--------------------------------------------------------------"
305 @echo ">>> stage 2: cleaning up the object tree"
306 @echo "--------------------------------------------------------------"
307 cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
311 @echo "--------------------------------------------------------------"
312 @echo ">>> stage 2: rebuilding the object tree"
313 @echo "--------------------------------------------------------------"
314 cd ${.CURDIR}; ${WMAKE} par-obj
317 @echo "--------------------------------------------------------------"
318 @echo ">>> stage 2: build tools"
319 @echo "--------------------------------------------------------------"
320 cd ${.CURDIR}; ${TMAKE} build-tools
323 @echo "--------------------------------------------------------------"
324 @echo ">>> stage 3: cross tools"
325 @echo "--------------------------------------------------------------"
326 cd ${.CURDIR}; ${XMAKE} cross-tools
329 @echo "--------------------------------------------------------------"
330 @echo ">>> stage 4: populating ${WORLDTMP}/usr/include"
331 @echo "--------------------------------------------------------------"
332 cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
335 @echo "--------------------------------------------------------------"
336 @echo ">>> stage 4: building libraries"
337 @echo "--------------------------------------------------------------"
338 cd ${.CURDIR}; ${WMAKE} -DNOHTML -DNOINFO -DNOMAN -DNOFSCHG libraries
341 @echo "--------------------------------------------------------------"
342 @echo ">>> stage 4: make dependencies"
343 @echo "--------------------------------------------------------------"
344 cd ${.CURDIR}; ${WMAKE} par-depend
347 @echo "--------------------------------------------------------------"
348 @echo ">>> stage 4: building everything.."
349 @echo "--------------------------------------------------------------"
350 cd ${.CURDIR}; ${WMAKE} par-all
354 .if !defined(SUBDIR_OVERRIDE)
355 WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools
357 WMAKE_TGTS+= _cleanobj _obj _build-tools
358 .if !defined(SUBDIR_OVERRIDE)
359 WMAKE_TGTS+= _cross-tools
361 WMAKE_TGTS+= _includes _libraries _depend everything
363 buildworld: ${WMAKE_TGTS}
364 .ORDER: ${WMAKE_TGTS}
369 # Checks to be sure system is ready for installworld
372 .if !defined(NO_SENDMAIL)
373 @if ! `grep -q '^smmsp:' /etc/passwd`; then \
374 echo "ERROR: Required smmsp user is missing, see /usr/src/UPDATING."; \
377 @if ! `grep -q '^smmsp:' /etc/group`; then \
378 echo "ERROR: Required smmsp group is missing, see /usr/src/UPDATING."; \
382 .if ${TARGET_ARCH} == ${MACHINE_ARCH} && !defined(DISTDIR) && \
383 (!defined(DESTDIR) || empty(DESTDIR) || ${DESTDIR} == "/")
384 @echo "Checking to see if your booted kernel is fresh enough.."
385 ${.OBJDIR}/bin/sh/sh -c \
386 'echo "Testing installed kernel for new sigaction(2) syscall"'
393 # Distributes everything compiled by a `buildworld'.
397 # Installs everything compiled by a 'buildworld'.
399 distributeworld installworld: installcheck
400 mkdir -p ${INSTALLTMP}
401 for prog in [ awk cap_mkdb cat chflags chmod chown \
402 date echo egrep find grep \
403 ln make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
404 test true uname wc zic; do \
405 cp `which $$prog` ${INSTALLTMP}; \
407 cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}
413 # If you have a build server, you can NFS mount the source and obj directories
414 # and do a 'make reinstall' on the *client* to install new binaries from the
415 # most recent server build.
418 @echo "--------------------------------------------------------------"
419 @echo ">>> Making hierarchy"
420 @echo "--------------------------------------------------------------"
421 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
423 @echo "--------------------------------------------------------------"
424 @echo ">>> Installing everything.."
425 @echo "--------------------------------------------------------------"
426 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
427 .if !defined(NOMAN) && !defined(NO_MAKEDB_RUN)
429 @echo "--------------------------------------------------------------"
430 @echo ">>> Rebuilding man page indices"
431 @echo "--------------------------------------------------------------"
432 cd ${.CURDIR}/share/man; ${MAKE} makedb
436 @echo "--------------------------------------------------------------"
437 @echo ">>> Distributing everything.."
438 @echo "--------------------------------------------------------------"
439 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
442 # buildkernel and installkernel
444 # Which kernels to build and/or install is specified by setting
445 # KERNCONF. If not defined a GENERIC kernel is built/installed.
446 # Only the existing (depending TARGET) config files are used
447 # for building kernels and only the first of these is designated
448 # as the one being installed.
450 # Note that we have to use TARGET instead of TARGET_ARCH when
451 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
452 # be set to cross-build, we have to make sure TARGET is set
455 .if !defined(KERNCONF) && defined(KERNEL)
461 INSTKERNNAME?= kernel
463 KERNSRCDIR?= ${.CURDIR}/sys
464 KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf
465 KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR}
466 KERNCONFDIR?= ${KRNLCONFDIR}
470 .for _kernel in ${KERNCONF}
471 .if exists(${KERNCONFDIR}/${_kernel})
472 BUILDKERNELS+= ${_kernel}
473 .if empty(INSTALLKERNEL)
474 INSTALLKERNEL= ${_kernel}
482 # Builds all kernels defined by BUILDKERNELS.
485 .if empty(BUILDKERNELS)
486 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF}).";
489 .if defined(KERNWARN)
490 @echo "--------------------------------------------------------------"
491 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
492 @echo "--------------------------------------------------------------"
496 .for _kernel in ${BUILDKERNELS}
497 @echo "--------------------------------------------------------------"
498 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
499 @echo "--------------------------------------------------------------"
500 @echo "===> ${_kernel}"
501 mkdir -p ${KRNLOBJDIR}
502 .if !defined(NO_KERNELCONFIG)
505 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
506 ${KERNCONFDIR}/${_kernel}
508 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
509 cd ${KRNLOBJDIR}/${_kernel}; \
510 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} ${CLEANDIR}
512 cd ${KRNLOBJDIR}/${_kernel}; \
513 MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \
514 ${MAKE} -DNO_CPU_CFLAGS -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
515 cd ${KRNLOBJDIR}/${_kernel}; \
516 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} obj
517 # XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case.
518 .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules)
519 .for target in obj depend all
520 cd ${.CURDIR}/sys/modules/aic7xxx/aicasm; \
521 MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
522 ${MAKE} -DNO_CPU_CFLAGS ${target}
525 .if !defined(NO_KERNELDEPEND)
526 cd ${KRNLOBJDIR}/${_kernel}; \
527 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend -DNO_MODULES_OBJ
529 cd ${KRNLOBJDIR}/${_kernel}; \
530 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all -DNO_MODULES_OBJ
531 @echo "--------------------------------------------------------------"
532 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
533 @echo "--------------------------------------------------------------"
539 # Install the kernel defined by INSTALLKERNEL
541 installkernel reinstallkernel:
542 .if empty(INSTALLKERNEL)
543 @echo "ERROR: No kernel \"${KERNCONF}\" to install."
546 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
547 ${CROSSENV} PATH=${TMPPATH} \
548 ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//}
553 # Update the source tree, by running sup and/or running cvs to update to the
557 .if defined(SUP_UPDATE)
558 @echo "--------------------------------------------------------------"
559 @echo ">>> Running ${SUP}"
560 @echo "--------------------------------------------------------------"
562 @${SUP} ${SUPFLAGS} ${SUPFILE}
564 .if defined(SUPFILE1)
565 @${SUP} ${SUPFLAGS} ${SUPFILE1}
567 .if defined(SUPFILE2)
568 @${SUP} ${SUPFLAGS} ${SUPFILE2}
570 .if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
571 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
573 .if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
574 @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
577 .if defined(CVS_UPDATE)
578 @echo "--------------------------------------------------------------"
579 @echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT}
580 @echo "--------------------------------------------------------------"
581 cd ${.CURDIR}; ${CVS} -R -q update -A -P -d
587 # Build most of the user binaries on the existing system libs and includes.
590 @echo "--------------------------------------------------------------"
591 @echo ">>> Building programs only"
592 @echo "--------------------------------------------------------------"
593 .for _dir in bin sbin libexec usr.bin usr.sbin gnu/usr.bin gnu/usr.sbin
594 cd ${.CURDIR}/${_dir}; ${MAKE} DIRPRFX=${_dir}/ all
600 # Install the binaries built by the 'most' target. This does not include
601 # libraries or include files.
604 @echo "--------------------------------------------------------------"
605 @echo ">>> Installing programs only"
606 @echo "--------------------------------------------------------------"
607 .for _dir in bin sbin libexec usr.bin usr.sbin gnu/usr.bin gnu/usr.sbin
608 cd ${.CURDIR}/${_dir}; ${MAKE} DIRPRFX=${_dir}/ install
612 # ------------------------------------------------------------------------
614 # From here onwards are utility targets used by the 'make world' and
615 # related targets. If your 'world' breaks, you may like to try to fix
616 # the problem and manually run the following targets to attempt to
617 # complete the build. Beware, this is *not* guaranteed to work, you
618 # need to have a pretty good grip on the current state of the system
619 # to attempt to manually finish it. If in doubt, 'make world' again.
623 # legacy: Build compatibility shims for the next three targets
626 .for _tool in tools/build
627 @${ECHODIR} "===> ${_tool}"; \
628 cd ${.CURDIR}/${_tool}; \
629 ${MAKE} DIRPRFX=${_tool}/ obj; \
630 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \
631 ${MAKE} DIRPRFX=${_tool}/ depend; \
632 ${MAKE} DIRPRFX=${_tool}/ all; \
633 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
637 # bootstrap-tools: Build tools needed for compatibility
639 .if exists(${.CURDIR}/games) && !defined(NOGAMES)
640 _strfile= games/fortune/strfile
644 _gperf= gnu/usr.bin/gperf
645 .if ${BOOTSTRAPPING} < 500113
646 _groff= gnu/usr.bin/groff
648 _groff= gnu/usr.bin/groff/tmac
652 .if ( ${BOOTSTRAPPING} < 450005 || \
653 ( ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500034 ))
654 _uudecode= usr.bin/uudecode
657 .if ( ${BOOTSTRAPPING} < 430002 || \
658 ( ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500019 ))
659 _xargs= usr.bin/xargs
662 .if ( ${BOOTSTRAPPING} < 430002 || \
663 ( ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500018 ))
667 .if ${BOOTSTRAPPING} < 500019
668 _kbdcontrol= usr.sbin/kbdcontrol
672 .for _tool in ${_strfile} usr.bin/colldef \
673 usr.bin/makewhatis usr.bin/rpcgen ${_uudecode} \
674 ${_xargs} usr.bin/xinstall ${_yacc} \
675 usr.sbin/config ${_kbdcontrol} \
676 ${_gperf} ${_groff} gnu/usr.bin/texinfo
677 @${ECHODIR} "===> ${_tool}"; \
678 cd ${.CURDIR}/${_tool}; \
679 ${MAKE} DIRPRFX=${_tool}/ obj; \
680 ${MAKE} DIRPRFX=${_tool}/ depend; \
681 ${MAKE} DIRPRFX=${_tool}/ all; \
682 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
686 # build-tools: Build special purpose build tools
688 .if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules)
689 _aicasm= sys/modules/aic7xxx/aicasm
692 .if exists(${.CURDIR}/share) && !defined(NOSHARE)
693 _share= share/syscons/scrnmaps
696 .if !defined(NO_FORTRAN)
697 _fortran= gnu/usr.bin/cc/f771
700 .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
701 !defined(NOCRYPT) && !defined(NO_OPENSSL) && !defined(NO_KERBEROS)
702 _libkrb5= kerberos5/lib/libroken kerberos5/lib/libvers \
703 kerberos5/lib/libasn1 kerberos5/lib/libhdb kerberos5/lib/libsl
707 .for _tool in bin/csh bin/sh gnu/usr.bin/cc/cc_tools ${_fortran} \
708 ${_libkrb5} lib/libncurses ${_share} \
709 ${_aicasm} usr.bin/awk usr.bin/file usr.sbin/sysinstall
710 @${ECHODIR} "===> ${_tool}"; \
711 cd ${.CURDIR}/${_tool}; \
712 ${MAKE} DIRPRFX=${_tool}/ obj; \
713 ${MAKE} DIRPRFX=${_tool}/ build-tools
717 # cross-tools: Build cross-building tools
719 .if ${TARGET_ARCH} == "alpha" && ${TARGET_ARCH} != ${MACHINE_ARCH}
720 _elf2exe= usr.sbin/elf2exe
723 .if ${TARGET_ARCH} == "i386" && ${TARGET_ARCH} != ${MACHINE_ARCH}
724 _btxld= usr.sbin/btxld
725 .if defined(RELEASEDIR)
726 _kgzip= usr.sbin/kgzip
730 .if ${TARGET_ARCH} == "sparc64" && ${TARGET_ARCH} != ${MACHINE_ARCH} && \
731 ${BOOTSTRAPPING} < 500037
732 _elf2aout= usr.bin/elf2aout
735 .if defined(RELEASEDIR)
736 _crunchide= usr.sbin/crunch/crunchide
739 _xlint= usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint
742 .for _tool in ${_btxld} ${_elf2aout} ${_elf2exe} \
743 gnu/usr.bin/binutils ${_crunchide} \
744 gnu/usr.bin/cc ${_xlint} ${_kgzip}
745 @${ECHODIR} "===> ${_tool}"; \
746 cd ${.CURDIR}/${_tool}; \
747 ${MAKE} DIRPRFX=${_tool}/ obj; \
748 ${MAKE} DIRPRFX=${_tool}/ depend; \
749 ${MAKE} DIRPRFX=${_tool}/ all; \
750 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
754 # hierarchy - ensure that all the needed directories are present
757 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs
760 # libraries - build all libraries, and install them under ${DESTDIR}.
762 # The list of libraries with dependents (${_prebuild_libs}) and their
763 # interdependencies (__L) are built automatically by the
764 # ${.CURDIR}/tools/make_libdeps.sh script.
768 ${MAKE} -f Makefile.inc1 _startup_libs; \
769 ${MAKE} -f Makefile.inc1 _prebuild_libs; \
770 ${MAKE} -f Makefile.inc1 _generic_libs;
772 # These dependencies are not automatically generated:
774 # gnu/lib/csu, gnu/lib/libgcc and lib/csu must be built before all
775 # shared libraries for ELF.
777 _startup_libs= gnu/lib/csu gnu/lib/libgcc
778 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
779 _startup_libs+= lib/csu/${MACHINE_ARCH}-elf
781 _startup_libs+= lib/csu/${MACHINE_ARCH}
786 _generic_libs= gnu/lib
788 .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
789 !defined(NOCRYPT) && !defined(NO_OPENSSL) && !defined(NO_KERBEROS)
790 _prebuild_libs+= kerberos5/lib/libasn1
791 _prebuild_libs+= kerberos5/lib/libgssapi
792 _prebuild_libs+= kerberos5/lib/libkrb5
793 _prebuild_libs+= kerberos5/lib/libroken
794 _generic_libs+= kerberos5/lib
797 _prebuild_libs+= lib/libcom_err lib/libcrypt lib/libexpat \
798 lib/libkvm lib/libmd \
799 lib/libncurses lib/libopie lib/libpam lib/libradius \
801 lib/libsbuf lib/libtacplus lib/libutil lib/libypclnt \
804 lib/libopie__L lib/libradius__L lib/libtacplus__L: lib/libmd__L
805 lib/libypclnt__L: lib/librpcsvc__L
809 .if !defined(NOCRYPT)
810 .if !defined(NO_OPENSSL)
811 _prebuild_libs+= secure/lib/libcrypto secure/lib/libssl
812 .if !defined(NO_OPENSSH)
813 _prebuild_libs+= secure/lib/libssh
814 secure/lib/libssh__L: secure/lib/libcrypto__L lib/libz__L
817 _generic_libs+= secure/lib
820 _generic_libs+= usr.bin/lex/lib
822 .if ${MACHINE_ARCH} == "i386"
823 _generic_libs+= usr.sbin/pcvt/keycap
826 .for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
828 .if exists(${.CURDIR}/${_lib})
829 @${ECHODIR} "===> ${_lib}"; \
830 cd ${.CURDIR}/${_lib}; \
831 ${MAKE} DIRPRFX=${_lib}/ depend; \
832 ${MAKE} DIRPRFX=${_lib}/ all; \
833 ${MAKE} DIRPRFX=${_lib}/ install
837 # libpam is special: we need to build static PAM modules before
838 # static PAM library, and dynamic PAM library before dynamic PAM
840 lib/libpam__L: .PHONY
841 @${ECHODIR} "===> lib/libpam"; \
842 cd ${.CURDIR}/lib/libpam; \
843 ${MAKE} DIRPRFX=lib/libpam/ depend; \
844 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \
845 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install
847 _startup_libs: ${_startup_libs:S/$/__L/}
848 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
849 _generic_libs: ${_generic_libs:S/$/__L/}
851 .for __target in all clean cleandepend cleandir depend includes obj
852 .for entry in ${SUBDIR}
853 ${entry}.${__target}__D: .PHONY
854 @if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
855 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
856 edir=${entry}.${MACHINE_ARCH}; \
857 cd ${.CURDIR}/$${edir}; \
859 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \
861 cd ${.CURDIR}/$${edir}; \
863 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
865 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
868 .include <bsd.subdir.mk>