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)
31 # Standard targets (not defined here) are documented in the makefiles in
32 # /usr/share/mk. These include:
33 # obj depend all install clean cleandepend cleanobj
35 # Put initial settings here.
38 # We must do share/info early so that installation of info `dir'
39 # entries works correctly. Do it first since it is less likely to
40 # grow dependencies on include and lib than vice versa.
41 .if exists(${.CURDIR}/share/info)
45 .if exists(${.CURDIR}/include)
48 .if exists(${.CURDIR}/lib)
52 # When upgrading to a dynamically linked root, install the runtime
53 # linker early into its new location before make(1) has a chance
54 # to run the dynamically linked /bin/sh.
55 .if defined(WITH_DYNAMICROOT) && !defined(NOPIC) && \
56 (!defined(TARGET_ARCH) || ${TARGET_ARCH} == ${MACHINE_ARCH}) && \
57 !defined(DISTDIR) && \
58 (!defined(DESTDIR) || empty(DESTDIR) || ${DESTDIR} == "/") && \
59 !exists(/libexec/ld-elf.so.1)
60 SUBDIR+= libexec/rtld-elf
63 .if exists(${.CURDIR}/bin)
66 .if exists(${.CURDIR}/games) && !defined(NOGAMES)
69 .if exists(${.CURDIR}/gnu)
72 .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
73 !defined(NOCRYPT) && !defined(NO_OPENSSL) && !defined(NO_KERBEROS)
76 .if exists(${.CURDIR}/libexec)
79 .if exists(${.CURDIR}/rescue) && !defined(NO_RESCUE)
82 .if exists(${.CURDIR}/sbin)
85 .if exists(${.CURDIR}/secure) && !defined(NOCRYPT)
88 .if exists(${.CURDIR}/share) && !defined(NOSHARE)
91 .if exists(${.CURDIR}/sys)
94 .if exists(${.CURDIR}/usr.bin)
97 .if exists(${.CURDIR}/usr.sbin)
101 # etc must be last for "distribute" to work
102 .if exists(${.CURDIR}/etc)
106 # These are last, since it is nice to at least get the base system
107 # rebuilt before you do them.
108 .if defined(LOCAL_DIRS)
109 .for _DIR in ${LOCAL_DIRS}
110 .if exists(${.CURDIR}/${_DIR}) && exists(${.CURDIR}/${_DIR}/Makefile)
116 .if defined(SUBDIR_OVERRIDE)
117 SUBDIR= ${SUBDIR_OVERRIDE}
120 .if defined(NOCLEANDIR)
121 CLEANDIR= clean cleandepend
127 SUP?= /usr/local/bin/cvsup
128 SUPFLAGS?= -g -L 2 -P -
130 SUPFLAGS+= -h ${SUPHOST}
133 MAKEOBJDIRPREFIX?= /usr/obj
134 .if !defined(OSRELDATE)
135 .if exists(/usr/include/osreldate.h)
136 OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
137 /usr/include/osreldate.h
142 TARGET_ARCH?= ${MACHINE_ARCH}
143 .if ${TARGET_ARCH} == ${MACHINE_ARCH}
145 TARGET_CPUTYPE?=${CPUTYPE}
147 TARGET?= ${TARGET_ARCH}
150 .if !empty(TARGET_CPUTYPE)
151 _TARGET_CPUTYPE=${TARGET_CPUTYPE}
153 _TARGET_CPUTYPE=dummy
155 _CPUTYPE!= ${MAKE} -f /dev/null -m ${.CURDIR}/share/mk \
156 CPUTYPE=${_TARGET_CPUTYPE} -V CPUTYPE
157 .if ${_CPUTYPE} != ${_TARGET_CPUTYPE}
158 .error CPUTYPE global should be set with ?=.
161 BUILD_ARCH!= sysctl -n hw.machine_arch
162 .if ${MACHINE_ARCH} != ${BUILD_ARCH}
163 .error To cross-build, set TARGET_ARCH.
166 .if ${MACHINE} == ${TARGET}
167 OBJTREE= ${MAKEOBJDIRPREFIX}
169 OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}
171 WORLDTMP= ${OBJTREE}${.CURDIR}/${MACHINE_ARCH}
172 # /usr/games added for fortune which depend on strfile
173 BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games
174 XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
175 STRICTTMPPATH= ${BPATH}:${XPATH}
176 TMPPATH= ${STRICTTMPPATH}:${PATH}
178 INSTALLTMP!= /usr/bin/mktemp -d -u -t install
181 # Building a world goes through the following stages
183 # 1. legacy stage [BMAKE]
184 # This stage is responsible for creating compatibility
185 # shims that are needed by the bootstrap-tools,
186 # build-tools and cross-tools stages.
187 # 1. bootstrap-tools stage [BMAKE]
188 # This stage is responsible for creating programs that
189 # are needed for backward compatibility reasons. They
190 # are not built as cross-tools.
191 # 2. build-tools stage [TMAKE]
192 # This stage is responsible for creating the object
193 # tree and building any tools that are needed during
195 # 3. cross-tools stage [XMAKE]
196 # This stage is responsible for creating any tools that
197 # are needed for cross-builds. A cross-compiler is one
199 # 4. world stage [WMAKE]
200 # This stage actually builds the world.
201 # 5. install stage (optional) [IMAKE]
202 # This stage installs a previously built world.
207 # Common environment for world related stages
208 CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \
209 MACHINE_ARCH=${TARGET_ARCH} \
211 CPUTYPE=${TARGET_CPUTYPE} \
212 GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
213 GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \
214 GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac
216 # bootstrap-tools stage
218 INSTALL="sh ${.CURDIR}/tools/install.sh" \
219 PATH=${BPATH}:${PATH} \
220 WORLDTMP=${WORLDTMP} \
221 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}"
222 BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
223 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
224 BOOTSTRAPPING=${OSRELDATE} \
225 -DNOHTML -DNOINFO -DNOLINT -DNOMAN -DNOPIC -DNOPROFILE \
226 -DNOSHARED -DNO_CPU_CFLAGS -DNO_WARNS
229 TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
230 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
231 BOOTSTRAPPING=${OSRELDATE} -DNOLINT -DNO_CPU_CFLAGS -DNO_WARNS
234 XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} -DNO_FORTRAN -DNO_GDB
237 WMAKEENV= ${CROSSENV} \
238 DESTDIR=${WORLDTMP} \
239 _SHLIBDIRPREFIX=${WORLDTMP} \
240 INSTALL="sh ${.CURDIR}/tools/install.sh" \
242 WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1
245 IMAKEENV= ${CROSSENV} \
246 PATH=${STRICTTMPPATH}:${INSTALLTMP}
247 IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1
250 KMAKEENV= ${WMAKEENV}
255 # Attempt to rebuild the entire system, with reasonable chance of
256 # success, regardless of how old your existing system is.
259 .if ${.CURDIR:C/[^,]//g} != ""
260 # The m4 build of sendmail files doesn't like it if ',' is used
261 # anywhere in the path of it's files.
263 @echo "*** Error: path to source tree contains a comma ','"
268 @echo "--------------------------------------------------------------"
269 @echo ">>> Rebuilding the temporary build tree"
270 @echo "--------------------------------------------------------------"
271 .if !defined(NOCLEAN)
274 rm -rf ${WORLDTMP}/legacy/usr/include
275 # XXX - These two can depend on any header file.
276 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
277 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
280 usr/bin usr/games usr/include/sys usr/lib \
281 usr/libexec usr/sbin usr/share/dict \
282 usr/share/groff_font/devX100 \
283 usr/share/groff_font/devX100-12 \
284 usr/share/groff_font/devX75 \
285 usr/share/groff_font/devX75-12 \
286 usr/share/groff_font/devascii \
287 usr/share/groff_font/devcp1047 \
288 usr/share/groff_font/devdvi \
289 usr/share/groff_font/devhtml \
290 usr/share/groff_font/devkoi8-r \
291 usr/share/groff_font/devlatin1 \
292 usr/share/groff_font/devlbp \
293 usr/share/groff_font/devlj4 \
294 usr/share/groff_font/devps \
295 usr/share/groff_font/devutf8 \
296 usr/share/tmac/mdoc usr/share/tmac/mm
297 mkdir -p ${WORLDTMP}/legacy/${_dir}
300 lib usr/bin usr/include usr/lib/compat/aout usr/libdata/ldscripts \
301 usr/libexec usr/share/misc
302 mkdir -p ${WORLDTMP}/${_dir}
304 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
305 -p ${WORLDTMP}/usr/include
306 ln -sf ${.CURDIR}/sys ${WORLDTMP}
309 @echo "--------------------------------------------------------------"
310 @echo ">>> stage 1.1: legacy release compatibility shims"
311 @echo "--------------------------------------------------------------"
312 cd ${.CURDIR}; ${BMAKE} legacy
315 @echo "--------------------------------------------------------------"
316 @echo ">>> stage 1.2: bootstrap tools"
317 @echo "--------------------------------------------------------------"
318 cd ${.CURDIR}; ${BMAKE} bootstrap-tools
320 .if !defined(NOCLEAN)
322 @echo "--------------------------------------------------------------"
323 @echo ">>> stage 2.1: cleaning up the object tree"
324 @echo "--------------------------------------------------------------"
325 cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
329 @echo "--------------------------------------------------------------"
330 @echo ">>> stage 2.2: rebuilding the object tree"
331 @echo "--------------------------------------------------------------"
332 cd ${.CURDIR}; ${WMAKE} par-obj
335 @echo "--------------------------------------------------------------"
336 @echo ">>> stage 2.3: build tools"
337 @echo "--------------------------------------------------------------"
338 cd ${.CURDIR}; ${TMAKE} build-tools
341 @echo "--------------------------------------------------------------"
342 @echo ">>> stage 3: cross tools"
343 @echo "--------------------------------------------------------------"
344 cd ${.CURDIR}; ${XMAKE} cross-tools
347 @echo "--------------------------------------------------------------"
348 @echo ">>> stage 4.1: building includes"
349 @echo "--------------------------------------------------------------"
350 cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
353 @echo "--------------------------------------------------------------"
354 @echo ">>> stage 4.2: building libraries"
355 @echo "--------------------------------------------------------------"
356 cd ${.CURDIR}; ${WMAKE} -DNOHTML -DNOINFO -DNOMAN -DNOFSCHG -DNOLINT \
360 @echo "--------------------------------------------------------------"
361 @echo ">>> stage 4.3: make dependencies"
362 @echo "--------------------------------------------------------------"
363 cd ${.CURDIR}; ${WMAKE} par-depend
366 @echo "--------------------------------------------------------------"
367 @echo ">>> stage 4.4: building everything.."
368 @echo "--------------------------------------------------------------"
369 cd ${.CURDIR}; ${WMAKE} par-all
373 .if !defined(SUBDIR_OVERRIDE)
374 WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools
376 WMAKE_TGTS+= _cleanobj _obj _build-tools
377 .if !defined(SUBDIR_OVERRIDE)
378 WMAKE_TGTS+= _cross-tools
380 WMAKE_TGTS+= _includes _libraries _depend everything
382 buildworld: ${WMAKE_TGTS}
383 .ORDER: ${WMAKE_TGTS}
388 # Checks to be sure system is ready for installworld
391 .if !defined(NO_SENDMAIL)
392 @if ! `id -u smmsp > /dev/null`; then \
393 echo "ERROR: Required smmsp user is missing, see /usr/src/UPDATING."; \
396 @if ! `id -g smmsp > /dev/null`; then \
397 echo "ERROR: Required smmsp group is missing, see /usr/src/UPDATING."; \
405 # Distributes everything compiled by a `buildworld'.
409 # Installs everything compiled by a 'buildworld'.
411 distributeworld installworld: installcheck
412 mkdir -p ${INSTALLTMP}
413 for prog in [ awk cap_mkdb cat chflags chmod chown \
414 date echo egrep find grep \
415 ln make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
416 test true uname wc zic; do \
417 cp `which $$prog` ${INSTALLTMP}; \
419 cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}
425 # If you have a build server, you can NFS mount the source and obj directories
426 # and do a 'make reinstall' on the *client* to install new binaries from the
427 # most recent server build.
430 @echo "--------------------------------------------------------------"
431 @echo ">>> Making hierarchy"
432 @echo "--------------------------------------------------------------"
433 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
435 @echo "--------------------------------------------------------------"
436 @echo ">>> Installing everything.."
437 @echo "--------------------------------------------------------------"
438 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
439 .if !defined(NOMAN) && !defined(NO_MAKEDB_RUN)
441 @echo "--------------------------------------------------------------"
442 @echo ">>> Rebuilding man page indices"
443 @echo "--------------------------------------------------------------"
444 cd ${.CURDIR}/share/man; ${MAKE} makedb
448 @echo "--------------------------------------------------------------"
449 @echo ">>> Distributing everything.."
450 @echo "--------------------------------------------------------------"
451 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
454 # buildkernel and installkernel
456 # Which kernels to build and/or install is specified by setting
457 # KERNCONF. If not defined a GENERIC kernel is built/installed.
458 # Only the existing (depending TARGET) config files are used
459 # for building kernels and only the first of these is designated
460 # as the one being installed.
462 # Note that we have to use TARGET instead of TARGET_ARCH when
463 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
464 # be set to cross-build, we have to make sure TARGET is set
467 .if !defined(KERNCONF) && defined(KERNEL)
473 INSTKERNNAME?= kernel
475 KERNSRCDIR?= ${.CURDIR}/sys
476 KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf
477 KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR}
478 KERNCONFDIR?= ${KRNLCONFDIR}
482 .for _kernel in ${KERNCONF}
483 .if exists(${KERNCONFDIR}/${_kernel})
484 BUILDKERNELS+= ${_kernel}
485 .if empty(INSTALLKERNEL)
486 INSTALLKERNEL= ${_kernel}
494 # Builds all kernels defined by BUILDKERNELS.
497 .if empty(BUILDKERNELS)
498 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF}).";
501 .if defined(KERNWARN)
502 @echo "--------------------------------------------------------------"
503 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
504 @echo "--------------------------------------------------------------"
508 .for _kernel in ${BUILDKERNELS}
509 @echo "--------------------------------------------------------------"
510 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
511 @echo "--------------------------------------------------------------"
512 @echo "===> ${_kernel}"
513 mkdir -p ${KRNLOBJDIR}
514 .if !defined(NO_KERNELCONFIG)
517 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
518 ${KERNCONFDIR}/${_kernel}
520 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
521 cd ${KRNLOBJDIR}/${_kernel}; \
522 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} ${CLEANDIR}
524 cd ${KRNLOBJDIR}/${_kernel}; \
525 MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \
526 ${MAKE} -DNO_CPU_CFLAGS -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
527 cd ${KRNLOBJDIR}/${_kernel}; \
528 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} obj
529 # XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case.
530 .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules)
531 .for target in obj depend all
532 cd ${.CURDIR}/sys/modules/aic7xxx/aicasm; \
533 MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
534 ${MAKE} -DNO_CPU_CFLAGS ${target}
537 .if !defined(NO_KERNELDEPEND)
538 cd ${KRNLOBJDIR}/${_kernel}; \
539 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend -DNO_MODULES_OBJ
541 cd ${KRNLOBJDIR}/${_kernel}; \
542 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all -DNO_MODULES_OBJ
543 @echo "--------------------------------------------------------------"
544 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
545 @echo "--------------------------------------------------------------"
551 # Install the kernel defined by INSTALLKERNEL
553 installkernel reinstallkernel installkernel.debug reinstallkernel.debug:
554 .if empty(INSTALLKERNEL)
555 @echo "ERROR: No kernel \"${KERNCONF}\" to install."
558 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
559 ${CROSSENV} PATH=${TMPPATH} \
560 ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
565 # Update the source tree, by running sup and/or running cvs to update to the
569 .if defined(SUP_UPDATE)
570 @echo "--------------------------------------------------------------"
571 @echo ">>> Running ${SUP}"
572 @echo "--------------------------------------------------------------"
574 @${SUP} ${SUPFLAGS} ${SUPFILE}
576 .if defined(SUPFILE1)
577 @${SUP} ${SUPFLAGS} ${SUPFILE1}
579 .if defined(SUPFILE2)
580 @${SUP} ${SUPFLAGS} ${SUPFILE2}
582 .if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
583 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
585 .if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
586 @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
589 .if defined(CVS_UPDATE)
590 @echo "--------------------------------------------------------------"
591 @echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT}
592 @echo "--------------------------------------------------------------"
593 cd ${.CURDIR}; ${CVS} -R -q update -A -P -d
597 # ------------------------------------------------------------------------
599 # From here onwards are utility targets used by the 'make world' and
600 # related targets. If your 'world' breaks, you may like to try to fix
601 # the problem and manually run the following targets to attempt to
602 # complete the build. Beware, this is *not* guaranteed to work, you
603 # need to have a pretty good grip on the current state of the system
604 # to attempt to manually finish it. If in doubt, 'make world' again.
608 # legacy: Build compatibility shims for the next three targets
611 .for _tool in tools/build
612 @${ECHODIR} "===> ${_tool}"; \
613 cd ${.CURDIR}/${_tool}; \
614 ${MAKE} DIRPRFX=${_tool}/ obj; \
615 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \
616 ${MAKE} DIRPRFX=${_tool}/ depend; \
617 ${MAKE} DIRPRFX=${_tool}/ all; \
618 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
622 # bootstrap-tools: Build tools needed for compatibility
624 .if exists(${.CURDIR}/games) && !defined(NOGAMES)
625 _strfile= games/fortune/strfile
629 _gperf= gnu/usr.bin/gperf
630 .if ${BOOTSTRAPPING} < 500113
631 _groff= gnu/usr.bin/groff
633 _groff= gnu/usr.bin/groff/tmac
637 .if ${BOOTSTRAPPING} < 450005 || \
638 ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500034
639 _uudecode= usr.bin/uudecode
642 .if ${BOOTSTRAPPING} < 430002 || \
643 ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500019
644 _xargs= usr.bin/xargs
647 .if ${BOOTSTRAPPING} < 430002 || \
648 ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500018
652 .if !defined(NO_RESCUE) && \
653 ${BOOTSTRAPPING} < 501100
654 _crunchgen= usr.sbin/crunch/crunchgen
657 .if ${BOOTSTRAPPING} < 500019
658 _kbdcontrol= usr.sbin/kbdcontrol
666 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
706 .if exists(${.CURDIR}/rescue) && !defined(NO_RESCUE)
707 _rescue= rescue/rescue
715 gnu/usr.bin/cc/cc_tools \
724 @${ECHODIR} "===> ${_tool}"; \
725 cd ${.CURDIR}/${_tool}; \
726 ${MAKE} DIRPRFX=${_tool}/ obj; \
727 ${MAKE} DIRPRFX=${_tool}/ build-tools
731 # cross-tools: Build cross-building tools
733 .if ${TARGET_ARCH} == "sparc64" && ${TARGET_ARCH} != ${MACHINE_ARCH} && \
734 ${BOOTSTRAPPING} < 500037
735 _elf2aout= usr.bin/elf2aout
738 .if ${TARGET_ARCH} == "i386" && ${TARGET_ARCH} != ${MACHINE_ARCH}
739 _btxld= usr.sbin/btxld
742 .if (!defined(NO_RESCUE) || \
743 defined(RELEASEDIR)) && \
744 (${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 501101)
745 _crunchide= usr.sbin/crunch/crunchide
748 .if ${TARGET_ARCH} == "alpha" && ${TARGET_ARCH} != ${MACHINE_ARCH}
749 _elf2exe= usr.sbin/elf2exe
752 .if ${TARGET_ARCH} == "i386" && ${TARGET_ARCH} != ${MACHINE_ARCH} && \
754 _kgzip= usr.sbin/kgzip
759 gnu/usr.bin/binutils \
762 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
767 @${ECHODIR} "===> ${_tool}"; \
768 cd ${.CURDIR}/${_tool}; \
769 ${MAKE} DIRPRFX=${_tool}/ obj; \
770 ${MAKE} DIRPRFX=${_tool}/ depend; \
771 ${MAKE} DIRPRFX=${_tool}/ all; \
772 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
776 # hierarchy - ensure that all the needed directories are present
779 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs
782 # libraries - build all libraries, and install them under ${DESTDIR}.
784 # The list of libraries with dependents (${_prebuild_libs}) and their
785 # interdependencies (__L) are built automatically by the
786 # ${.CURDIR}/tools/make_libdeps.sh script.
790 ${MAKE} -f Makefile.inc1 _startup_libs; \
791 ${MAKE} -f Makefile.inc1 _prebuild_libs; \
792 ${MAKE} -f Makefile.inc1 _generic_libs;
794 # These dependencies are not automatically generated:
796 # gnu/lib/csu, gnu/lib/libgcc and lib/csu must be built before all
797 # shared libraries for ELF.
799 _startup_libs= gnu/lib/csu gnu/lib/libgcc
800 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
801 _startup_libs+= lib/csu/${MACHINE_ARCH}-elf
803 _startup_libs+= lib/csu/${MACHINE_ARCH}
808 _generic_libs= gnu/lib
810 .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
811 !defined(NOCRYPT) && !defined(NO_OPENSSL) && !defined(NO_KERBEROS)
812 _prebuild_libs+= kerberos5/lib/libasn1
813 _prebuild_libs+= kerberos5/lib/libgssapi
814 _prebuild_libs+= kerberos5/lib/libkrb5
815 _prebuild_libs+= kerberos5/lib/libroken
816 _generic_libs+= kerberos5/lib
819 _prebuild_libs+= lib/libcom_err lib/libcrypt lib/libexpat \
820 lib/libkvm lib/libmd \
821 lib/libncurses lib/libopie lib/libpam lib/libradius \
823 lib/libsbuf lib/libtacplus lib/libutil lib/libypclnt \
826 lib/libopie__L lib/libradius__L lib/libtacplus__L: lib/libmd__L
827 lib/libypclnt__L: lib/librpcsvc__L
831 .if !defined(NOCRYPT)
832 .if !defined(NO_OPENSSL)
833 _prebuild_libs+= secure/lib/libcrypto secure/lib/libssl
834 .if !defined(NO_OPENSSH)
835 _prebuild_libs+= secure/lib/libssh
836 secure/lib/libssh__L: secure/lib/libcrypto__L lib/libz__L
839 _generic_libs+= secure/lib
842 _generic_libs+= usr.bin/lex/lib
844 .if ${MACHINE_ARCH} == "i386"
845 _generic_libs+= usr.sbin/pcvt/keycap
848 .for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
850 .if exists(${.CURDIR}/${_lib})
851 @${ECHODIR} "===> ${_lib}"; \
852 cd ${.CURDIR}/${_lib}; \
853 ${MAKE} DIRPRFX=${_lib}/ depend; \
854 ${MAKE} DIRPRFX=${_lib}/ all; \
855 ${MAKE} DIRPRFX=${_lib}/ install
859 # libpam is special: we need to build static PAM modules before
860 # static PAM library, and dynamic PAM library before dynamic PAM
862 lib/libpam__L: .PHONY
863 @${ECHODIR} "===> lib/libpam"; \
864 cd ${.CURDIR}/lib/libpam; \
865 ${MAKE} DIRPRFX=lib/libpam/ depend; \
866 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \
867 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install
869 _startup_libs: ${_startup_libs:S/$/__L/}
870 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
871 _generic_libs: ${_generic_libs:S/$/__L/}
873 .for __target in all clean cleandepend cleandir depend includes obj
874 .for entry in ${SUBDIR}
875 ${entry}.${__target}__D: .PHONY
876 @if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
877 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
878 edir=${entry}.${MACHINE_ARCH}; \
879 cd ${.CURDIR}/$${edir}; \
881 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \
883 cd ${.CURDIR}/$${edir}; \
885 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
887 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
890 .include <bsd.subdir.mk>