4 # Make command line options:
5 # -DMAKE_KERBEROS4 to build KerberosIV
6 # -DMAKE_KERBEROS5 to build Kerberos5
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 # -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}/kerberosIV) && exists(${.CURDIR}/crypto) && \
64 !defined(NOCRYPT) && !defined(NO_OPENSSL) && defined(MAKE_KERBEROS4)
67 .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
68 !defined(NOCRYPT) && !defined(NO_OPENSSL) && defined(MAKE_KERBEROS5)
71 .if exists(${.CURDIR}/libexec)
74 .if exists(${.CURDIR}/sbin)
77 .if exists(${.CURDIR}/secure) && !defined(NOCRYPT) && !defined(NOSECURE)
80 .if exists(${.CURDIR}/share) && !defined(NOSHARE)
83 .if exists(${.CURDIR}/sys)
86 .if exists(${.CURDIR}/usr.bin)
89 .if exists(${.CURDIR}/usr.sbin)
93 # etc must be last for "distribute" to work
94 .if exists(${.CURDIR}/etc)
98 # These are last, since it is nice to at least get the base system
99 # rebuilt before you do them.
100 .if defined(LOCAL_DIRS)
101 .for _DIR in ${LOCAL_DIRS}
102 .if exists(${.CURDIR}/${_DIR}) & exists(${.CURDIR}/${_DIR}/Makefile)
108 .if defined(SUBDIR_OVERRIDE)
109 SUBDIR= ${SUBDIR_OVERRIDE}
112 .if defined(NOCLEANDIR)
113 CLEANDIR= clean cleandepend
119 SUP?= /usr/local/bin/cvsup
120 SUPFLAGS?= -g -L 2 -P -
122 SUPFLAGS+= -h ${SUPHOST}
125 MAKEOBJDIRPREFIX?= /usr/obj
126 OSRELDATE!= sysctl -n kern.osreldate
127 TARGET_ARCH?= ${MACHINE_ARCH}
128 .if ${TARGET_ARCH} == ${MACHINE_ARCH}
130 TARGET_CPUTYPE?=${CPUTYPE}
132 TARGET?= ${TARGET_ARCH}
135 .if !empty(TARGET_CPUTYPE)
136 _TARGET_CPUTYPE=${TARGET_CPUTYPE}
138 _TARGET_CPUTYPE=dummy
140 _CPUTYPE!= ${MAKE} -f /dev/null -m ${.CURDIR}/share/mk \
141 CPUTYPE=${_TARGET_CPUTYPE} -V CPUTYPE
142 .if ${_CPUTYPE} != ${_TARGET_CPUTYPE}
143 .error CPUTYPE global should be set with ?=.
146 BUILD_ARCH!= sysctl -n hw.machine_arch
147 .if ${MACHINE_ARCH} != ${BUILD_ARCH}
148 .error To cross-build, set TARGET_ARCH.
151 .if ${MACHINE} == ${TARGET}
152 OBJTREE= ${MAKEOBJDIRPREFIX}
154 OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}
156 WORLDTMP= ${OBJTREE}${.CURDIR}/${MACHINE_ARCH}
157 # /usr/games added for fortune which depend on strfile
158 STRICTTMPPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
159 TMPPATH= ${STRICTTMPPATH}:${PATH}
161 INSTALLTMP!= /usr/bin/mktemp -d -u -t install
164 # Building a world goes through the following stages
166 # 1. bootstrap-tool stage [BMAKE]
167 # This stage is responsible for creating programs that
168 # are needed for backward compatibility reasons. They
169 # are not built as cross-tools.
170 # 2. build-tool stage [TMAKE]
171 # This stage is responsible for creating the object
172 # tree and building any tools that are needed during
174 # 3. cross-tool stage [XMAKE]
175 # This stage is responsible for creating any tools that
176 # are needed for cross-builds. A cross-compiler is one
178 # 4. world stage [WMAKE]
179 # This stage actually builds the world.
180 # 5. install stage (optional) [IMAKE]
181 # This stage installs a previously built world.
184 # Common environment for world related stages
185 CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \
186 MACHINE_ARCH=${TARGET_ARCH} \
188 CPUTYPE=${TARGET_CPUTYPE} \
189 GROFF_BIN_PATH=${WORLDTMP}/usr/bin \
190 GROFF_FONT_PATH=${WORLDTMP}/usr/share/groff_font \
191 GROFF_TMAC_PATH=${WORLDTMP}/usr/share/tmac
193 # bootstrap-tool stage
194 BMAKEENV= MAKEOBJDIRPREFIX=${WORLDTMP} \
196 INSTALL="sh ${.CURDIR}/tools/install.sh"
197 BMAKE= ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
198 BOOTSTRAPPING=${OSRELDATE} \
199 -DNOHTML -DNOINFO -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED \
200 -DNO_CPU_CFLAGS -DNO_WERROR
203 TMAKEENV= MAKEOBJDIRPREFIX=${OBJTREE} \
205 INSTALL="sh ${.CURDIR}/tools/install.sh"
206 TMAKE= ${TMAKEENV} ${MAKE} -f Makefile.inc1 \
207 BOOTSTRAPPING=${OSRELDATE} -DNO_CPU_CFLAGS
210 XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} -DNO_FORTRAN -DNO_GDB
213 WMAKEENV= ${CROSSENV} \
214 DESTDIR=${WORLDTMP} \
215 INSTALL="sh ${.CURDIR}/tools/install.sh" \
217 WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1
220 IMAKEENV= ${CROSSENV} \
221 PATH=${STRICTTMPPATH}:${INSTALLTMP}
222 IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1
225 KMAKEENV= ${WMAKEENV}
227 USRDIRS= usr/bin usr/lib/compat/aout usr/games usr/libdata/ldscripts \
228 usr/libexec usr/sbin usr/share/misc \
230 usr/share/groff_font/devX100 \
231 usr/share/groff_font/devX100-12 \
232 usr/share/groff_font/devX75 \
233 usr/share/groff_font/devX75-12 \
234 usr/share/groff_font/devascii \
235 usr/share/groff_font/devcp1047 \
236 usr/share/groff_font/devdvi \
237 usr/share/groff_font/devhtml \
238 usr/share/groff_font/devkoi8-r \
239 usr/share/groff_font/devlatin1 \
240 usr/share/groff_font/devlbp \
241 usr/share/groff_font/devlj4 \
242 usr/share/groff_font/devps \
243 usr/share/groff_font/devutf8 \
244 usr/share/tmac/mdoc usr/share/tmac/mm
246 INCDIRS= arpa dev fs g++/backward g++/bits g++/ext isc isofs libmilter \
247 objc openssl protocols readline rpc rpcsvc security ufs
252 # Attempt to rebuild the entire system, with reasonable chance of
253 # success, regardless of how old your existing system is.
257 @echo "--------------------------------------------------------------"
258 @echo ">>> Rebuilding the temporary build tree"
259 @echo "--------------------------------------------------------------"
260 .if !defined(NOCLEAN)
263 # XXX - These two can depend on any header file.
264 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
265 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
267 .for _dir in ${USRDIRS}
268 mkdir -p ${WORLDTMP}/${_dir}
270 .for _dir in ${INCDIRS}
271 mkdir -p ${WORLDTMP}/usr/include/${_dir}
273 ln -sf ${.CURDIR}/sys ${WORLDTMP}
276 @echo "--------------------------------------------------------------"
277 @echo ">>> stage 1: bootstrap tools"
278 @echo "--------------------------------------------------------------"
279 cd ${.CURDIR}; ${BMAKE} bootstrap-tools
281 .if !defined(NOCLEAN)
283 @echo "--------------------------------------------------------------"
284 @echo ">>> stage 2: cleaning up the object tree"
285 @echo "--------------------------------------------------------------"
286 cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
290 @echo "--------------------------------------------------------------"
291 @echo ">>> stage 2: rebuilding the object tree"
292 @echo "--------------------------------------------------------------"
293 cd ${.CURDIR}; ${WMAKE} par-obj
296 @echo "--------------------------------------------------------------"
297 @echo ">>> stage 2: build tools"
298 @echo "--------------------------------------------------------------"
299 cd ${.CURDIR}; ${TMAKE} build-tools
302 @echo "--------------------------------------------------------------"
303 @echo ">>> stage 3: cross tools"
304 @echo "--------------------------------------------------------------"
305 cd ${.CURDIR}; ${XMAKE} cross-tools
308 @echo "--------------------------------------------------------------"
309 @echo ">>> stage 4: populating ${WORLDTMP}/usr/include"
310 @echo "--------------------------------------------------------------"
311 cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
314 @echo "--------------------------------------------------------------"
315 @echo ">>> stage 4: building libraries"
316 @echo "--------------------------------------------------------------"
317 cd ${.CURDIR}; ${WMAKE} -DNOHTML -DNOINFO -DNOMAN -DNOFSCHG libraries
320 @echo "--------------------------------------------------------------"
321 @echo ">>> stage 4: make dependencies"
322 @echo "--------------------------------------------------------------"
323 cd ${.CURDIR}; ${WMAKE} par-depend
326 @echo "--------------------------------------------------------------"
327 @echo ">>> stage 4: building everything.."
328 @echo "--------------------------------------------------------------"
329 cd ${.CURDIR}; ${WMAKE} all
333 .if !defined(SUBDIR_OVERRIDE)
334 WMAKE_TGTS+= _worldtmp _bootstrap-tools
336 WMAKE_TGTS+= _cleanobj _obj _build-tools
337 .if !defined(SUBDIR_OVERRIDE)
338 WMAKE_TGTS+= _cross-tools
340 WMAKE_TGTS+= _includes _libraries _depend everything
342 buildworld: ${WMAKE_TGTS}
343 .ORDER: ${WMAKE_TGTS}
348 # Checks to be sure system is ready for installworld
351 .if !defined(NO_SENDMAIL)
352 @if ! `grep -q '^smmsp:' /etc/passwd`; then \
353 echo "ERROR: Required smmsp user is missing, see /usr/src/UPDATING."; \
356 @if ! `grep -q '^smmsp:' /etc/group`; then \
357 echo "ERROR: Required smmsp group is missing, see /usr/src/UPDATING."; \
361 .if ${TARGET_ARCH} == ${MACHINE_ARCH} && !defined(DISTDIR) && \
362 (!defined(DESTDIR) || empty(DESTDIR) || ${DESTDIR} == "/")
363 @echo "Checking to see if your booted kernel is fresh enough.."
364 ${.OBJDIR}/bin/sh/sh -c \
365 'echo "Testing installed kernel for new sigaction(2) syscall"'
372 # Distributes everything compiled by a `buildworld'.
376 # Installs everything compiled by a 'buildworld'.
378 distributeworld installworld: installcheck
379 mkdir -p ${INSTALLTMP}
380 for prog in [ awk cat chflags chmod chown date echo egrep find grep \
381 ln make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
382 test true uname wc zic; do \
383 cp `which $$prog` ${INSTALLTMP}; \
385 cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}
391 # If you have a build server, you can NFS mount the source and obj directories
392 # and do a 'make reinstall' on the *client* to install new binaries from the
393 # most recent server build.
396 @echo "--------------------------------------------------------------"
397 @echo ">>> Making hierarchy"
398 @echo "--------------------------------------------------------------"
399 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
401 @echo "--------------------------------------------------------------"
402 @echo ">>> Installing everything.."
403 @echo "--------------------------------------------------------------"
404 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
405 .if !defined(NOMAN) && !defined(NO_MAKEDB_RUN)
407 @echo "--------------------------------------------------------------"
408 @echo ">>> Rebuilding man page indices"
409 @echo "--------------------------------------------------------------"
410 cd ${.CURDIR}/share/man; ${MAKE} makedb
414 @echo "--------------------------------------------------------------"
415 @echo ">>> Distributing everything.."
416 @echo "--------------------------------------------------------------"
417 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
420 # buildkernel and installkernel
422 # Which kernels to build and/or install is specified by setting
423 # KERNCONF. If not defined a GENERIC kernel is built/installed.
424 # Only the existing (depending TARGET) config files are used
425 # for building kernels and only the first of these is designated
426 # as the one being installed.
428 # Note that we have to use TARGET instead of TARGET_ARCH when
429 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
430 # be set to cross-build, we have to make sure TARGET is set
433 .if !defined(KERNCONF) && defined(KERNEL)
439 INSTKERNNAME?= kernel
441 KRNLSRCDIR= ${.CURDIR}/sys
442 KRNLCONFDIR= ${KRNLSRCDIR}/${TARGET}/conf
443 KRNLOBJDIR= ${OBJTREE}${KRNLSRCDIR}
444 KERNCONFDIR?= ${KRNLCONFDIR}
448 .for _kernel in ${KERNCONF}
449 .if exists(${KERNCONFDIR}/${_kernel})
450 BUILDKERNELS+= ${_kernel}
451 .if empty(INSTALLKERNEL)
452 INSTALLKERNEL= ${_kernel}
460 # Builds all kernels defined by BUILDKERNELS.
463 .if empty(BUILDKERNELS)
464 @echo ">>> ERROR: Missing kernel configuration file(s) (${KERNCONF})."
467 .if defined(KERNWARN)
468 @echo "--------------------------------------------------------------"
469 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
470 @echo "--------------------------------------------------------------"
474 .for _kernel in ${BUILDKERNELS}
475 @echo "--------------------------------------------------------------"
476 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
477 @echo "--------------------------------------------------------------"
478 @echo "===> ${_kernel}"
479 mkdir -p ${KRNLOBJDIR}
480 .if !defined(NO_KERNELCONFIG)
483 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
484 ${KERNCONFDIR}/${_kernel}
486 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
487 cd ${KRNLOBJDIR}/${_kernel}; \
488 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} -DNO_MODULES clean
489 .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KRNLSRCDIR}/modules)
490 cd ${KRNLOBJDIR}/${_kernel}; \
491 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} cleandir
494 cd ${KRNLOBJDIR}/${_kernel}; \
495 MAKESRCPATH=${KRNLSRCDIR}/dev/aic7xxx/aicasm \
496 ${MAKE} -DNO_CPU_CFLAGS -f ${KRNLSRCDIR}/dev/aic7xxx/aicasm/Makefile
497 .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KRNLSRCDIR}/modules)
498 cd ${KRNLOBJDIR}/${_kernel}; \
499 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} modules-obj
500 cd ${.CURDIR}/sys/modules/aic7xxx/aicasm; \
501 MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
502 ${MAKE} -DNO_CPU_CFLAGS depend; \
503 MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
504 ${MAKE} -DNO_CPU_CFLAGS all
506 .if !defined(NO_KERNELDEPEND)
507 cd ${KRNLOBJDIR}/${_kernel}; \
508 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend -DNO_MODULES_OBJ
510 cd ${KRNLOBJDIR}/${_kernel}; \
511 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all -DNO_MODULES_OBJ
512 @echo "--------------------------------------------------------------"
513 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
514 @echo "--------------------------------------------------------------"
520 # Install the kernel defined by INSTALLKERNEL
522 installkernel reinstallkernel:
523 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
524 ${CROSSENV} ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//}
529 # Update the source tree, by running sup and/or running cvs to update to the
533 .if defined(SUP_UPDATE)
534 @echo "--------------------------------------------------------------"
535 @echo ">>> Running ${SUP}"
536 @echo "--------------------------------------------------------------"
538 @${SUP} ${SUPFLAGS} ${SUPFILE}
540 .if defined(SUPFILE1)
541 @${SUP} ${SUPFLAGS} ${SUPFILE1}
543 .if defined(SUPFILE2)
544 @${SUP} ${SUPFLAGS} ${SUPFILE2}
546 .if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
547 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
549 .if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
550 @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
553 .if defined(CVS_UPDATE)
554 @echo "--------------------------------------------------------------"
555 @echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT}
556 @echo "--------------------------------------------------------------"
557 cd ${.CURDIR}; ${CVS} -q update -A -P -d
563 # Build most of the user binaries on the existing system libs and includes.
566 @echo "--------------------------------------------------------------"
567 @echo ">>> Building programs only"
568 @echo "--------------------------------------------------------------"
569 .for _dir in bin sbin libexec usr.bin usr.sbin gnu/usr.bin gnu/usr.sbin
570 cd ${.CURDIR}/${_dir}; ${MAKE} DIRPRFX=${_dir}/ all
576 # Install the binaries built by the 'most' target. This does not include
577 # libraries or include files.
580 @echo "--------------------------------------------------------------"
581 @echo ">>> Installing programs only"
582 @echo "--------------------------------------------------------------"
583 .for _dir in bin sbin libexec usr.bin usr.sbin gnu/usr.bin gnu/usr.sbin
584 cd ${.CURDIR}/${_dir}; ${MAKE} DIRPRFX=${_dir}/ install
588 # ------------------------------------------------------------------------
590 # From here onwards are utility targets used by the 'make world' and
591 # related targets. If your 'world' breaks, you may like to try to fix
592 # the problem and manually run the following targets to attempt to
593 # complete the build. Beware, this is *not* guaranteed to work, you
594 # need to have a pretty good grip on the current state of the system
595 # to attempt to manually finish it. If in doubt, 'make world' again.
599 # bootstrap-tools: Build tools needed for compatibility
601 .if exists(${.CURDIR}/games) && !defined(NOGAMES)
602 _strfile= games/fortune/strfile
606 .for _tool in ${_strfile} usr.bin/yacc usr.bin/colldef \
607 usr.bin/makewhatis usr.bin/rpcgen usr.bin/uudecode \
608 usr.bin/xargs usr.bin/xinstall \
609 usr.sbin/config usr.sbin/kbdcontrol \
610 gnu/usr.bin/gperf gnu/usr.bin/groff gnu/usr.bin/texinfo
611 ${ECHODIR} "===> ${_tool}"; \
612 cd ${.CURDIR}/${_tool}; \
613 ${MAKE} DIRPRFX=${_tool}/ obj; \
614 ${MAKE} DIRPRFX=${_tool}/ depend; \
615 ${MAKE} DIRPRFX=${_tool}/ all; \
616 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
620 # build-tools: Build special purpose build tools
622 .if defined(MODULES_WITH_WORLD) && exists(${KRNLSRCDIR}/modules)
623 _aicasm= sys/modules/aic7xxx/aicasm
626 .if exists(${.CURDIR}/share) && !defined(NOSHARE)
627 _share= share/syscons/scrnmaps
630 .if !defined(NO_FORTRAN)
631 _fortran= gnu/usr.bin/cc/f771
634 .if exists(${.CURDIR}/kerberosIV) && exists(${.CURDIR}/crypto) && \
635 !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
636 _libroken4= kerberosIV/lib/libroken
639 .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
640 !defined(NOCRYPT) && defined(MAKE_KERBEROS5)
641 _libkrb5= kerberos5/lib/libroken kerberos5/lib/libvers \
642 kerberos5/lib/libasn1 kerberos5/lib/libhdb kerberos5/lib/libsl
646 .for _tool in bin/csh bin/sh gnu/usr.bin/cc/cc_tools ${_fortran} \
647 ${_libroken4} ${_libkrb5} lib/libncurses ${_share} \
648 ${_aicasm} usr.bin/awk usr.bin/file usr.sbin/sysinstall
649 ${ECHODIR} "===> ${_tool}"; \
650 cd ${.CURDIR}/${_tool}; ${MAKE} DIRPRFX=${_tool}/ build-tools
654 # cross-tools: Build cross-building tools
656 .if ${TARGET_ARCH} == "alpha" && ${MACHINE_ARCH} != "alpha"
657 _elf2exe= usr.sbin/elf2exe
660 .if ${TARGET_ARCH} == "i386" && ${MACHINE_ARCH} != "i386"
661 _btxld= usr.sbin/btxld
664 .if ${TARGET_ARCH} == "sparc64"
665 _elf2aout= usr.sbin/elf2aout
668 _xlint= usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint
671 .for _tool in ${_btxld} ${_elf2aout} ${_elf2exe} \
672 gnu/usr.bin/binutils usr.sbin/crunch/crunchide \
673 gnu/usr.bin/cc ${_xlint}
674 ${ECHODIR} "===> ${_tool}"; \
675 cd ${.CURDIR}/${_tool}; \
676 ${MAKE} DIRPRFX=${_tool}/ obj; \
677 ${MAKE} DIRPRFX=${_tool}/ depend; \
678 ${MAKE} DIRPRFX=${_tool}/ all; \
679 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
683 # hierarchy - ensure that all the needed directories are present
686 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs
689 # libraries - build all libraries, and install them under ${DESTDIR}.
691 # The list of libraries with dependents (${_prebuild_libs}) and their
692 # interdependencies (__L) are built automatically by the
693 # ${.CURDIR}/tools/make_libdeps.sh script.
697 ${MAKE} -f Makefile.inc1 _startup_libs; \
698 ${MAKE} -f Makefile.inc1 _prebuild_libs; \
699 ${MAKE} -f Makefile.inc1 _generic_libs;
701 # These dependencies are not automatically generated:
703 # gnu/lib/csu, gnu/lib/libgcc and lib/csu must be built before all
704 # shared libraries for ELF.
706 _startup_libs= gnu/lib/csu gnu/lib/libgcc
707 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
708 _startup_libs+= lib/csu/${MACHINE_ARCH}-elf
710 _startup_libs+= lib/csu/${MACHINE_ARCH}
715 _generic_libs= gnu/lib
717 .if !defined(NOCRYPT) && defined(MAKE_KERBEROS5)
718 _prebuild_libs+= kerberos5/lib/libasn1
719 _prebuild_libs+= kerberos5/lib/libgssapi
720 _prebuild_libs+= kerberos5/lib/libkrb5
721 _prebuild_libs+= kerberos5/lib/libroken
722 _generic_libs+= kerberos5/lib
725 .if !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
726 _prebuild_libs+= kerberosIV/lib/libkrb
727 kerberosIV/lib/libkrb__L: lib/libcrypt__L
728 _generic_libs+= kerberosIV/lib
731 _prebuild_libs+= lib/libcom_err lib/libcrypt lib/libkvm lib/libmd \
732 lib/libncurses lib/libopie lib/libpam lib/libradius \
734 lib/libsbuf lib/libtacplus lib/libutil lib/libypclnt \
737 lib/libopie__L lib/libradius__L lib/libtacplus__L: lib/libmd__L
738 lib/libypclnt__L: lib/librpcsvc__L
742 .if !defined(NOCRYPT) && !defined(NOSECURE)
743 .if !defined(NO_OPENSSL)
744 _prebuild_libs+= secure/lib/libcrypto secure/lib/libssl
745 .if !defined(NO_OPENSSH)
746 _prebuild_libs+= secure/lib/libssh
747 secure/lib/libssh__L: secure/lib/libcrypto__L lib/libz__L
750 _generic_libs+= secure/lib
753 _generic_libs+= usr.bin/lex/lib
755 .if ${MACHINE_ARCH} == "i386"
756 _generic_libs+= usr.sbin/pcvt/keycap
759 .for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
761 .if exists(${.CURDIR}/${_lib})
762 ${ECHODIR} "===> ${_lib}"; \
763 cd ${.CURDIR}/${_lib}; \
764 ${MAKE} DIRPRFX=${_lib}/ depend; \
765 ${MAKE} DIRPRFX=${_lib}/ all; \
766 ${MAKE} DIRPRFX=${_lib}/ install
770 # libpam is special: we need to build static PAM modules before
771 # static PAM library, and dynamic PAM library before dynamic PAM
773 lib/libpam__L: .PHONY
774 ${ECHODIR} "===> lib/libpam"; \
775 cd ${.CURDIR}/lib/libpam; \
776 ${MAKE} DIRPRFX=lib/libpam/ depend; \
777 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \
778 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install
780 _startup_libs: ${_startup_libs:S/$/__L/}
781 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
782 _generic_libs: ${_generic_libs:S/$/__L/}
784 .for __target in clean cleandepend cleandir depend includes obj
785 .for entry in ${SUBDIR}
786 ${entry}.${__target}__D: .PHONY
787 @if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
788 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
789 edir=${entry}.${MACHINE_ARCH}; \
790 cd ${.CURDIR}/$${edir}; \
792 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \
794 cd ${.CURDIR}/$${edir}; \
796 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
798 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
801 .include <bsd.subdir.mk>