4 # Make command line options:
5 # -DMAKE_KERBEROS5 to build Kerberos5
6 # -DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
7 # -DNOCLEAN do not clean at all
8 # -DNOCRYPT will prevent building of crypt versions
9 # -DNOMAN do not build the manual pages
10 # -DNOPROFILE do not build profiled libraries
11 # -DNOSECURE do not go into secure subdir
12 # -DNOGAMES do not go into games subdir
13 # -DNOSHARE do not go into share subdir
14 # -DNOINFO do not make or install info files
15 # -DNOLIBC_R do not build libc_r.
16 # -DNO_FORTRAN do not build g77 and related libraries.
17 # -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel
18 # -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel
19 # -DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel
20 # -DNO_PORTSUPDATE do not update ports in ${MAKE} update
21 # -DNO_DOCUPDATE do not update doc in ${MAKE} update
22 # LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
23 # TARGET_ARCH="arch" to crossbuild world to a different arch
26 # The intended user-driven targets are:
27 # buildworld - rebuild *everything*, including glue to help do upgrades
28 # installworld- install everything built by "buildworld"
29 # update - convenient way to update your source tree (eg: sup/cvs)
30 # most - build user commands, no libraries or include files
31 # installmost - install user commands, no libraries or include files
33 # Standard targets (not defined here) are documented in the makefiles in
34 # /usr/share/mk. These include:
35 # obj depend all install clean cleandepend cleanobj
37 # Put initial settings here.
40 # We must do share/info early so that installation of info `dir'
41 # entries works correctly. Do it first since it is less likely to
42 # grow dependencies on include and lib than vice versa.
43 .if exists(${.CURDIR}/share/info)
47 .if exists(${.CURDIR}/include)
50 .if exists(${.CURDIR}/lib)
54 .if exists(${.CURDIR}/bin)
57 .if exists(${.CURDIR}/games) && !defined(NOGAMES)
60 .if exists(${.CURDIR}/gnu)
63 .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
64 !defined(NOCRYPT) && !defined(NO_OPENSSL) && defined(MAKE_KERBEROS5)
67 .if exists(${.CURDIR}/libexec)
70 .if exists(${.CURDIR}/sbin)
73 .if exists(${.CURDIR}/secure) && !defined(NOCRYPT) && !defined(NOSECURE)
76 .if exists(${.CURDIR}/share) && !defined(NOSHARE)
79 .if exists(${.CURDIR}/sys)
82 .if exists(${.CURDIR}/usr.bin)
85 .if exists(${.CURDIR}/usr.sbin)
89 # etc must be last for "distribute" to work
90 .if exists(${.CURDIR}/etc)
94 # These are last, since it is nice to at least get the base system
95 # rebuilt before you do them.
96 .if defined(LOCAL_DIRS)
97 .for _DIR in ${LOCAL_DIRS}
98 .if exists(${.CURDIR}/${_DIR}) & exists(${.CURDIR}/${_DIR}/Makefile)
104 .if defined(SUBDIR_OVERRIDE)
105 SUBDIR= ${SUBDIR_OVERRIDE}
108 .if defined(NOCLEANDIR)
109 CLEANDIR= clean cleandepend
115 SUP?= /usr/local/bin/cvsup
116 SUPFLAGS?= -g -L 2 -P -
118 SUPFLAGS+= -h ${SUPHOST}
121 MAKEOBJDIRPREFIX?= /usr/obj
122 OSRELDATE!= sysctl -n kern.osreldate
123 TARGET_ARCH?= ${MACHINE_ARCH}
124 .if ${TARGET_ARCH} == ${MACHINE_ARCH}
126 TARGET_CPUTYPE?=${CPUTYPE}
128 TARGET?= ${TARGET_ARCH}
131 .if !empty(TARGET_CPUTYPE)
132 _TARGET_CPUTYPE=${TARGET_CPUTYPE}
134 _TARGET_CPUTYPE=dummy
136 _CPUTYPE!= ${MAKE} -f /dev/null -m ${.CURDIR}/share/mk \
137 CPUTYPE=${_TARGET_CPUTYPE} -V CPUTYPE
138 .if ${_CPUTYPE} != ${_TARGET_CPUTYPE}
139 .error CPUTYPE global should be set with ?=.
142 BUILD_ARCH!= sysctl -n hw.machine_arch
143 .if ${MACHINE_ARCH} != ${BUILD_ARCH}
144 .error To cross-build, set TARGET_ARCH.
147 .if ${MACHINE} == ${TARGET}
148 OBJTREE= ${MAKEOBJDIRPREFIX}
150 OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}
152 WORLDTMP= ${OBJTREE}${.CURDIR}/${MACHINE_ARCH}
153 # /usr/games added for fortune which depend on strfile
154 STRICTTMPPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
155 TMPPATH= ${STRICTTMPPATH}:${PATH}
157 INSTALLTMP!= /usr/bin/mktemp -d -u -t install
160 # Building a world goes through the following stages
162 # 1. bootstrap-tool stage [BMAKE]
163 # This stage is responsible for creating programs that
164 # are needed for backward compatibility reasons. They
165 # are not built as cross-tools.
166 # 2. build-tool stage [TMAKE]
167 # This stage is responsible for creating the object
168 # tree and building any tools that are needed during
170 # 3. cross-tool stage [XMAKE]
171 # This stage is responsible for creating any tools that
172 # are needed for cross-builds. A cross-compiler is one
174 # 4. world stage [WMAKE]
175 # This stage actually builds the world.
176 # 5. install stage (optional) [IMAKE]
177 # This stage installs a previously built world.
180 # Common environment for world related stages
181 CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \
182 MACHINE_ARCH=${TARGET_ARCH} \
184 CPUTYPE=${TARGET_CPUTYPE} \
185 GROFF_BIN_PATH=${WORLDTMP}/usr/bin \
186 GROFF_FONT_PATH=${WORLDTMP}/usr/share/groff_font \
187 GROFF_TMAC_PATH=${WORLDTMP}/usr/share/tmac
189 # bootstrap-tool stage
190 BMAKEENV= MAKEOBJDIRPREFIX=${WORLDTMP} \
192 INSTALL="sh ${.CURDIR}/tools/install.sh"
193 BMAKE= ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
194 BOOTSTRAPPING=${OSRELDATE} \
195 -DNOHTML -DNOINFO -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED \
196 -DNO_CPU_CFLAGS -DNO_WERROR
199 TMAKEENV= MAKEOBJDIRPREFIX=${OBJTREE} \
201 INSTALL="sh ${.CURDIR}/tools/install.sh"
202 TMAKE= ${TMAKEENV} ${MAKE} -f Makefile.inc1 \
203 BOOTSTRAPPING=${OSRELDATE} -DNO_CPU_CFLAGS
206 XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} -DNO_FORTRAN -DNO_GDB
209 WMAKEENV= ${CROSSENV} \
210 DESTDIR=${WORLDTMP} \
211 INSTALL="sh ${.CURDIR}/tools/install.sh" \
213 WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1
216 IMAKEENV= ${CROSSENV} \
217 PATH=${STRICTTMPPATH}:${INSTALLTMP}
218 IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1
221 KMAKEENV= ${WMAKEENV}
223 USRDIRS= usr/bin usr/lib/compat/aout usr/games usr/libdata/ldscripts \
224 usr/libexec usr/sbin usr/share/misc \
226 usr/share/groff_font/devX100 \
227 usr/share/groff_font/devX100-12 \
228 usr/share/groff_font/devX75 \
229 usr/share/groff_font/devX75-12 \
230 usr/share/groff_font/devascii \
231 usr/share/groff_font/devcp1047 \
232 usr/share/groff_font/devdvi \
233 usr/share/groff_font/devhtml \
234 usr/share/groff_font/devkoi8-r \
235 usr/share/groff_font/devlatin1 \
236 usr/share/groff_font/devlbp \
237 usr/share/groff_font/devlj4 \
238 usr/share/groff_font/devps \
239 usr/share/groff_font/devutf8 \
240 usr/share/tmac/mdoc usr/share/tmac/mm
242 INCDIRS= arpa dev fs g++/backward g++/bits g++/ext isc isofs libmilter \
243 objc openssl protocols readline rpc rpcsvc security ufs
248 # Attempt to rebuild the entire system, with reasonable chance of
249 # success, regardless of how old your existing system is.
252 .if ${.CURDIR:C/[^,]//g} != ""
253 # The m4 build of sendmail files doesn't like it if ',' is used
254 # anywhere in the path of it's files.
256 @echo "*** Error: path to source tree contains a comma ','"
261 @echo "--------------------------------------------------------------"
262 @echo ">>> Rebuilding the temporary build tree"
263 @echo "--------------------------------------------------------------"
264 .if !defined(NOCLEAN)
267 # XXX - These two can depend on any header file.
268 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
269 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
271 .for _dir in ${USRDIRS}
272 mkdir -p ${WORLDTMP}/${_dir}
274 .for _dir in ${INCDIRS}
275 mkdir -p ${WORLDTMP}/usr/include/${_dir}
277 ln -sf ${.CURDIR}/sys ${WORLDTMP}
280 @echo "--------------------------------------------------------------"
281 @echo ">>> stage 1: bootstrap tools"
282 @echo "--------------------------------------------------------------"
283 cd ${.CURDIR}; ${BMAKE} bootstrap-tools
285 .if !defined(NOCLEAN)
287 @echo "--------------------------------------------------------------"
288 @echo ">>> stage 2: cleaning up the object tree"
289 @echo "--------------------------------------------------------------"
290 cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
294 @echo "--------------------------------------------------------------"
295 @echo ">>> stage 2: rebuilding the object tree"
296 @echo "--------------------------------------------------------------"
297 cd ${.CURDIR}; ${WMAKE} par-obj
300 @echo "--------------------------------------------------------------"
301 @echo ">>> stage 2: build tools"
302 @echo "--------------------------------------------------------------"
303 cd ${.CURDIR}; ${TMAKE} build-tools
306 @echo "--------------------------------------------------------------"
307 @echo ">>> stage 3: cross tools"
308 @echo "--------------------------------------------------------------"
309 cd ${.CURDIR}; ${XMAKE} cross-tools
312 @echo "--------------------------------------------------------------"
313 @echo ">>> stage 4: populating ${WORLDTMP}/usr/include"
314 @echo "--------------------------------------------------------------"
315 cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
318 @echo "--------------------------------------------------------------"
319 @echo ">>> stage 4: building libraries"
320 @echo "--------------------------------------------------------------"
321 cd ${.CURDIR}; ${WMAKE} -DNOHTML -DNOINFO -DNOMAN -DNOFSCHG libraries
324 @echo "--------------------------------------------------------------"
325 @echo ">>> stage 4: make dependencies"
326 @echo "--------------------------------------------------------------"
327 cd ${.CURDIR}; ${WMAKE} par-depend
330 @echo "--------------------------------------------------------------"
331 @echo ">>> stage 4: building everything.."
332 @echo "--------------------------------------------------------------"
333 cd ${.CURDIR}; ${WMAKE} all
337 .if !defined(SUBDIR_OVERRIDE)
338 WMAKE_TGTS+= _worldtmp _bootstrap-tools
340 WMAKE_TGTS+= _cleanobj _obj _build-tools
341 .if !defined(SUBDIR_OVERRIDE)
342 WMAKE_TGTS+= _cross-tools
344 WMAKE_TGTS+= _includes _libraries _depend everything
346 buildworld: ${WMAKE_TGTS}
347 .ORDER: ${WMAKE_TGTS}
352 # Checks to be sure system is ready for installworld
355 .if !defined(NO_SENDMAIL)
356 @if ! `grep -q '^smmsp:' /etc/passwd`; then \
357 echo "ERROR: Required smmsp user is missing, see /usr/src/UPDATING."; \
360 @if ! `grep -q '^smmsp:' /etc/group`; then \
361 echo "ERROR: Required smmsp group is missing, see /usr/src/UPDATING."; \
365 .if ${TARGET_ARCH} == ${MACHINE_ARCH} && !defined(DISTDIR) && \
366 (!defined(DESTDIR) || empty(DESTDIR) || ${DESTDIR} == "/")
367 @echo "Checking to see if your booted kernel is fresh enough.."
368 ${.OBJDIR}/bin/sh/sh -c \
369 'echo "Testing installed kernel for new sigaction(2) syscall"'
376 # Distributes everything compiled by a `buildworld'.
380 # Installs everything compiled by a 'buildworld'.
382 distributeworld installworld: installcheck
383 mkdir -p ${INSTALLTMP}
384 for prog in [ awk cap_mkdb cat chflags chmod chown \
385 date echo egrep find grep \
386 ln make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
387 test true uname wc zic; do \
388 cp `which $$prog` ${INSTALLTMP}; \
390 cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}
396 # If you have a build server, you can NFS mount the source and obj directories
397 # and do a 'make reinstall' on the *client* to install new binaries from the
398 # most recent server build.
401 @echo "--------------------------------------------------------------"
402 @echo ">>> Making hierarchy"
403 @echo "--------------------------------------------------------------"
404 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
406 @echo "--------------------------------------------------------------"
407 @echo ">>> Installing everything.."
408 @echo "--------------------------------------------------------------"
409 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
410 .if !defined(NOMAN) && !defined(NO_MAKEDB_RUN)
412 @echo "--------------------------------------------------------------"
413 @echo ">>> Rebuilding man page indices"
414 @echo "--------------------------------------------------------------"
415 cd ${.CURDIR}/share/man; ${MAKE} makedb
419 @echo "--------------------------------------------------------------"
420 @echo ">>> Distributing everything.."
421 @echo "--------------------------------------------------------------"
422 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
425 # buildkernel and installkernel
427 # Which kernels to build and/or install is specified by setting
428 # KERNCONF. If not defined a GENERIC kernel is built/installed.
429 # Only the existing (depending TARGET) config files are used
430 # for building kernels and only the first of these is designated
431 # as the one being installed.
433 # Note that we have to use TARGET instead of TARGET_ARCH when
434 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
435 # be set to cross-build, we have to make sure TARGET is set
438 .if !defined(KERNCONF) && defined(KERNEL)
444 INSTKERNNAME?= kernel
446 KRNLSRCDIR= ${.CURDIR}/sys
447 KRNLCONFDIR= ${KRNLSRCDIR}/${TARGET}/conf
448 KRNLOBJDIR= ${OBJTREE}${KRNLSRCDIR}
449 KERNCONFDIR?= ${KRNLCONFDIR}
453 .for _kernel in ${KERNCONF}
454 .if exists(${KERNCONFDIR}/${_kernel})
455 BUILDKERNELS+= ${_kernel}
456 .if empty(INSTALLKERNEL)
457 INSTALLKERNEL= ${_kernel}
465 # Builds all kernels defined by BUILDKERNELS.
468 .if empty(BUILDKERNELS)
469 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF}).";
472 .if defined(KERNWARN)
473 @echo "--------------------------------------------------------------"
474 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
475 @echo "--------------------------------------------------------------"
479 .for _kernel in ${BUILDKERNELS}
480 @echo "--------------------------------------------------------------"
481 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
482 @echo "--------------------------------------------------------------"
483 @echo "===> ${_kernel}"
484 mkdir -p ${KRNLOBJDIR}
485 .if !defined(NO_KERNELCONFIG)
488 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
489 ${KERNCONFDIR}/${_kernel}
491 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
492 cd ${KRNLOBJDIR}/${_kernel}; \
493 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} ${CLEANDIR}
495 cd ${KRNLOBJDIR}/${_kernel}; \
496 MAKESRCPATH=${KRNLSRCDIR}/dev/aic7xxx/aicasm \
497 ${MAKE} -DNO_CPU_CFLAGS -f ${KRNLSRCDIR}/dev/aic7xxx/aicasm/Makefile
498 cd ${KRNLOBJDIR}/${_kernel}; \
499 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} obj
500 # XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case.
501 .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KRNLSRCDIR}/modules)
502 .for target in obj depend all
503 cd ${.CURDIR}/sys/modules/aic7xxx/aicasm; \
504 MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
505 ${MAKE} -DNO_CPU_CFLAGS ${target}
508 .if !defined(NO_KERNELDEPEND)
509 cd ${KRNLOBJDIR}/${_kernel}; \
510 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend -DNO_MODULES_OBJ
512 cd ${KRNLOBJDIR}/${_kernel}; \
513 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all -DNO_MODULES_OBJ
514 @echo "--------------------------------------------------------------"
515 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
516 @echo "--------------------------------------------------------------"
522 # Install the kernel defined by INSTALLKERNEL
524 installkernel reinstallkernel:
525 .if empty(INSTALLKERNEL)
526 @echo "ERROR: No kernel \"${KERNCONF}\" to install."
529 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
530 ${CROSSENV} PATH=${TMPPATH} \
531 ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//}
536 # Update the source tree, by running sup and/or running cvs to update to the
540 .if defined(SUP_UPDATE)
541 @echo "--------------------------------------------------------------"
542 @echo ">>> Running ${SUP}"
543 @echo "--------------------------------------------------------------"
545 @${SUP} ${SUPFLAGS} ${SUPFILE}
547 .if defined(SUPFILE1)
548 @${SUP} ${SUPFLAGS} ${SUPFILE1}
550 .if defined(SUPFILE2)
551 @${SUP} ${SUPFLAGS} ${SUPFILE2}
553 .if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
554 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
556 .if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
557 @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
560 .if defined(CVS_UPDATE)
561 @echo "--------------------------------------------------------------"
562 @echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT}
563 @echo "--------------------------------------------------------------"
564 cd ${.CURDIR}; ${CVS} -R -q update -A -P -d
570 # Build most of the user binaries on the existing system libs and includes.
573 @echo "--------------------------------------------------------------"
574 @echo ">>> Building programs only"
575 @echo "--------------------------------------------------------------"
576 .for _dir in bin sbin libexec usr.bin usr.sbin gnu/usr.bin gnu/usr.sbin
577 cd ${.CURDIR}/${_dir}; ${MAKE} DIRPRFX=${_dir}/ all
583 # Install the binaries built by the 'most' target. This does not include
584 # libraries or include files.
587 @echo "--------------------------------------------------------------"
588 @echo ">>> Installing programs only"
589 @echo "--------------------------------------------------------------"
590 .for _dir in bin sbin libexec usr.bin usr.sbin gnu/usr.bin gnu/usr.sbin
591 cd ${.CURDIR}/${_dir}; ${MAKE} DIRPRFX=${_dir}/ install
595 # ------------------------------------------------------------------------
597 # From here onwards are utility targets used by the 'make world' and
598 # related targets. If your 'world' breaks, you may like to try to fix
599 # the problem and manually run the following targets to attempt to
600 # complete the build. Beware, this is *not* guaranteed to work, you
601 # need to have a pretty good grip on the current state of the system
602 # to attempt to manually finish it. If in doubt, 'make world' again.
606 # bootstrap-tools: Build tools needed for compatibility
608 .if exists(${.CURDIR}/games) && !defined(NOGAMES)
609 _strfile= games/fortune/strfile
613 .for _tool in ${_strfile} usr.bin/yacc usr.bin/colldef \
614 usr.bin/makewhatis usr.bin/rpcgen usr.bin/uudecode \
615 usr.bin/xargs usr.bin/xinstall \
616 usr.sbin/config usr.sbin/kbdcontrol \
617 gnu/usr.bin/gperf gnu/usr.bin/groff gnu/usr.bin/texinfo
618 ${ECHODIR} "===> ${_tool}"; \
619 cd ${.CURDIR}/${_tool}; \
620 ${MAKE} DIRPRFX=${_tool}/ obj; \
621 ${MAKE} DIRPRFX=${_tool}/ depend; \
622 ${MAKE} DIRPRFX=${_tool}/ all; \
623 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
627 # build-tools: Build special purpose build tools
629 .if defined(MODULES_WITH_WORLD) && exists(${KRNLSRCDIR}/modules)
630 _aicasm= sys/modules/aic7xxx/aicasm
633 .if exists(${.CURDIR}/share) && !defined(NOSHARE)
634 _share= share/syscons/scrnmaps
637 .if !defined(NO_FORTRAN)
638 _fortran= gnu/usr.bin/cc/f771
641 .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
642 !defined(NOCRYPT) && defined(MAKE_KERBEROS5)
643 _libkrb5= kerberos5/lib/libroken kerberos5/lib/libvers \
644 kerberos5/lib/libasn1 kerberos5/lib/libhdb kerberos5/lib/libsl
648 .for _tool in bin/csh bin/sh gnu/usr.bin/cc/cc_tools ${_fortran} \
649 ${_libkrb5} lib/libncurses ${_share} \
650 ${_aicasm} usr.bin/awk usr.bin/file usr.sbin/sysinstall
651 ${ECHODIR} "===> ${_tool}"; \
652 cd ${.CURDIR}/${_tool}; \
653 ${MAKE} DIRPRFX=${_tool}/ obj; \
654 ${MAKE} DIRPRFX=${_tool}/ build-tools
658 # cross-tools: Build cross-building tools
660 .if ${TARGET_ARCH} == "alpha" && ${TARGET_ARCH} != ${MACHINE_ARCH}
661 _elf2exe= usr.sbin/elf2exe
664 .if ${TARGET_ARCH} == "i386" && ${TARGET_ARCH} != ${MACHINE_ARCH}
665 _btxld= usr.sbin/btxld
666 .if defined(RELEASEDIR)
667 _kgzip= usr.sbin/kgzip
671 .if ${TARGET_ARCH} == "sparc64" && ${TARGET_ARCH} != ${MACHINE_ARCH}
672 _elf2aout= usr.bin/elf2aout
675 .if defined(RELEASEDIR)
676 _crunchide= usr.sbin/crunch/crunchide
679 _xlint= usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint
682 .for _tool in ${_btxld} ${_elf2aout} ${_elf2exe} \
683 gnu/usr.bin/binutils ${_crunchide} \
684 gnu/usr.bin/cc ${_xlint} ${_kgzip}
685 ${ECHODIR} "===> ${_tool}"; \
686 cd ${.CURDIR}/${_tool}; \
687 ${MAKE} DIRPRFX=${_tool}/ obj; \
688 ${MAKE} DIRPRFX=${_tool}/ depend; \
689 ${MAKE} DIRPRFX=${_tool}/ all; \
690 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
694 # hierarchy - ensure that all the needed directories are present
697 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs
700 # libraries - build all libraries, and install them under ${DESTDIR}.
702 # The list of libraries with dependents (${_prebuild_libs}) and their
703 # interdependencies (__L) are built automatically by the
704 # ${.CURDIR}/tools/make_libdeps.sh script.
708 ${MAKE} -f Makefile.inc1 _startup_libs; \
709 ${MAKE} -f Makefile.inc1 _prebuild_libs; \
710 ${MAKE} -f Makefile.inc1 _generic_libs;
712 # These dependencies are not automatically generated:
714 # gnu/lib/csu, gnu/lib/libgcc and lib/csu must be built before all
715 # shared libraries for ELF.
717 _startup_libs= gnu/lib/csu gnu/lib/libgcc
718 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
719 _startup_libs+= lib/csu/${MACHINE_ARCH}-elf
721 _startup_libs+= lib/csu/${MACHINE_ARCH}
726 _generic_libs= gnu/lib
728 .if !defined(NOCRYPT) && defined(MAKE_KERBEROS5)
729 _prebuild_libs+= kerberos5/lib/libasn1
730 _prebuild_libs+= kerberos5/lib/libgssapi
731 _prebuild_libs+= kerberos5/lib/libkrb5
732 _prebuild_libs+= kerberos5/lib/libroken
733 _generic_libs+= kerberos5/lib
736 _prebuild_libs+= lib/libcom_err lib/libcrypt lib/libkvm lib/libmd \
737 lib/libncurses lib/libopie lib/libpam lib/libradius \
739 lib/libsbuf lib/libtacplus lib/libutil lib/libypclnt \
742 lib/libopie__L lib/libradius__L lib/libtacplus__L: lib/libmd__L
743 lib/libypclnt__L: lib/librpcsvc__L
747 .if !defined(NOCRYPT) && !defined(NOSECURE)
748 .if !defined(NO_OPENSSL)
749 _prebuild_libs+= secure/lib/libcrypto secure/lib/libssl
750 .if !defined(NO_OPENSSH)
751 _prebuild_libs+= secure/lib/libssh
752 secure/lib/libssh__L: secure/lib/libcrypto__L lib/libz__L
755 _generic_libs+= secure/lib
758 _generic_libs+= usr.bin/lex/lib
760 .if ${MACHINE_ARCH} == "i386"
761 _generic_libs+= usr.sbin/pcvt/keycap
764 .for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
766 .if exists(${.CURDIR}/${_lib})
767 ${ECHODIR} "===> ${_lib}"; \
768 cd ${.CURDIR}/${_lib}; \
769 ${MAKE} DIRPRFX=${_lib}/ depend; \
770 ${MAKE} DIRPRFX=${_lib}/ all; \
771 ${MAKE} DIRPRFX=${_lib}/ install
775 # libpam is special: we need to build static PAM modules before
776 # static PAM library, and dynamic PAM library before dynamic PAM
778 lib/libpam__L: .PHONY
779 ${ECHODIR} "===> lib/libpam"; \
780 cd ${.CURDIR}/lib/libpam; \
781 ${MAKE} DIRPRFX=lib/libpam/ depend; \
782 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \
783 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install
785 _startup_libs: ${_startup_libs:S/$/__L/}
786 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
787 _generic_libs: ${_generic_libs:S/$/__L/}
789 .for __target in clean cleandepend cleandir depend includes obj
790 .for entry in ${SUBDIR}
791 ${entry}.${__target}__D: .PHONY
792 @if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
793 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
794 edir=${entry}.${MACHINE_ARCH}; \
795 cd ${.CURDIR}/$${edir}; \
797 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \
799 cd ${.CURDIR}/$${edir}; \
801 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
803 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
806 .include <bsd.subdir.mk>