2 # $Id: Makefile,v 1.209 1998/08/04 17:13:38 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}
46 # Pick up any macros that are defined in the src-relative bsd.own.mk
47 # but not in the "system" bsd.own.mk. The "system" version has
48 # unfortunately already been included by the "system" sys.mk, so this
49 # only works for new macros. First undefine old macros that cause
53 .include "${.CURDIR}/share/mk/bsd.own.mk"
55 # Put initial settings here.
58 # We must do share/info early so that installation of info `dir'
59 # entries works correctly. Do it first since it is less likely to
60 # grow dependencies on include and lib than vice versa.
61 .if exists(share/info)
65 # We must do include and lib early so that the perl *.ph generation
66 # works correctly as it uses the header files installed by this.
77 .if exists(games) && !defined(NOGAMES)
83 .if exists(kerberosIV) && exists(crypto) && !defined(NOCRYPT) && \
84 defined(MAKE_KERBEROS4)
93 .if exists(share) && !defined(NOSHARE)
105 .if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
108 .if exists(lkm) && !defined(NOLKM)
112 # etc must be last for "distribute" to work
117 # These are last, since it is nice to at least get the base system
118 # rebuilt before you do them.
119 .if defined(LOCAL_DIRS)
120 .for _DIR in ${LOCAL_DIRS}
121 .if exists(${_DIR}) & exists(${_DIR}/Makefile)
127 # Handle -DNOOBJDIR, -DNOCLEAN and -DNOCLEANDIR
128 .if defined(NOOBJDIR)
137 .if defined(NOCLEANDIR)
138 CLEANDIR= clean cleandepend
144 .if !defined(NOCLEAN)
147 .if defined(_NODEPEND)
154 SUPFLAGS?= -g -L 2 -P -
157 # While building tools for bootstrapping, we don't need to waste time on
158 # shared or profiled libraries, shared linkage, or documentation, except
159 # when the tools won't get cleaned we must use the defaults for shared
160 # libraries and shared linkage (and this doesn't waste time).
161 # XXX actually, we do need to waste time building shared libraries.
164 MK_FLAGS= -DNOINFO -DNOMAN -DNOPROFILE
166 MK_FLAGS= -DNOINFO -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED
172 # Attempt to rebuild and reinstall *everything*, with reasonable chance of
173 # success, regardless of how old your existing system is.
175 # >> Beware, it overwrites the local build environment! <<
178 @echo "--------------------------------------------------------------"
179 @echo "make world started on `LC_TIME=C date`"
180 @echo "--------------------------------------------------------------"
181 .if target(pre-world)
183 @echo "--------------------------------------------------------------"
184 @echo " Making 'pre-world' target"
185 @echo "--------------------------------------------------------------"
186 cd ${.CURDIR}; ${MAKE} pre-world
188 cd ${.CURDIR}; ${MAKE} buildworld
189 cd ${.CURDIR}; ${MAKE} -B installworld
190 .if target(post-world)
192 @echo "--------------------------------------------------------------"
193 @echo " Making 'post-world' target"
194 @echo "--------------------------------------------------------------"
195 cd ${.CURDIR}; ${MAKE} post-world
198 @echo "--------------------------------------------------------------"
199 @echo "make world completed on `LC_TIME=C date`"
200 @echo "--------------------------------------------------------------"
202 .if defined(MAKEOBJDIRPREFIX)
203 WORLDTMP= ${MAKEOBJDIRPREFIX}${.CURDIR}/tmp
205 WORLDTMP= /usr/obj${.CURDIR}/tmp
207 STRICTTMPPATH= ${WORLDTMP}/sbin:${WORLDTMP}/usr/sbin:${WORLDTMP}/bin:${WORLDTMP}/usr/bin
208 TMPPATH= ${STRICTTMPPATH}:${PATH}
210 # XXX COMPILER_PATH is needed for finding cc1, ld and as
211 # XXX GCC_EXEC_PREFIX is for *crt.o. It is probably unnecessary now
212 # that LIBRARY_PATH is set. We still can't use -nostdlib, since gcc
213 # wouldn't link *crt.o or libgcc if it were used.
214 # XXX LD_LIBRARY_PATH is for ld.so. It is also used by ld, although we don't
215 # want that - all compile-time library paths should be resolved by gcc.
216 # It fails for set[ug]id executables (are any used?).
217 COMPILER_ENV= BISON_SIMPLE=${WORLDTMP}/usr/share/misc/bison.simple \
218 COMPILER_PATH=${WORLDTMP}/usr/libexec:${WORLDTMP}/usr/bin \
219 GCC_EXEC_PREFIX=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib/ \
220 LD_LIBRARY_PATH=${WORLDTMP}${SHLIBDIR} \
221 LIBRARY_PATH=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib
223 BMAKEENV= PATH=${TMPPATH} ${COMPILER_ENV} NOEXTRADEPEND=t \
224 OBJFORMAT_PATH=${WORLDTMP}/usr/libexec:/usr/libexec
225 XMAKEENV= PATH=${STRICTTMPPATH} ${COMPILER_ENV} \
226 OBJFORMAT_PATH=${WORLDTMP}/usr/libexec \
227 CFLAGS="-nostdinc ${CFLAGS}" # XXX -nostdlib
229 # used to compile and install 'make' in temporary build tree
230 MAKETMP= ${WORLDTMP}/make
231 IBMAKE= ${BMAKEENV} MAKEOBJDIR=${MAKETMP} ${MAKE} DESTDIR=${WORLDTMP}
233 BMAKE= ${BMAKEENV} ${WORLDTMP}/usr/bin/make DESTDIR=${WORLDTMP}
234 # cross make used for compilation
235 XMAKE= ${XMAKEENV} ${WORLDTMP}/usr/bin/make DESTDIR=${WORLDTMP}
236 # cross make used for final installation
237 IXMAKE= ${XMAKEENV} ${WORLDTMP}/usr/bin/make
242 # Attempt to rebuild the entire system, with reasonable chance of
243 # success, regardless of how old your existing system is.
246 .if !defined(NOCLEAN)
248 @echo "--------------------------------------------------------------"
249 @echo " Cleaning up the temporary build tree"
250 @echo "--------------------------------------------------------------"
252 chflags -R noschg ${WORLDTMP}/
255 .if !defined(NOTOOLS)
257 @echo "--------------------------------------------------------------"
259 @echo "--------------------------------------------------------------"
260 mkdir -p ${WORLDTMP}/usr/bin ${MAKETMP}
262 cd ${.CURDIR}/usr.bin/make; \
263 MAKEOBJDIRPREFIX=""; unset MAKEOBJDIRPREFIX; \
264 ${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} all; \
265 ${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} install; \
266 ${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} clean \
269 @echo "--------------------------------------------------------------"
270 @echo " Making mtree"
271 @echo "--------------------------------------------------------------"
272 mkdir -p ${WORLDTMP}/usr/sbin ${WORLDTMP}/mtree
274 cd ${.CURDIR}/usr.sbin/mtree; \
275 MAKEOBJDIRPREFIX=""; unset MAKEOBJDIRPREFIX; \
276 export MAKEOBJDIR=${WORLDTMP}/mtree; \
277 ${BMAKE} ${MK_FLAGS} all; \
278 ${BMAKE} ${MK_FLAGS} -B install clean \
282 @echo "--------------------------------------------------------------"
283 @echo " Making hierarchy"
284 @echo "--------------------------------------------------------------"
285 cd ${.CURDIR}; ${BMAKE} hierarchy
286 .if !defined(NOCLEAN)
288 @echo "--------------------------------------------------------------"
289 @echo " Cleaning up the obj tree"
290 @echo "--------------------------------------------------------------"
291 cd ${.CURDIR}; ${BMAKE} ${CLEANDIR:S/^/par-/}
293 .if !defined(NOOBJDIR)
295 @echo "--------------------------------------------------------------"
296 @echo " Rebuilding the obj tree"
297 @echo "--------------------------------------------------------------"
298 cd ${.CURDIR}; ${BMAKE} par-${OBJDIR}
300 .if !defined(NOTOOLS)
302 @echo "--------------------------------------------------------------"
303 @echo " Rebuilding bootstrap tools"
304 @echo "--------------------------------------------------------------"
305 cd ${.CURDIR}; ${BMAKE} bootstrap
307 @echo "--------------------------------------------------------------"
308 @echo " Rebuilding tools necessary to build the include files"
309 @echo "--------------------------------------------------------------"
310 cd ${.CURDIR}; ${BMAKE} include-tools
313 @echo "--------------------------------------------------------------"
314 @echo " Rebuilding ${DESTDIR}/usr/include"
315 @echo "--------------------------------------------------------------"
316 cd ${.CURDIR}; SHARED=copies ${BMAKE} includes
318 @echo "--------------------------------------------------------------"
319 @echo " Rebuilding bootstrap libraries"
320 @echo "--------------------------------------------------------------"
321 cd ${.CURDIR}; ${BMAKE} bootstrap-libraries
322 .if !defined(NOTOOLS)
324 @echo "--------------------------------------------------------------"
325 @echo " Rebuilding tools needed to build libraries"
326 @echo "--------------------------------------------------------------"
327 cd ${.CURDIR}; ${BMAKE} lib-tools
329 .if !defined(NOTOOLS)
331 @echo "--------------------------------------------------------------"
332 @echo " Rebuilding all other tools needed to build the world"
333 @echo "--------------------------------------------------------------"
334 cd ${.CURDIR}; ${BMAKE} build-tools
336 .if !defined(_NODEPEND)
338 @echo "--------------------------------------------------------------"
339 @echo " Rebuilding dependencies"
340 @echo "--------------------------------------------------------------"
341 cd ${.CURDIR}; ${XMAKE} par-depend
344 @echo "--------------------------------------------------------------"
345 @echo " Building libraries"
346 @echo "--------------------------------------------------------------"
347 cd ${.CURDIR}; ${XMAKE} -DNOINFO -DNOMAN libraries
349 @echo "--------------------------------------------------------------"
350 @echo " Building everything.."
351 @echo "--------------------------------------------------------------"
352 cd ${.CURDIR}; ${XMAKE} all
357 # Installs everything compiled by a 'buildworld'.
360 cd ${.CURDIR}; ${IXMAKE} reinstall
365 # If you have a build server, you can NFS mount the source and obj directories
366 # and do a 'make reinstall' on the *client* to install new binaries from the
367 # most recent server build.
370 @echo "--------------------------------------------------------------"
371 @echo " Making hierarchy"
372 @echo "--------------------------------------------------------------"
373 cd ${.CURDIR}; ${MAKE} hierarchy
375 @echo "--------------------------------------------------------------"
376 @echo " Installing everything.."
377 @echo "--------------------------------------------------------------"
378 cd ${.CURDIR}; ${MAKE} install
379 .if ${MACHINE_ARCH} == "i386"
381 @echo "--------------------------------------------------------------"
382 @echo " Re-scanning the shared libraries.."
383 @echo "--------------------------------------------------------------"
384 cd ${.CURDIR}; /sbin/ldconfig -R
387 @echo "--------------------------------------------------------------"
388 @echo " Rebuilding man page indexes"
389 @echo "--------------------------------------------------------------"
390 cd ${.CURDIR}/share/man; ${MAKE} makedb
395 # Update the source tree, by running sup and/or running cvs to update to the
399 .if defined(SUP_UPDATE)
400 @echo "--------------------------------------------------------------"
401 @echo "Running ${SUP}"
402 @echo "--------------------------------------------------------------"
403 @${SUP} ${SUPFLAGS} ${SUPFILE}
404 .if defined(SUPFILE1)
405 @${SUP} ${SUPFLAGS} ${SUPFILE1}
407 .if defined(SUPFILE2)
408 @${SUP} ${SUPFLAGS} ${SUPFILE2}
411 .if defined(CVS_UPDATE)
412 @echo "--------------------------------------------------------------"
413 @echo "Updating /usr/src from cvs repository" ${CVSROOT}
414 @echo "--------------------------------------------------------------"
415 cd ${.CURDIR}; cvs -q update -P -d
421 # Build most of the user binaries on the existing system libs and includes.
424 @echo "--------------------------------------------------------------"
425 @echo " Building programs only"
426 @echo "--------------------------------------------------------------"
427 cd ${.CURDIR}/bin; ${MAKE} all
428 cd ${.CURDIR}/sbin; ${MAKE} all
429 cd ${.CURDIR}/libexec; ${MAKE} all
430 cd ${.CURDIR}/usr.bin; ${MAKE} all
431 cd ${.CURDIR}/usr.sbin; ${MAKE} all
432 cd ${.CURDIR}/gnu/libexec; ${MAKE} all
433 cd ${.CURDIR}/gnu/usr.bin; ${MAKE} all
434 cd ${.CURDIR}/gnu/usr.sbin; ${MAKE} all
435 #.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT)
436 # cd ${.CURDIR}/kerberosIV; ${MAKE} most
438 #.if !defined(NOSECURE) && !defined(NOCRYPT)
439 # cd ${.CURDIR}/secure; ${MAKE} most
445 # Install the binaries built by the 'most' target. This does not include
446 # libraries or include files.
449 @echo "--------------------------------------------------------------"
450 @echo " Installing programs only"
451 @echo "--------------------------------------------------------------"
452 cd ${.CURDIR}/bin; ${MAKE} install
453 cd ${.CURDIR}/sbin; ${MAKE} install
454 cd ${.CURDIR}/libexec; ${MAKE} install
455 cd ${.CURDIR}/usr.bin; ${MAKE} install
456 cd ${.CURDIR}/usr.sbin; ${MAKE} install
457 cd ${.CURDIR}/gnu/libexec; ${MAKE} install
458 cd ${.CURDIR}/gnu/usr.bin; ${MAKE} install
459 cd ${.CURDIR}/gnu/usr.sbin; ${MAKE} install
460 #.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT)
461 # cd ${.CURDIR}/kerberosIV; ${MAKE} installmost
463 #.if !defined(NOSECURE) && !defined(NOCRYPT)
464 # cd ${.CURDIR}/secure; ${MAKE} installmost
468 # ------------------------------------------------------------------------
470 # From here onwards are utility targets used by the 'make world' and
471 # related targets. If your 'world' breaks, you may like to try to fix
472 # the problem and manually run the following targets to attempt to
473 # complete the build. Beware, this is *not* guaranteed to work, you
474 # need to have a pretty good grip on the current state of the system
475 # to attempt to manually finish it. If in doubt, 'make world' again.
479 # heirarchy - ensure that all the needed directories are present
482 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs
485 # bootstrap - [re]build tools needed to run the actual build, this includes
486 # tools needed by 'make depend', as some tools are needed to generate source
487 # for the dependency information to be gathered from.
491 rm -f ${DESTDIR}/usr/src/sys
492 ln -s ${.CURDIR}/sys ${DESTDIR}/usr/src
493 cd ${.CURDIR}/include; find -dx . | cpio -dump ${DESTDIR}/usr/include
494 .for d in net netinet posix4 sys vm machine
495 if [ -h ${DESTDIR}/usr/include/$d ]; then \
496 rm -f ${DESTDIR}/usr/include/$d ; \
500 find -dx net netinet posix4 sys vm -name '*.h' -o -type d | \
501 cpio -dump ${DESTDIR}/usr/include
502 mkdir -p ${DESTDIR}/usr/include/machine
503 cd ${.CURDIR}/sys/${MACHINE_ARCH}/include; find -dx . -name '*.h' -o -type d | \
504 cpio -dump ${DESTDIR}/usr/include/machine
506 cd ${.CURDIR}/usr.bin/make; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
507 ${MAKE} ${MK_FLAGS} all; \
508 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
509 cd ${.CURDIR}/usr.bin/xinstall; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
510 ${MAKE} ${MK_FLAGS} all; \
511 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
512 cd ${.CURDIR}/usr.bin/yacc; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
513 ${MAKE} ${MK_FLAGS} all; \
514 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
515 cd ${.CURDIR}/usr.bin/lex; ${MAKE} bootstrap; \
516 ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
517 ${MAKE} ${MK_FLAGS} -DNOLIB all; \
518 ${MAKE} ${MK_FLAGS} -DNOLIB -B install ${CLEANDIR}
519 .if !defined(NOOBJDIR)
520 cd ${.CURDIR}/usr.bin/lex; ${MAKE} ${OBJDIR}
522 cd ${.CURDIR}/usr.sbin/mtree; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
523 ${MAKE} ${MK_FLAGS} all; \
524 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
526 cd ${.CURDIR}/include && ${MAKE} copies
530 # include-tools - generally the same as 'bootstrap', except that it's for
531 # things that are specifically needed to generate include files.
533 # XXX should be merged with bootstrap, it's not worth keeeping them separate.
534 # Well, maybe it is now. We force 'cleandepend' here to avoid dependencies
535 # on cleaned away headers in ${WORLDTMP}.
538 .for d in usr.bin/compile_et usr.bin/rpcgen
539 cd ${.CURDIR}/$d; ${MAKE} cleandepend; \
540 ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
541 ${MAKE} ${MK_FLAGS} all; \
542 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
546 # includes - possibly generate and install the include files.
550 rm -rf ${DESTDIR}/usr/include/*
551 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
552 -p ${DESTDIR}/usr/include
554 cd ${.CURDIR}/include; ${MAKE} -B all install
555 cd ${.CURDIR}/gnu/include; ${MAKE} install
556 cd ${.CURDIR}/gnu/lib/libmp; ${MAKE} beforeinstall
557 cd ${.CURDIR}/gnu/lib/libobjc; ${MAKE} beforeinstall
558 cd ${.CURDIR}/gnu/lib/libreadline; ${MAKE} beforeinstall
559 cd ${.CURDIR}/gnu/lib/libregex; ${MAKE} beforeinstall
560 cd ${.CURDIR}/gnu/lib/libstdc++; ${MAKE} beforeinstall
561 cd ${.CURDIR}/gnu/lib/libg++; ${MAKE} beforeinstall
562 cd ${.CURDIR}/gnu/lib/libdialog; ${MAKE} beforeinstall
563 cd ${.CURDIR}/gnu/lib/libgmp; ${MAKE} beforeinstall
564 .if exists(secure) && !defined(NOCRYPT)
565 cd ${.CURDIR}/secure/lib/libdes; ${MAKE} beforeinstall
567 .if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
568 cd ${.CURDIR}/kerberosIV/lib/libacl; ${MAKE} beforeinstall
569 cd ${.CURDIR}/kerberosIV/lib/libkadm; ${MAKE} beforeinstall
570 cd ${.CURDIR}/kerberosIV/lib/libkafs; ${MAKE} beforeinstall
571 cd ${.CURDIR}/kerberosIV/lib/libkdb; ${MAKE} beforeinstall
572 cd ${.CURDIR}/kerberosIV/lib/libkrb; ${MAKE} beforeinstall
573 cd ${.CURDIR}/kerberosIV/lib/libtelnet; ${MAKE} beforeinstall
575 cd ${.CURDIR}/lib/libtelnet; ${MAKE} beforeinstall
577 .if exists(${.CURDIR}/lib/csu/${MACHINE})
578 cd ${.CURDIR}/lib/csu/${MACHINE}; ${MAKE} beforeinstall
580 cd ${.CURDIR}/lib/libalias; ${MAKE} beforeinstall
581 cd ${.CURDIR}/lib/libc; ${MAKE} beforeinstall
582 cd ${.CURDIR}/lib/libcalendar; ${MAKE} beforeinstall
583 cd ${.CURDIR}/lib/libcurses; ${MAKE} beforeinstall
584 cd ${.CURDIR}/lib/libdisk; ${MAKE} beforeinstall
585 cd ${.CURDIR}/lib/libedit; ${MAKE} beforeinstall
586 cd ${.CURDIR}/lib/libftpio; ${MAKE} beforeinstall
587 cd ${.CURDIR}/lib/libmd; ${MAKE} beforeinstall
588 cd ${.CURDIR}/lib/libmytinfo; ${MAKE} beforeinstall
589 cd ${.CURDIR}/lib/libncurses; ${MAKE} beforeinstall
590 .if !defined(WANT_CSRG_LIBM)
591 cd ${.CURDIR}/lib/msun; ${MAKE} beforeinstall
593 cd ${.CURDIR}/lib/libopie; ${MAKE} beforeinstall
594 cd ${.CURDIR}/lib/libpcap; ${MAKE} beforeinstall
595 cd ${.CURDIR}/lib/librpcsvc; ${MAKE} beforeinstall
596 cd ${.CURDIR}/lib/libskey; ${MAKE} beforeinstall
597 .if !defined(NOTCL) && exists (${.CURDIR}/contrib/tcl) && \
598 exists(${.CURDIR}/usr.bin/tclsh) && exists (${.CURDIR}/lib/libtcl)
599 cd ${.CURDIR}/lib/libtcl; ${MAKE} installhdrs
601 cd ${.CURDIR}/lib/libtermcap; ${MAKE} beforeinstall
602 cd ${.CURDIR}/lib/libcom_err; ${MAKE} beforeinstall
603 cd ${.CURDIR}/lib/libss; ${MAKE} -B hdrs beforeinstall
604 cd ${.CURDIR}/lib/libscsi; ${MAKE} beforeinstall
605 cd ${.CURDIR}/lib/libutil; ${MAKE} beforeinstall
606 cd ${.CURDIR}/lib/libvgl; ${MAKE} beforeinstall
607 cd ${.CURDIR}/lib/libz; ${MAKE} beforeinstall
608 cd ${.CURDIR}/usr.bin/f2c; ${MAKE} beforeinstall
609 cd ${.CURDIR}/usr.bin/lex; ${MAKE} beforeinstall
612 # Declare tools if they are not required on all architectures.
614 .if ${MACHINE_ARCH} == "i386"
616 _aout_ar = usr.bin/ar
617 _aout_as = gnu/usr.bin/as
618 _aout_ld = gnu/usr.bin/ld
619 _aout_nm = usr.bin/nm
620 _aout_ranlib = usr.bin/ranlib
621 _aout_size = usr.bin/size
622 _aout_strip = usr.bin/strip
626 # lib-tools - build tools to compile and install the libraries.
628 # XXX gperf is required for cc
629 # XXX a new ld and tsort is required for cc
645 gnu/usr.bin/binutils \
648 cd ${.CURDIR}/$d; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
649 ${MAKE} ${MK_FLAGS} all; \
650 ${MAKE} ${MK_FLAGS} -B install; \
651 ${MAKE} ${MK_FLAGS:S/-DNOPIC//} -B ${CLEANDIR} ${OBJDIR}
655 # We have to know too much about ordering and subdirs in the lib trees:
657 # To satisfy shared library linkage when only the libraries being built
660 # libcom_err must be built before libss.
661 # libcrypt and libmd must be built before libskey.
662 # libm must be built before libtcl.
663 # libmytinfo must be built before libdialog and libncurses.
664 # libncurses must be built before libdialog.
665 # libtermcap must be built before libcurses, libedit and libreadline.
667 # Some libraries are built conditionally and/or are in inconsistently
670 .if exists(lib/csu/${MACHINE}.pcc)
671 _csu=lib/csu/${MACHINE}.pcc
673 _csu=lib/csu/${MACHINE}
676 .if !defined(NOSECURE) && !defined(NOCRYPT)
677 _libcrypt= secure/lib/libcrypt lib/libcrypt
679 _libcrypt= lib/libcrypt
682 .if defined(WANT_CSRG_LIBM)
689 # bootstrap-libraries - build just enough libraries for the bootstrap
690 # tools, and install them under ${WORLDTMP}.
692 # Build csu and libgcc early so that some tools get linked to the new
693 # versions (too late for the main tools, however). Then build the
694 # necessary prerequisite libraries (libtermcap just needs to be before
695 # libcurses, and this only matters for the NOCLEAN case when NOPIC is
698 # This is mostly wrong. The build tools must run on the host system,
699 # so they should use host libraries. We depend on the target being
700 # similar enough to the host for new target libraries to work on the
704 .for _lib in ${_csu} gnu/usr.bin/cc/libgcc lib/libtermcap \
705 gnu/lib/libregex gnu/lib/libreadline lib/libc \
706 ${_libcrypt} lib/libcurses lib/libedit ${_libm} \
707 lib/libmd lib/libutil lib/libz usr.bin/lex/lib
708 .if exists(${.CURDIR}/${_lib})
709 cd ${.CURDIR}/${_lib}; \
710 ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
711 ${MAKE} ${MK_FLAGS} all; \
712 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
717 # libraries - build all libraries, and install them under ${DESTDIR}.
719 # The ordering is not as special as for bootstrap-libraries. Build
720 # the prerequisites first, then build almost everything else in
721 # alphabetical order.
724 .for _lib in lib/libcom_err ${_libcrypt} ${_libm} lib/libmytinfo \
725 lib/libncurses lib/libtermcap \
726 gnu/lib gnu/usr.bin/cc/libgcc lib usr.bin/lex/lib usr.sbin/pcvt/keycap
727 .if exists(${.CURDIR}/${_lib})
728 cd ${.CURDIR}/${_lib}; ${MAKE} all; ${MAKE} -B install
731 .if exists(${.CURDIR}/secure/lib) && !defined(NOCRYPT) && !defined(NOSECURE)
732 cd ${.CURDIR}/secure/lib; ${MAKE} all; ${MAKE} -B install
734 .if exists(${.CURDIR}/kerberosIV/lib) && !defined(NOCRYPT) && \
735 defined(MAKE_KERBEROS4)
736 cd ${.CURDIR}/kerberosIV/lib; ${MAKE} all; ${MAKE} -B install
740 # Exclude unused tools from build-tools.
742 .if !defined(NOGAMES) && exists(${.CURDIR}/games)
743 _adventure= games/adventure
744 _caesar= games/caesar
746 _phantasia= games/phantasia
747 _strfile= games/fortune/strfile
750 _perl= gnu/usr.bin/perl/perl
752 .if !defined(NOSHARE) && exists(${.CURDIR}/share)
753 _scrnmaps= share/syscons/scrnmaps
755 .if !defined(NOLKM) && exists(${.CURDIR}/lkm)
759 BTMAKEFLAGS= ${MK_FLAGS} -D_BUILD_TOOLS
762 # build-tools - build and install any other tools needed to complete the
763 # compile and install.
765 # bc and cpp are required to build groff. Otherwise, the order here is
766 # mostly historical, i.e., bogus.
767 # chmod is used to build gcc's tmpmultilib[2] at obscure times.
769 # XXX uname is a bug - the target should not depend on the host.
794 gnu/usr.bin/man/makewhatis \
798 gnu/usr.bin/texinfo \
835 cd ${.CURDIR}/$d; ${MAKE} ${BTMAKEFLAGS} ${_DEPEND}; \
836 ${MAKE} ${BTMAKEFLAGS} all; \
837 ${MAKE} ${BTMAKEFLAGS} -B install ${CLEANDIR} ${OBJDIR}
839 .if !defined(NOGAMES) && exists(${.CURDIR}/games)
840 cd ${DESTDIR}/usr/games; cp -p caesar strfile ${DESTDIR}/usr/bin
847 gnu/usr.bin/cc/cc_tools \
851 sys/i386/boot/netboot
852 cd ${.CURDIR}/$d; ${MAKE} ${BTMAKEFLAGS} build-tools
854 cd ${.CURDIR}/usr.bin/tn3270/tools; ${MAKE} ${BTMAKEFLAGS} all
856 .for __target in clean cleandepend cleandir depend obj
857 .for entry in ${SUBDIR}
858 ${entry}.${__target}__D: .PHONY
859 @if test -d ${.CURDIR}/${entry}.${MACHINE}; then \
860 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE}"; \
861 edir=${entry}.${MACHINE}; \
862 cd ${.CURDIR}/$${edir}; \
864 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \
866 cd ${.CURDIR}/$${edir}; \
868 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
870 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
875 .include <bsd.subdir.mk>