2 # $Id: Makefile.inc1,v 1.75 1999/05/02 15:23:55 markm Exp $
4 # Make command line options:
5 # -DCLOBBER will remove /usr/include
6 # -DMAKE_KERBEROS4 to build KerberosIV
7 # -DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
8 # -DNOCLEAN do not clean at all
9 # -DNOTOOLS do not rebuild any tools first
10 # -DNOCRYPT will prevent building of crypt versions
11 # -DNOPROFILE do not build profiled libraries
12 # -DNOSECURE do not go into secure subdir
13 # -DNOGAMES do not go into games subdir
14 # -DNOSHARE do not go into share subdir
15 # -DNOINFO do not make or install info files
16 # -DNOLIBC_R do not build libc_r.
17 # -DNO_FORTRAN do not build g77 and related libraries.
18 # LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
21 # The intended user-driven targets are:
22 # buildworld - rebuild *everything*, including glue to help do upgrades
23 # installworld- install everything built by "buildworld"
24 # update - convenient way to update your source tree (eg: sup/cvs)
25 # most - build user commands, no libraries or include files
26 # installmost - install user commands, no libraries or include files
28 # Standard targets (not defined here) are documented in the makefiles in
29 # /usr/share/mk. These include:
30 # obj depend all install clean cleandepend cleanobj
32 # Put initial settings here.
35 # We must do share/info early so that installation of info `dir'
36 # entries works correctly. Do it first since it is less likely to
37 # grow dependencies on include and lib than vice versa.
38 .if exists(${.CURDIR}/share/info)
42 # We must do include and lib early so that the perl *.ph generation
43 # works correctly as it uses the header files installed by this.
44 .if exists(${.CURDIR}/include)
47 .if exists(${.CURDIR}/lib)
51 .if exists(${.CURDIR}/bin)
54 .if exists(${.CURDIR}/games) && !defined(NOGAMES)
57 .if exists(${.CURDIR}/gnu)
60 .if exists(${.CURDIR}/kerberosIV) && exists(${.CURDIR}/crypto) && \
61 !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
64 .if exists(${.CURDIR}/libexec)
67 .if exists(${.CURDIR}/sbin)
70 .if exists(${.CURDIR}/share) && !defined(NOSHARE)
73 .if exists(${.CURDIR}/sys)
76 .if exists(${.CURDIR}/usr.bin)
79 .if exists(${.CURDIR}/usr.sbin)
82 .if exists(${.CURDIR}/secure) && !defined(NOCRYPT) && !defined(NOSECURE)
86 # etc must be last for "distribute" to work
87 .if exists(${.CURDIR}/etc)
91 # These are last, since it is nice to at least get the base system
92 # rebuilt before you do them.
93 .if defined(LOCAL_DIRS)
94 .for _DIR in ${LOCAL_DIRS}
95 .if exists(${.CURDIR}/${_DIR}) & exists(${.CURDIR}/${_DIR}/Makefile)
106 .if defined(NOCLEANDIR)
107 CLEANDIR= clean cleandepend
113 .if !defined(NOCLEAN)
116 .if defined(_NODEPEND)
123 SUPFLAGS?= -g -L 2 -P -
126 # While building tools for bootstrapping, we don't need to waste time on
127 # shared or profiled libraries, shared linkage, or documentation, except
128 # when the tools won't get cleaned we must use the defaults for shared
129 # libraries and shared linkage (and this doesn't waste time).
130 # XXX actually, we do need to waste time building shared libraries.
133 MK_FLAGS= -DWORLD -DNOINFO -DNOMAN -DNOPROFILE
135 MK_FLAGS= -DWORLD -DNOINFO -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED
139 # Define the location of the temporary installation directory. Note that
140 # MAKEOBJDIRPREFIX normally isn't defined so if the current directory is
141 # /usr/src, then the world temporary directory is /usr/obj/usr/src/tmp.
143 # During the transition from aout to elf format on i386, MAKEOBJDIRPREFIX
144 # is set by the parent makefile (Makefile.inc0) to be /usr/obj/${OBJFORMAT}
145 # in order to keep aout and elf format files apart.
147 .if defined(MAKEOBJDIRPREFIX)
148 WORLDTMP= ${MAKEOBJDIRPREFIX}${.CURDIR}/tmp
150 WORLDTMP= /usr/obj${.CURDIR}/tmp
154 # Define the PATH to the build tools.
156 # If not building tools, the PATH always points to the installed binaries.
157 # The NOTOOLS option assumes that in installed tools are good enough and that
158 # the user's PATH will locate to appropriate tools. This option is required
159 # for a cross-compiled build environment.
161 # If building tools, then the PATH includes the world temporary directories
162 # so that the bootstrapped tools are used as soon as they are built. The
163 # strict path is for use after all tools are supposed to have been
164 # bootstrapped. It doesn't allow any of the installed tools to be used.
167 # Default root of the tool tree
169 # Choose the PATH relative to the root of the tool tree
170 PATH= ${TOOLROOT}/sbin:${TOOLROOT}/bin:${TOOLROOT}/usr/sbin:${TOOLROOT}/usr/bin
172 TOOLROOT= ${WORLDTMP}
174 STRICTTMPPATH= ${TOOLROOT}/sbin:${TOOLROOT}/usr/sbin:${TOOLROOT}/bin:${TOOLROOT}/usr/bin
175 TMPPATH= ${STRICTTMPPATH}:${PATH}
177 # XXX COMPILER_PATH is needed for finding cc1, ld and as
178 # XXX GCC_EXEC_PREFIX is for *crt.o. It is probably unnecessary now
179 # that LIBRARY_PATH is set. We still can't use -nostdlib, since gcc
180 # wouldn't link *crt.o or libgcc if it were used.
181 # XXX LD_LIBRARY_PATH is for ld.so. It is also used by ld, although we don't
182 # want that - all compile-time library paths should be resolved by gcc.
183 # It fails for set[ug]id executables (are any used?).
184 COMPILER_ENV= BISON_SIMPLE=${TOOLROOT}/usr/share/misc/bison.simple \
185 COMPILER_PATH=${TOOLROOT}/usr/libexec:${TOOLROOT}/usr/bin \
186 GCC_EXEC_PREFIX=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib/ \
187 LD_LIBRARY_PATH=${TOOLROOT}${SHLIBDIR} \
188 LIBRARY_PATH=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib
190 BMAKEENV= PATH=${TMPPATH} ${COMPILER_ENV} NOEXTRADEPEND=t \
191 OBJFORMAT_PATH=${TOOLROOT}/usr/libexec:/usr/libexec
192 XMAKEENV= PATH=${STRICTTMPPATH} ${COMPILER_ENV} \
193 PERL5LIB=${DESTDIR}/usr/libdata/perl/5.00503 \
194 OBJFORMAT_PATH=${TOOLROOT}/usr/libexec \
195 CFLAGS="-nostdinc ${CFLAGS}" # XXX -nostdlib
197 # used to compile and install 'make' in temporary build tree
198 MAKETMP= ${WORLDTMP}/make
199 IBMAKE= ${BMAKEENV} MAKEOBJDIR=${MAKETMP} ${MAKE} DESTDIR=${WORLDTMP}
203 BMAKE= ${BMAKEENV} ${MAKE} DESTDIR=${WORLDTMP}
204 # cross make used for compilation
205 XMAKE= ${XMAKEENV} ${MAKE} DESTDIR=${WORLDTMP}
206 # cross make used for final installation
207 IXMAKE= ${XMAKEENV} ${MAKE}
210 BMAKE= ${BMAKEENV} ${WORLDTMP}/usr/bin/make DESTDIR=${WORLDTMP}
211 # cross make used for compilation
212 XMAKE= ${XMAKEENV} ${WORLDTMP}/usr/bin/make DESTDIR=${WORLDTMP}
213 # cross make used for final installation
214 IXMAKE= ${XMAKEENV} ${WORLDTMP}/usr/bin/make
220 # Attempt to rebuild the entire system, with reasonable chance of
221 # success, regardless of how old your existing system is.
223 buildworld: check-objformat
224 .if !defined(NOCLEAN)
226 @echo "--------------------------------------------------------------"
227 @echo ">>> Cleaning up the temporary ${OBJFORMAT} build tree"
228 @echo "--------------------------------------------------------------"
230 -chflags -R noschg ${WORLDTMP}/
233 .if !defined(NOTOOLS)
235 @echo "--------------------------------------------------------------"
236 @echo ">>> Making make"
237 @echo "--------------------------------------------------------------"
238 mkdir -p ${WORLDTMP}/usr/bin ${MAKETMP}
240 cd ${.CURDIR}/usr.bin/make; \
241 MAKEOBJDIRPREFIX=""; unset MAKEOBJDIRPREFIX; \
242 ${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} all; \
243 ${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} install; \
244 ${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} clean \
247 @echo "--------------------------------------------------------------"
248 @echo ">>> Making mtree"
249 @echo "--------------------------------------------------------------"
250 mkdir -p ${WORLDTMP}/usr/sbin ${WORLDTMP}/mtree
252 cd ${.CURDIR}/usr.sbin/mtree; \
253 MAKEOBJDIRPREFIX=""; unset MAKEOBJDIRPREFIX; \
254 export MAKEOBJDIR=${WORLDTMP}/mtree; \
255 ${BMAKE} ${MK_FLAGS} all; \
256 ${BMAKE} ${MK_FLAGS} -B install clean \
260 @echo "--------------------------------------------------------------"
261 @echo ">>> Making hierarchy"
262 @echo "--------------------------------------------------------------"
264 cd ${.CURDIR}; ${BMAKE} -f Makefile.inc1 hierarchy
265 .if !defined(NOCLEAN)
267 @echo "--------------------------------------------------------------"
268 @echo ">>> Cleaning up the ${OBJFORMAT} obj tree"
269 @echo "--------------------------------------------------------------"
270 cd ${.CURDIR}; ${BMAKE} -f Makefile.inc1 ${CLEANDIR:S/^/par-/}
273 @echo "--------------------------------------------------------------"
274 @echo ">>> Rebuilding the ${OBJFORMAT} obj tree"
275 @echo "--------------------------------------------------------------"
276 cd ${.CURDIR}; ${BMAKE} -f Makefile.inc1 par-${OBJDIR}
277 .if !defined(NOTOOLS)
279 @echo "--------------------------------------------------------------"
280 @echo ">>> Rebuilding ${OBJFORMAT} bootstrap tools"
281 @echo "--------------------------------------------------------------"
282 cd ${.CURDIR}; ${BMAKE} -f Makefile.inc1 bootstrap
284 @echo "--------------------------------------------------------------"
285 @echo ">>> Rebuilding tools necessary to build the include files"
286 @echo "--------------------------------------------------------------"
287 cd ${.CURDIR}; ${BMAKE} -f Makefile.inc1 include-tools
290 @echo "--------------------------------------------------------------"
291 @echo ">>> Rebuilding ${DESTDIR}/usr/include"
292 @echo "--------------------------------------------------------------"
293 cd ${.CURDIR}; SHARED=copies ${BMAKE} -f Makefile.inc1 includes
295 @echo "--------------------------------------------------------------"
296 @echo ">>> Rebuilding bootstrap libraries"
297 @echo "--------------------------------------------------------------"
298 cd ${.CURDIR}; ${BMAKE} -f Makefile.inc1 bootstrap-libraries
299 .if !defined(NOTOOLS)
301 @echo "--------------------------------------------------------------"
302 @echo ">>> Rebuilding tools needed to build libraries"
303 @echo "--------------------------------------------------------------"
304 cd ${.CURDIR}; ${BMAKE} -f Makefile.inc1 lib-tools
306 .if !defined(NOTOOLS)
308 @echo "--------------------------------------------------------------"
309 @echo ">>> Rebuilding all other tools needed to build the ${OBJFORMAT} world"
310 @echo "--------------------------------------------------------------"
311 cd ${.CURDIR}; ${BMAKE} -f Makefile.inc1 build-tools
313 .if !defined(_NODEPEND)
315 @echo "--------------------------------------------------------------"
316 @echo ">>> Rebuilding dependencies"
317 @echo "--------------------------------------------------------------"
318 cd ${.CURDIR}; ${XMAKE} -f Makefile.inc1 par-depend
321 @echo "--------------------------------------------------------------"
322 @echo ">>> Building ${OBJFORMAT} libraries"
323 @echo "--------------------------------------------------------------"
324 cd ${.CURDIR}; ${XMAKE} -DNOINFO -DNOMAN -f Makefile.inc1 libraries
326 @echo "--------------------------------------------------------------"
327 @echo ">>> Building everything.."
328 @echo "--------------------------------------------------------------"
329 cd ${.CURDIR}; ${XMAKE} -f Makefile.inc1 all
332 @echo "--------------------------------------------------------------"
333 @echo ">>> Building everything.."
334 @echo "--------------------------------------------------------------"
335 cd ${.CURDIR}; ${XMAKE} -f Makefile.inc1 all
340 # Installs everything compiled by a 'buildworld'.
343 cd ${.CURDIR}; ${IXMAKE} -f Makefile.inc1 reinstall
348 # If you have a build server, you can NFS mount the source and obj directories
349 # and do a 'make reinstall' on the *client* to install new binaries from the
350 # most recent server build.
353 @echo "--------------------------------------------------------------"
354 @echo ">>> Making hierarchy"
355 @echo "--------------------------------------------------------------"
356 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
358 @echo "--------------------------------------------------------------"
359 @echo ">>> Installing everything.."
360 @echo "--------------------------------------------------------------"
361 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
362 .if ${MACHINE_ARCH} == "i386" && ${OBJFORMAT} == "aout" && !defined(DESTDIR)
364 @echo "--------------------------------------------------------------"
365 @echo ">>> Re-scanning the shared libraries.."
366 @echo "--------------------------------------------------------------"
367 -cd ${.CURDIR}; /sbin/ldconfig -R
371 @echo "--------------------------------------------------------------"
372 @echo ">>> Rebuilding man page indices"
373 @echo "--------------------------------------------------------------"
374 cd ${.CURDIR}/share/man; ${MAKE} makedb
380 # Update the source tree, by running sup and/or running cvs to update to the
384 .if defined(SUP_UPDATE)
385 @echo "--------------------------------------------------------------"
386 @echo ">>> Running ${SUP}"
387 @echo "--------------------------------------------------------------"
388 @${SUP} ${SUPFLAGS} ${SUPFILE}
389 .if defined(SUPFILE1)
390 @${SUP} ${SUPFLAGS} ${SUPFILE1}
392 .if defined(SUPFILE2)
393 @${SUP} ${SUPFLAGS} ${SUPFILE2}
396 .if defined(CVS_UPDATE)
397 @echo "--------------------------------------------------------------"
398 @echo ">>> Updating /usr/src from cvs repository" ${CVSROOT}
399 @echo "--------------------------------------------------------------"
400 cd ${.CURDIR}; cvs -q update -P -d
406 # Build most of the user binaries on the existing system libs and includes.
409 @echo "--------------------------------------------------------------"
410 @echo ">>> Building programs only"
411 @echo "--------------------------------------------------------------"
412 cd ${.CURDIR}/bin; ${MAKE} all
413 cd ${.CURDIR}/sbin; ${MAKE} all
414 cd ${.CURDIR}/libexec; ${MAKE} all
415 cd ${.CURDIR}/usr.bin; ${MAKE} all
416 cd ${.CURDIR}/usr.sbin; ${MAKE} all
417 cd ${.CURDIR}/gnu/libexec; ${MAKE} all
418 cd ${.CURDIR}/gnu/usr.bin; ${MAKE} all
419 cd ${.CURDIR}/gnu/usr.sbin; ${MAKE} all
420 #.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT)
421 # cd ${.CURDIR}/kerberosIV; ${MAKE} most
423 #.if !defined(NOSECURE) && !defined(NOCRYPT)
424 # cd ${.CURDIR}/secure; ${MAKE} most
430 # Install the binaries built by the 'most' target. This does not include
431 # libraries or include files.
434 @echo "--------------------------------------------------------------"
435 @echo ">>> Installing programs only"
436 @echo "--------------------------------------------------------------"
437 cd ${.CURDIR}/bin; ${MAKE} install
438 cd ${.CURDIR}/sbin; ${MAKE} install
439 cd ${.CURDIR}/libexec; ${MAKE} install
440 cd ${.CURDIR}/usr.bin; ${MAKE} install
441 cd ${.CURDIR}/usr.sbin; ${MAKE} install
442 cd ${.CURDIR}/gnu/libexec; ${MAKE} install
443 cd ${.CURDIR}/gnu/usr.bin; ${MAKE} install
444 cd ${.CURDIR}/gnu/usr.sbin; ${MAKE} install
445 #.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT)
446 # cd ${.CURDIR}/kerberosIV; ${MAKE} installmost
448 #.if !defined(NOSECURE) && !defined(NOCRYPT)
449 # cd ${.CURDIR}/secure; ${MAKE} installmost
453 # ------------------------------------------------------------------------
455 # From here onwards are utility targets used by the 'make world' and
456 # related targets. If your 'world' breaks, you may like to try to fix
457 # the problem and manually run the following targets to attempt to
458 # complete the build. Beware, this is *not* guaranteed to work, you
459 # need to have a pretty good grip on the current state of the system
460 # to attempt to manually finish it. If in doubt, 'make world' again.
464 # hierarchy - ensure that all the needed directories are present
467 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs
470 # bootstrap - [re]build tools needed to run the actual build, this includes
471 # tools needed by 'make depend', as some tools are needed to generate source
472 # for the dependency information to be gathered from.
475 cd ${.CURDIR}/usr.bin/make; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
476 ${MAKE} ${MK_FLAGS} all; \
477 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
478 cd ${.CURDIR}/usr.bin/xinstall; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
479 ${MAKE} ${MK_FLAGS} all; \
480 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
481 cd ${.CURDIR}/usr.bin/yacc; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
482 ${MAKE} ${MK_FLAGS} all; \
483 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
484 cd ${.CURDIR}/usr.bin/lex; ${MAKE} bootstrap; \
485 ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
486 ${MAKE} ${MK_FLAGS} -DNOLIB all; \
487 ${MAKE} ${MK_FLAGS} -DNOLIB -B install ${CLEANDIR}
488 cd ${.CURDIR}/usr.bin/lex; ${MAKE} ${OBJDIR}
489 cd ${.CURDIR}/usr.sbin/mtree; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
490 ${MAKE} ${MK_FLAGS} all; \
491 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
494 # include-tools - generally the same as 'bootstrap', except that it's for
495 # things that are specifically needed to generate include files.
497 # XXX should be merged with bootstrap, it's not worth keeeping them separate.
498 # Well, maybe it is now. We force 'cleandepend' here to avoid dependencies
499 # on cleaned away headers in ${WORLDTMP}.
502 .for d in usr.bin/compile_et usr.bin/rpcgen
503 cd ${.CURDIR}/$d; ${MAKE} cleandepend; \
504 ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
505 ${MAKE} ${MK_FLAGS} all; \
506 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
510 # includes - possibly generate and install the include files.
514 rm -rf ${DESTDIR}/usr/include/*
515 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
516 -p ${DESTDIR}/usr/include
518 cd ${.CURDIR}/include; ${MAKE} -B all install
519 cd ${.CURDIR}/gnu/include; ${MAKE} install
520 cd ${.CURDIR}/gnu/lib/libmp; ${MAKE} beforeinstall
521 cd ${.CURDIR}/gnu/lib/libobjc; ${MAKE} beforeinstall
522 cd ${.CURDIR}/gnu/lib/libreadline; ${MAKE} beforeinstall
523 cd ${.CURDIR}/gnu/lib/libregex; ${MAKE} beforeinstall
524 cd ${.CURDIR}/gnu/lib/libstdc++; ${MAKE} beforeinstall
525 cd ${.CURDIR}/gnu/lib/libdialog; ${MAKE} beforeinstall
526 cd ${.CURDIR}/gnu/lib/libgmp; ${MAKE} beforeinstall
527 cd ${.CURDIR}/gnu/usr.bin/cc/cc1plus; ${MAKE} beforeinstall
528 .if exists(${.CURDIR}/secure) && !defined(NOCRYPT)
529 cd ${.CURDIR}/secure/lib/libdes; ${MAKE} beforeinstall
531 .if exists(${.CURDIR}/kerberosIV) && !defined(NOCRYPT) && \
532 defined(MAKE_KERBEROS4)
533 cd ${.CURDIR}/kerberosIV/lib/libacl; ${MAKE} beforeinstall
534 cd ${.CURDIR}/kerberosIV/lib/libkadm; ${MAKE} beforeinstall
535 cd ${.CURDIR}/kerberosIV/lib/libkafs; ${MAKE} beforeinstall
536 cd ${.CURDIR}/kerberosIV/lib/libkdb; ${MAKE} beforeinstall
537 cd ${.CURDIR}/kerberosIV/lib/libkrb; ${MAKE} beforeinstall
538 cd ${.CURDIR}/kerberosIV/lib/libtelnet; ${MAKE} beforeinstall
540 cd ${.CURDIR}/lib/libtelnet; ${MAKE} beforeinstall
542 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH})
543 cd ${.CURDIR}/lib/csu/${MACHINE_ARCH}; ${MAKE} beforeinstall
545 cd ${.CURDIR}/lib/libalias; ${MAKE} beforeinstall
546 cd ${.CURDIR}/lib/libatm; ${MAKE} beforeinstall
547 cd ${.CURDIR}/lib/libdevstat; ${MAKE} beforeinstall
548 cd ${.CURDIR}/lib/libc; ${MAKE} beforeinstall
549 cd ${.CURDIR}/lib/libcalendar; ${MAKE} beforeinstall
550 cd ${.CURDIR}/lib/libcam; ${MAKE} beforeinstall
551 cd ${.CURDIR}/lib/libcurses; ${MAKE} beforeinstall
552 cd ${.CURDIR}/lib/libdisk; ${MAKE} beforeinstall
553 cd ${.CURDIR}/lib/libedit; ${MAKE} beforeinstall
554 cd ${.CURDIR}/lib/libftpio; ${MAKE} beforeinstall
555 cd ${.CURDIR}/lib/libmd; ${MAKE} beforeinstall
556 cd ${.CURDIR}/lib/libmytinfo; ${MAKE} beforeinstall
557 cd ${.CURDIR}/lib/libncurses; ${MAKE} beforeinstall
558 .if !defined(WANT_CSRG_LIBM)
559 cd ${.CURDIR}/lib/msun; ${MAKE} beforeinstall
561 cd ${.CURDIR}/lib/libopie; ${MAKE} beforeinstall
562 cd ${.CURDIR}/lib/libpam/libpam; ${MAKE} beforeinstall
563 cd ${.CURDIR}/lib/libpcap; ${MAKE} beforeinstall
564 cd ${.CURDIR}/lib/libradius; ${MAKE} beforeinstall
565 cd ${.CURDIR}/lib/librpcsvc; ${MAKE} beforeinstall
566 cd ${.CURDIR}/lib/libskey; ${MAKE} beforeinstall
567 cd ${.CURDIR}/lib/libstand; ${MAKE} beforeinstall
568 cd ${.CURDIR}/lib/libtacplus; ${MAKE} beforeinstall
569 cd ${.CURDIR}/lib/libtermcap; ${MAKE} beforeinstall
570 cd ${.CURDIR}/lib/libcom_err; ${MAKE} beforeinstall
571 cd ${.CURDIR}/lib/libss; ${MAKE} -B hdrs beforeinstall
572 cd ${.CURDIR}/lib/libutil; ${MAKE} beforeinstall
573 cd ${.CURDIR}/lib/libvgl; ${MAKE} beforeinstall
574 cd ${.CURDIR}/lib/libwrap; ${MAKE} beforeinstall
575 cd ${.CURDIR}/lib/libz; ${MAKE} beforeinstall
576 cd ${.CURDIR}/usr.bin/f2c; ${MAKE} beforeinstall
577 cd ${.CURDIR}/usr.bin/lex; ${MAKE} beforeinstall
580 # Declare tools if they are not required on all architectures.
582 .if ${MACHINE_ARCH} == "i386"
584 _aout_ar = usr.bin/ar
585 _aout_as = gnu/usr.bin/as
586 _aout_ld = gnu/usr.bin/ld
587 _aout_nm = usr.bin/nm
588 _aout_ranlib = usr.bin/ranlib
589 _aout_size = usr.bin/size
590 _aout_strip = usr.bin/strip
591 # boot block/loader tools:
592 _btxld = usr.sbin/btxld
596 # lib-tools - build tools to compile and install the libraries.
598 # XXX gperf is required for cc
599 # XXX a new ld and tsort is required for cc
616 gnu/usr.bin/binutils \
619 cd ${.CURDIR}/$d; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
620 ${MAKE} ${MK_FLAGS} all; \
621 ${MAKE} ${MK_FLAGS} -B install; \
622 ${MAKE} ${MK_FLAGS:S/-DNOPIC//} -B ${CLEANDIR} ${OBJDIR}
626 # We have to know too much about ordering and subdirs in the lib trees:
628 # To satisfy shared library linkage when only the libraries being built
631 # csu must be built before all shared libaries for ELF.
632 # libcom_err must be built before libss.
633 # libcrypt must be built before libskey and libkrb.
634 # libdes must be built before libpam.
635 # libkrb must be built before libpam.
636 # libm must be built before libf2c and libstdc++.
637 # libmd must be built before libatm, libopie, libradius, libskey,
638 # libtacplus and libcrypt.
639 # libmytinfo must be built before libdialog and libncurses.
640 # libncurses must be built before libdialog.
641 # libradius must be built before libpam.
642 # libskey must be built before libpam.
643 # libtacplus must be built before libpam.
644 # libtermcap must be built before libcurses, libedit and libreadline.
646 # Some libraries are built conditionally and/or are in inconsistently
649 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}.pcc)
650 _csu=lib/csu/${MACHINE_ARCH}.pcc
651 .elif ${MACHINE_ARCH} == "i386" && ${OBJFORMAT} == "elf"
652 _csu=lib/csu/i386-elf
654 _csu=lib/csu/${MACHINE_ARCH}
657 .if !defined(NOSECURE) && !defined(NOCRYPT)
658 _libcrypt= lib/libcrypt secure/lib/libcrypt
659 _secure_lib= secure/lib
661 _libcrypt= lib/libcrypt
664 .if !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
665 _kerberosIV_lib=kerberosIV/lib
668 .if defined(WANT_CSRG_LIBM)
675 _libperl= gnu/usr.bin/perl/libperl
679 # bootstrap-libraries - build just enough libraries for the bootstrap
680 # tools, and install them under ${WORLDTMP}.
682 # Build csu early so that some tools get linked to the new
683 # version (too late for the main tools, however). Then build the
684 # necessary prerequisite libraries (libtermcap just needs to be before
685 # libcurses, and this only matters for the NOCLEAN case when NOPIC is
688 # This is mostly wrong. The build tools must run on the host system,
689 # so they should use host libraries. We depend on the target being
690 # similar enough to the host for new target libraries to work on the
694 .for _lib in ${_csu} lib/libtermcap \
695 gnu/lib/libregex gnu/lib/libreadline lib/libc \
696 lib/libcurses lib/libedit ${_libm} \
697 lib/libmd lib/libcrypt lib/libutil lib/libz usr.bin/lex/lib \
699 .if exists(${.CURDIR}/${_lib})
700 cd ${.CURDIR}/${_lib}; \
701 ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
702 ${MAKE} ${MK_FLAGS} all; \
703 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
708 # libraries - build all libraries, and install them under ${DESTDIR}.
710 # The ordering is not as special as for bootstrap-libraries. Build
711 # the prerequisites first, then build almost everything else in
712 # alphabetical order.
715 .for _lib in ${_csu} lib/libcom_err ${_libm} lib/libmd ${_libcrypt} \
716 lib/libmytinfo lib/libncurses lib/libtermcap \
717 lib/libradius lib/libskey lib/libtacplus \
718 ${_secure_lib} ${_kerberosIV_lib} \
719 gnu/lib ${_libperl} lib usr.bin/lex/lib \
721 .if exists(${.CURDIR}/${_lib})
722 cd ${.CURDIR}/${_lib}; ${MAKE} all; ${MAKE} -B install
727 # Exclude unused tools from build-tools.
729 .if !defined(NOGAMES) && exists(${.CURDIR}/games)
730 _adventure= games/adventure
731 _caesar= games/caesar
733 _phantasia= games/phantasia
734 _strfile= games/fortune/strfile
737 _perl= gnu/usr.bin/perl/miniperl
739 .if !defined(NOSHARE) && exists(${.CURDIR}/share)
740 _scrnmaps= share/syscons/scrnmaps
742 .if ${MACHINE_ARCH} == i386
743 _kldlinux= sys/modules/linux
745 .if ${OBJFORMAT} == "aout"
746 _netboot= sys/${MACHINE}/boot/netboot
749 BTMAKEFLAGS= ${MK_FLAGS} -D_BUILD_TOOLS
752 # build-tools - build and install any other tools needed to complete the
753 # compile and install.
755 # bc and cpp are required to build groff. Otherwise, the order here is
756 # mostly historical, i.e., bogus.
757 # chmod is used to build gcc's tmpmultilib[2] at obscure times.
759 # XXX uname is a bug - the target should not depend on the host.
784 gnu/usr.bin/man/makewhatis \
788 gnu/usr.bin/texinfo \
828 cd ${.CURDIR}/$d; ${MAKE} ${BTMAKEFLAGS} ${_DEPEND}; \
829 ${MAKE} ${BTMAKEFLAGS} all; \
830 ${MAKE} ${BTMAKEFLAGS} -B install ${CLEANDIR} ${OBJDIR}
832 .if !defined(NOGAMES) && exists(${.CURDIR}/games)
833 cd ${DESTDIR}/usr/games; cp -p caesar strfile ${DESTDIR}/usr/bin
840 gnu/usr.bin/cc/cc_tools \
846 cd ${.CURDIR}/$d; ${MAKE} ${BTMAKEFLAGS} build-tools
848 cd ${.CURDIR}/usr.bin/tn3270/tools; ${MAKE} ${BTMAKEFLAGS} all
851 # Build aout versions of things that provide legacy support when all the
852 # rest of the world is elf.
855 .if ${MACHINE_ARCH} == "i386" && ${OBJFORMAT} == "aout"
857 @echo "--------------------------------------------------------------"
858 @echo ">>> Making hierarchy"
859 @echo "--------------------------------------------------------------"
861 cd ${.CURDIR}; ${XMAKE} -f Makefile.inc1 hierarchy
863 @echo "--------------------------------------------------------------"
864 @echo ">>> Rebuilding the ${OBJFORMAT} obj tree"
865 @echo "--------------------------------------------------------------"
866 cd ${.CURDIR}; ${XMAKE} -f Makefile.inc1 par-${OBJDIR}
868 @echo "--------------------------------------------------------------"
869 @echo ">>> Rebuilding ${DESTDIR}/usr/include"
870 @echo "--------------------------------------------------------------"
871 cd ${.CURDIR}; SHARED=copies ${XMAKE} -f Makefile.inc1 includes
873 @echo "--------------------------------------------------------------"
874 @echo ">>> Building legacy libraries"
875 @echo "--------------------------------------------------------------"
877 ${XMAKE} -DNOINFO -DNOMAN -f Makefile.inc1 bootstrap-libraries
879 ${XMAKE} -DNOINFO -DNOMAN -f Makefile.inc1 libraries
881 @echo "--------------------------------------------------------------"
882 @echo ">>> Building legacy rtld"
883 @echo "--------------------------------------------------------------"
884 cd ${.CURDIR}/libexec/rtld-aout; \
885 ${XMAKE} -DNOMAN depend; ${XMAKE} -DNOMAN all;
887 @echo "--------------------------------------------------------------"
888 @echo ">>> Building legacy boot"
889 @echo "--------------------------------------------------------------"
890 cd ${.CURDIR}/sys/${MACHINE}/boot && \
891 ${XMAKE} -DNOMAN -B obj depend; ${XMAKE} -DNOMAN all;
895 # Install aout versions of things that provide legacy support when all the
896 # rest of the world is elf.
899 .if ${MACHINE_ARCH} == "i386" && ${OBJFORMAT} == "aout"
901 @echo "--------------------------------------------------------------"
902 @echo ">>> Installing legacy libraries"
903 @echo "--------------------------------------------------------------"
904 cd ${.CURDIR}/lib; ${MAKE} -B -DNOMAN -DNOINFO install
905 cd ${.CURDIR}/gnu/lib; ${MAKE} -B -DNOMAN -DNOINFO install
906 cd ${.CURDIR}/gnu/lib/libgcc; \
907 ${MAKE} -B -DNOMAN -DNOINFO install
908 cd ${.CURDIR}/usr.bin/lex/lib; \
909 ${MAKE} -B -DNOMAN -DNOINFO install
910 cd ${.CURDIR}/usr.sbin/pcvt/keycap; \
911 ${MAKE} -B -DNOMAN -DNOINFO install
912 .if exists(${.CURDIR}/secure/lib) && !defined(NOCRYPT) && !defined(NOSECURE)
913 cd ${.CURDIR}/secure/lib; ${MAKE} -B -DNOMAN -DNOINFO install
915 .if exists(${.CURDIR}/kerberosIV/lib) && !defined(NOCRYPT) && \
916 defined(MAKE_KERBEROS4)
917 cd ${.CURDIR}/kerberosIV/lib; ${MAKE} -B -DNOMAN -DNOINFO install
920 @echo "--------------------------------------------------------------"
921 @echo ">>> Installing legacy rtld"
922 @echo "--------------------------------------------------------------"
923 cd ${.CURDIR}/libexec/rtld-aout; ${MAKE} -DNOMAN install
925 .if ${MACHINE_ARCH} == "i386"
926 @echo "--------------------------------------------------------------"
927 @echo ">>> Installing legacy boot"
928 @echo "--------------------------------------------------------------"
929 cd ${.CURDIR}/sys/${MACHINE}/boot && ${MAKE} -DNOMAN install
934 # Get the object format that the tools see.
937 .if exists(/usr/bin/objformat)
938 __OBJFORMAT!= objformat
940 __OBJFORMAT= ${OBJFORMAT}
944 # Check if the local /etc/make.conf or /etc/make.conf.local have attempted
945 # to override the OBJFORMAT without updating the environment for the tools
949 .if ${__OBJFORMAT} != ${OBJFORMAT}
950 @/bin/sh -c "echo \"It looks like you set OBJFORMAT=${OBJFORMAT} in /etc/make.conf. Don't do that!\" "
951 @/bin/sh -c "echo \"If you want to override the installed object format, you must set OBJFORMAT\" "
952 @/bin/sh -c "echo \"in your environment.\" "
955 .if !defined(REALLY_WANT_DEPRECIATED_AOUT) && ${OBJFORMAT} == "aout"
956 @echo "==== NOTICE: a.out buildworld is depreciated and disabled! ====="
957 @echo "Read: http://www.freebsd.org/~peter/elfday.html for information."
958 @echo "You need to complete a 'make aout-to-elf' to bring your system"
959 @echo "up to date with ELF tools. This requires a fair amount of disk"
960 @echo "space to complete. Alternatively, you can do a binary upgrade"
961 @echo "using the 3.0-RELEASE binaries from CD or ftp.freebsd.org in"
962 @echo "/pub/FreeBSD/3.0-RELEASE/bin/ to convert your userland to ELF."
967 .for __target in clean cleandepend cleandir depend obj
968 .for entry in ${SUBDIR}
969 ${entry}.${__target}__D: .PHONY
970 @if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
971 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
972 edir=${entry}.${MACHINE_ARCH}; \
973 cd ${.CURDIR}/$${edir}; \
975 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \
977 cd ${.CURDIR}/$${edir}; \
979 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
981 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
984 .include <bsd.subdir.mk>