2 # $Id: Makefile.inc1,v 1.50 1998/12/27 21:11:07 phk 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 # LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
20 # The intended user-driven targets are:
21 # buildworld - rebuild *everything*, including glue to help do upgrades
22 # installworld- install everything built by "buildworld"
23 # update - convenient way to update your source tree (eg: sup/cvs)
24 # most - build user commands, no libraries or include files
25 # installmost - install user commands, no libraries or include files
27 # Standard targets (not defined here) are documented in the makefiles in
28 # /usr/share/mk. These include:
29 # obj depend all install clean cleandepend cleanobj
31 # Put initial settings here.
34 # We must do share/info early so that installation of info `dir'
35 # entries works correctly. Do it first since it is less likely to
36 # grow dependencies on include and lib than vice versa.
37 .if exists(share/info)
41 # We must do include and lib early so that the perl *.ph generation
42 # works correctly as it uses the header files installed by this.
53 .if exists(games) && !defined(NOGAMES)
59 .if exists(kerberosIV) && exists(crypto) && !defined(NOCRYPT) && \
60 defined(MAKE_KERBEROS4)
69 .if exists(share) && !defined(NOSHARE)
81 .if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
85 # etc must be last for "distribute" to work
90 # These are last, since it is nice to at least get the base system
91 # rebuilt before you do them.
92 .if defined(LOCAL_DIRS)
93 .for _DIR in ${LOCAL_DIRS}
94 .if exists(${_DIR}) & exists(${_DIR}/Makefile)
105 .if defined(NOCLEANDIR)
106 CLEANDIR= clean cleandepend
112 .if !defined(NOCLEAN)
115 .if defined(_NODEPEND)
122 SUPFLAGS?= -g -L 2 -P -
125 # While building tools for bootstrapping, we don't need to waste time on
126 # shared or profiled libraries, shared linkage, or documentation, except
127 # when the tools won't get cleaned we must use the defaults for shared
128 # libraries and shared linkage (and this doesn't waste time).
129 # XXX actually, we do need to waste time building shared libraries.
132 MK_FLAGS= -DNOINFO -DNOMAN -DNOPROFILE
134 MK_FLAGS= -DNOINFO -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED
138 # Define the location of the temporary installation directory. Note that
139 # MAKEOBJDIRPREFIX normally isn't defined so if the current directory is
140 # /usr/src, then the world temporary directory is /usr/obj/usr/src/tmp.
142 # During the transition from aout to elf format on i386, MAKEOBJDIRPREFIX
143 # is set by the parent makefile (Makefile.inc0) to be /usr/obj/${OBJFORMAT}
144 # in order to keep aout and elf format files apart.
146 .if defined(MAKEOBJDIRPREFIX)
147 WORLDTMP= ${MAKEOBJDIRPREFIX}${.CURDIR}/tmp
149 WORLDTMP= /usr/obj${.CURDIR}/tmp
153 # Define the PATH to the build tools.
155 # If not building tools, the PATH always points to the installed binaries.
156 # The NOTOOLS option assumes that in installed tools are good enough and that
157 # the user's PATH will locate to appropriate tools. This option is required
158 # for a cross-compiled build environment.
160 # If building tools, then the PATH includes the world temporary directories
161 # so that the bootstrapped tools are used as soon as they are built. The
162 # strict path is for use after all tools are supposed to have been
163 # bootstrapped. It doesn't allow any of the installed tools to be used.
166 # Default root of the tool tree
168 # Choose the PATH relative to the root of the tool tree
169 PATH= ${TOOLROOT}/sbin:${TOOLROOT}/bin:${TOOLROOT}/usr/sbin:${TOOLROOT}/usr/bin
171 TOOLROOT= ${WORLDTMP}
173 STRICTTMPPATH= ${TOOLROOT}/sbin:${TOOLROOT}/usr/sbin:${TOOLROOT}/bin:${TOOLROOT}/usr/bin
174 TMPPATH= ${STRICTTMPPATH}:${PATH}
176 # XXX COMPILER_PATH is needed for finding cc1, ld and as
177 # XXX GCC_EXEC_PREFIX is for *crt.o. It is probably unnecessary now
178 # that LIBRARY_PATH is set. We still can't use -nostdlib, since gcc
179 # wouldn't link *crt.o or libgcc if it were used.
180 # XXX LD_LIBRARY_PATH is for ld.so. It is also used by ld, although we don't
181 # want that - all compile-time library paths should be resolved by gcc.
182 # It fails for set[ug]id executables (are any used?).
183 COMPILER_ENV= BISON_SIMPLE=${TOOLROOT}/usr/share/misc/bison.simple \
184 COMPILER_PATH=${TOOLROOT}/usr/libexec:${TOOLROOT}/usr/bin \
185 GCC_EXEC_PREFIX=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib/ \
186 LD_LIBRARY_PATH=${TOOLROOT}${SHLIBDIR} \
187 LIBRARY_PATH=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib
189 BMAKEENV= PATH=${TMPPATH} ${COMPILER_ENV} NOEXTRADEPEND=t \
190 OBJFORMAT_PATH=${TOOLROOT}/usr/libexec:/usr/libexec
191 XMAKEENV= PATH=${STRICTTMPPATH} ${COMPILER_ENV} \
192 OBJFORMAT_PATH=${TOOLROOT}/usr/libexec \
193 CFLAGS="-nostdinc ${CFLAGS}" # XXX -nostdlib
195 # used to compile and install 'make' in temporary build tree
196 MAKETMP= ${WORLDTMP}/make
197 IBMAKE= ${BMAKEENV} MAKEOBJDIR=${MAKETMP} ${MAKE} DESTDIR=${WORLDTMP}
201 BMAKE= ${BMAKEENV} ${MAKE} DESTDIR=${WORLDTMP}
202 # cross make used for compilation
203 XMAKE= ${XMAKEENV} ${MAKE} DESTDIR=${WORLDTMP}
204 # cross make used for final installation
205 IXMAKE= ${XMAKEENV} ${MAKE}
208 BMAKE= ${BMAKEENV} ${WORLDTMP}/usr/bin/make DESTDIR=${WORLDTMP}
209 # cross make used for compilation
210 XMAKE= ${XMAKEENV} ${WORLDTMP}/usr/bin/make DESTDIR=${WORLDTMP}
211 # cross make used for final installation
212 IXMAKE= ${XMAKEENV} ${WORLDTMP}/usr/bin/make
218 # Attempt to rebuild the entire system, with reasonable chance of
219 # success, regardless of how old your existing system is.
221 buildworld: check-objformat
222 .if !defined(NOCLEAN)
224 @echo "--------------------------------------------------------------"
225 @echo ">>> Cleaning up the temporary ${OBJFORMAT} build tree"
226 @echo "--------------------------------------------------------------"
228 chflags -R noschg ${WORLDTMP}/
231 .if !defined(NOTOOLS)
233 @echo "--------------------------------------------------------------"
234 @echo ">>> Making make"
235 @echo "--------------------------------------------------------------"
236 mkdir -p ${WORLDTMP}/usr/bin ${MAKETMP}
238 cd ${.CURDIR}/usr.bin/make; \
239 MAKEOBJDIRPREFIX=""; unset MAKEOBJDIRPREFIX; \
240 ${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} all; \
241 ${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} install; \
242 ${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} clean \
245 @echo "--------------------------------------------------------------"
246 @echo ">>> Making mtree"
247 @echo "--------------------------------------------------------------"
248 mkdir -p ${WORLDTMP}/usr/sbin ${WORLDTMP}/mtree
250 cd ${.CURDIR}/usr.sbin/mtree; \
251 MAKEOBJDIRPREFIX=""; unset MAKEOBJDIRPREFIX; \
252 export MAKEOBJDIR=${WORLDTMP}/mtree; \
253 ${BMAKE} ${MK_FLAGS} all; \
254 ${BMAKE} ${MK_FLAGS} -B install clean \
258 @echo "--------------------------------------------------------------"
259 @echo ">>> Making hierarchy"
260 @echo "--------------------------------------------------------------"
262 cd ${.CURDIR}; ${BMAKE} -f Makefile.inc1 hierarchy
263 .if !defined(NOCLEAN)
265 @echo "--------------------------------------------------------------"
266 @echo ">>> Cleaning up the ${OBJFORMAT} obj tree"
267 @echo "--------------------------------------------------------------"
268 cd ${.CURDIR}; ${BMAKE} -f Makefile.inc1 ${CLEANDIR:S/^/par-/}
270 @echo "--------------------------------------------------------------"
271 @echo ">>> Rebuilding the ${OBJFORMAT} obj tree"
272 @echo "--------------------------------------------------------------"
273 cd ${.CURDIR}; ${BMAKE} -f Makefile.inc1 par-${OBJDIR}
275 .if !defined(NOTOOLS)
277 @echo "--------------------------------------------------------------"
278 @echo ">>> Rebuilding ${OBJFORMAT} bootstrap tools"
279 @echo "--------------------------------------------------------------"
280 cd ${.CURDIR}; ${BMAKE} -f Makefile.inc1 bootstrap
282 @echo "--------------------------------------------------------------"
283 @echo ">>> Rebuilding tools necessary to build the include files"
284 @echo "--------------------------------------------------------------"
285 cd ${.CURDIR}; ${BMAKE} -f Makefile.inc1 include-tools
288 @echo "--------------------------------------------------------------"
289 @echo ">>> Rebuilding ${DESTDIR}/usr/include"
290 @echo "--------------------------------------------------------------"
291 cd ${.CURDIR}; SHARED=copies ${BMAKE} -f Makefile.inc1 includes
293 @echo "--------------------------------------------------------------"
294 @echo ">>> Rebuilding bootstrap libraries"
295 @echo "--------------------------------------------------------------"
296 cd ${.CURDIR}; ${BMAKE} -f Makefile.inc1 bootstrap-libraries
297 .if !defined(NOTOOLS)
299 @echo "--------------------------------------------------------------"
300 @echo ">>> Rebuilding tools needed to build libraries"
301 @echo "--------------------------------------------------------------"
302 cd ${.CURDIR}; ${BMAKE} -f Makefile.inc1 lib-tools
304 .if !defined(NOTOOLS)
306 @echo "--------------------------------------------------------------"
307 @echo ">>> Rebuilding all other tools needed to build the ${OBJFORMAT} world"
308 @echo "--------------------------------------------------------------"
309 cd ${.CURDIR}; ${BMAKE} -f Makefile.inc1 build-tools
311 .if !defined(_NODEPEND)
313 @echo "--------------------------------------------------------------"
314 @echo ">>> Rebuilding dependencies"
315 @echo "--------------------------------------------------------------"
316 cd ${.CURDIR}; ${XMAKE} -f Makefile.inc1 par-depend
319 @echo "--------------------------------------------------------------"
320 @echo ">>> Building ${OBJFORMAT} libraries"
321 @echo "--------------------------------------------------------------"
322 cd ${.CURDIR}; ${XMAKE} -DNOINFO -DNOMAN -f Makefile.inc1 libraries
324 @echo "--------------------------------------------------------------"
325 @echo ">>> Building everything.."
326 @echo "--------------------------------------------------------------"
327 cd ${.CURDIR}; ${XMAKE} -f Makefile.inc1 all
330 @echo "--------------------------------------------------------------"
331 @echo ">>> Building everything.."
332 @echo "--------------------------------------------------------------"
333 cd ${.CURDIR}; ${XMAKE} -f Makefile.inc1 all
338 # Installs everything compiled by a 'buildworld'.
341 cd ${.CURDIR}; ${IXMAKE} -f Makefile.inc1 reinstall
346 # If you have a build server, you can NFS mount the source and obj directories
347 # and do a 'make reinstall' on the *client* to install new binaries from the
348 # most recent server build.
351 @echo "--------------------------------------------------------------"
352 @echo ">>> Making hierarchy"
353 @echo "--------------------------------------------------------------"
354 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
356 @echo "--------------------------------------------------------------"
357 @echo ">>> Installing everything.."
358 @echo "--------------------------------------------------------------"
359 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
360 .if ${MACHINE_ARCH} == "i386" && ${OBJFORMAT} == "aout"
362 @echo "--------------------------------------------------------------"
363 @echo ">>> Re-scanning the shared libraries.."
364 @echo "--------------------------------------------------------------"
365 cd ${.CURDIR}; /sbin/ldconfig -R
368 @echo "--------------------------------------------------------------"
369 @echo ">>> Rebuilding man page indexes"
370 @echo "--------------------------------------------------------------"
371 cd ${.CURDIR}/share/man; ${MAKE} makedb
376 # Update the source tree, by running sup and/or running cvs to update to the
380 .if defined(SUP_UPDATE)
381 @echo "--------------------------------------------------------------"
382 @echo ">>> Running ${SUP}"
383 @echo "--------------------------------------------------------------"
384 @${SUP} ${SUPFLAGS} ${SUPFILE}
385 .if defined(SUPFILE1)
386 @${SUP} ${SUPFLAGS} ${SUPFILE1}
388 .if defined(SUPFILE2)
389 @${SUP} ${SUPFLAGS} ${SUPFILE2}
392 .if defined(CVS_UPDATE)
393 @echo "--------------------------------------------------------------"
394 @echo ">>> Updating /usr/src from cvs repository" ${CVSROOT}
395 @echo "--------------------------------------------------------------"
396 cd ${.CURDIR}; cvs -q update -P -d
402 # Build most of the user binaries on the existing system libs and includes.
405 @echo "--------------------------------------------------------------"
406 @echo ">>> Building programs only"
407 @echo "--------------------------------------------------------------"
408 cd ${.CURDIR}/bin; ${MAKE} all
409 cd ${.CURDIR}/sbin; ${MAKE} all
410 cd ${.CURDIR}/libexec; ${MAKE} all
411 cd ${.CURDIR}/usr.bin; ${MAKE} all
412 cd ${.CURDIR}/usr.sbin; ${MAKE} all
413 cd ${.CURDIR}/gnu/libexec; ${MAKE} all
414 cd ${.CURDIR}/gnu/usr.bin; ${MAKE} all
415 cd ${.CURDIR}/gnu/usr.sbin; ${MAKE} all
416 #.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT)
417 # cd ${.CURDIR}/kerberosIV; ${MAKE} most
419 #.if !defined(NOSECURE) && !defined(NOCRYPT)
420 # cd ${.CURDIR}/secure; ${MAKE} most
426 # Install the binaries built by the 'most' target. This does not include
427 # libraries or include files.
430 @echo "--------------------------------------------------------------"
431 @echo ">>> Installing programs only"
432 @echo "--------------------------------------------------------------"
433 cd ${.CURDIR}/bin; ${MAKE} install
434 cd ${.CURDIR}/sbin; ${MAKE} install
435 cd ${.CURDIR}/libexec; ${MAKE} install
436 cd ${.CURDIR}/usr.bin; ${MAKE} install
437 cd ${.CURDIR}/usr.sbin; ${MAKE} install
438 cd ${.CURDIR}/gnu/libexec; ${MAKE} install
439 cd ${.CURDIR}/gnu/usr.bin; ${MAKE} install
440 cd ${.CURDIR}/gnu/usr.sbin; ${MAKE} install
441 #.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT)
442 # cd ${.CURDIR}/kerberosIV; ${MAKE} installmost
444 #.if !defined(NOSECURE) && !defined(NOCRYPT)
445 # cd ${.CURDIR}/secure; ${MAKE} installmost
449 # ------------------------------------------------------------------------
451 # From here onwards are utility targets used by the 'make world' and
452 # related targets. If your 'world' breaks, you may like to try to fix
453 # the problem and manually run the following targets to attempt to
454 # complete the build. Beware, this is *not* guaranteed to work, you
455 # need to have a pretty good grip on the current state of the system
456 # to attempt to manually finish it. If in doubt, 'make world' again.
460 # hierarchy - ensure that all the needed directories are present
463 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs
466 # bootstrap - [re]build tools needed to run the actual build, this includes
467 # tools needed by 'make depend', as some tools are needed to generate source
468 # for the dependency information to be gathered from.
472 rm -f ${DESTDIR}/usr/src/sys
473 ln -s ${.CURDIR}/sys ${DESTDIR}/usr/src
474 cd ${.CURDIR}/include; ${MAKE} all
475 cd ${.CURDIR}/include; ${MAKE} beforeinstall
477 cd ${.CURDIR}/usr.bin/make; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
478 ${MAKE} ${MK_FLAGS} all; \
479 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
480 cd ${.CURDIR}/usr.bin/xinstall; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
481 ${MAKE} ${MK_FLAGS} all; \
482 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
483 cd ${.CURDIR}/usr.bin/yacc; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
484 ${MAKE} ${MK_FLAGS} all; \
485 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
486 cd ${.CURDIR}/usr.bin/lex; ${MAKE} bootstrap; \
487 ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
488 ${MAKE} ${MK_FLAGS} -DNOLIB all; \
489 ${MAKE} ${MK_FLAGS} -DNOLIB -B install ${CLEANDIR}
490 cd ${.CURDIR}/usr.bin/lex; ${MAKE} ${OBJDIR}
491 cd ${.CURDIR}/usr.sbin/mtree; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
492 ${MAKE} ${MK_FLAGS} all; \
493 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
495 cd ${.CURDIR}/include && ${MAKE} copies
499 # include-tools - generally the same as 'bootstrap', except that it's for
500 # things that are specifically needed to generate include files.
502 # XXX should be merged with bootstrap, it's not worth keeeping them separate.
503 # Well, maybe it is now. We force 'cleandepend' here to avoid dependencies
504 # on cleaned away headers in ${WORLDTMP}.
507 .for d in usr.bin/compile_et usr.bin/rpcgen
508 cd ${.CURDIR}/$d; ${MAKE} cleandepend; \
509 ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
510 ${MAKE} ${MK_FLAGS} all; \
511 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
515 # includes - possibly generate and install the include files.
519 rm -rf ${DESTDIR}/usr/include/*
520 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
521 -p ${DESTDIR}/usr/include
523 cd ${.CURDIR}/include; ${MAKE} -B all install
524 cd ${.CURDIR}/gnu/include; ${MAKE} install
525 cd ${.CURDIR}/gnu/lib/libmp; ${MAKE} beforeinstall
526 cd ${.CURDIR}/gnu/lib/libobjc; ${MAKE} beforeinstall
527 cd ${.CURDIR}/gnu/lib/libreadline; ${MAKE} beforeinstall
528 cd ${.CURDIR}/gnu/lib/libregex; ${MAKE} beforeinstall
529 cd ${.CURDIR}/gnu/lib/libstdc++; ${MAKE} beforeinstall
530 cd ${.CURDIR}/gnu/lib/libg++; ${MAKE} beforeinstall
531 cd ${.CURDIR}/gnu/lib/libdialog; ${MAKE} beforeinstall
532 cd ${.CURDIR}/gnu/lib/libgmp; ${MAKE} beforeinstall
533 .if exists(secure) && !defined(NOCRYPT)
534 cd ${.CURDIR}/secure/lib/libdes; ${MAKE} beforeinstall
536 .if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
537 cd ${.CURDIR}/kerberosIV/lib/libacl; ${MAKE} beforeinstall
538 cd ${.CURDIR}/kerberosIV/lib/libkadm; ${MAKE} beforeinstall
539 cd ${.CURDIR}/kerberosIV/lib/libkafs; ${MAKE} beforeinstall
540 cd ${.CURDIR}/kerberosIV/lib/libkdb; ${MAKE} beforeinstall
541 cd ${.CURDIR}/kerberosIV/lib/libkrb; ${MAKE} beforeinstall
542 cd ${.CURDIR}/kerberosIV/lib/libtelnet; ${MAKE} beforeinstall
544 cd ${.CURDIR}/lib/libtelnet; ${MAKE} beforeinstall
546 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH})
547 cd ${.CURDIR}/lib/csu/${MACHINE_ARCH}; ${MAKE} beforeinstall
549 cd ${.CURDIR}/lib/libalias; ${MAKE} beforeinstall
550 cd ${.CURDIR}/lib/libatm; ${MAKE} beforeinstall
551 cd ${.CURDIR}/lib/libdevstat; ${MAKE} beforeinstall
552 cd ${.CURDIR}/lib/libc; ${MAKE} beforeinstall
553 cd ${.CURDIR}/lib/libcalendar; ${MAKE} beforeinstall
554 cd ${.CURDIR}/lib/libcam; ${MAKE} beforeinstall
555 cd ${.CURDIR}/lib/libcurses; ${MAKE} beforeinstall
556 cd ${.CURDIR}/lib/libdisk; ${MAKE} beforeinstall
557 cd ${.CURDIR}/lib/libedit; ${MAKE} beforeinstall
558 cd ${.CURDIR}/lib/libftpio; ${MAKE} beforeinstall
559 cd ${.CURDIR}/lib/libmd; ${MAKE} beforeinstall
560 cd ${.CURDIR}/lib/libmytinfo; ${MAKE} beforeinstall
561 cd ${.CURDIR}/lib/libncurses; ${MAKE} beforeinstall
562 .if !defined(WANT_CSRG_LIBM)
563 cd ${.CURDIR}/lib/msun; ${MAKE} beforeinstall
565 cd ${.CURDIR}/lib/libopie; ${MAKE} beforeinstall
566 cd ${.CURDIR}/lib/libpam/libpam; ${MAKE} beforeinstall
567 cd ${.CURDIR}/lib/libpcap; ${MAKE} beforeinstall
568 cd ${.CURDIR}/lib/libradius; ${MAKE} beforeinstall
569 cd ${.CURDIR}/lib/librpcsvc; ${MAKE} beforeinstall
570 cd ${.CURDIR}/lib/libskey; ${MAKE} beforeinstall
571 cd ${.CURDIR}/lib/libstand; ${MAKE} beforeinstall
572 cd ${.CURDIR}/lib/libtacplus; ${MAKE} beforeinstall
573 cd ${.CURDIR}/lib/libtermcap; ${MAKE} beforeinstall
574 cd ${.CURDIR}/lib/libcom_err; ${MAKE} beforeinstall
575 cd ${.CURDIR}/lib/libss; ${MAKE} -B hdrs beforeinstall
576 cd ${.CURDIR}/lib/libutil; ${MAKE} beforeinstall
577 cd ${.CURDIR}/lib/libvgl; ${MAKE} beforeinstall
578 cd ${.CURDIR}/lib/libz; ${MAKE} beforeinstall
579 cd ${.CURDIR}/usr.bin/f2c; ${MAKE} beforeinstall
580 cd ${.CURDIR}/usr.bin/lex; ${MAKE} beforeinstall
583 # Declare tools if they are not required on all architectures.
585 .if ${MACHINE_ARCH} == "i386"
587 _aout_ar = usr.bin/ar
588 _aout_as = gnu/usr.bin/as
589 _aout_ld = gnu/usr.bin/ld
590 _aout_nm = usr.bin/nm
591 _aout_ranlib = usr.bin/ranlib
592 _aout_size = usr.bin/size
593 _aout_strip = usr.bin/strip
594 # boot block/loader tools:
595 _btxld = usr.sbin/btxld
599 # lib-tools - build tools to compile and install the libraries.
601 # XXX gperf is required for cc
602 # XXX a new ld and tsort is required for cc
618 gnu/usr.bin/binutils \
621 cd ${.CURDIR}/$d; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
622 ${MAKE} ${MK_FLAGS} all; \
623 ${MAKE} ${MK_FLAGS} -B install; \
624 ${MAKE} ${MK_FLAGS:S/-DNOPIC//} -B ${CLEANDIR} ${OBJDIR}
628 # We have to know too much about ordering and subdirs in the lib trees:
630 # To satisfy shared library linkage when only the libraries being built
633 # csu must be built before all shared libaries for ELF.
634 # libcom_err must be built before libss.
635 # libcrypt must be built before libskey and libkrb.
636 # libdes must be built before libpam.
637 # libkrb must be built before libpam.
638 # libm must be built before libf2c, libg++ and libstdc++.
639 # libmd must be built before libatm, libopie, libradius, libskey,
641 # libmytinfo must be built before libdialog and libncurses.
642 # libncurses must be built before libdialog.
643 # libradius must be built before libpam.
644 # libskey must be built before libpam.
645 # libtacplus must be built before libpam.
646 # libtermcap must be built before libcurses, libedit and libreadline.
648 # Some libraries are built conditionally and/or are in inconsistently
651 .if exists(lib/csu/${MACHINE_ARCH}.pcc)
652 _csu=lib/csu/${MACHINE_ARCH}.pcc
653 .elif ${MACHINE_ARCH} == "i386" && ${OBJFORMAT} == "elf"
654 _csu=lib/csu/i386-elf
656 _csu=lib/csu/${MACHINE_ARCH}
659 .if !defined(NOSECURE) && !defined(NOCRYPT)
660 _libcrypt= secure/lib/libcrypt lib/libcrypt
661 _secure_lib= secure/lib
663 _libcrypt= lib/libcrypt
666 .if !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
667 _kerberosIV_lib=kerberosIV/lib
670 .if defined(WANT_CSRG_LIBM)
677 _libperl= gnu/usr.bin/perl/libperl
681 # bootstrap-libraries - build just enough libraries for the bootstrap
682 # tools, and install them under ${WORLDTMP}.
684 # Build csu and libgcc early so that some tools get linked to the new
685 # versions (too late for the main tools, however). Then build the
686 # necessary prerequisite libraries (libtermcap just needs to be before
687 # libcurses, and this only matters for the NOCLEAN case when NOPIC is
690 # This is mostly wrong. The build tools must run on the host system,
691 # so they should use host libraries. We depend on the target being
692 # similar enough to the host for new target libraries to work on the
696 .for _lib in ${_csu} gnu/usr.bin/cc/libgcc lib/libtermcap \
697 gnu/lib/libregex gnu/lib/libreadline lib/libc \
698 ${_libcrypt} lib/libcurses lib/libedit ${_libm} \
699 lib/libmd lib/libutil lib/libz usr.bin/lex/lib \
701 .if exists(${.CURDIR}/${_lib})
702 cd ${.CURDIR}/${_lib}; \
703 ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
704 ${MAKE} ${MK_FLAGS} all; \
705 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
710 # libraries - build all libraries, and install them under ${DESTDIR}.
712 # The ordering is not as special as for bootstrap-libraries. Build
713 # the prerequisites first, then build almost everything else in
714 # alphabetical order.
717 .for _lib in ${_csu} lib/libcom_err ${_libcrypt} ${_libm} lib/libmd \
718 lib/libmytinfo lib/libncurses lib/libtermcap \
719 lib/libradius lib/libskey lib/libtacplus \
720 ${_secure_lib} ${_kerberosIV_lib} \
721 gnu/lib gnu/usr.bin/cc/libgcc ${_libperl} lib usr.bin/lex/lib
722 .if exists(${.CURDIR}/${_lib})
723 cd ${.CURDIR}/${_lib}; ${MAKE} all; ${MAKE} -B install
728 # Exclude unused tools from build-tools.
730 .if !defined(NOGAMES) && exists(${.CURDIR}/games)
731 _adventure= games/adventure
732 _caesar= games/caesar
734 _phantasia= games/phantasia
735 _strfile= games/fortune/strfile
738 _perl= gnu/usr.bin/perl/miniperl
740 .if !defined(NOSHARE) && exists(${.CURDIR}/share)
741 _scrnmaps= share/syscons/scrnmaps
743 .if ${MACHINE_ARCH} == i386
744 _kldlinux= sys/modules/linux
746 .if ${OBJFORMAT} == "aout"
747 _netboot= sys/${MACHINE}/boot/netboot
750 BTMAKEFLAGS= ${MK_FLAGS} -D_BUILD_TOOLS
753 # build-tools - build and install any other tools needed to complete the
754 # compile and install.
756 # bc and cpp are required to build groff. Otherwise, the order here is
757 # mostly historical, i.e., bogus.
758 # chmod is used to build gcc's tmpmultilib[2] at obscure times.
760 # XXX uname is a bug - the target should not depend on the host.
785 gnu/usr.bin/man/makewhatis \
789 gnu/usr.bin/texinfo \
829 cd ${.CURDIR}/$d; ${MAKE} ${BTMAKEFLAGS} ${_DEPEND}; \
830 ${MAKE} ${BTMAKEFLAGS} all; \
831 ${MAKE} ${BTMAKEFLAGS} -B install ${CLEANDIR} ${OBJDIR}
833 .if !defined(NOGAMES) && exists(${.CURDIR}/games)
834 cd ${DESTDIR}/usr/games; cp -p caesar strfile ${DESTDIR}/usr/bin
841 gnu/usr.bin/cc/cc_tools \
847 cd ${.CURDIR}/$d; ${MAKE} ${BTMAKEFLAGS} build-tools
849 cd ${.CURDIR}/usr.bin/tn3270/tools; ${MAKE} ${BTMAKEFLAGS} all
852 # Build aout versions of things that provide legacy support when all the
853 # rest of the world is elf.
856 .if ${MACHINE_ARCH} == "i386" && ${OBJFORMAT} == "aout"
858 @echo "--------------------------------------------------------------"
859 @echo ">>> Making hierarchy"
860 @echo "--------------------------------------------------------------"
862 cd ${.CURDIR}; ${XMAKE} -f Makefile.inc1 hierarchy
864 @echo "--------------------------------------------------------------"
865 @echo ">>> Rebuilding the ${OBJFORMAT} obj tree"
866 @echo "--------------------------------------------------------------"
867 cd ${.CURDIR}; ${XMAKE} -f Makefile.inc1 par-${OBJDIR}
869 @echo "--------------------------------------------------------------"
870 @echo ">>> Rebuilding ${DESTDIR}/usr/include"
871 @echo "--------------------------------------------------------------"
872 cd ${.CURDIR}; SHARED=copies ${XMAKE} -f Makefile.inc1 includes
874 @echo "--------------------------------------------------------------"
875 @echo ">>> Building legacy libraries"
876 @echo "--------------------------------------------------------------"
878 ${XMAKE} -DNOINFO -DNOMAN -f Makefile.inc1 bootstrap-libraries
880 ${XMAKE} -DNOINFO -DNOMAN -f Makefile.inc1 libraries
882 @echo "--------------------------------------------------------------"
883 @echo ">>> Building legacy rtld"
884 @echo "--------------------------------------------------------------"
885 cd ${.CURDIR}/libexec/rtld-aout; \
886 ${XMAKE} -DNOMAN depend; ${XMAKE} -DNOMAN all;
888 @echo "--------------------------------------------------------------"
889 @echo ">>> Building legacy boot"
890 @echo "--------------------------------------------------------------"
891 cd ${.CURDIR}/sys/${MACHINE}/boot && \
892 ${XMAKE} -DNOMAN -B obj depend; ${XMAKE} -DNOMAN all;
896 # Install aout versions of things that provide legacy support when all the
897 # rest of the world is elf.
900 .if ${MACHINE_ARCH} == "i386" && ${OBJFORMAT} == "aout"
902 @echo "--------------------------------------------------------------"
903 @echo ">>> Installing legacy libraries"
904 @echo "--------------------------------------------------------------"
905 cd ${.CURDIR}/lib; ${MAKE} -B -DNOMAN -DNOINFO install
906 cd ${.CURDIR}/gnu/lib; ${MAKE} -B -DNOMAN -DNOINFO install
907 cd ${.CURDIR}/gnu/usr.bin/cc/libgcc; \
908 ${MAKE} -B -DNOMAN -DNOINFO install
909 cd ${.CURDIR}/usr.bin/lex/lib; \
910 ${MAKE} -B -DNOMAN -DNOINFO install
911 .if exists(${.CURDIR}/secure/lib) && !defined(NOCRYPT) && !defined(NOSECURE)
912 cd ${.CURDIR}/secure/lib; ${MAKE} -B -DNOMAN -DNOINFO install
914 .if exists(${.CURDIR}/kerberosIV/lib) && !defined(NOCRYPT) && \
915 defined(MAKE_KERBEROS4)
916 cd ${.CURDIR}/kerberosIV/lib; ${MAKE} -B -DNOMAN -DNOINFO install
919 @echo "--------------------------------------------------------------"
920 @echo ">>> Installing legacy rtld"
921 @echo "--------------------------------------------------------------"
922 cd ${.CURDIR}/libexec/rtld-aout; ${MAKE} -DNOMAN install
924 .if ${MACHINE_ARCH} != "alpha"
925 @echo "--------------------------------------------------------------"
926 @echo ">>> Installing legacy boot"
927 @echo "--------------------------------------------------------------"
928 cd ${.CURDIR}/sys/${MACHINE}/boot && ${MAKE} -DNOMAN install
933 # Get the object format that the tools see.
936 .if exists(/usr/bin/objformat)
937 __OBJFORMAT!= objformat
939 __OBJFORMAT= ${OBJFORMAT}
943 # Check if the local /etc/make.conf or /etc/make.conf.local have attempted
944 # to override the OBJFORMAT without updating the environment for the tools
948 .if ${__OBJFORMAT} != ${OBJFORMAT}
949 @/bin/sh -c "echo \"It looks like you set OBJFORMAT=${OBJFORMAT} in /etc/make.conf. Don't do that!\" "
950 @/bin/sh -c "echo \"If you want to override the installed object format, you must set OBJFORMAT\" "
951 @/bin/sh -c "echo \"in your environment.\" "
956 .for __target in clean cleandepend cleandir depend obj
957 .for entry in ${SUBDIR}
958 ${entry}.${__target}__D: .PHONY
959 @if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
960 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
961 edir=${entry}.${MACHINE_ARCH}; \
962 cd ${.CURDIR}/$${edir}; \
964 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \
966 cd ${.CURDIR}/$${edir}; \
968 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
970 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
973 .include <bsd.subdir.mk>