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 .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}/rescue) && !defined(NO_RESCUE)
73 .if exists(${.CURDIR}/sbin)
76 .if exists(${.CURDIR}/secure) && !defined(NOCRYPT)
79 .if exists(${.CURDIR}/share) && !defined(NOSHARE)
82 .if exists(${.CURDIR}/sys)
85 .if exists(${.CURDIR}/usr.bin)
88 .if exists(${.CURDIR}/usr.sbin)
92 # etc must be last for "distribute" to work
93 .if exists(${.CURDIR}/etc)
97 # These are last, since it is nice to at least get the base system
98 # rebuilt before you do them.
99 .if defined(LOCAL_DIRS)
100 .for _DIR in ${LOCAL_DIRS}
101 .if exists(${.CURDIR}/${_DIR}) && exists(${.CURDIR}/${_DIR}/Makefile)
107 .if defined(SUBDIR_OVERRIDE)
108 SUBDIR= ${SUBDIR_OVERRIDE}
111 .if defined(NOCLEANDIR)
112 CLEANDIR= clean cleandepend
118 SUP?= /usr/local/bin/cvsup
119 SUPFLAGS?= -g -L 2 -P -
121 SUPFLAGS+= -h ${SUPHOST}
124 MAKEOBJDIRPREFIX?= /usr/obj
125 .if !defined(OSRELDATE)
126 .if exists(/usr/include/osreldate.h)
127 OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
128 /usr/include/osreldate.h
133 TARGET_ARCH?= ${MACHINE_ARCH}
134 .if ${TARGET_ARCH} == ${MACHINE_ARCH}
136 TARGET_CPUTYPE?=${CPUTYPE}
138 TARGET?= ${TARGET_ARCH}
141 .if !empty(TARGET_CPUTYPE)
142 _TARGET_CPUTYPE=${TARGET_CPUTYPE}
144 _TARGET_CPUTYPE=dummy
146 _CPUTYPE!= ${MAKE} -f /dev/null -m ${.CURDIR}/share/mk \
147 CPUTYPE=${_TARGET_CPUTYPE} -V CPUTYPE
148 .if ${_CPUTYPE} != ${_TARGET_CPUTYPE}
149 .error CPUTYPE global should be set with ?=.
152 BUILD_ARCH!= sysctl -n hw.machine_arch
153 .if ${MACHINE_ARCH} != ${BUILD_ARCH}
154 .error To cross-build, set TARGET_ARCH.
157 .if ${MACHINE} == ${TARGET}
158 OBJTREE= ${MAKEOBJDIRPREFIX}
160 OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}
162 WORLDTMP= ${OBJTREE}${.CURDIR}/${MACHINE_ARCH}
163 # /usr/games added for fortune which depend on strfile
164 BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games
165 XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
166 STRICTTMPPATH= ${BPATH}:${XPATH}
167 TMPPATH= ${STRICTTMPPATH}:${PATH}
169 INSTALLTMP!= /usr/bin/mktemp -d -u -t install
172 # Building a world goes through the following stages
174 # 1. legacy stage [BMAKE]
175 # This stage is responsible for creating compatibility
176 # shims that are needed by the bootstrap-tools,
177 # build-tools and cross-tools stages.
178 # 1. bootstrap-tools stage [BMAKE]
179 # This stage is responsible for creating programs that
180 # are needed for backward compatibility reasons. They
181 # are not built as cross-tools.
182 # 2. build-tools stage [TMAKE]
183 # This stage is responsible for creating the object
184 # tree and building any tools that are needed during
186 # 3. cross-tools stage [XMAKE]
187 # This stage is responsible for creating any tools that
188 # are needed for cross-builds. A cross-compiler is one
190 # 4. world stage [WMAKE]
191 # This stage actually builds the world.
192 # 5. install stage (optional) [IMAKE]
193 # This stage installs a previously built world.
198 # Common environment for world related stages
199 CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \
200 MACHINE_ARCH=${TARGET_ARCH} \
202 CPUTYPE=${TARGET_CPUTYPE} \
203 GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
204 GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \
205 GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac
207 # bootstrap-tools stage
209 INSTALL="sh ${.CURDIR}/tools/install.sh" \
210 PATH=${BPATH}:${PATH} \
211 WORLDTMP=${WORLDTMP} \
212 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}"
213 BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
214 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
215 BOOTSTRAPPING=${OSRELDATE} \
216 -DNOHTML -DNOINFO -DNOLINT -DNOMAN -DNOPIC -DNOPROFILE \
217 -DNOSHARED -DNO_CPU_CFLAGS -DNO_WARNS
220 TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
221 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
222 BOOTSTRAPPING=${OSRELDATE} -DNOLINT -DNO_CPU_CFLAGS -DNO_WARNS
225 XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} -DNO_FORTRAN -DNO_GDB
228 WMAKEENV= ${CROSSENV} \
229 DESTDIR=${WORLDTMP} \
230 INSTALL="sh ${.CURDIR}/tools/install.sh" \
232 WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1
235 IMAKEENV= ${CROSSENV} \
236 PATH=${STRICTTMPPATH}:${INSTALLTMP}
237 IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1
240 KMAKEENV= ${WMAKEENV}
245 # Attempt to rebuild the entire system, with reasonable chance of
246 # success, regardless of how old your existing system is.
249 .if ${.CURDIR:C/[^,]//g} != ""
250 # The m4 build of sendmail files doesn't like it if ',' is used
251 # anywhere in the path of it's files.
253 @echo "*** Error: path to source tree contains a comma ','"
258 @echo "--------------------------------------------------------------"
259 @echo ">>> Rebuilding the temporary build tree"
260 @echo "--------------------------------------------------------------"
261 .if !defined(NOCLEAN)
264 rm -rf ${WORLDTMP}/legacy/usr/include
265 # XXX - These two can depend on any header file.
266 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
267 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
270 usr/bin usr/games usr/include/sys usr/lib \
271 usr/libexec usr/sbin usr/share/dict \
272 usr/share/groff_font/devX100 \
273 usr/share/groff_font/devX100-12 \
274 usr/share/groff_font/devX75 \
275 usr/share/groff_font/devX75-12 \
276 usr/share/groff_font/devascii \
277 usr/share/groff_font/devcp1047 \
278 usr/share/groff_font/devdvi \
279 usr/share/groff_font/devhtml \
280 usr/share/groff_font/devkoi8-r \
281 usr/share/groff_font/devlatin1 \
282 usr/share/groff_font/devlbp \
283 usr/share/groff_font/devlj4 \
284 usr/share/groff_font/devps \
285 usr/share/groff_font/devutf8 \
286 usr/share/tmac/mdoc usr/share/tmac/mm
287 mkdir -p ${WORLDTMP}/legacy/${_dir}
290 lib usr/bin usr/include usr/lib/compat/aout usr/libdata/ldscripts \
291 usr/libexec usr/share/misc
292 mkdir -p ${WORLDTMP}/${_dir}
294 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
295 -p ${WORLDTMP}/usr/include
296 ln -sf ${.CURDIR}/sys ${WORLDTMP}
299 @echo "--------------------------------------------------------------"
300 @echo ">>> stage 1: legacy release compatibility shims"
301 @echo "--------------------------------------------------------------"
302 cd ${.CURDIR}; ${BMAKE} legacy
305 @echo "--------------------------------------------------------------"
306 @echo ">>> stage 1: bootstrap tools"
307 @echo "--------------------------------------------------------------"
308 cd ${.CURDIR}; ${BMAKE} bootstrap-tools
310 .if !defined(NOCLEAN)
312 @echo "--------------------------------------------------------------"
313 @echo ">>> stage 2: cleaning up the object tree"
314 @echo "--------------------------------------------------------------"
315 cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
319 @echo "--------------------------------------------------------------"
320 @echo ">>> stage 2: rebuilding the object tree"
321 @echo "--------------------------------------------------------------"
322 cd ${.CURDIR}; ${WMAKE} par-obj
325 @echo "--------------------------------------------------------------"
326 @echo ">>> stage 2: build tools"
327 @echo "--------------------------------------------------------------"
328 cd ${.CURDIR}; ${TMAKE} build-tools
331 @echo "--------------------------------------------------------------"
332 @echo ">>> stage 3: cross tools"
333 @echo "--------------------------------------------------------------"
334 cd ${.CURDIR}; ${XMAKE} cross-tools
337 @echo "--------------------------------------------------------------"
338 @echo ">>> stage 4: populating ${WORLDTMP}/usr/include"
339 @echo "--------------------------------------------------------------"
340 cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
343 @echo "--------------------------------------------------------------"
344 @echo ">>> stage 4: building libraries"
345 @echo "--------------------------------------------------------------"
346 cd ${.CURDIR}; ${WMAKE} -DNOHTML -DNOINFO -DNOMAN -DNOFSCHG -DNOLINT \
350 @echo "--------------------------------------------------------------"
351 @echo ">>> stage 4: make dependencies"
352 @echo "--------------------------------------------------------------"
353 cd ${.CURDIR}; ${WMAKE} par-depend
356 @echo "--------------------------------------------------------------"
357 @echo ">>> stage 4: building everything.."
358 @echo "--------------------------------------------------------------"
359 cd ${.CURDIR}; ${WMAKE} par-all
363 .if !defined(SUBDIR_OVERRIDE)
364 WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools
366 WMAKE_TGTS+= _cleanobj _obj _build-tools
367 .if !defined(SUBDIR_OVERRIDE)
368 WMAKE_TGTS+= _cross-tools
370 WMAKE_TGTS+= _includes _libraries _depend everything
372 buildworld: ${WMAKE_TGTS}
373 .ORDER: ${WMAKE_TGTS}
378 # Checks to be sure system is ready for installworld
381 .if !defined(NO_SENDMAIL)
382 @if ! `id -u smmsp > /dev/null`; then \
383 echo "ERROR: Required smmsp user is missing, see /usr/src/UPDATING."; \
386 @if ! `id -g smmsp > /dev/null`; then \
387 echo "ERROR: Required smmsp group is missing, see /usr/src/UPDATING."; \
395 # Distributes everything compiled by a `buildworld'.
399 # Installs everything compiled by a 'buildworld'.
401 distributeworld installworld: installcheck
402 mkdir -p ${INSTALLTMP}
403 for prog in [ awk cap_mkdb cat chflags chmod chown \
404 date echo egrep find grep \
405 ln make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
406 test true uname wc zic; do \
407 cp `which $$prog` ${INSTALLTMP}; \
409 cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}
415 # If you have a build server, you can NFS mount the source and obj directories
416 # and do a 'make reinstall' on the *client* to install new binaries from the
417 # most recent server build.
420 @echo "--------------------------------------------------------------"
421 @echo ">>> Making hierarchy"
422 @echo "--------------------------------------------------------------"
423 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
425 @echo "--------------------------------------------------------------"
426 @echo ">>> Installing everything.."
427 @echo "--------------------------------------------------------------"
428 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
429 .if !defined(NOMAN) && !defined(NO_MAKEDB_RUN)
431 @echo "--------------------------------------------------------------"
432 @echo ">>> Rebuilding man page indices"
433 @echo "--------------------------------------------------------------"
434 cd ${.CURDIR}/share/man; ${MAKE} makedb
438 @echo "--------------------------------------------------------------"
439 @echo ">>> Distributing everything.."
440 @echo "--------------------------------------------------------------"
441 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
444 # buildkernel and installkernel
446 # Which kernels to build and/or install is specified by setting
447 # KERNCONF. If not defined a GENERIC kernel is built/installed.
448 # Only the existing (depending TARGET) config files are used
449 # for building kernels and only the first of these is designated
450 # as the one being installed.
452 # Note that we have to use TARGET instead of TARGET_ARCH when
453 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
454 # be set to cross-build, we have to make sure TARGET is set
457 .if !defined(KERNCONF) && defined(KERNEL)
463 INSTKERNNAME?= kernel
465 KERNSRCDIR?= ${.CURDIR}/sys
466 KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf
467 KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR}
468 KERNCONFDIR?= ${KRNLCONFDIR}
472 .for _kernel in ${KERNCONF}
473 .if exists(${KERNCONFDIR}/${_kernel})
474 BUILDKERNELS+= ${_kernel}
475 .if empty(INSTALLKERNEL)
476 INSTALLKERNEL= ${_kernel}
484 # Builds all kernels defined by BUILDKERNELS.
487 .if empty(BUILDKERNELS)
488 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF}).";
491 .if defined(KERNWARN)
492 @echo "--------------------------------------------------------------"
493 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
494 @echo "--------------------------------------------------------------"
498 .for _kernel in ${BUILDKERNELS}
499 @echo "--------------------------------------------------------------"
500 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
501 @echo "--------------------------------------------------------------"
502 @echo "===> ${_kernel}"
503 mkdir -p ${KRNLOBJDIR}
504 .if !defined(NO_KERNELCONFIG)
507 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
508 ${KERNCONFDIR}/${_kernel}
510 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
511 cd ${KRNLOBJDIR}/${_kernel}; \
512 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} ${CLEANDIR}
514 cd ${KRNLOBJDIR}/${_kernel}; \
515 MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \
516 ${MAKE} -DNO_CPU_CFLAGS -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
517 cd ${KRNLOBJDIR}/${_kernel}; \
518 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} obj
519 # XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case.
520 .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules)
521 .for target in obj depend all
522 cd ${.CURDIR}/sys/modules/aic7xxx/aicasm; \
523 MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
524 ${MAKE} -DNO_CPU_CFLAGS ${target}
527 .if !defined(NO_KERNELDEPEND)
528 cd ${KRNLOBJDIR}/${_kernel}; \
529 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend -DNO_MODULES_OBJ
531 cd ${KRNLOBJDIR}/${_kernel}; \
532 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all -DNO_MODULES_OBJ
533 @echo "--------------------------------------------------------------"
534 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
535 @echo "--------------------------------------------------------------"
541 # Install the kernel defined by INSTALLKERNEL
543 installkernel reinstallkernel installkernel.debug reinstallkernel.debug:
544 .if empty(INSTALLKERNEL)
545 @echo "ERROR: No kernel \"${KERNCONF}\" to install."
548 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
549 ${CROSSENV} PATH=${TMPPATH} \
550 ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
555 # Update the source tree, by running sup and/or running cvs to update to the
559 .if defined(SUP_UPDATE)
560 @echo "--------------------------------------------------------------"
561 @echo ">>> Running ${SUP}"
562 @echo "--------------------------------------------------------------"
564 @${SUP} ${SUPFLAGS} ${SUPFILE}
566 .if defined(SUPFILE1)
567 @${SUP} ${SUPFLAGS} ${SUPFILE1}
569 .if defined(SUPFILE2)
570 @${SUP} ${SUPFLAGS} ${SUPFILE2}
572 .if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
573 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
575 .if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
576 @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
579 .if defined(CVS_UPDATE)
580 @echo "--------------------------------------------------------------"
581 @echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT}
582 @echo "--------------------------------------------------------------"
583 cd ${.CURDIR}; ${CVS} -R -q update -A -P -d
589 # Build most of the user binaries on the existing system libs and includes.
592 @echo "--------------------------------------------------------------"
593 @echo ">>> Building programs only"
594 @echo "--------------------------------------------------------------"
595 .for _dir in bin sbin libexec usr.bin usr.sbin gnu/usr.bin gnu/usr.sbin
596 cd ${.CURDIR}/${_dir}; ${MAKE} DIRPRFX=${_dir}/ all
602 # Install the binaries built by the 'most' target. This does not include
603 # libraries or include files.
606 @echo "--------------------------------------------------------------"
607 @echo ">>> Installing programs only"
608 @echo "--------------------------------------------------------------"
609 .for _dir in bin sbin libexec usr.bin usr.sbin gnu/usr.bin gnu/usr.sbin
610 cd ${.CURDIR}/${_dir}; ${MAKE} DIRPRFX=${_dir}/ install
614 # ------------------------------------------------------------------------
616 # From here onwards are utility targets used by the 'make world' and
617 # related targets. If your 'world' breaks, you may like to try to fix
618 # the problem and manually run the following targets to attempt to
619 # complete the build. Beware, this is *not* guaranteed to work, you
620 # need to have a pretty good grip on the current state of the system
621 # to attempt to manually finish it. If in doubt, 'make world' again.
625 # legacy: Build compatibility shims for the next three targets
628 .for _tool in tools/build
629 @${ECHODIR} "===> ${_tool}"; \
630 cd ${.CURDIR}/${_tool}; \
631 ${MAKE} DIRPRFX=${_tool}/ obj; \
632 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \
633 ${MAKE} DIRPRFX=${_tool}/ depend; \
634 ${MAKE} DIRPRFX=${_tool}/ all; \
635 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
639 # bootstrap-tools: Build tools needed for compatibility
641 .if exists(${.CURDIR}/games) && !defined(NOGAMES)
642 _strfile= games/fortune/strfile
646 _gperf= gnu/usr.bin/gperf
647 .if ${BOOTSTRAPPING} < 500113
648 _groff= gnu/usr.bin/groff
650 _groff= gnu/usr.bin/groff/tmac
654 .if ${BOOTSTRAPPING} < 450005 || \
655 ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500034
656 _uudecode= usr.bin/uudecode
659 .if ${BOOTSTRAPPING} < 430002 || \
660 ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500019
661 _xargs= usr.bin/xargs
664 .if ${BOOTSTRAPPING} < 430002 || \
665 ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500018
669 .if !defined(NO_RESCUE) && \
670 ${BOOTSTRAPPING} < 501100
671 _crunchgen= usr.sbin/crunch/crunchgen
674 .if ${BOOTSTRAPPING} < 500019
675 _kbdcontrol= usr.sbin/kbdcontrol
683 gnu/usr.bin/texinfo \
694 @${ECHODIR} "===> ${_tool}"; \
695 cd ${.CURDIR}/${_tool}; \
696 ${MAKE} DIRPRFX=${_tool}/ obj; \
697 ${MAKE} DIRPRFX=${_tool}/ depend; \
698 ${MAKE} DIRPRFX=${_tool}/ all; \
699 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
703 # build-tools: Build special purpose build tools
705 .if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules)
706 _aicasm= sys/modules/aic7xxx/aicasm
709 .if exists(${.CURDIR}/share) && !defined(NOSHARE)
710 _share= share/syscons/scrnmaps
713 .if !defined(NO_FORTRAN)
714 _fortran= gnu/usr.bin/cc/f771
717 .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
718 !defined(NOCRYPT) && !defined(NO_OPENSSL) && !defined(NO_KERBEROS)
719 _libkrb5= kerberos5/lib/libroken kerberos5/lib/libvers \
720 kerberos5/lib/libasn1 kerberos5/lib/libhdb kerberos5/lib/libsl
723 .if exists(${.CURDIR}/rescue) && !defined(NO_RESCUE)
724 _rescue= rescue/rescue
732 gnu/usr.bin/cc/cc_tools \
741 @${ECHODIR} "===> ${_tool}"; \
742 cd ${.CURDIR}/${_tool}; \
743 ${MAKE} DIRPRFX=${_tool}/ obj; \
744 ${MAKE} DIRPRFX=${_tool}/ build-tools
748 # cross-tools: Build cross-building tools
750 .if ${TARGET_ARCH} == "sparc64" && ${TARGET_ARCH} != ${MACHINE_ARCH} && \
751 ${BOOTSTRAPPING} < 500037
752 _elf2aout= usr.bin/elf2aout
755 .if ${TARGET_ARCH} == "i386" && ${TARGET_ARCH} != ${MACHINE_ARCH}
756 _btxld= usr.sbin/btxld
759 .if (!defined(NO_RESCUE) || \
760 defined(RELEASEDIR)) && \
761 (${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 501101)
762 _crunchide= usr.sbin/crunch/crunchide
765 .if ${TARGET_ARCH} == "alpha" && ${TARGET_ARCH} != ${MACHINE_ARCH}
766 _elf2exe= usr.sbin/elf2exe
769 .if ${TARGET_ARCH} == "i386" && ${TARGET_ARCH} != ${MACHINE_ARCH} && \
771 _kgzip= usr.sbin/kgzip
776 gnu/usr.bin/binutils \
779 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
784 @${ECHODIR} "===> ${_tool}"; \
785 cd ${.CURDIR}/${_tool}; \
786 ${MAKE} DIRPRFX=${_tool}/ obj; \
787 ${MAKE} DIRPRFX=${_tool}/ depend; \
788 ${MAKE} DIRPRFX=${_tool}/ all; \
789 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
793 # hierarchy - ensure that all the needed directories are present
796 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs
799 # libraries - build all libraries, and install them under ${DESTDIR}.
801 # The list of libraries with dependents (${_prebuild_libs}) and their
802 # interdependencies (__L) are built automatically by the
803 # ${.CURDIR}/tools/make_libdeps.sh script.
807 ${MAKE} -f Makefile.inc1 _startup_libs; \
808 ${MAKE} -f Makefile.inc1 _prebuild_libs; \
809 ${MAKE} -f Makefile.inc1 _generic_libs;
811 # These dependencies are not automatically generated:
813 # gnu/lib/csu, gnu/lib/libgcc and lib/csu must be built before all
814 # shared libraries for ELF.
816 # lib/libc (libc_pic.a) must be built before lib/libpthread.
818 _startup_libs= gnu/lib/csu gnu/lib/libgcc
819 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
820 _startup_libs+= lib/csu/${MACHINE_ARCH}-elf
822 _startup_libs+= lib/csu/${MACHINE_ARCH}
826 _generic_libs= gnu/lib
828 .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
829 !defined(NOCRYPT) && !defined(NO_OPENSSL) && !defined(NO_KERBEROS)
830 _prebuild_libs+= kerberos5/lib/libasn1
831 _prebuild_libs+= kerberos5/lib/libgssapi
832 _prebuild_libs+= kerberos5/lib/libkrb5
833 _prebuild_libs+= kerberos5/lib/libroken
834 _generic_libs+= kerberos5/lib
837 .if !defined(NOLIBPTHREAD)
838 _prebuild_libs+= lib/libc
840 _prebuild_libs+= lib/libcom_err lib/libcrypt lib/libexpat \
841 lib/libkvm lib/libmd \
842 lib/libncurses lib/libopie lib/libpam lib/libradius \
844 lib/libsbuf lib/libtacplus lib/libutil lib/libypclnt \
847 lib/libopie__L lib/libradius__L lib/libtacplus__L: lib/libmd__L
848 lib/libypclnt__L: lib/librpcsvc__L
852 .if !defined(NOCRYPT)
853 .if !defined(NO_OPENSSL)
854 _prebuild_libs+= secure/lib/libcrypto secure/lib/libssl
855 .if !defined(NO_OPENSSH)
856 _prebuild_libs+= secure/lib/libssh
857 secure/lib/libssh__L: secure/lib/libcrypto__L lib/libz__L
860 _generic_libs+= secure/lib
863 _generic_libs+= usr.bin/lex/lib
865 .if ${MACHINE_ARCH} == "i386"
866 _generic_libs+= usr.sbin/pcvt/keycap
869 .for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
871 .if exists(${.CURDIR}/${_lib})
872 @${ECHODIR} "===> ${_lib}"; \
873 cd ${.CURDIR}/${_lib}; \
874 ${MAKE} DIRPRFX=${_lib}/ depend; \
875 ${MAKE} DIRPRFX=${_lib}/ all; \
876 ${MAKE} DIRPRFX=${_lib}/ install
880 # libpam is special: we need to build static PAM modules before
881 # static PAM library, and dynamic PAM library before dynamic PAM
883 lib/libpam__L: .PHONY
884 @${ECHODIR} "===> lib/libpam"; \
885 cd ${.CURDIR}/lib/libpam; \
886 ${MAKE} DIRPRFX=lib/libpam/ depend; \
887 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \
888 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install
890 _startup_libs: ${_startup_libs:S/$/__L/}
891 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
892 _generic_libs: ${_generic_libs:S/$/__L/}
894 .for __target in all clean cleandepend cleandir depend includes obj
895 .for entry in ${SUBDIR}
896 ${entry}.${__target}__D: .PHONY
897 @if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
898 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
899 edir=${entry}.${MACHINE_ARCH}; \
900 cd ${.CURDIR}/$${edir}; \
902 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \
904 cd ${.CURDIR}/$${edir}; \
906 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
908 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
911 .include <bsd.subdir.mk>