2 # $FreeBSD: src/Makefile.inc1,v 1.141.2.62 2003/04/06 19:54:00 dwmalone Exp $
3 # $DragonFly: src/Makefile.inc1,v 1.22 2004/03/21 03:48:38 dillon Exp $
5 # Make command line options:
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 # -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 # We must do include and lib early so that the perl *.ph generation
48 # works correctly as it uses the header files installed by this.
49 .if exists(${.CURDIR}/include)
52 .if exists(${.CURDIR}/lib)
55 # This exists simply to ensure that the obj dir hierarchy is
56 # intact for nrelease, allowing the nrelease Makefile's to
57 # reference ${.OBJDIR}.
59 .if exists(${.CURDIR}/nrelease)
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(MAKE_KERBEROS5)
76 .if exists(${.CURDIR}/libexec)
79 .if exists(${.CURDIR}/sbin)
82 .if exists(${.CURDIR}/secure) && !defined(NOCRYPT)
85 .if exists(${.CURDIR}/share) && !defined(NOSHARE)
88 .if exists(${.CURDIR}/sys)
91 .if exists(${.CURDIR}/usr.bin)
94 .if exists(${.CURDIR}/usr.sbin)
98 # etc must be last for "distribute" to work
99 .if exists(${.CURDIR}/etc)
103 # These are last, since it is nice to at least get the base system
104 # rebuilt before you do them.
105 .if defined(LOCAL_DIRS)
106 .for _DIR in ${LOCAL_DIRS}
107 .if exists(${.CURDIR}/${_DIR}) & exists(${.CURDIR}/${_DIR}/Makefile)
113 .if defined(SUBDIR_OVERRIDE)
114 SUBDIR= ${SUBDIR_OVERRIDE}
117 .if defined(NOCLEANDIR)
118 CLEANDIR= clean cleandepend
123 SUP?= /usr/local/bin/cvsup
124 SUPFLAGS?= -g -L 2 -P -
126 SUPFLAGS+= -h ${SUPHOST}
129 MAKEOBJDIRPREFIX?= /usr/obj
130 TARGET_ARCH?= ${MACHINE_ARCH}
131 .if ${TARGET_ARCH} == ${MACHINE_ARCH}
134 TARGET?= ${TARGET_ARCH}
137 BUILD_ARCH!= sysctl -n hw.machine_arch
138 .if ${MACHINE_ARCH} != ${BUILD_ARCH}
139 .error To cross-build, set TARGET_ARCH.
142 .if ${MACHINE} == ${TARGET}
143 OBJTREE= ${MAKEOBJDIRPREFIX}
145 OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}
147 WORLDTMP= ${OBJTREE}${.CURDIR}/${MACHINE_ARCH}
148 # /usr/games added for fortune which depend on strfile
149 STRICTTMPPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
150 TMPPATH= ${STRICTTMPPATH}:${PATH}
154 INSTALLTMP= ${TMPDIR}/install.${TMPPID}
157 # Building a world goes through the following stages
159 # 1. bootstrap-tool stage [BMAKE]
160 # This stage is responsible for creating programs that
161 # are needed for backward compatibility reasons. They
162 # are not built as cross-tools.
163 # 2. build-tool stage [TMAKE]
164 # This stage is responsible for creating the object
165 # tree and building any tools that are needed during
167 # 3. cross-tool stage [XMAKE]
168 # This stage is responsible for creating any tools that
169 # are needed for cross-builds. A cross-compiler is one
171 # 4. world stage [WMAKE]
172 # This stage actually builds the world.
173 # 5. install stage (optional) [IMAKE]
174 # This stage installs a previously built world.
177 # Common environment for world related stages
178 CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \
179 MACHINE_ARCH=${TARGET_ARCH} \
181 OBJFORMAT_PATH=${WORLDTMP} \
182 PERL5LIB=${WORLDTMP}/usr/libdata/perl/5.00503 \
183 GROFF_BIN_PATH=${WORLDTMP}/usr/bin \
184 GROFF_FONT_PATH=${WORLDTMP}/usr/share/groff_font \
185 GROFF_TMAC_PATH=${WORLDTMP}/usr/share/tmac
187 # bootstrap-tool stage
188 BMAKEENV= MAKEOBJDIRPREFIX=${WORLDTMP} \
190 INSTALL="sh ${.CURDIR}/tools/install.sh"
191 BMAKE= ${BMAKEENV} ${MAKE} -f Makefile.inc1 -DBOOTSTRAPPING \
192 -DNOHTML -DNOINFO -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED \
196 TMAKEENV= MAKEOBJDIRPREFIX=${OBJTREE} \
198 INSTALL="sh ${.CURDIR}/tools/install.sh"
199 TMAKE= ${TMAKEENV} ${MAKE} -f Makefile.inc1 -DBOOTSTRAPPING
202 XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} -DNO_FORTRAN -DNO_GDB
205 WMAKEENV= ${CROSSENV} \
206 DESTDIR=${WORLDTMP} \
207 INSTALL="sh ${.CURDIR}/tools/install.sh" \
209 WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1
212 IMAKEENV= ${CROSSENV} \
213 PATH=${STRICTTMPPATH}:${INSTALLTMP}
214 IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1
217 KMAKEENV= ${WMAKEENV} \
218 OBJFORMAT_PATH=${WORLDTMP}:${OBJFORMAT_PATH}
220 # /usr/bin/gccX version-specific gcc binaries
221 # /usr/lib/gccX version-specific gcc libraries
222 # /usr/libexec/gccX version-specific gcc helper binaries
223 # /usr/libexec/binutilsXXX version-specific binutils
226 usr/lib/gcc2 usr/lib/gcc3 \
227 usr/libexec/gcc2 usr/libexec/gcc3 \
228 usr/lib/compat/aout usr/games \
230 usr/libexec/binutils212 \
231 usr/libexec/binutils212/elf \
232 usr/libexec/binutils212/aout \
233 usr/libexec/binutils212/ldscripts \
234 usr/libexec/binutils214 \
235 usr/libexec/binutils214/elf \
236 usr/libexec/binutils214/ldscripts \
237 usr/sbin usr/share/misc \
239 usr/share/groff_font/devX100 \
240 usr/share/groff_font/devX100-12 \
241 usr/share/groff_font/devX75 \
242 usr/share/groff_font/devX75-12 \
243 usr/share/groff_font/devascii \
244 usr/share/groff_font/devcp1047 \
245 usr/share/groff_font/devdvi \
246 usr/share/groff_font/devhtml \
247 usr/share/groff_font/devkoi8-r \
248 usr/share/groff_font/devlatin1 \
249 usr/share/groff_font/devlbp \
250 usr/share/groff_font/devlj4 \
251 usr/share/groff_font/devps \
252 usr/share/groff_font/devutf8 \
253 usr/share/tmac/mdoc usr/share/tmac/mm
255 # XXX remove in favor of the BSD.include.dist mtree that we already have.
257 INCDIRS= arpa dev c++/2.95 isc libmilter objc openssl \
258 protocols readline rpc rpcsvc security
263 # Attempt to rebuild the entire system, with reasonable chance of
264 # success, regardless of how old your existing system is.
268 @echo "--------------------------------------------------------------"
269 @echo ">>> Rebuilding the temporary build tree"
270 @echo "--------------------------------------------------------------"
271 .if !defined(NOCLEAN)
274 # XXX - These two can depend on any header file.
275 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
276 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
278 .for _dir in ${USRDIRS}
279 mkdir -p ${WORLDTMP}/${_dir}
281 .for _dir in ${INCDIRS}
282 mkdir -p ${WORLDTMP}/usr/include/${_dir}
284 ln -sf ${.CURDIR}/sys ${WORLDTMP}
287 @echo "--------------------------------------------------------------"
288 @echo ">>> stage 1: bootstrap tools"
289 @echo "--------------------------------------------------------------"
290 cd ${.CURDIR}; ${BMAKE} bootstrap-tools
292 .if !defined(NOCLEAN)
294 @echo "--------------------------------------------------------------"
295 @echo ">>> stage 2: cleaning up the object tree"
296 @echo "--------------------------------------------------------------"
297 cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
301 @echo "--------------------------------------------------------------"
302 @echo ">>> stage 2: rebuilding the object tree"
303 @echo "--------------------------------------------------------------"
304 cd ${.CURDIR}; ${WMAKE} par-obj
307 @echo "--------------------------------------------------------------"
308 @echo ">>> stage 2: build tools"
309 @echo "--------------------------------------------------------------"
310 cd ${.CURDIR}; ${TMAKE} build-tools
313 @echo "--------------------------------------------------------------"
314 @echo ">>> stage 3: cross tools"
315 @echo "--------------------------------------------------------------"
316 cd ${.CURDIR}; ${XMAKE} cross-tools
319 @echo "--------------------------------------------------------------"
320 @echo ">>> stage 4: populating ${WORLDTMP}/usr/include"
321 @echo "--------------------------------------------------------------"
322 cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
325 @echo "--------------------------------------------------------------"
326 @echo ">>> stage 4: building libraries"
327 @echo "--------------------------------------------------------------"
328 cd ${.CURDIR}; ${WMAKE} -DNOHTML -DNOINFO -DNOMAN -DNOFSCHG libraries
331 @echo "--------------------------------------------------------------"
332 @echo ">>> stage 4: make dependencies"
333 @echo "--------------------------------------------------------------"
334 cd ${.CURDIR}; ${WMAKE} par-depend
337 @echo "--------------------------------------------------------------"
338 @echo ">>> stage 4: building everything.."
339 @echo "--------------------------------------------------------------"
340 cd ${.CURDIR}; ${WMAKE} all
344 .if !defined(SUBDIR_OVERRIDE)
345 WMAKE_TGTS+= _worldtmp _bootstrap-tools
347 WMAKE_TGTS+= _cleanobj _obj _build-tools
348 .if !defined(SUBDIR_OVERRIDE)
349 WMAKE_TGTS+= _cross-tools
351 WMAKE_TGTS+= _includes _libraries _depend everything
353 buildworld: ${WMAKE_TGTS}
354 .ORDER: ${WMAKE_TGTS}
359 # Checks to be sure system is ready for installworld
362 .if !defined(NO_SENDMAIL)
363 @if ! `id -u smmsp > /dev/null`; then \
364 echo "ERROR: Required smmsp user is missing, see /usr/src/UPDATING."; \
367 @if ! `id -g smmsp > /dev/null`; then \
368 echo "ERROR: Required smmsp group is missing, see /usr/src/UPDATING."; \
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 makewhatis mkdir mtree mv perl 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} -DNO_MODULES clean
494 .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KRNLSRCDIR}/modules)
495 cd ${KRNLOBJDIR}/${_kernel}; \
496 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} cleandir
499 cd ${KRNLOBJDIR}/${_kernel}; \
500 MAKESRCPATH=${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm \
501 ${MAKE} -DBOOTSTRAPPING -f ${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm/Makefile
502 .if !defined(NO_KERNELDEPEND)
503 cd ${KRNLOBJDIR}/${_kernel}; \
504 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend
506 cd ${KRNLOBJDIR}/${_kernel}; \
507 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all
508 @echo "--------------------------------------------------------------"
509 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
510 @echo "--------------------------------------------------------------"
516 # Install the kernel defined by INSTALLKERNEL
518 installkernel reinstallkernel:
519 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
520 ${CROSSENV} ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//}
525 # Update the source tree, by running sup and/or running cvs to update to the
529 .if defined(SUP_UPDATE)
530 @echo "--------------------------------------------------------------"
531 @echo ">>> Running ${SUP}"
532 @echo "--------------------------------------------------------------"
534 @${SUP} ${SUPFLAGS} ${SUPFILE}
536 .if defined(SUPFILE1)
537 @${SUP} ${SUPFLAGS} ${SUPFILE1}
539 .if defined(SUPFILE2)
540 @${SUP} ${SUPFLAGS} ${SUPFILE2}
542 .if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
543 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
545 .if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
546 @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
549 .if defined(CVS_UPDATE)
550 @echo "--------------------------------------------------------------"
551 @echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT}
552 @echo "--------------------------------------------------------------"
553 cd ${.CURDIR}; cvs -q update -rRELENG_4 -P -d
559 # Build most of the user binaries on the existing system libs and includes.
562 @echo "--------------------------------------------------------------"
563 @echo ">>> Building programs only"
564 @echo "--------------------------------------------------------------"
565 .for _dir in bin sbin libexec usr.bin usr.sbin gnu/libexec gnu/usr.bin gnu/usr.sbin
566 cd ${.CURDIR}/${_dir}; ${MAKE} DIRPRFX=${_dir}/ all
572 # Install the binaries built by the 'most' target. This does not include
573 # libraries or include files.
576 @echo "--------------------------------------------------------------"
577 @echo ">>> Installing programs only"
578 @echo "--------------------------------------------------------------"
579 .for _dir in bin sbin libexec usr.bin usr.sbin gnu/libexec gnu/usr.bin gnu/usr.sbin
580 cd ${.CURDIR}/${_dir}; ${MAKE} DIRPRFX=${_dir}/ install
584 # ------------------------------------------------------------------------
586 # From here onwards are utility targets used by the 'make world' and
587 # related targets. If your 'world' breaks, you may like to try to fix
588 # the problem and manually run the following targets to attempt to
589 # complete the build. Beware, this is *not* guaranteed to work, you
590 # need to have a pretty good grip on the current state of the system
591 # to attempt to manually finish it. If in doubt, 'make world' again.
594 # bootstrap-tools: Build tools needed for compatibility
596 # [x]install: dependancies on various new install features
597 # rpcgen: old rpcgen used a hardwired cpp path, newer OBJFORMAT_PATH
598 # envs are not compatible with older objformat binaries.
600 .if exists(${.CURDIR}/games) && !defined(NOGAMES)
601 _strfile= games/fortune/strfile
605 .for _tool in ${_strfile} usr.bin/yacc usr.bin/colldef \
606 usr.bin/uudecode usr.bin/xinstall usr.bin/rpcgen \
608 gnu/usr.bin/gperf gnu/usr.bin/groff gnu/usr.bin/texinfo
609 ${ECHODIR} "===> ${_tool}"; \
610 cd ${.CURDIR}/${_tool}; \
611 ${MAKE} DIRPRFX=${_tool}/ obj; \
612 ${MAKE} DIRPRFX=${_tool}/ depend; \
613 ${MAKE} DIRPRFX=${_tool}/ all; \
614 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
617 # build-tools: Build special purpose build tools. gcc2 related tools are
618 # only built under the i386 architecture. Other architectures are
621 .if exists(${.CURDIR}/games) && !defined(NOGAMES)
622 _games= games/adventure games/hack games/phantasia
625 .if exists(${.CURDIR}/share) && !defined(NOSHARE)
626 _share= share/syscons/scrnmaps
629 _gcc3_cross= gnu/usr.bin/cc3
630 _gcc3_tools= gnu/usr.bin/cc3/cc_tools
631 .if ${MACHINE_ARCH} == "i386" && ${TARGET_ARCH} == "i386"
632 _gcc2_cross= gnu/usr.bin/cc
633 _gcc2_tools= gnu/usr.bin/cc/cc_tools
634 _binutils= gnu/usr.bin/binutils gnu/usr.bin/binutils214
636 _binutils= gnu/usr.bin/binutils214
639 .if !defined(NO_FORTRAN)
640 .if ${TARGET_ARCH} == "i386"
641 _fortran= gnu/usr.bin/cc/f771
643 _fortran= gnu/usr.bin/cc3/f771
648 _perl= gnu/usr.bin/perl/miniperl
651 .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
652 !defined(NOCRYPT) && defined(MAKE_KERBEROS5)
653 _libkrb5= kerberos5/lib/libroken kerberos5/lib/libvers \
654 kerberos5/lib/libasn1 kerberos5/lib/libhdb kerberos5/lib/libsl
657 .if defined(RELEASEDIR)
658 _sysinstall= release/sysinstall
661 # build-tools: tools we need
664 .for _tool in bin/csh bin/sh ${_games} ${_gcc2_tools} ${_gcc3_tools} \
665 ${_fortran} ${_perl} ${_libroken4} ${_libkrb5} \
666 lib/libncurses ${_share} usr.bin/awk usr.bin/file \
668 ${ECHODIR} "===> ${_tool}"; \
669 cd ${.CURDIR}/${_tool}; \
670 ${MAKE} DIRPRFX=${_tool}/ obj; \
671 ${MAKE} DIRPRFX=${_tool}/ build-tools
675 # cross-tools: Build cross-building tools
677 .if ${TARGET_ARCH} == "alpha" && ${MACHINE_ARCH} != "alpha"
678 _elf2exe= usr.sbin/elf2exe
681 .if ${TARGET_ARCH} == "i386" && ${MACHINE_ARCH} != "i386"
682 _btxld= usr.sbin/btxld
686 .for _tool in ${_btxld} ${_elf2exe} ${_binutils} \
687 usr.bin/objformat usr.sbin/crunch/crunchide \
688 ${_gcc2_cross} ${_gcc3_cross}
689 ${ECHODIR} "===> ${_tool}"; \
690 cd ${.CURDIR}/${_tool}; \
691 ${MAKE} DIRPRFX=${_tool}/ obj; \
692 ${MAKE} DIRPRFX=${_tool}/ depend; \
693 ${MAKE} DIRPRFX=${_tool}/ all; \
694 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
698 # hierarchy - ensure that all the needed directories are present
701 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs
704 # libraries - build all libraries, and install them under ${DESTDIR}.
706 # The list of libraries with dependents (${_prebuild_libs}) and their
707 # interdependencies (__L) are built automatically by the
708 # ${.CURDIR}/tools/make_libdeps.sh script.
710 # .makeenv does not work when bootstrapping from 4.x, so we must be sure
711 # to specify the correct CCVER or 'cc' will not exec the correct compiler.
715 CCVER=gcc2 ${MAKE} -f Makefile.inc1 _startup_libs2; \
716 CCVER=gcc3 ${MAKE} -f Makefile.inc1 _startup_libs3; \
717 ${MAKE} -f Makefile.inc1 _startup_libs; \
718 ${MAKE} -f Makefile.inc1 _prebuild_libs; \
719 ${MAKE} -f Makefile.inc1 _generic_libs;
721 # These dependencies are not automatically generated:
723 # gnu/lib/csu, gnu/lib/libgcc and lib/csu must be built before all
724 # shared libraries for ELF. The targets for _startup_libs{2,3} are
725 # specifically built using gcc{2,3}.
727 _startup_libs2= gnu/lib/gcc2/csu gnu/lib/gcc2/libgcc
728 _startup_libs3= gnu/lib/gcc3/csu gnu/lib/gcc3/libgcc
729 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
730 _startup_libs= lib/csu/${MACHINE_ARCH}-elf
732 _startup_libs= lib/csu/${MACHINE_ARCH}
737 _generic_libs= gnu/lib
740 _generic_libs+= gnu/usr.bin/perl/libperl
743 .if !defined(NOCRYPT) && defined(MAKE_KERBEROS5)
744 _prebuild_libs+= kerberos5/lib/libasn1
745 _prebuild_libs+= kerberos5/lib/libgssapi
746 _prebuild_libs+= kerberos5/lib/libkrb5
747 _prebuild_libs+= kerberos5/lib/libroken
748 _generic_libs+= kerberos5/lib
751 _prebuild_libs+= lib/libcom_err lib/libcrypt lib/libmd \
752 lib/libncurses lib/libopie lib/libradius lib/libskey \
753 lib/libtacplus lib/libutil \
756 lib/libopie__L lib/libradius__L lib/libtacplus__L: lib/libmd__L
757 lib/libskey__L: lib/libcrypt__L lib/libmd__L
761 .if !defined(NOCRYPT)
762 .if !defined(NO_OPENSSL)
763 _prebuild_libs+= secure/lib/libcrypto secure/lib/libssl
764 .if !defined(NO_OPENSSH)
765 _prebuild_libs+= secure/lib/libssh
766 secure/lib/libssh__L: secure/lib/libcrypto__L lib/libz__L
769 _generic_libs+= secure/lib
772 _generic_libs+= usr.bin/lex/lib
774 .if ${MACHINE_ARCH} == "i386"
775 _generic_libs+= usr.sbin/pcvt/keycap
778 .for _lib in ${_startup_libs2} ${_startup_libs3} ${_startup_libs} \
779 ${_prebuild_libs} ${_generic_libs}
781 .if exists(${.CURDIR}/${_lib})
782 ${ECHODIR} "===> ${_lib}"; \
783 cd ${.CURDIR}/${_lib}; \
784 ${MAKE} DIRPRFX=${_lib}/ depend; \
785 ${MAKE} DIRPRFX=${_lib}/ all; \
786 ${MAKE} DIRPRFX=${_lib}/ install
790 # only mess with gcc2 for i386 architectures.
792 _startup_libs: ${_startup_libs:S/$/__L/}
793 .if ${TARGET_ARCH} == "i386"
794 _startup_libs2: ${_startup_libs2:S/$/__L/}
798 _startup_libs3: ${_startup_libs3:S/$/__L/}
799 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
800 _generic_libs: ${_generic_libs:S/$/__L/}
802 .for __target in clean cleandepend cleandir depend includes obj
803 .for entry in ${SUBDIR}
804 ${entry}.${__target}__D: .PHONY
805 @if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
806 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
807 edir=${entry}.${MACHINE_ARCH}; \
808 cd ${.CURDIR}/$${edir}; \
810 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \
812 cd ${.CURDIR}/$${edir}; \
814 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
816 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
819 # The wmake target is used by /usr/bin/wmake to run make in a
820 # world build environment.
823 @echo '${WMAKEENV} ${MAKE} ${WMAKE_ARGS}'
826 @echo '${WMAKEENV} /bin/sh'
829 @echo '${BMAKEENV} /bin/sh'
832 @echo '${TMAKEENV} /bin/sh'
834 .include <bsd.subdir.mk>