4 # Make command line options:
5 # -DMAKE_KERBEROS5 to build Kerberos5
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(MAKE_KERBEROS5)
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 OSRELDATE!= sysctl -n kern.osreldate
123 TARGET_ARCH?= ${MACHINE_ARCH}
124 .if ${TARGET_ARCH} == ${MACHINE_ARCH}
126 TARGET_CPUTYPE?=${CPUTYPE}
128 TARGET?= ${TARGET_ARCH}
131 .if !empty(TARGET_CPUTYPE)
132 _TARGET_CPUTYPE=${TARGET_CPUTYPE}
134 _TARGET_CPUTYPE=dummy
136 _CPUTYPE!= ${MAKE} -f /dev/null -m ${.CURDIR}/share/mk \
137 CPUTYPE=${_TARGET_CPUTYPE} -V CPUTYPE
138 .if ${_CPUTYPE} != ${_TARGET_CPUTYPE}
139 .error CPUTYPE global should be set with ?=.
142 BUILD_ARCH!= sysctl -n hw.machine_arch
143 .if ${MACHINE_ARCH} != ${BUILD_ARCH}
144 .error To cross-build, set TARGET_ARCH.
147 .if ${MACHINE} == ${TARGET}
148 OBJTREE= ${MAKEOBJDIRPREFIX}
150 OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}
152 WORLDTMP= ${OBJTREE}${.CURDIR}/${MACHINE_ARCH}
153 # /usr/games added for fortune which depend on strfile
154 BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games
155 XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
156 STRICTTMPPATH= ${BPATH}:${XPATH}
157 TMPPATH= ${STRICTTMPPATH}:${PATH}
159 INSTALLTMP!= /usr/bin/mktemp -d -u -t install
162 # Building a world goes through the following stages
164 # 1. legacy stage [BMAKE]
165 # This stage is responsible for creating compatibility
166 # shims that are needed by the bootstrap-tools,
167 # build-tools and cross-tools stages.
168 # 1. bootstrap-tools stage [BMAKE]
169 # This stage is responsible for creating programs that
170 # are needed for backward compatibility reasons. They
171 # are not built as cross-tools.
172 # 2. build-tools stage [TMAKE]
173 # This stage is responsible for creating the object
174 # tree and building any tools that are needed during
176 # 3. cross-tools stage [XMAKE]
177 # This stage is responsible for creating any tools that
178 # are needed for cross-builds. A cross-compiler is one
180 # 4. world stage [WMAKE]
181 # This stage actually builds the world.
182 # 5. install stage (optional) [IMAKE]
183 # This stage installs a previously built world.
188 # Common environment for world related stages
189 CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \
190 MACHINE_ARCH=${TARGET_ARCH} \
192 CPUTYPE=${TARGET_CPUTYPE} \
193 GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
194 GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \
195 GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac
197 # bootstrap-tools stage
199 INSTALL="sh ${.CURDIR}/tools/install.sh" \
200 PATH=${BPATH}:${PATH} \
201 WORLDTMP=${WORLDTMP} \
202 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}"
203 BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
204 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
205 BOOTSTRAPPING=${OSRELDATE} \
206 -DNOHTML -DNOINFO -DNOLINT -DNOMAN -DNOPIC -DNOPROFILE \
207 -DNOSHARED -DNO_CPU_CFLAGS -DNO_WARNS
210 TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
211 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
212 BOOTSTRAPPING=${OSRELDATE} -DNOLINT -DNO_CPU_CFLAGS -DNO_WARNS
215 XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} -DNO_FORTRAN -DNO_GDB
218 WMAKEENV= ${CROSSENV} \
219 DESTDIR=${WORLDTMP} \
220 INSTALL="sh ${.CURDIR}/tools/install.sh" \
222 WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1
225 IMAKEENV= ${CROSSENV} \
226 PATH=${STRICTTMPPATH}:${INSTALLTMP}
227 IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1
230 KMAKEENV= ${WMAKEENV}
235 # Attempt to rebuild the entire system, with reasonable chance of
236 # success, regardless of how old your existing system is.
239 .if ${.CURDIR:C/[^,]//g} != ""
240 # The m4 build of sendmail files doesn't like it if ',' is used
241 # anywhere in the path of it's files.
243 @echo "*** Error: path to source tree contains a comma ','"
248 @echo "--------------------------------------------------------------"
249 @echo ">>> Rebuilding the temporary build tree"
250 @echo "--------------------------------------------------------------"
251 .if !defined(NOCLEAN)
254 rm -rf ${WORLDTMP}/legacy/usr/include
255 # XXX - These two can depend on any header file.
256 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
257 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
260 usr/bin usr/games usr/include/sys usr/lib \
261 usr/libexec usr/sbin usr/share/dict \
262 usr/share/groff_font/devX100 \
263 usr/share/groff_font/devX100-12 \
264 usr/share/groff_font/devX75 \
265 usr/share/groff_font/devX75-12 \
266 usr/share/groff_font/devascii \
267 usr/share/groff_font/devcp1047 \
268 usr/share/groff_font/devdvi \
269 usr/share/groff_font/devhtml \
270 usr/share/groff_font/devkoi8-r \
271 usr/share/groff_font/devlatin1 \
272 usr/share/groff_font/devlbp \
273 usr/share/groff_font/devlj4 \
274 usr/share/groff_font/devps \
275 usr/share/groff_font/devutf8 \
276 usr/share/tmac/mdoc usr/share/tmac/mm
277 mkdir -p ${WORLDTMP}/legacy/${_dir}
280 usr/bin usr/lib/compat/aout usr/libdata/ldscripts usr/libexec usr/share/misc
281 mkdir -p ${WORLDTMP}/${_dir}
284 arpa dev fs g++/backward g++/bits g++/ext isc isofs libmilter \
285 objc openssl protocols readline rpc rpcsvc security ufs
286 mkdir -p ${WORLDTMP}/usr/include/${_dir}
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
643 .if ${BOOTSTRAPPING} < 500042
644 _groff= gnu/usr.bin/groff
646 _groff= gnu/usr.bin/groff/tmac
649 .if ( ${BOOTSTRAPPING} < 450005 || \
650 ( ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500034 ))
651 _uudecode= usr.bin/uudecode
654 .if ( ${BOOTSTRAPPING} < 430002 || \
655 ( ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500019 ))
656 _xargs= usr.bin/xargs
659 .if ( ${BOOTSTRAPPING} < 430002 || \
660 ( ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500018 ))
664 .if ${BOOTSTRAPPING} < 500019
665 _kbdcontrol= usr.sbin/kbdcontrol
669 .for _tool in ${_strfile} usr.bin/colldef \
670 usr.bin/makewhatis usr.bin/rpcgen ${_uudecode} \
671 ${_xargs} usr.bin/xinstall ${_yacc} \
672 usr.sbin/config ${_kbdcontrol} \
673 gnu/usr.bin/gperf ${_groff} gnu/usr.bin/texinfo
674 @${ECHODIR} "===> ${_tool}"; \
675 cd ${.CURDIR}/${_tool}; \
676 ${MAKE} DIRPRFX=${_tool}/ obj; \
677 ${MAKE} DIRPRFX=${_tool}/ depend; \
678 ${MAKE} DIRPRFX=${_tool}/ all; \
679 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
683 # build-tools: Build special purpose build tools
685 .if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules)
686 _aicasm= sys/modules/aic7xxx/aicasm
689 .if exists(${.CURDIR}/share) && !defined(NOSHARE)
690 _share= share/syscons/scrnmaps
693 .if !defined(NO_FORTRAN)
694 _fortran= gnu/usr.bin/cc/f771
697 .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
698 !defined(NOCRYPT) && defined(MAKE_KERBEROS5)
699 _libkrb5= kerberos5/lib/libroken kerberos5/lib/libvers \
700 kerberos5/lib/libasn1 kerberos5/lib/libhdb kerberos5/lib/libsl
704 .for _tool in bin/csh bin/sh gnu/usr.bin/cc/cc_tools ${_fortran} \
705 ${_libkrb5} lib/libncurses ${_share} \
706 ${_aicasm} usr.bin/awk usr.bin/file usr.sbin/sysinstall
707 @${ECHODIR} "===> ${_tool}"; \
708 cd ${.CURDIR}/${_tool}; \
709 ${MAKE} DIRPRFX=${_tool}/ obj; \
710 ${MAKE} DIRPRFX=${_tool}/ build-tools
714 # cross-tools: Build cross-building tools
716 .if ${TARGET_ARCH} == "alpha" && ${TARGET_ARCH} != ${MACHINE_ARCH}
717 _elf2exe= usr.sbin/elf2exe
720 .if ${TARGET_ARCH} == "i386" && ${TARGET_ARCH} != ${MACHINE_ARCH}
721 _btxld= usr.sbin/btxld
722 .if defined(RELEASEDIR)
723 _kgzip= usr.sbin/kgzip
727 .if ${TARGET_ARCH} == "sparc64" && ${TARGET_ARCH} != ${MACHINE_ARCH} && \
728 ${BOOTSTRAPPING} < 500037
729 _elf2aout= usr.bin/elf2aout
732 .if defined(RELEASEDIR)
733 _crunchide= usr.sbin/crunch/crunchide
736 _xlint= usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint
739 .for _tool in ${_btxld} ${_elf2aout} ${_elf2exe} \
740 gnu/usr.bin/binutils ${_crunchide} \
741 gnu/usr.bin/cc ${_xlint} ${_kgzip}
742 @${ECHODIR} "===> ${_tool}"; \
743 cd ${.CURDIR}/${_tool}; \
744 ${MAKE} DIRPRFX=${_tool}/ obj; \
745 ${MAKE} DIRPRFX=${_tool}/ depend; \
746 ${MAKE} DIRPRFX=${_tool}/ all; \
747 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
751 # hierarchy - ensure that all the needed directories are present
754 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs
757 # libraries - build all libraries, and install them under ${DESTDIR}.
759 # The list of libraries with dependents (${_prebuild_libs}) and their
760 # interdependencies (__L) are built automatically by the
761 # ${.CURDIR}/tools/make_libdeps.sh script.
765 ${MAKE} -f Makefile.inc1 _startup_libs; \
766 ${MAKE} -f Makefile.inc1 _prebuild_libs; \
767 ${MAKE} -f Makefile.inc1 _generic_libs;
769 # These dependencies are not automatically generated:
771 # gnu/lib/csu, gnu/lib/libgcc and lib/csu must be built before all
772 # shared libraries for ELF.
774 _startup_libs= gnu/lib/csu gnu/lib/libgcc
775 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
776 _startup_libs+= lib/csu/${MACHINE_ARCH}-elf
778 _startup_libs+= lib/csu/${MACHINE_ARCH}
783 _generic_libs= gnu/lib
785 .if !defined(NOCRYPT) && defined(MAKE_KERBEROS5)
786 _prebuild_libs+= kerberos5/lib/libasn1
787 _prebuild_libs+= kerberos5/lib/libgssapi
788 _prebuild_libs+= kerberos5/lib/libkrb5
789 _prebuild_libs+= kerberos5/lib/libroken
790 _generic_libs+= kerberos5/lib
793 _prebuild_libs+= lib/libcom_err lib/libcrypt 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>