4 # Make command line options:
5 # -DNO_KERBEROS Do not build Heimdal (Kerberos 5)
6 # -DNO_RESCUE do not build rescue binaries
7 # -DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
8 # -DNOCLEAN do not clean at all
9 # -DNOCRYPT will prevent building of crypt versions
10 # -DNOMAN do not build the manual pages
11 # -DNOPROFILE do not build profiled libraries
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 # When upgrading to a dynamically linked root, install the runtime
55 # linker early into its new location before make(1) has a chance
56 # to run the dynamically linked /bin/sh.
57 .if defined(WITH_DYNAMICROOT) && !defined(NOPIC) && \
58 (!defined(TARGET_ARCH) || ${TARGET_ARCH} == ${MACHINE_ARCH}) && \
59 !defined(DISTDIR) && \
60 (!defined(DESTDIR) || empty(DESTDIR) || ${DESTDIR} == "/") && \
61 !exists(/libexec/ld-elf.so.1)
62 SUBDIR+= libexec/rtld-elf
65 .if exists(${.CURDIR}/bin)
68 .if exists(${.CURDIR}/games) && !defined(NOGAMES)
71 .if exists(${.CURDIR}/gnu)
74 .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
75 !defined(NOCRYPT) && !defined(NO_OPENSSL) && !defined(NO_KERBEROS)
78 .if exists(${.CURDIR}/libexec)
81 .if exists(${.CURDIR}/rescue) && !defined(NO_RESCUE)
84 .if exists(${.CURDIR}/sbin)
87 .if exists(${.CURDIR}/secure) && !defined(NOCRYPT)
90 .if exists(${.CURDIR}/share) && !defined(NOSHARE)
93 .if exists(${.CURDIR}/sys)
96 .if exists(${.CURDIR}/usr.bin)
99 .if exists(${.CURDIR}/usr.sbin)
103 # etc must be last for "distribute" to work
104 .if exists(${.CURDIR}/etc)
108 # These are last, since it is nice to at least get the base system
109 # rebuilt before you do them.
110 .if defined(LOCAL_DIRS)
111 .for _DIR in ${LOCAL_DIRS}
112 .if exists(${.CURDIR}/${_DIR}) && exists(${.CURDIR}/${_DIR}/Makefile)
118 .if defined(SUBDIR_OVERRIDE)
119 SUBDIR= ${SUBDIR_OVERRIDE}
122 .if defined(NOCLEANDIR)
123 CLEANDIR= clean cleandepend
129 SUP?= /usr/local/bin/cvsup
130 SUPFLAGS?= -g -L 2 -P -
132 SUPFLAGS+= -h ${SUPHOST}
135 MAKEOBJDIRPREFIX?= /usr/obj
136 .if !defined(OSRELDATE)
137 .if exists(/usr/include/osreldate.h)
138 OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
139 /usr/include/osreldate.h
144 TARGET_ARCH?= ${MACHINE_ARCH}
145 .if ${TARGET_ARCH} == ${MACHINE_ARCH}
147 TARGET_CPUTYPE?=${CPUTYPE}
149 TARGET?= ${TARGET_ARCH}
152 .if !empty(TARGET_CPUTYPE)
153 _TARGET_CPUTYPE=${TARGET_CPUTYPE}
155 _TARGET_CPUTYPE=dummy
157 _CPUTYPE!= ${MAKE} -f /dev/null -m ${.CURDIR}/share/mk \
158 CPUTYPE=${_TARGET_CPUTYPE} -V CPUTYPE
159 .if ${_CPUTYPE} != ${_TARGET_CPUTYPE}
160 .error CPUTYPE global should be set with ?=.
163 BUILD_ARCH!= sysctl -n hw.machine_arch
164 .if ${MACHINE_ARCH} != ${BUILD_ARCH}
165 .error To cross-build, set TARGET_ARCH.
168 .if ${MACHINE} == ${TARGET}
169 OBJTREE= ${MAKEOBJDIRPREFIX}
171 OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}
173 WORLDTMP= ${OBJTREE}${.CURDIR}/${MACHINE_ARCH}
174 # /usr/games added for fortune which depend on strfile
175 BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games
176 XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
177 STRICTTMPPATH= ${BPATH}:${XPATH}
178 TMPPATH= ${STRICTTMPPATH}:${PATH}
180 INSTALLTMP!= /usr/bin/mktemp -d -u -t install
183 # Building a world goes through the following stages
185 # 1. legacy stage [BMAKE]
186 # This stage is responsible for creating compatibility
187 # shims that are needed by the bootstrap-tools,
188 # build-tools and cross-tools stages.
189 # 1. bootstrap-tools stage [BMAKE]
190 # This stage is responsible for creating programs that
191 # are needed for backward compatibility reasons. They
192 # are not built as cross-tools.
193 # 2. build-tools stage [TMAKE]
194 # This stage is responsible for creating the object
195 # tree and building any tools that are needed during
197 # 3. cross-tools stage [XMAKE]
198 # This stage is responsible for creating any tools that
199 # are needed for cross-builds. A cross-compiler is one
201 # 4. world stage [WMAKE]
202 # This stage actually builds the world.
203 # 5. install stage (optional) [IMAKE]
204 # This stage installs a previously built world.
209 # Common environment for world related stages
210 CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \
211 MACHINE_ARCH=${TARGET_ARCH} \
213 CPUTYPE=${TARGET_CPUTYPE} \
214 GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
215 GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \
216 GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac
218 # bootstrap-tools stage
220 INSTALL="sh ${.CURDIR}/tools/install.sh" \
221 PATH=${BPATH}:${PATH} \
222 WORLDTMP=${WORLDTMP} \
223 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}"
224 BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
225 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
226 BOOTSTRAPPING=${OSRELDATE} \
227 -DNOHTML -DNOINFO -DNOLINT -DNOMAN -DNOPIC -DNOPROFILE \
228 -DNOSHARED -DNO_CPU_CFLAGS -DNO_WARNS
231 TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
232 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
233 BOOTSTRAPPING=${OSRELDATE} -DNOLINT -DNO_CPU_CFLAGS -DNO_WARNS
236 XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} -DNO_FORTRAN -DNO_GDB
239 WMAKEENV= ${CROSSENV} \
240 DESTDIR=${WORLDTMP} \
241 _SHLIBDIRPREFIX=${WORLDTMP} \
242 INSTALL="sh ${.CURDIR}/tools/install.sh" \
244 WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1
247 IMAKEENV= ${CROSSENV} \
248 PATH=${STRICTTMPPATH}:${INSTALLTMP}
249 IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1
252 KMAKEENV= ${WMAKEENV}
257 # Attempt to rebuild the entire system, with reasonable chance of
258 # success, regardless of how old your existing system is.
261 .if ${.CURDIR:C/[^,]//g} != ""
262 # The m4 build of sendmail files doesn't like it if ',' is used
263 # anywhere in the path of it's files.
265 @echo "*** Error: path to source tree contains a comma ','"
270 @echo "--------------------------------------------------------------"
271 @echo ">>> Rebuilding the temporary build tree"
272 @echo "--------------------------------------------------------------"
273 .if !defined(NOCLEAN)
276 rm -rf ${WORLDTMP}/legacy/usr/include
277 # XXX - These two can depend on any header file.
278 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
279 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
282 usr/bin usr/games usr/include/sys usr/lib \
283 usr/libexec usr/sbin usr/share/dict \
284 usr/share/groff_font/devX100 \
285 usr/share/groff_font/devX100-12 \
286 usr/share/groff_font/devX75 \
287 usr/share/groff_font/devX75-12 \
288 usr/share/groff_font/devascii \
289 usr/share/groff_font/devcp1047 \
290 usr/share/groff_font/devdvi \
291 usr/share/groff_font/devhtml \
292 usr/share/groff_font/devkoi8-r \
293 usr/share/groff_font/devlatin1 \
294 usr/share/groff_font/devlbp \
295 usr/share/groff_font/devlj4 \
296 usr/share/groff_font/devps \
297 usr/share/groff_font/devutf8 \
298 usr/share/tmac/mdoc usr/share/tmac/mm
299 mkdir -p ${WORLDTMP}/legacy/${_dir}
302 lib usr/bin usr/include usr/lib/compat/aout usr/libdata/ldscripts \
303 usr/libexec usr/share/misc
304 mkdir -p ${WORLDTMP}/${_dir}
306 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
307 -p ${WORLDTMP}/usr/include
308 ln -sf ${.CURDIR}/sys ${WORLDTMP}
311 @echo "--------------------------------------------------------------"
312 @echo ">>> stage 1.1: legacy release compatibility shims"
313 @echo "--------------------------------------------------------------"
314 cd ${.CURDIR}; ${BMAKE} legacy
317 @echo "--------------------------------------------------------------"
318 @echo ">>> stage 1.2: bootstrap tools"
319 @echo "--------------------------------------------------------------"
320 cd ${.CURDIR}; ${BMAKE} bootstrap-tools
322 .if !defined(NOCLEAN)
324 @echo "--------------------------------------------------------------"
325 @echo ">>> stage 2.1: cleaning up the object tree"
326 @echo "--------------------------------------------------------------"
327 cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
331 @echo "--------------------------------------------------------------"
332 @echo ">>> stage 2.2: rebuilding the object tree"
333 @echo "--------------------------------------------------------------"
334 cd ${.CURDIR}; ${WMAKE} par-obj
337 @echo "--------------------------------------------------------------"
338 @echo ">>> stage 2.3: build tools"
339 @echo "--------------------------------------------------------------"
340 cd ${.CURDIR}; ${TMAKE} build-tools
343 @echo "--------------------------------------------------------------"
344 @echo ">>> stage 3: cross tools"
345 @echo "--------------------------------------------------------------"
346 cd ${.CURDIR}; ${XMAKE} cross-tools
349 @echo "--------------------------------------------------------------"
350 @echo ">>> stage 4.1: populating ${WORLDTMP}/usr/include"
351 @echo "--------------------------------------------------------------"
352 cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
355 @echo "--------------------------------------------------------------"
356 @echo ">>> stage 4.2: building libraries"
357 @echo "--------------------------------------------------------------"
358 cd ${.CURDIR}; ${WMAKE} -DNOHTML -DNOINFO -DNOMAN -DNOFSCHG -DNOLINT \
362 @echo "--------------------------------------------------------------"
363 @echo ">>> stage 4.3: make dependencies"
364 @echo "--------------------------------------------------------------"
365 cd ${.CURDIR}; ${WMAKE} par-depend
368 @echo "--------------------------------------------------------------"
369 @echo ">>> stage 4.4: building everything.."
370 @echo "--------------------------------------------------------------"
371 cd ${.CURDIR}; ${WMAKE} par-all
375 .if !defined(SUBDIR_OVERRIDE)
376 WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools
378 WMAKE_TGTS+= _cleanobj _obj _build-tools
379 .if !defined(SUBDIR_OVERRIDE)
380 WMAKE_TGTS+= _cross-tools
382 WMAKE_TGTS+= _includes _libraries _depend everything
384 buildworld: ${WMAKE_TGTS}
385 .ORDER: ${WMAKE_TGTS}
390 # Checks to be sure system is ready for installworld
393 .if !defined(NO_SENDMAIL)
394 @if ! `id -u smmsp > /dev/null`; then \
395 echo "ERROR: Required smmsp user is missing, see /usr/src/UPDATING."; \
398 @if ! `id -g smmsp > /dev/null`; then \
399 echo "ERROR: Required smmsp group is missing, see /usr/src/UPDATING."; \
407 # Distributes everything compiled by a `buildworld'.
411 # Installs everything compiled by a 'buildworld'.
413 distributeworld installworld: installcheck
414 mkdir -p ${INSTALLTMP}
415 for prog in [ awk cap_mkdb cat chflags chmod chown \
416 date echo egrep find grep \
417 ln make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
418 test true uname wc zic; do \
419 cp `which $$prog` ${INSTALLTMP}; \
421 cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}
427 # If you have a build server, you can NFS mount the source and obj directories
428 # and do a 'make reinstall' on the *client* to install new binaries from the
429 # most recent server build.
432 @echo "--------------------------------------------------------------"
433 @echo ">>> Making hierarchy"
434 @echo "--------------------------------------------------------------"
435 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
437 @echo "--------------------------------------------------------------"
438 @echo ">>> Installing everything.."
439 @echo "--------------------------------------------------------------"
440 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
441 .if !defined(NOMAN) && !defined(NO_MAKEDB_RUN)
443 @echo "--------------------------------------------------------------"
444 @echo ">>> Rebuilding man page indices"
445 @echo "--------------------------------------------------------------"
446 cd ${.CURDIR}/share/man; ${MAKE} makedb
450 @echo "--------------------------------------------------------------"
451 @echo ">>> Distributing everything.."
452 @echo "--------------------------------------------------------------"
453 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
456 # buildkernel and installkernel
458 # Which kernels to build and/or install is specified by setting
459 # KERNCONF. If not defined a GENERIC kernel is built/installed.
460 # Only the existing (depending TARGET) config files are used
461 # for building kernels and only the first of these is designated
462 # as the one being installed.
464 # Note that we have to use TARGET instead of TARGET_ARCH when
465 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
466 # be set to cross-build, we have to make sure TARGET is set
469 .if !defined(KERNCONF) && defined(KERNEL)
475 INSTKERNNAME?= kernel
477 KERNSRCDIR?= ${.CURDIR}/sys
478 KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf
479 KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR}
480 KERNCONFDIR?= ${KRNLCONFDIR}
484 .for _kernel in ${KERNCONF}
485 .if exists(${KERNCONFDIR}/${_kernel})
486 BUILDKERNELS+= ${_kernel}
487 .if empty(INSTALLKERNEL)
488 INSTALLKERNEL= ${_kernel}
496 # Builds all kernels defined by BUILDKERNELS.
499 .if empty(BUILDKERNELS)
500 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF}).";
503 .if defined(KERNWARN)
504 @echo "--------------------------------------------------------------"
505 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
506 @echo "--------------------------------------------------------------"
510 .for _kernel in ${BUILDKERNELS}
511 @echo "--------------------------------------------------------------"
512 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
513 @echo "--------------------------------------------------------------"
514 @echo "===> ${_kernel}"
515 mkdir -p ${KRNLOBJDIR}
516 .if !defined(NO_KERNELCONFIG)
519 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
520 ${KERNCONFDIR}/${_kernel}
522 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
523 cd ${KRNLOBJDIR}/${_kernel}; \
524 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} ${CLEANDIR}
526 cd ${KRNLOBJDIR}/${_kernel}; \
527 MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \
528 ${MAKE} -DNO_CPU_CFLAGS -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
529 cd ${KRNLOBJDIR}/${_kernel}; \
530 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} obj
531 # XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case.
532 .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules)
533 .for target in obj depend all
534 cd ${.CURDIR}/sys/modules/aic7xxx/aicasm; \
535 MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
536 ${MAKE} -DNO_CPU_CFLAGS ${target}
539 .if !defined(NO_KERNELDEPEND)
540 cd ${KRNLOBJDIR}/${_kernel}; \
541 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend -DNO_MODULES_OBJ
543 cd ${KRNLOBJDIR}/${_kernel}; \
544 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all -DNO_MODULES_OBJ
545 @echo "--------------------------------------------------------------"
546 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
547 @echo "--------------------------------------------------------------"
553 # Install the kernel defined by INSTALLKERNEL
555 installkernel reinstallkernel installkernel.debug reinstallkernel.debug:
556 .if empty(INSTALLKERNEL)
557 @echo "ERROR: No kernel \"${KERNCONF}\" to install."
560 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
561 ${CROSSENV} PATH=${TMPPATH} \
562 ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
567 # Update the source tree, by running sup and/or running cvs to update to the
571 .if defined(SUP_UPDATE)
572 @echo "--------------------------------------------------------------"
573 @echo ">>> Running ${SUP}"
574 @echo "--------------------------------------------------------------"
576 @${SUP} ${SUPFLAGS} ${SUPFILE}
578 .if defined(SUPFILE1)
579 @${SUP} ${SUPFLAGS} ${SUPFILE1}
581 .if defined(SUPFILE2)
582 @${SUP} ${SUPFLAGS} ${SUPFILE2}
584 .if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
585 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
587 .if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
588 @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
591 .if defined(CVS_UPDATE)
592 @echo "--------------------------------------------------------------"
593 @echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT}
594 @echo "--------------------------------------------------------------"
595 cd ${.CURDIR}; ${CVS} -R -q update -A -P -d
601 # Build most of the user binaries on the existing system libs and includes.
604 @echo "--------------------------------------------------------------"
605 @echo ">>> Building 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}/ all
614 # Install the binaries built by the 'most' target. This does not include
615 # libraries or include files.
618 @echo "--------------------------------------------------------------"
619 @echo ">>> Installing programs only"
620 @echo "--------------------------------------------------------------"
621 .for _dir in bin sbin libexec usr.bin usr.sbin gnu/usr.bin gnu/usr.sbin
622 cd ${.CURDIR}/${_dir}; ${MAKE} DIRPRFX=${_dir}/ install
626 # ------------------------------------------------------------------------
628 # From here onwards are utility targets used by the 'make world' and
629 # related targets. If your 'world' breaks, you may like to try to fix
630 # the problem and manually run the following targets to attempt to
631 # complete the build. Beware, this is *not* guaranteed to work, you
632 # need to have a pretty good grip on the current state of the system
633 # to attempt to manually finish it. If in doubt, 'make world' again.
637 # legacy: Build compatibility shims for the next three targets
640 .for _tool in tools/build
641 @${ECHODIR} "===> ${_tool}"; \
642 cd ${.CURDIR}/${_tool}; \
643 ${MAKE} DIRPRFX=${_tool}/ obj; \
644 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \
645 ${MAKE} DIRPRFX=${_tool}/ depend; \
646 ${MAKE} DIRPRFX=${_tool}/ all; \
647 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
651 # bootstrap-tools: Build tools needed for compatibility
653 .if exists(${.CURDIR}/games) && !defined(NOGAMES)
654 _strfile= games/fortune/strfile
658 _gperf= gnu/usr.bin/gperf
659 .if ${BOOTSTRAPPING} < 500113
660 _groff= gnu/usr.bin/groff
662 _groff= gnu/usr.bin/groff/tmac
666 .if ${BOOTSTRAPPING} < 450005 || \
667 ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500034
668 _uudecode= usr.bin/uudecode
671 .if ${BOOTSTRAPPING} < 430002 || \
672 ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500019
673 _xargs= usr.bin/xargs
676 .if ${BOOTSTRAPPING} < 430002 || \
677 ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500018
681 .if !defined(NO_RESCUE) && \
682 ${BOOTSTRAPPING} < 501100
683 _crunchgen= usr.sbin/crunch/crunchgen
686 .if ${BOOTSTRAPPING} < 500019
687 _kbdcontrol= usr.sbin/kbdcontrol
695 gnu/usr.bin/texinfo \
706 @${ECHODIR} "===> ${_tool}"; \
707 cd ${.CURDIR}/${_tool}; \
708 ${MAKE} DIRPRFX=${_tool}/ obj; \
709 ${MAKE} DIRPRFX=${_tool}/ depend; \
710 ${MAKE} DIRPRFX=${_tool}/ all; \
711 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
715 # build-tools: Build special purpose build tools
717 .if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules)
718 _aicasm= sys/modules/aic7xxx/aicasm
721 .if exists(${.CURDIR}/share) && !defined(NOSHARE)
722 _share= share/syscons/scrnmaps
725 .if !defined(NO_FORTRAN)
726 _fortran= gnu/usr.bin/cc/f771
729 .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
730 !defined(NOCRYPT) && !defined(NO_OPENSSL) && !defined(NO_KERBEROS)
731 _libkrb5= kerberos5/lib/libroken kerberos5/lib/libvers \
732 kerberos5/lib/libasn1 kerberos5/lib/libhdb kerberos5/lib/libsl
735 .if exists(${.CURDIR}/rescue) && !defined(NO_RESCUE)
736 _rescue= rescue/rescue
744 gnu/usr.bin/cc/cc_tools \
753 @${ECHODIR} "===> ${_tool}"; \
754 cd ${.CURDIR}/${_tool}; \
755 ${MAKE} DIRPRFX=${_tool}/ obj; \
756 ${MAKE} DIRPRFX=${_tool}/ build-tools
760 # cross-tools: Build cross-building tools
762 .if ${TARGET_ARCH} == "sparc64" && ${TARGET_ARCH} != ${MACHINE_ARCH} && \
763 ${BOOTSTRAPPING} < 500037
764 _elf2aout= usr.bin/elf2aout
767 .if ${TARGET_ARCH} == "i386" && ${TARGET_ARCH} != ${MACHINE_ARCH}
768 _btxld= usr.sbin/btxld
771 .if (!defined(NO_RESCUE) || \
772 defined(RELEASEDIR)) && \
773 (${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 501101)
774 _crunchide= usr.sbin/crunch/crunchide
777 .if ${TARGET_ARCH} == "alpha" && ${TARGET_ARCH} != ${MACHINE_ARCH}
778 _elf2exe= usr.sbin/elf2exe
781 .if ${TARGET_ARCH} == "i386" && ${TARGET_ARCH} != ${MACHINE_ARCH} && \
783 _kgzip= usr.sbin/kgzip
788 gnu/usr.bin/binutils \
791 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
796 @${ECHODIR} "===> ${_tool}"; \
797 cd ${.CURDIR}/${_tool}; \
798 ${MAKE} DIRPRFX=${_tool}/ obj; \
799 ${MAKE} DIRPRFX=${_tool}/ depend; \
800 ${MAKE} DIRPRFX=${_tool}/ all; \
801 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
805 # hierarchy - ensure that all the needed directories are present
808 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs
811 # libraries - build all libraries, and install them under ${DESTDIR}.
813 # The list of libraries with dependents (${_prebuild_libs}) and their
814 # interdependencies (__L) are built automatically by the
815 # ${.CURDIR}/tools/make_libdeps.sh script.
819 ${MAKE} -f Makefile.inc1 _startup_libs; \
820 ${MAKE} -f Makefile.inc1 _prebuild_libs; \
821 ${MAKE} -f Makefile.inc1 _generic_libs;
823 # These dependencies are not automatically generated:
825 # gnu/lib/csu, gnu/lib/libgcc and lib/csu must be built before all
826 # shared libraries for ELF.
828 _startup_libs= gnu/lib/csu gnu/lib/libgcc
829 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
830 _startup_libs+= lib/csu/${MACHINE_ARCH}-elf
832 _startup_libs+= lib/csu/${MACHINE_ARCH}
837 _generic_libs= gnu/lib
839 .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
840 !defined(NOCRYPT) && !defined(NO_OPENSSL) && !defined(NO_KERBEROS)
841 _prebuild_libs+= kerberos5/lib/libasn1
842 _prebuild_libs+= kerberos5/lib/libgssapi
843 _prebuild_libs+= kerberos5/lib/libkrb5
844 _prebuild_libs+= kerberos5/lib/libroken
845 _generic_libs+= kerberos5/lib
848 _prebuild_libs+= lib/libcom_err lib/libcrypt lib/libexpat \
849 lib/libkvm lib/libmd \
850 lib/libncurses lib/libopie lib/libpam lib/libradius \
852 lib/libsbuf lib/libtacplus lib/libutil lib/libypclnt \
855 lib/libopie__L lib/libradius__L lib/libtacplus__L: lib/libmd__L
856 lib/libypclnt__L: lib/librpcsvc__L
860 .if !defined(NOCRYPT)
861 .if !defined(NO_OPENSSL)
862 _prebuild_libs+= secure/lib/libcrypto secure/lib/libssl
863 .if !defined(NO_OPENSSH)
864 _prebuild_libs+= secure/lib/libssh
865 secure/lib/libssh__L: secure/lib/libcrypto__L lib/libz__L
868 _generic_libs+= secure/lib
871 _generic_libs+= usr.bin/lex/lib
873 .if ${MACHINE_ARCH} == "i386"
874 _generic_libs+= usr.sbin/pcvt/keycap
877 .for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
879 .if exists(${.CURDIR}/${_lib})
880 @${ECHODIR} "===> ${_lib}"; \
881 cd ${.CURDIR}/${_lib}; \
882 ${MAKE} DIRPRFX=${_lib}/ depend; \
883 ${MAKE} DIRPRFX=${_lib}/ all; \
884 ${MAKE} DIRPRFX=${_lib}/ install
888 # libpam is special: we need to build static PAM modules before
889 # static PAM library, and dynamic PAM library before dynamic PAM
891 lib/libpam__L: .PHONY
892 @${ECHODIR} "===> lib/libpam"; \
893 cd ${.CURDIR}/lib/libpam; \
894 ${MAKE} DIRPRFX=lib/libpam/ depend; \
895 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \
896 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install
898 _startup_libs: ${_startup_libs:S/$/__L/}
899 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
900 _generic_libs: ${_generic_libs:S/$/__L/}
902 .for __target in all clean cleandepend cleandir depend includes obj
903 .for entry in ${SUBDIR}
904 ${entry}.${__target}__D: .PHONY
905 @if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
906 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
907 edir=${entry}.${MACHINE_ARCH}; \
908 cd ${.CURDIR}/$${edir}; \
910 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \
912 cd ${.CURDIR}/$${edir}; \
914 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
916 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
919 .include <bsd.subdir.mk>