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!= sysctl -n kern.osreldate
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 ln -sf ${.CURDIR}/sys ${WORLDTMP}
289 @echo "--------------------------------------------------------------"
290 @echo ">>> stage 1: legacy release compatibility shims"
291 @echo "--------------------------------------------------------------"
292 cd ${.CURDIR}; ${BMAKE} legacy
295 @echo "--------------------------------------------------------------"
296 @echo ">>> stage 1: bootstrap tools"
297 @echo "--------------------------------------------------------------"
298 cd ${.CURDIR}; ${BMAKE} bootstrap-tools
300 .if !defined(NOCLEAN)
302 @echo "--------------------------------------------------------------"
303 @echo ">>> stage 2: cleaning up the object tree"
304 @echo "--------------------------------------------------------------"
305 cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
309 @echo "--------------------------------------------------------------"
310 @echo ">>> stage 2: rebuilding the object tree"
311 @echo "--------------------------------------------------------------"
312 cd ${.CURDIR}; ${WMAKE} par-obj
315 @echo "--------------------------------------------------------------"
316 @echo ">>> stage 2: build tools"
317 @echo "--------------------------------------------------------------"
318 cd ${.CURDIR}; ${TMAKE} build-tools
321 @echo "--------------------------------------------------------------"
322 @echo ">>> stage 3: cross tools"
323 @echo "--------------------------------------------------------------"
324 cd ${.CURDIR}; ${XMAKE} cross-tools
327 @echo "--------------------------------------------------------------"
328 @echo ">>> stage 4: populating ${WORLDTMP}/usr/include"
329 @echo "--------------------------------------------------------------"
330 cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
333 @echo "--------------------------------------------------------------"
334 @echo ">>> stage 4: building libraries"
335 @echo "--------------------------------------------------------------"
336 cd ${.CURDIR}; ${WMAKE} -DNOHTML -DNOINFO -DNOMAN -DNOFSCHG libraries
339 @echo "--------------------------------------------------------------"
340 @echo ">>> stage 4: make dependencies"
341 @echo "--------------------------------------------------------------"
342 cd ${.CURDIR}; ${WMAKE} par-depend
345 @echo "--------------------------------------------------------------"
346 @echo ">>> stage 4: building everything.."
347 @echo "--------------------------------------------------------------"
348 cd ${.CURDIR}; ${WMAKE} par-all
352 .if !defined(SUBDIR_OVERRIDE)
353 WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools
355 WMAKE_TGTS+= _cleanobj _obj _build-tools
356 .if !defined(SUBDIR_OVERRIDE)
357 WMAKE_TGTS+= _cross-tools
359 WMAKE_TGTS+= _includes _libraries _depend everything
361 buildworld: ${WMAKE_TGTS}
362 .ORDER: ${WMAKE_TGTS}
367 # Checks to be sure system is ready for installworld
370 .if !defined(NO_SENDMAIL)
371 @if ! `grep -q '^smmsp:' /etc/passwd`; then \
372 echo "ERROR: Required smmsp user is missing, see /usr/src/UPDATING."; \
375 @if ! `grep -q '^smmsp:' /etc/group`; then \
376 echo "ERROR: Required smmsp group is missing, see /usr/src/UPDATING."; \
380 .if ${TARGET_ARCH} == ${MACHINE_ARCH} && !defined(DISTDIR) && \
381 (!defined(DESTDIR) || empty(DESTDIR) || ${DESTDIR} == "/")
382 @echo "Checking to see if your booted kernel is fresh enough.."
383 ${.OBJDIR}/bin/sh/sh -c \
384 'echo "Testing installed kernel for new sigaction(2) syscall"'
391 # Distributes everything compiled by a `buildworld'.
395 # Installs everything compiled by a 'buildworld'.
397 distributeworld installworld: installcheck
398 mkdir -p ${INSTALLTMP}
399 for prog in [ awk cap_mkdb cat chflags chmod chown \
400 date echo egrep find grep \
401 ln make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
402 test true uname wc zic; do \
403 cp `which $$prog` ${INSTALLTMP}; \
405 cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}
411 # If you have a build server, you can NFS mount the source and obj directories
412 # and do a 'make reinstall' on the *client* to install new binaries from the
413 # most recent server build.
416 @echo "--------------------------------------------------------------"
417 @echo ">>> Making hierarchy"
418 @echo "--------------------------------------------------------------"
419 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
421 @echo "--------------------------------------------------------------"
422 @echo ">>> Installing everything.."
423 @echo "--------------------------------------------------------------"
424 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
425 .if !defined(NOMAN) && !defined(NO_MAKEDB_RUN)
427 @echo "--------------------------------------------------------------"
428 @echo ">>> Rebuilding man page indices"
429 @echo "--------------------------------------------------------------"
430 cd ${.CURDIR}/share/man; ${MAKE} makedb
434 @echo "--------------------------------------------------------------"
435 @echo ">>> Distributing everything.."
436 @echo "--------------------------------------------------------------"
437 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
440 # buildkernel and installkernel
442 # Which kernels to build and/or install is specified by setting
443 # KERNCONF. If not defined a GENERIC kernel is built/installed.
444 # Only the existing (depending TARGET) config files are used
445 # for building kernels and only the first of these is designated
446 # as the one being installed.
448 # Note that we have to use TARGET instead of TARGET_ARCH when
449 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
450 # be set to cross-build, we have to make sure TARGET is set
453 .if !defined(KERNCONF) && defined(KERNEL)
459 INSTKERNNAME?= kernel
461 KERNSRCDIR?= ${.CURDIR}/sys
462 KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf
463 KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR}
464 KERNCONFDIR?= ${KRNLCONFDIR}
468 .for _kernel in ${KERNCONF}
469 .if exists(${KERNCONFDIR}/${_kernel})
470 BUILDKERNELS+= ${_kernel}
471 .if empty(INSTALLKERNEL)
472 INSTALLKERNEL= ${_kernel}
480 # Builds all kernels defined by BUILDKERNELS.
483 .if empty(BUILDKERNELS)
484 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF}).";
487 .if defined(KERNWARN)
488 @echo "--------------------------------------------------------------"
489 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
490 @echo "--------------------------------------------------------------"
494 .for _kernel in ${BUILDKERNELS}
495 @echo "--------------------------------------------------------------"
496 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
497 @echo "--------------------------------------------------------------"
498 @echo "===> ${_kernel}"
499 mkdir -p ${KRNLOBJDIR}
500 .if !defined(NO_KERNELCONFIG)
503 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
504 ${KERNCONFDIR}/${_kernel}
506 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
507 cd ${KRNLOBJDIR}/${_kernel}; \
508 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} ${CLEANDIR}
510 cd ${KRNLOBJDIR}/${_kernel}; \
511 MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \
512 ${MAKE} -DNO_CPU_CFLAGS -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
513 cd ${KRNLOBJDIR}/${_kernel}; \
514 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} obj
515 # XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case.
516 .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules)
517 .for target in obj depend all
518 cd ${.CURDIR}/sys/modules/aic7xxx/aicasm; \
519 MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
520 ${MAKE} -DNO_CPU_CFLAGS ${target}
523 .if !defined(NO_KERNELDEPEND)
524 cd ${KRNLOBJDIR}/${_kernel}; \
525 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend -DNO_MODULES_OBJ
527 cd ${KRNLOBJDIR}/${_kernel}; \
528 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all -DNO_MODULES_OBJ
529 @echo "--------------------------------------------------------------"
530 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
531 @echo "--------------------------------------------------------------"
537 # Install the kernel defined by INSTALLKERNEL
539 installkernel reinstallkernel:
540 .if empty(INSTALLKERNEL)
541 @echo "ERROR: No kernel \"${KERNCONF}\" to install."
544 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
545 ${CROSSENV} PATH=${TMPPATH} \
546 ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//}
551 # Update the source tree, by running sup and/or running cvs to update to the
555 .if defined(SUP_UPDATE)
556 @echo "--------------------------------------------------------------"
557 @echo ">>> Running ${SUP}"
558 @echo "--------------------------------------------------------------"
560 @${SUP} ${SUPFLAGS} ${SUPFILE}
562 .if defined(SUPFILE1)
563 @${SUP} ${SUPFLAGS} ${SUPFILE1}
565 .if defined(SUPFILE2)
566 @${SUP} ${SUPFLAGS} ${SUPFILE2}
568 .if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
569 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
571 .if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
572 @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
575 .if defined(CVS_UPDATE)
576 @echo "--------------------------------------------------------------"
577 @echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT}
578 @echo "--------------------------------------------------------------"
579 cd ${.CURDIR}; ${CVS} -R -q update -A -P -d
585 # Build most of the user binaries on the existing system libs and includes.
588 @echo "--------------------------------------------------------------"
589 @echo ">>> Building programs only"
590 @echo "--------------------------------------------------------------"
591 .for _dir in bin sbin libexec usr.bin usr.sbin gnu/usr.bin gnu/usr.sbin
592 cd ${.CURDIR}/${_dir}; ${MAKE} DIRPRFX=${_dir}/ all
598 # Install the binaries built by the 'most' target. This does not include
599 # libraries or include files.
602 @echo "--------------------------------------------------------------"
603 @echo ">>> Installing programs only"
604 @echo "--------------------------------------------------------------"
605 .for _dir in bin sbin libexec usr.bin usr.sbin gnu/usr.bin gnu/usr.sbin
606 cd ${.CURDIR}/${_dir}; ${MAKE} DIRPRFX=${_dir}/ install
610 # ------------------------------------------------------------------------
612 # From here onwards are utility targets used by the 'make world' and
613 # related targets. If your 'world' breaks, you may like to try to fix
614 # the problem and manually run the following targets to attempt to
615 # complete the build. Beware, this is *not* guaranteed to work, you
616 # need to have a pretty good grip on the current state of the system
617 # to attempt to manually finish it. If in doubt, 'make world' again.
621 # legacy: Build compatibility shims for the next three targets
624 .for _tool in tools/build
625 @${ECHODIR} "===> ${_tool}"; \
626 cd ${.CURDIR}/${_tool}; \
627 ${MAKE} DIRPRFX=${_tool}/ obj; \
628 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \
629 ${MAKE} DIRPRFX=${_tool}/ depend; \
630 ${MAKE} DIRPRFX=${_tool}/ all; \
631 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
635 # bootstrap-tools: Build tools needed for compatibility
637 .if exists(${.CURDIR}/games) && !defined(NOGAMES)
638 _strfile= games/fortune/strfile
641 .if ${BOOTSTRAPPING} < 500113
642 _groff= gnu/usr.bin/groff
644 _groff= gnu/usr.bin/groff/tmac
647 .if ( ${BOOTSTRAPPING} < 450005 || \
648 ( ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500034 ))
649 _uudecode= usr.bin/uudecode
652 .if ( ${BOOTSTRAPPING} < 430002 || \
653 ( ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500019 ))
654 _xargs= usr.bin/xargs
657 .if ( ${BOOTSTRAPPING} < 430002 || \
658 ( ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500018 ))
662 .if ${BOOTSTRAPPING} < 500019
663 _kbdcontrol= usr.sbin/kbdcontrol
667 .for _tool in ${_strfile} usr.bin/colldef \
668 usr.bin/makewhatis usr.bin/rpcgen ${_uudecode} \
669 ${_xargs} usr.bin/xinstall ${_yacc} \
670 usr.sbin/config ${_kbdcontrol} \
671 gnu/usr.bin/gperf ${_groff} gnu/usr.bin/texinfo
672 @${ECHODIR} "===> ${_tool}"; \
673 cd ${.CURDIR}/${_tool}; \
674 ${MAKE} DIRPRFX=${_tool}/ obj; \
675 ${MAKE} DIRPRFX=${_tool}/ depend; \
676 ${MAKE} DIRPRFX=${_tool}/ all; \
677 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
681 # build-tools: Build special purpose build tools
683 .if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules)
684 _aicasm= sys/modules/aic7xxx/aicasm
687 .if exists(${.CURDIR}/share) && !defined(NOSHARE)
688 _share= share/syscons/scrnmaps
691 .if !defined(NO_FORTRAN)
692 _fortran= gnu/usr.bin/cc/f771
695 .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
696 !defined(NOCRYPT) && !defined(NO_KERBEROS)
697 _libkrb5= kerberos5/lib/libroken kerberos5/lib/libvers \
698 kerberos5/lib/libasn1 kerberos5/lib/libhdb kerberos5/lib/libsl
702 .for _tool in bin/csh bin/sh gnu/usr.bin/cc/cc_tools ${_fortran} \
703 ${_libkrb5} lib/libncurses ${_share} \
704 ${_aicasm} usr.bin/awk usr.bin/file usr.sbin/sysinstall
705 @${ECHODIR} "===> ${_tool}"; \
706 cd ${.CURDIR}/${_tool}; \
707 ${MAKE} DIRPRFX=${_tool}/ obj; \
708 ${MAKE} DIRPRFX=${_tool}/ build-tools
712 # cross-tools: Build cross-building tools
714 .if ${TARGET_ARCH} == "alpha" && ${TARGET_ARCH} != ${MACHINE_ARCH}
715 _elf2exe= usr.sbin/elf2exe
718 .if ${TARGET_ARCH} == "i386" && ${TARGET_ARCH} != ${MACHINE_ARCH}
719 _btxld= usr.sbin/btxld
720 .if defined(RELEASEDIR)
721 _kgzip= usr.sbin/kgzip
725 .if ${TARGET_ARCH} == "sparc64" && ${TARGET_ARCH} != ${MACHINE_ARCH} && \
726 ${BOOTSTRAPPING} < 500037
727 _elf2aout= usr.bin/elf2aout
730 .if defined(RELEASEDIR)
731 _crunchide= usr.sbin/crunch/crunchide
734 _xlint= usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint
737 .for _tool in ${_btxld} ${_elf2aout} ${_elf2exe} \
738 gnu/usr.bin/binutils ${_crunchide} \
739 gnu/usr.bin/cc ${_xlint} ${_kgzip}
740 @${ECHODIR} "===> ${_tool}"; \
741 cd ${.CURDIR}/${_tool}; \
742 ${MAKE} DIRPRFX=${_tool}/ obj; \
743 ${MAKE} DIRPRFX=${_tool}/ depend; \
744 ${MAKE} DIRPRFX=${_tool}/ all; \
745 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
749 # hierarchy - ensure that all the needed directories are present
752 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs
755 # libraries - build all libraries, and install them under ${DESTDIR}.
757 # The list of libraries with dependents (${_prebuild_libs}) and their
758 # interdependencies (__L) are built automatically by the
759 # ${.CURDIR}/tools/make_libdeps.sh script.
763 ${MAKE} -f Makefile.inc1 _startup_libs; \
764 ${MAKE} -f Makefile.inc1 _prebuild_libs; \
765 ${MAKE} -f Makefile.inc1 _generic_libs;
767 # These dependencies are not automatically generated:
769 # gnu/lib/csu, gnu/lib/libgcc and lib/csu must be built before all
770 # shared libraries for ELF.
772 _startup_libs= gnu/lib/csu gnu/lib/libgcc
773 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
774 _startup_libs+= lib/csu/${MACHINE_ARCH}-elf
776 _startup_libs+= lib/csu/${MACHINE_ARCH}
781 _generic_libs= gnu/lib
783 .if !defined(NOCRYPT) && !defined(NO_KERBEROS)
784 _prebuild_libs+= kerberos5/lib/libasn1
785 _prebuild_libs+= kerberos5/lib/libgssapi
786 _prebuild_libs+= kerberos5/lib/libkrb5
787 _prebuild_libs+= kerberos5/lib/libroken
788 _generic_libs+= kerberos5/lib
791 _prebuild_libs+= lib/libcom_err lib/libcrypt lib/libkvm lib/libmd \
792 lib/libncurses lib/libopie lib/libpam lib/libradius \
794 lib/libsbuf lib/libtacplus lib/libutil lib/libypclnt \
797 lib/libopie__L lib/libradius__L lib/libtacplus__L: lib/libmd__L
798 lib/libypclnt__L: lib/librpcsvc__L
802 .if !defined(NOCRYPT) && !defined(NOSECURE)
803 .if !defined(NO_OPENSSL)
804 _prebuild_libs+= secure/lib/libcrypto secure/lib/libssl
805 .if !defined(NO_OPENSSH)
806 _prebuild_libs+= secure/lib/libssh
807 secure/lib/libssh__L: secure/lib/libcrypto__L lib/libz__L
810 _generic_libs+= secure/lib
813 _generic_libs+= usr.bin/lex/lib
815 .if ${MACHINE_ARCH} == "i386"
816 _generic_libs+= usr.sbin/pcvt/keycap
819 .for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
821 .if exists(${.CURDIR}/${_lib})
822 @${ECHODIR} "===> ${_lib}"; \
823 cd ${.CURDIR}/${_lib}; \
824 ${MAKE} DIRPRFX=${_lib}/ depend; \
825 ${MAKE} DIRPRFX=${_lib}/ all; \
826 ${MAKE} DIRPRFX=${_lib}/ install
830 # libpam is special: we need to build static PAM modules before
831 # static PAM library, and dynamic PAM library before dynamic PAM
833 lib/libpam__L: .PHONY
834 @${ECHODIR} "===> lib/libpam"; \
835 cd ${.CURDIR}/lib/libpam; \
836 ${MAKE} DIRPRFX=lib/libpam/ depend; \
837 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \
838 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install
840 _startup_libs: ${_startup_libs:S/$/__L/}
841 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
842 _generic_libs: ${_generic_libs:S/$/__L/}
844 .for __target in all clean cleandepend cleandir depend includes obj
845 .for entry in ${SUBDIR}
846 ${entry}.${__target}__D: .PHONY
847 @if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
848 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
849 edir=${entry}.${MACHINE_ARCH}; \
850 cd ${.CURDIR}/$${edir}; \
852 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \
854 cd ${.CURDIR}/$${edir}; \
856 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
858 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
861 .include <bsd.subdir.mk>