2 # $Id: Makefile,v 1.201 1998/06/09 07:19:13 bde Exp $
4 # While porting to the another architecture include the bootstrap instead
7 .if exists(${.CURDIR}/Makefile.${MACHINE}) && defined(BOOTSTRAP_WORLD)
8 .include "${.CURDIR}/Makefile.${MACHINE}"
11 # Make command line options:
12 # -DCLOBBER will remove /usr/include
13 # -DMAKE_KERBEROS4 to build KerberosIV
14 # -DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
15 # -DNOCLEAN do not clean at all
16 # -DNOTOOLS do not rebuild any tools first
17 # -DNOCRYPT will prevent building of crypt versions
18 # -DNOLKM do not build loadable kernel modules
19 # -DNOOBJDIR do not run ``${MAKE} obj''
20 # -DNOPROFILE do not build profiled libraries
21 # -DNOSECURE do not go into secure subdir
22 # -DNOGAMES do not go into games subdir
23 # -DNOSHARE do not go into share subdir
24 # -DNOINFO do not make or install info files
25 # -DNOLIBC_R do not build libc_r.
26 # LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
29 # The intended user-driven targets are:
30 # buildworld - rebuild *everything*, including glue to help do upgrades
31 # installworld- install everything built by "buildworld"
32 # world - buildworld + installworld
33 # update - convenient way to update your source tree (eg: sup/cvs)
34 # most - build user commands, no libraries or include files
35 # installmost - install user commands, no libraries or include files
37 # Standard targets (not defined here) are documented in the makefiles in
38 # /usr/share/mk. These include:
39 # obj depend all install clean cleandepend cleanobj
41 .if (!make(world)) && (!make(buildworld)) && (!make(installworld))
42 .MAKEFLAGS:= -m ${.CURDIR}/share/mk ${.MAKEFLAGS}
45 # Put initial settings here.
48 # We must do share/info early so that installation of info `dir'
49 # entries works correctly. Do it first since it is less likely to
50 # grow dependencies on include and lib than vice versa.
51 .if exists(share/info)
55 # We must do include and lib early so that the perl *.ph generation
56 # works correctly as it uses the header files installed by this.
67 .if exists(games) && !defined(NOGAMES)
73 .if exists(kerberosIV) && exists(crypto) && !defined(NOCRYPT) && \
74 defined(MAKE_KERBEROS4)
83 .if exists(share) && !defined(NOSHARE)
95 .if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
98 .if exists(lkm) && !defined(NOLKM)
102 # etc must be last for "distribute" to work
103 .if exists(etc) && make(distribute)
107 # These are last, since it is nice to at least get the base system
108 # rebuilt before you do them.
109 .if defined(LOCAL_DIRS)
110 .for _DIR in ${LOCAL_DIRS}
111 .if exists(${_DIR}) & exists(${_DIR}/Makefile)
117 # Handle -DNOOBJDIR, -DNOCLEAN and -DNOCLEANDIR
118 .if defined(NOOBJDIR)
127 .if defined(NOCLEANDIR)
128 CLEANDIR= clean cleandepend
134 .if !defined(NOCLEAN) && ${.MAKEFLAGS:M-j} == ""
137 .if defined(_NODEPEND)
144 SUPFLAGS?= -g -L 2 -P -
147 # While building tools for bootstrapping, we don't need to waste time on
148 # shared or profiled libraries, shared linkage, or documentation, except
149 # when the tools won't get cleaned we must use the defaults for shared
150 # libraries and shared linkage (and this doesn't waste time).
151 # XXX actually, we do need to waste time building shared libraries.
154 MK_FLAGS= -DNOINFO -DNOMAN -DNOPROFILE
156 MK_FLAGS= -DNOINFO -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED
162 # Attempt to rebuild and reinstall *everything*, with reasonable chance of
163 # success, regardless of how old your existing system is.
165 # >> Beware, it overwrites the local build environment! <<
168 @echo "--------------------------------------------------------------"
169 @echo "make world started on `LC_TIME=C date`"
170 @echo "--------------------------------------------------------------"
171 .if target(pre-world)
173 @echo "--------------------------------------------------------------"
174 @echo " Making 'pre-world' target"
175 @echo "--------------------------------------------------------------"
176 cd ${.CURDIR}; ${MAKE} pre-world
178 cd ${.CURDIR}; ${MAKE} buildworld
179 cd ${.CURDIR}; ${MAKE} -B installworld
180 .if target(post-world)
182 @echo "--------------------------------------------------------------"
183 @echo " Making 'post-world' target"
184 @echo "--------------------------------------------------------------"
185 cd ${.CURDIR}; ${MAKE} post-world
188 @echo "--------------------------------------------------------------"
189 @echo "make world completed on `LC_TIME=C date`"
190 @echo "--------------------------------------------------------------"
192 .if defined(MAKEOBJDIRPREFIX)
193 WORLDTMP= ${MAKEOBJDIRPREFIX}${.CURDIR}/tmp
195 WORLDTMP= /usr/obj${.CURDIR}/tmp
197 STRICTTMPPATH= ${WORLDTMP}/sbin:${WORLDTMP}/usr/sbin:${WORLDTMP}/bin:${WORLDTMP}/usr/bin
198 TMPPATH= ${STRICTTMPPATH}:${PATH}
200 # XXX COMPILER_PATH is needed for finding cc1, ld and as
201 # XXX GCC_EXEC_PREFIX is for *crt.o. It is probably unnecessary now
202 # that LIBRARY_PATH is set. We still can't use -nostdlib, since gcc
203 # wouldn't link *crt.o or libgcc if it were used.
204 # XXX LD_LIBRARY_PATH is for ld.so. It is also used by ld, although we don't
205 # want that - all compile-time library paths should be resolved by gcc.
206 # It fails for set[ug]id executables (are any used?).
207 COMPILER_ENV= BISON_SIMPLE=${WORLDTMP}/usr/share/misc/bison.simple \
208 COMPILER_PATH=${WORLDTMP}/usr/libexec:${WORLDTMP}/usr/bin \
209 GCC_EXEC_PREFIX=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib/ \
210 LD_LIBRARY_PATH=${WORLDTMP}${SHLIBDIR} \
211 LIBRARY_PATH=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib
213 BMAKEENV= PATH=${TMPPATH} ${COMPILER_ENV} NOEXTRADEPEND=t \
214 OBJFORMAT_PATH=${WORLDTMP}/usr/libexec:/usr/libexec
215 XMAKEENV= PATH=${STRICTTMPPATH} ${COMPILER_ENV} \
216 OBJFORMAT_PATH=${WORLDTMP}/usr/libexec \
217 CFLAGS="-nostdinc ${CFLAGS}" # XXX -nostdlib
219 # used to compile and install 'make' in temporary build tree
220 MAKETMP= ${WORLDTMP}/make
221 IBMAKE= ${BMAKEENV} MAKEOBJDIR=${MAKETMP} ${MAKE} DESTDIR=${WORLDTMP}
223 BMAKE= ${BMAKEENV} ${WORLDTMP}/usr/bin/make DESTDIR=${WORLDTMP}
224 # cross make used for compilation
225 XMAKE= ${XMAKEENV} ${WORLDTMP}/usr/bin/make DESTDIR=${WORLDTMP}
226 # cross make used for final installation
227 IXMAKE= ${XMAKEENV} ${WORLDTMP}/usr/bin/make
232 # Attempt to rebuild the entire system, with reasonable chance of
233 # success, regardless of how old your existing system is.
236 .if !defined(NOCLEAN)
238 @echo "--------------------------------------------------------------"
239 @echo " Cleaning up the temporary build tree"
240 @echo "--------------------------------------------------------------"
242 chflags -R noschg ${WORLDTMP}/
245 .if !defined(NOTOOLS)
247 @echo "--------------------------------------------------------------"
249 @echo "--------------------------------------------------------------"
250 mkdir -p ${WORLDTMP}/usr/bin ${MAKETMP}
252 cd ${.CURDIR}/usr.bin/make; \
253 MAKEOBJDIRPREFIX=""; unset MAKEOBJDIRPREFIX; \
254 ${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} all; \
255 ${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} install; \
256 ${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} clean \
259 @echo "--------------------------------------------------------------"
260 @echo " Making mtree"
261 @echo "--------------------------------------------------------------"
262 mkdir -p ${WORLDTMP}/usr/sbin ${WORLDTMP}/mtree
264 cd ${.CURDIR}/usr.sbin/mtree; \
265 MAKEOBJDIRPREFIX=""; unset MAKEOBJDIRPREFIX; \
266 export MAKEOBJDIR=${WORLDTMP}/mtree; \
267 ${BMAKE} ${MK_FLAGS} all; \
268 ${BMAKE} ${MK_FLAGS} -B install clean \
272 @echo "--------------------------------------------------------------"
273 @echo " Making hierarchy"
274 @echo "--------------------------------------------------------------"
275 cd ${.CURDIR}; ${BMAKE} hierarchy
276 .if !defined(NOCLEAN)
278 @echo "--------------------------------------------------------------"
279 @echo " Cleaning up the obj tree"
280 @echo "--------------------------------------------------------------"
281 cd ${.CURDIR}; ${BMAKE} ${CLEANDIR:S/^/par-/}
283 .if !defined(NOOBJDIR)
285 @echo "--------------------------------------------------------------"
286 @echo " Rebuilding the obj tree"
287 @echo "--------------------------------------------------------------"
288 cd ${.CURDIR}; ${BMAKE} par-${OBJDIR}
290 .if !defined(NOTOOLS)
292 @echo "--------------------------------------------------------------"
293 @echo " Rebuilding bootstrap tools"
294 @echo "--------------------------------------------------------------"
295 cd ${.CURDIR}; ${BMAKE} bootstrap
297 @echo "--------------------------------------------------------------"
298 @echo " Rebuilding tools necessary to build the include files"
299 @echo "--------------------------------------------------------------"
300 cd ${.CURDIR}; ${BMAKE} include-tools
303 @echo "--------------------------------------------------------------"
304 @echo " Rebuilding ${DESTDIR}/usr/include"
305 @echo "--------------------------------------------------------------"
306 cd ${.CURDIR}; SHARED=copies ${BMAKE} includes
308 @echo "--------------------------------------------------------------"
309 @echo " Rebuilding bootstrap libraries"
310 @echo "--------------------------------------------------------------"
311 cd ${.CURDIR}; ${BMAKE} bootstrap-libraries
312 .if !defined(NOTOOLS)
314 @echo "--------------------------------------------------------------"
315 @echo " Rebuilding tools needed to build libraries"
316 @echo "--------------------------------------------------------------"
317 cd ${.CURDIR}; ${BMAKE} lib-tools
319 .if !defined(NOTOOLS)
321 @echo "--------------------------------------------------------------"
322 @echo " Rebuilding all other tools needed to build the world"
323 @echo "--------------------------------------------------------------"
324 cd ${.CURDIR}; ${BMAKE} build-tools
326 .if !defined(_NODEPEND)
328 @echo "--------------------------------------------------------------"
329 @echo " Rebuilding dependencies"
330 @echo "--------------------------------------------------------------"
331 cd ${.CURDIR}; ${XMAKE} par-depend
334 @echo "--------------------------------------------------------------"
335 @echo " Building libraries"
336 @echo "--------------------------------------------------------------"
337 cd ${.CURDIR}; ${XMAKE} -DNOINFO -DNOMAN libraries
339 @echo "--------------------------------------------------------------"
340 @echo " Building everything.."
341 @echo "--------------------------------------------------------------"
342 cd ${.CURDIR}; ${XMAKE} all
347 # Installs everything compiled by a 'buildworld'.
350 cd ${.CURDIR}; ${IXMAKE} reinstall
355 # If you have a build server, you can NFS mount the source and obj directories
356 # and do a 'make reinstall' on the *client* to install new binaries from the
357 # most recent server build.
360 @echo "--------------------------------------------------------------"
361 @echo " Making hierarchy"
362 @echo "--------------------------------------------------------------"
363 cd ${.CURDIR}; ${MAKE} hierarchy
365 @echo "--------------------------------------------------------------"
366 @echo " Installing everything.."
367 @echo "--------------------------------------------------------------"
368 cd ${.CURDIR}; ${MAKE} install
369 .if ${MACHINE_ARCH} == "i386"
371 @echo "--------------------------------------------------------------"
372 @echo " Re-scanning the shared libraries.."
373 @echo "--------------------------------------------------------------"
374 cd ${.CURDIR}; /sbin/ldconfig -R
377 @echo "--------------------------------------------------------------"
378 @echo " Rebuilding man page indexes"
379 @echo "--------------------------------------------------------------"
380 cd ${.CURDIR}/share/man; ${MAKE} makedb
385 # Update the source tree, by running sup and/or running cvs to update to the
389 .if defined(SUP_UPDATE)
390 @echo "--------------------------------------------------------------"
391 @echo "Running ${SUP}"
392 @echo "--------------------------------------------------------------"
393 @${SUP} ${SUPFLAGS} ${SUPFILE}
394 .if defined(SUPFILE1)
395 @${SUP} ${SUPFLAGS} ${SUPFILE1}
397 .if defined(SUPFILE2)
398 @${SUP} ${SUPFLAGS} ${SUPFILE2}
401 .if defined(CVS_UPDATE)
402 @echo "--------------------------------------------------------------"
403 @echo "Updating /usr/src from cvs repository" ${CVSROOT}
404 @echo "--------------------------------------------------------------"
405 cd ${.CURDIR}; cvs -q update -P -d
411 # Build most of the user binaries on the existing system libs and includes.
414 @echo "--------------------------------------------------------------"
415 @echo " Building programs only"
416 @echo "--------------------------------------------------------------"
417 cd ${.CURDIR}/bin; ${MAKE} all
418 cd ${.CURDIR}/sbin; ${MAKE} all
419 cd ${.CURDIR}/libexec; ${MAKE} all
420 cd ${.CURDIR}/usr.bin; ${MAKE} all
421 cd ${.CURDIR}/usr.sbin; ${MAKE} all
422 cd ${.CURDIR}/gnu/libexec; ${MAKE} all
423 cd ${.CURDIR}/gnu/usr.bin; ${MAKE} all
424 cd ${.CURDIR}/gnu/usr.sbin; ${MAKE} all
425 #.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT)
426 # cd ${.CURDIR}/kerberosIV; ${MAKE} most
428 #.if !defined(NOSECURE) && !defined(NOCRYPT)
429 # cd ${.CURDIR}/secure; ${MAKE} most
435 # Install the binaries built by the 'most' target. This does not include
436 # libraries or include files.
439 @echo "--------------------------------------------------------------"
440 @echo " Installing programs only"
441 @echo "--------------------------------------------------------------"
442 cd ${.CURDIR}/bin; ${MAKE} install
443 cd ${.CURDIR}/sbin; ${MAKE} install
444 cd ${.CURDIR}/libexec; ${MAKE} install
445 cd ${.CURDIR}/usr.bin; ${MAKE} install
446 cd ${.CURDIR}/usr.sbin; ${MAKE} install
447 cd ${.CURDIR}/gnu/libexec; ${MAKE} install
448 cd ${.CURDIR}/gnu/usr.bin; ${MAKE} install
449 cd ${.CURDIR}/gnu/usr.sbin; ${MAKE} install
450 #.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT)
451 # cd ${.CURDIR}/kerberosIV; ${MAKE} installmost
453 #.if !defined(NOSECURE) && !defined(NOCRYPT)
454 # cd ${.CURDIR}/secure; ${MAKE} installmost
458 # ------------------------------------------------------------------------
460 # From here onwards are utility targets used by the 'make world' and
461 # related targets. If your 'world' breaks, you may like to try to fix
462 # the problem and manually run the following targets to attempt to
463 # complete the build. Beware, this is *not* guaranteed to work, you
464 # need to have a pretty good grip on the current state of the system
465 # to attempt to manually finish it. If in doubt, 'make world' again.
469 # heirarchy - ensure that all the needed directories are present
472 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs
475 # bootstrap - [re]build tools needed to run the actual build, this includes
476 # tools needed by 'make depend', as some tools are needed to generate source
477 # for the dependency information to be gathered from.
481 rm -f ${DESTDIR}/usr/src/sys
482 ln -s ${.CURDIR}/sys ${DESTDIR}/usr/src
483 cd ${.CURDIR}/include; find -dx . | cpio -dump ${DESTDIR}/usr/include
484 .for d in net netinet posix4 sys vm machine
485 if [ -h ${DESTDIR}/usr/include/$d ]; then \
486 rm -f ${DESTDIR}/usr/include/$d ; \
490 find -dx net netinet posix4 sys vm -name '*.h' -o -type d | \
491 cpio -dump ${DESTDIR}/usr/include
492 mkdir -p ${DESTDIR}/usr/include/machine
493 cd ${.CURDIR}/sys/${MACHINE_ARCH}/include; find -dx . -name '*.h' -o -type d | \
494 cpio -dump ${DESTDIR}/usr/include/machine
496 cd ${.CURDIR}/usr.bin/make; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
497 ${MAKE} ${MK_FLAGS} all; \
498 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
499 cd ${.CURDIR}/usr.bin/xinstall; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
500 ${MAKE} ${MK_FLAGS} all; \
501 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
502 cd ${.CURDIR}/usr.bin/lex; ${MAKE} bootstrap; \
503 ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
504 ${MAKE} ${MK_FLAGS} -DNOLIB all; \
505 ${MAKE} ${MK_FLAGS} -DNOLIB -B install ${CLEANDIR}
506 .if !defined(NOOBJDIR)
507 cd ${.CURDIR}/usr.bin/lex; ${MAKE} ${OBJDIR}
509 cd ${.CURDIR}/usr.sbin/mtree; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
510 ${MAKE} ${MK_FLAGS} all; \
511 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
513 cd ${.CURDIR}/include && ${MAKE} copies
517 # include-tools - generally the same as 'bootstrap', except that it's for
518 # things that are specifically needed to generate include files.
520 # XXX should be merged with bootstrap, it's not worth keeeping them separate.
521 # Well, maybe it is now. We force 'cleandepend' here to avoid dependencies
522 # on cleaned away headers in ${WORLDTMP}.
525 .for d in usr.bin/compile_et usr.bin/rpcgen
526 cd ${.CURDIR}/$d; ${MAKE} cleandepend; \
527 ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
528 ${MAKE} ${MK_FLAGS} all; \
529 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
533 # includes - possibly generate and install the include files.
537 rm -rf ${DESTDIR}/usr/include/*
538 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
539 -p ${DESTDIR}/usr/include
541 cd ${.CURDIR}/include; ${MAKE} -B all install
542 cd ${.CURDIR}/gnu/include; ${MAKE} install
543 cd ${.CURDIR}/gnu/lib/libmp; ${MAKE} beforeinstall
544 cd ${.CURDIR}/gnu/lib/libobjc; ${MAKE} beforeinstall
545 cd ${.CURDIR}/gnu/lib/libreadline; ${MAKE} beforeinstall
546 cd ${.CURDIR}/gnu/lib/libregex; ${MAKE} beforeinstall
547 cd ${.CURDIR}/gnu/lib/libstdc++; ${MAKE} beforeinstall
548 cd ${.CURDIR}/gnu/lib/libg++; ${MAKE} beforeinstall
549 cd ${.CURDIR}/gnu/lib/libdialog; ${MAKE} beforeinstall
550 cd ${.CURDIR}/gnu/lib/libgmp; ${MAKE} beforeinstall
551 .if exists(secure) && !defined(NOCRYPT)
552 cd ${.CURDIR}/secure/lib/libdes; ${MAKE} beforeinstall
554 .if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
555 cd ${.CURDIR}/kerberosIV/lib/libacl; ${MAKE} beforeinstall
556 cd ${.CURDIR}/kerberosIV/lib/libkadm; ${MAKE} beforeinstall
557 cd ${.CURDIR}/kerberosIV/lib/libkafs; ${MAKE} beforeinstall
558 cd ${.CURDIR}/kerberosIV/lib/libkdb; ${MAKE} beforeinstall
559 cd ${.CURDIR}/kerberosIV/lib/libkrb; ${MAKE} beforeinstall
560 cd ${.CURDIR}/kerberosIV/lib/libtelnet; ${MAKE} beforeinstall
562 cd ${.CURDIR}/lib/libtelnet; ${MAKE} beforeinstall
564 .if exists(${.CURDIR}/lib/csu/${MACHINE})
565 cd ${.CURDIR}/lib/csu/${MACHINE}; ${MAKE} beforeinstall
567 cd ${.CURDIR}/lib/libalias; ${MAKE} beforeinstall
568 cd ${.CURDIR}/lib/libc; ${MAKE} beforeinstall
569 cd ${.CURDIR}/lib/libcalendar; ${MAKE} beforeinstall
570 cd ${.CURDIR}/lib/libcurses; ${MAKE} beforeinstall
571 cd ${.CURDIR}/lib/libdisk; ${MAKE} beforeinstall
572 cd ${.CURDIR}/lib/libedit; ${MAKE} beforeinstall
573 cd ${.CURDIR}/lib/libftpio; ${MAKE} beforeinstall
574 cd ${.CURDIR}/lib/libmd; ${MAKE} beforeinstall
575 cd ${.CURDIR}/lib/libmytinfo; ${MAKE} beforeinstall
576 cd ${.CURDIR}/lib/libncurses; ${MAKE} beforeinstall
577 .if !defined(WANT_CSRG_LIBM)
578 cd ${.CURDIR}/lib/msun; ${MAKE} beforeinstall
580 cd ${.CURDIR}/lib/libopie; ${MAKE} beforeinstall
581 cd ${.CURDIR}/lib/libpcap; ${MAKE} beforeinstall
582 cd ${.CURDIR}/lib/librpcsvc; ${MAKE} beforeinstall
583 cd ${.CURDIR}/lib/libskey; ${MAKE} beforeinstall
584 .if !defined(NOTCL) && exists (${.CURDIR}/contrib/tcl) && \
585 exists(${.CURDIR}/usr.bin/tclsh) && exists (${.CURDIR}/lib/libtcl)
586 cd ${.CURDIR}/lib/libtcl; ${MAKE} installhdrs
588 cd ${.CURDIR}/lib/libtermcap; ${MAKE} beforeinstall
589 cd ${.CURDIR}/lib/libcom_err; ${MAKE} beforeinstall
590 cd ${.CURDIR}/lib/libss; ${MAKE} -B hdrs beforeinstall
591 cd ${.CURDIR}/lib/libscsi; ${MAKE} beforeinstall
592 cd ${.CURDIR}/lib/libutil; ${MAKE} beforeinstall
593 cd ${.CURDIR}/lib/libvgl; ${MAKE} beforeinstall
594 cd ${.CURDIR}/lib/libz; ${MAKE} beforeinstall
595 cd ${.CURDIR}/usr.bin/f2c; ${MAKE} beforeinstall
596 cd ${.CURDIR}/usr.bin/lex; ${MAKE} beforeinstall
599 # Declare tools if they are not required on all architectures.
601 .if ${MACHINE_ARCH} == "i386"
603 _aout_ar = usr.bin/ar
604 _aout_as = gnu/usr.bin/as
605 _aout_ld = gnu/usr.bin/ld
606 _aout_nm = usr.bin/nm
607 _aout_ranlib = usr.bin/ranlib
608 _aout_size = usr.bin/size
609 _aout_strip = usr.bin/strip
610 _objformat = usr.bin/objformat
614 # lib-tools - build tools to compile and install the libraries.
616 # XXX gperf is required for cc
617 # XXX a new ld and tsort is required for cc
633 gnu/usr.bin/binutils \
636 cd ${.CURDIR}/$d; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
637 ${MAKE} ${MK_FLAGS} all; \
638 ${MAKE} ${MK_FLAGS} -B install; \
639 ${MAKE} ${MK_FLAGS:S/-DNOPIC//} -B ${CLEANDIR} ${OBJDIR}
643 # We have to know too much about ordering and subdirs in the lib trees:
645 # To satisfy shared library linkage when only the libraries being built
648 # libcom_err must be built before libss.
649 # libcrypt and libmd must be built before libskey.
650 # libm must be built before libtcl.
651 # libmytinfo must be built before libdialog and libncurses.
652 # libncurses must be built before libdialog.
653 # libtermcap must be built before libcurses, libedit and libreadline.
655 # Some libraries are built conditionally and/or are in inconsistently
658 .if exists(lib/csu/${MACHINE}.pcc)
659 _csu=lib/csu/${MACHINE}.pcc
661 _csu=lib/csu/${MACHINE}
664 .if !defined(NOSECURE) && !defined(NOCRYPT)
665 _libcrypt= secure/lib/libcrypt lib/libcrypt
667 _libcrypt= lib/libcrypt
670 .if defined(WANT_CSRG_LIBM)
677 # bootstrap-libraries - build just enough libraries for the bootstrap
678 # tools, and install them under ${WORLDTMP}.
680 # Build csu and libgcc early so that some tools get linked to the new
681 # versions (too late for the main tools, however). Then build the
682 # necessary prerequisite libraries (libtermcap just needs to be before
683 # libcurses, and this only matters for the NOCLEAN case when NOPIC is
686 # This is mostly wrong. The build tools must run on the host system,
687 # so they should use host libraries. We depend on the target being
688 # similar enough to the host for new target libraries to work on the
692 .for _lib in ${_csu} gnu/usr.bin/cc/libgcc lib/libtermcap \
693 gnu/lib/libregex gnu/lib/libreadline lib/libc \
694 ${_libcrypt} lib/libcurses lib/libedit ${_libm} \
695 lib/libmd lib/libutil lib/libz usr.bin/lex/lib
696 .if exists(${.CURDIR}/${_lib})
697 cd ${.CURDIR}/${_lib}; \
698 ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
699 ${MAKE} ${MK_FLAGS} all; \
700 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
705 # libraries - build all libraries, and install them under ${DESTDIR}.
707 # The ordering is not as special as for bootstrap-libraries. Build
708 # the prerequisites first, then build almost everything else in
709 # alphabetical order.
712 .for _lib in lib/libcom_err ${_libcrypt} ${_libm} lib/libmytinfo \
713 lib/libncurses lib/libtermcap \
714 gnu/lib gnu/usr.bin/cc/libgcc lib usr.bin/lex/lib usr.sbin/pcvt/keycap
715 .if exists(${.CURDIR}/${_lib})
716 cd ${.CURDIR}/${_lib}; ${MAKE} all; ${MAKE} -B install
719 .if exists(${.CURDIR}/secure/lib) && !defined(NOCRYPT) && !defined(NOSECURE)
720 cd ${.CURDIR}/secure/lib; ${MAKE} all; ${MAKE} -B install
722 .if exists(${.CURDIR}/kerberosIV/lib) && !defined(NOCRYPT) && \
723 defined(MAKE_KERBEROS4)
724 cd ${.CURDIR}/kerberosIV/lib; ${MAKE} all; ${MAKE} -B install
727 # Exclude perl from the build-tools if NOPERL is defined.
731 _perl= gnu/usr.bin/perl/perl
735 # build-tools - build and install any other tools needed to complete the
736 # compile and install.
738 # bc and cpp are required to build groff. Otherwise, the order here is
739 # mostly historical, i.e., bogus.
740 # chmod is used to build gcc's tmpmultilib[2] at obscure times.
742 # XXX uname is a bug - the target should not depend on the host.
765 gnu/usr.bin/man/makewhatis \
769 gnu/usr.bin/texinfo \
804 cd ${.CURDIR}/$d; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
805 ${MAKE} ${MK_FLAGS} all; \
806 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
809 .for __target in clean cleandepend cleandir depend obj
810 .for entry in ${SUBDIR}
811 ${entry}.${__target}__D: .PHONY
812 @if test -d ${.CURDIR}/${entry}.${MACHINE}; then \
813 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE}"; \
814 edir=${entry}.${MACHINE}; \
815 cd ${.CURDIR}/$${edir}; \
817 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \
819 cd ${.CURDIR}/$${edir}; \
821 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
823 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
828 .include <bsd.subdir.mk>