2 # $FreeBSD: src/Makefile.inc1,v 1.141.2.62 2003/04/06 19:54:00 dwmalone Exp $
3 # $DragonFly: src/Makefile.inc1,v 1.83 2005/10/08 10:50:53 corecode Exp $
5 # Build-time options are documented in make.conf(5).
7 # The intended user-driven targets are:
9 # buildworld - rebuild *everything*, including glue to help do upgrades
10 # quickworld - skip the glue and do a depend+build on the meat
11 # realquickworld - skip the glue and depend stages and just build the meat
12 # crossworld - only build the glue (particularly the cross-build environment)
13 # installworld- install everything built by "buildworld"
14 # update - convenient way to update your source tree (eg: sup/cvs)
15 # most - build user commands, no libraries or include files
16 # installmost - install user commands, no libraries or include files
18 # Standard targets (not defined here) are documented in the makefiles in
19 # /usr/share/mk. These include:
20 # obj depend all install clean cleandepend cleanobj
22 # Put initial settings here.
25 # We must do share/info early so that installation of info `dir'
26 # entries works correctly. Do it first since it is less likely to
27 # grow dependencies on include and lib than vice versa.
28 .if exists(${.CURDIR}/share/info)
32 # We must do include and lib early so that the perl *.ph generation
33 # works correctly as it uses the header files installed by this.
34 .if exists(${.CURDIR}/include)
37 .if exists(${.CURDIR}/lib)
40 # This exists simply to ensure that the obj dir hierarchy is
41 # intact for nrelease, allowing the nrelease Makefile's to
42 # reference ${.OBJDIR}.
44 .if exists(${.CURDIR}/nrelease)
48 .if exists(${.CURDIR}/bin)
51 .if exists(${.CURDIR}/games) && !defined(NO_GAMES)
54 .if exists(${.CURDIR}/gnu)
57 .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
58 !defined(NO_CRYPT) && !defined(NO_OPENSSL) && defined(WANT_KERBEROS)
61 .if exists(${.CURDIR}/libexec)
64 .if exists(${.CURDIR}/sbin)
67 .if exists(${.CURDIR}/secure) && !defined(NO_CRYPT)
70 .if exists(${.CURDIR}/share) && !defined(NO_SHARE)
73 .if exists(${.CURDIR}/sys)
76 .if exists(${.CURDIR}/usr.bin)
79 .if exists(${.CURDIR}/usr.sbin)
83 # etc must be last for "distribute" to work
84 .if exists(${.CURDIR}/etc)
88 # These are last, since it is nice to at least get the base system
89 # rebuilt before you do them.
90 .if defined(LOCAL_DIRS)
91 .for _DIR in ${LOCAL_DIRS}
92 .if exists(${.CURDIR}/${_DIR}) & exists(${.CURDIR}/${_DIR}/Makefile)
98 .if defined(SUBDIR_OVERRIDE)
99 SUBDIR= ${SUBDIR_OVERRIDE}
102 .if defined(NOCLEANDIR)
103 CLEANDIR= clean cleandepend
108 SUP?= /usr/local/bin/cvsup
109 SUPFLAGS?= -g -L 2 -P -
111 SUPFLAGS+= -h ${SUPHOST}
114 NOCLEAN?= ${NO_CLEAN}
116 # Object directory base in primary make. Note that when we rerun make
117 # from inside this file we change MAKEOBJDIRPREFIX to the appropriate
118 # subdirectory because the rest of the build system needs it that way.
119 # The original object directory base is saved in OBJTREE.
121 MAKEOBJDIRPREFIX?= /usr/obj
122 OBJTREE?= ${MAKEOBJDIRPREFIX}
124 # Used for stage installs and pathing
126 DESTDIRBASE?= ${OBJTREE}${.CURDIR}
128 TARGET_ARCH?= ${MACHINE_ARCH}
129 .if ${TARGET_ARCH} == ${MACHINE_ARCH}
132 TARGET?= ${TARGET_ARCH}
135 BUILD_ARCH!= sysctl -n hw.machine_arch
136 .if ${MACHINE_ARCH} != ${BUILD_ARCH}
137 .error To cross-build, set TARGET_ARCH.
141 # BTOOLS (Natively built) All non-cross-development tools that the
142 # main build needs. This includes things like 'mkdir' and 'rm'.
143 # We will not use the native system's exec path once we start
144 # on WORLD. (bootstrap-tools and build-tools or BTOOLS)
146 # CTOOLS (Natively built) Cross development tools which are specific
147 # to the target architecture.
149 # WORLD (Cross built) Our ultimate buildworld, using only BTOOLS and
152 # MACHINE_ARCH Architecture we are building on
153 # TARGET_ARCH Architecture we are building for
155 BTOOLSDEST= ${DESTDIRBASE}/btools_${MACHINE_ARCH}
156 CTOOLSDEST= ${DESTDIRBASE}/ctools_${MACHINE_ARCH}_${TARGET_ARCH}
157 WORLDDEST= ${DESTDIRBASE}/world_${TARGET_ARCH}
159 # The bootstrap-tools path is used by the bootstrap-tools, build-tools, and
160 # cross-tools stages to augment the existing command path to access newer
161 # versions of certain utilities such as 'patch' that the cross-tools stage
164 BTOOLSPATH= ${BTOOLSDEST}/usr/sbin:${BTOOLSDEST}/usr/bin:${BTOOLSDEST}/bin:${BTOOLSDEST}/usr/games
166 # The strict temporary command path contains all binaries required
167 # by the buildworld system after the cross-tools stage.
169 STRICTTMPPATH= ${CTOOLSDEST}/usr/sbin:${CTOOLSDEST}/usr/bin:${CTOOLSDEST}/bin:${CTOOLSDEST}/usr/games:${BTOOLSDEST}/usr/sbin:${BTOOLSDEST}/usr/bin:${BTOOLSDEST}/bin:${BTOOLSDEST}/usr/games
175 # Building a world goes through the following stages
177 # 1. bootstrap-tool stage [BMAKE]
178 # This stage is responsible for creating programs that
179 # are needed for backward compatibility reasons. They
180 # are not built as cross-tools.
181 # 2. build-tool stage [TMAKE]
182 # This stage is responsible for creating the object
183 # tree and building any tools that are needed during
185 # 3. cross-tool stage [XMAKE]
186 # This stage is responsible for creating any tools that
187 # are needed for cross-builds. A cross-compiler is one
189 # 4. world stage [WMAKE]
190 # This stage actually builds the world.
191 # 5. install stage (optional) [IMAKE]
192 # This stage installs a previously built world.
195 # bootstrap-tool stage
197 BMAKEENV= MAKEOBJDIRPREFIX=${BTOOLSDEST} \
199 DESTDIR=${BTOOLSDEST} \
200 PATH=${BTOOLSPATH}:${PATH} \
201 INSTALL="sh ${.CURDIR}/tools/install.sh"
203 BMAKE= ${BMAKEENV} ${MAKE} -f Makefile.inc1 -DBOOTSTRAPPING \
204 -DNOINFO -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED \
209 TMAKEENV= MAKEOBJDIRPREFIX=${BTOOLSDEST} \
212 PATH=${BTOOLSPATH}:${PATH} \
213 INSTALL="sh ${.CURDIR}/tools/install.sh"
215 TMAKE= ${TMAKEENV} ${MAKE} -f Makefile.inc1 -DBOOTSTRAPPING \
216 -DNO_FORTRAN -DNOSHARED
220 # note: TOOLS_PREFIX points to the obj root holding the cross
221 # compiler binaries, while USRDATA_PREFIX points to the obj root
222 # holding the target environment (and also determines where cross-built
223 # libraries, crt*.o, and include files are installed).
225 XMAKEENV= MAKEOBJDIRPREFIX=${CTOOLSDEST} \
227 DESTDIR=${CTOOLSDEST} \
228 INSTALL="sh ${.CURDIR}/tools/install.sh" \
229 TOOLS_PREFIX=${CTOOLSDEST} \
230 USRDATA_PREFIX=${WORLDDEST} \
231 PATH=${BTOOLSPATH}:${PATH}
233 XMAKE= ${XMAKEENV} ${MAKE} -f Makefile.inc1 -DNO_FORTRAN -DNO_GDB \
234 -DBOOTSTRAPPING -DNOSHARED
236 # world stage, note the strict path and note that TOOLS_PREFIX is left
237 # unset and USRDATA_PREFIX (which defaults to TOOLS_PREFIX) is set to empty,
238 # which is primarily for the compiler so it targets / (e.g. /usr/<blah>)
239 # for both binary and library paths, even though it is being compiled to
240 # WORLDDEST. None of the programs in the world stage are ever actually
241 # executed during the buildworld/installworld.
243 CROSSENV= MAKEOBJDIRPREFIX=${WORLDDEST} \
245 MACHINE_ARCH=${TARGET_ARCH} \
247 OBJFORMAT_PATH=${CTOOLSDEST}
249 WMAKEENV= ${CROSSENV} \
250 DESTDIR=${WORLDDEST} \
251 INSTALL="sh ${.CURDIR}/tools/install.sh" \
252 PATH=${STRICTTMPPATH}
254 WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1
258 IMAKEENV= ${CROSSENV} \
259 PATH=${STRICTTMPPATH}
260 IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1
264 KMAKEENV= ${WMAKEENV}
268 # Attempt to rebuild the entire system, with reasonable chance of
269 # success, regardless of how old your existing system is.
273 @echo "--------------------------------------------------------------"
274 @echo ">>> Rebuilding the temporary build tree"
275 @echo "--------------------------------------------------------------"
276 .if !defined(NOCLEAN)
277 rm -rf ${BTOOLSDEST} ${CTOOLSDEST} ${WORLDDEST}
279 # XXX - These two can depend on any header file.
280 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
281 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
283 mkdir -p ${DESTDIRBASE} ${BTOOLSDEST} ${CTOOLSDEST} ${WORLDDEST}
284 .for _dir in ${WORLDDEST} ${BTOOLSDEST} ${CTOOLSDEST}
285 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
286 -p ${_dir}/ > /dev/null
287 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
288 -p ${_dir}/usr > /dev/null
290 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
291 -p ${WORLDDEST}/usr/include > /dev/null
292 ${LN} -sf ${.CURDIR}/sys ${WORLDDEST}
296 @echo "--------------------------------------------------------------"
297 @echo ">>> stage 1: bootstrap tools"
298 @echo "--------------------------------------------------------------"
299 cd ${.CURDIR}; ${BMAKE} bootstrap-tools
302 @echo "--------------------------------------------------------------"
303 @echo ">>> stage 2a: cleaning up the object tree"
304 @echo "--------------------------------------------------------------"
305 cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
308 @echo "--------------------------------------------------------------"
309 @echo ">>> stage 2b: rebuilding the object tree"
310 @echo "--------------------------------------------------------------"
311 cd ${.CURDIR}; ${WMAKE} par-obj
314 @echo "--------------------------------------------------------------"
315 @echo ">>> stage 2c: build tools"
316 @echo "--------------------------------------------------------------"
317 cd ${.CURDIR}; ${TMAKE} build-tools
320 @echo "--------------------------------------------------------------"
321 @echo ">>> stage 3: cross tools"
322 @echo "--------------------------------------------------------------"
323 cd ${.CURDIR}; ${XMAKE} cross-tools
326 @echo "--------------------------------------------------------------"
327 @echo ">>> stage 4a: populating ${WORLDDEST}/usr/include"
328 @echo "--------------------------------------------------------------"
329 cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
332 @echo "--------------------------------------------------------------"
333 @echo ">>> stage 4b: building libraries"
334 @echo "--------------------------------------------------------------"
335 cd ${.CURDIR}; ${WMAKE} -DNOHTML -DNOINFO -DNOMAN -DNOFSCHG libraries
338 @echo "--------------------------------------------------------------"
339 @echo ">>> stage 4c: make dependencies"
340 @echo "--------------------------------------------------------------"
341 cd ${.CURDIR}; ${WMAKE} par-depend
344 @echo "--------------------------------------------------------------"
345 @echo ">>> stage 4d: building everything.."
346 @echo "--------------------------------------------------------------"
347 cd ${.CURDIR}; ${WMAKE} all
349 # note: buildworld no longer depends on _cleanobj because we rm -rf the
350 # entire object tree and built the bootstrap tools in a different location.
352 # buildworld - build everything from scratch
353 # quickworld - skip the bootstrap, build, and cross-build steps
354 # realquickworld - skip the bootstrap, build, crossbuild, and depend step.
356 # note: we include _obj in realquickworld to prevent accidental creation
357 # of files in /usr/src.
360 .if !defined(SUBDIR_OVERRIDE)
361 WMAKE_TGTS+= _worldtmp _bootstrap-tools
363 WMAKE_TGTS+= _obj _build-tools
364 .if !defined(SUBDIR_OVERRIDE)
365 WMAKE_TGTS+= _cross-tools
367 WMAKE_TGTS+= _includes _libraries _depend everything
369 buildworld: ${WMAKE_TGTS}
371 quickworld: _obj _includes _libraries _depend everything
373 realquickworld: _obj _includes _libraries everything
375 crossworld: _worldtmp _bootstrap-tools _obj _build-tools _cross-tools
377 .ORDER: ${WMAKE_TGTS}
382 # Checks to be sure system is ready for installworld
385 .if !defined(NO_SENDMAIL)
386 @pw usershow smmsp || (echo "You may need to run 'make preupgrade' first"; exit 1)
387 @pw groupshow smmsp || (echo "You may need to run 'make preupgrade' first"; exit 1)
389 @pw usershow _pflogd || (echo "You may need to run 'make preupgrade' first"; exit 1)
390 @pw usershow _ntp || (echo "You may need to run 'make preupgrade' first"; exit 1)
391 @pw groupshow authpf || (echo "You may need to run 'make preupgrade' first"; exit 1)
392 @pw groupshow _pflogd || (echo "You may need to run 'make preupgrade' first"; exit 1)
393 @pw groupshow _ntp || (echo "You may need to run 'make preupgrade' first"; exit 1)
394 .if !defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/"
395 @case `uname -r` in 1.2*|1.3-*|1.3.0-*|1.3.1-*|1.3.2-*|1.3.3-*|1.3.4-*) echo "You must upgrade your kernel to at least 1.3.5 and reboot before you can safely installworld, due to stat(2) and dirent ABI changes" ; exit 1;; esac
400 # Distributes everything compiled by a `buildworld'.
404 # Installs everything compiled by a 'buildworld'.
406 distributeworld installworld: installcheck
407 cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}
412 # If you have a build server, you can NFS mount the source and obj directories
413 # and do a 'make reinstall' on the *client* to install new binaries from the
414 # most recent server build.
417 @echo "--------------------------------------------------------------"
418 @echo ">>> Making hierarchy"
419 @echo "--------------------------------------------------------------"
420 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
422 @echo "--------------------------------------------------------------"
423 @echo ">>> Installing everything.."
424 @echo "--------------------------------------------------------------"
425 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
426 .if !defined(NOMAN) && !defined(NO_MAKEDB_RUN)
428 @echo "--------------------------------------------------------------"
429 @echo ">>> Rebuilding man page indices"
430 @echo "--------------------------------------------------------------"
431 cd ${.CURDIR}/share/man; ${MAKE} makedb
435 @echo "--------------------------------------------------------------"
436 @echo ">>> Distributing everything.."
437 @echo "--------------------------------------------------------------"
438 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
441 # buildkernel, nativekernel, quickkernel, and installkernel
443 # Which kernels to build and/or install is specified by setting
444 # KERNCONF. If not defined a GENERIC kernel is built/installed.
445 # Only the existing (depending TARGET) config files are used
446 # for building kernels and only the first of these is designated
447 # as the one being installed.
449 # You can specify INSTALLSTRIPPED=1 if you wish the installed
450 # kernel and modules to be stripped of its debug info (required
451 # symbols are left intact). You can specify INSTALLSTRIPPEDMODULES
452 # if you only want to strip the modules of their debug info. These
453 # only apply if you have DEBUG=-g in your kernel config or make line.
455 # Note that we have to use TARGET instead of TARGET_ARCH when
456 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
457 # be set to cross-build, we have to make sure TARGET is set
460 .if !defined(KERNCONF) && defined(KERNEL)
466 INSTKERNNAME?= kernel
468 KRNLSRCDIR= ${.CURDIR}/sys
469 KRNLCONFDIR= ${KRNLSRCDIR}/${TARGET}/conf
470 KRNLOBJDIR= ${OBJTREE}${KRNLSRCDIR}
471 KERNCONFDIR?= ${KRNLCONFDIR}
475 .for _kernel in ${KERNCONF}
476 .if exists(${KERNCONFDIR}/${_kernel})
477 BUILDKERNELS+= ${_kernel}
478 .if empty(INSTALLKERNEL)
479 INSTALLKERNEL= ${_kernel}
484 # kernel version numbers survive rm -rf
486 .for _kernel in ${BUILDKERNELS}
487 .if exists(${KRNLOBJDIR}/${_kernel}/version)
488 KERNEL_VERSION_${_kernel} != cat ${KRNLOBJDIR}/${_kernel}/version
495 # Builds all kernels defined by BUILDKERNELS.
498 @if [ ! -f ${WORLDDEST}/.libraries_done ]; then \
499 echo "You must buildworld before buildkernel. If you wish"; \
500 echo "to build a kernel using native tools, config it manually"; \
501 echo "or use the nativekernel target if you are in a rush"; \
506 .for _kernel in ${BUILDKERNELS}
507 @if [ ! -f ${KRNLOBJDIR}/${_kernel}/.nativekernel_run ]; then \
508 if [ ! -f ${WORLDDEST}/.libraries_done ]; then \
509 echo "The kernel was build using buildworld tools which no" ; \
510 echo "longer appear to exist, quickkernel failed!" ; \
517 .if empty(BUILDKERNELS)
518 @echo ">>> ERROR: Missing kernel configuration file(s) (${KERNCONF})."
523 .if defined(KERNWARN)
524 @echo "--------------------------------------------------------------"
525 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
526 @echo "--------------------------------------------------------------"
531 # The buildkernel target rebuilds the specified kernels from scratch
532 # using the crossbuild tools generated by the last buildworld. It is
533 # the safest (but also the most time consuming) way to build a new kernel.
535 buildkernel: bk_tools bk_build_list bk_kernwarn
536 .for _kernel in ${BUILDKERNELS}
537 @echo "--------------------------------------------------------------"
538 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
539 @echo "--------------------------------------------------------------"
540 @echo "===> ${_kernel}"
541 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
542 rm -rf ${KRNLOBJDIR}/${_kernel}
544 @if [ -f ${KRNLOBJDIR}/${_kernel}/.nativekernel_run ]; then \
545 echo "YOU ARE REBUILDING WITH BUILDKERNEL, REMOVING OLD NATIVEKERNEL BUILD"; \
546 rm -rf ${KRNLOBJDIR}/${_kernel}; fi
548 mkdir -p ${KRNLOBJDIR}
549 .if !defined(NO_KERNELCONFIG)
551 PATH=${STRICTTMPPATH} \
552 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
553 ${KERNCONFDIR}/${_kernel}
555 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN) && defined(KERNEL_VERSION_${_kernel})
556 echo ${KERNEL_VERSION_${_kernel}} > ${KRNLOBJDIR}/${_kernel}/version
558 touch ${KRNLOBJDIR}/${_kernel}/.buildkernel_run
559 cd ${KRNLOBJDIR}/${_kernel}; \
560 MAKESRCPATH=${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm \
561 ${MAKE} -DBOOTSTRAPPING -f ${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm/Makefile
562 .if !defined(NO_KERNELDEPEND)
563 cd ${KRNLOBJDIR}/${_kernel}; \
564 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend
566 cd ${KRNLOBJDIR}/${_kernel}; \
567 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all
568 @echo "--------------------------------------------------------------"
569 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
570 @echo "--------------------------------------------------------------"
573 # The nativekernel target rebuilds the specified kernels from scratch
574 # using the systems standard compiler rather then using the crossbuild
575 # tools generated by the last buildworld. This is fairly safe if your
576 # system is reasonable up-to-date.
578 nativekernel: bk_build_list bk_kernwarn
579 .for _kernel in ${BUILDKERNELS}
580 @echo "--------------------------------------------------------------"
581 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
582 @echo "--------------------------------------------------------------"
583 @echo "===> ${_kernel}"
584 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
585 rm -rf ${KRNLOBJDIR}/${_kernel}
587 @if [ -f ${KRNLOBJDIR}/${_kernel}/.buildkernel_run ]; then \
588 echo "YOU ARE REBUILDING WITH NATIVEKERNEL, REMOVING OLD BUILDKERNEL BUILD"; \
589 rm -rf ${KRNLOBJDIR}/${_kernel}; fi
591 mkdir -p ${KRNLOBJDIR}
592 .if !defined(NO_KERNELCONFIG)
594 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
595 ${KERNCONFDIR}/${_kernel}
597 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN) && defined(KERNEL_VERSION_${_kernel})
598 echo ${KERNEL_VERSION_${_kernel}} > ${KRNLOBJDIR}/${_kernel}/version
600 touch ${KRNLOBJDIR}/${_kernel}/.nativekernel_run
601 cd ${KRNLOBJDIR}/${_kernel}; \
602 MAKESRCPATH=${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm \
603 ${MAKE} -DBOOTSTRAPPING -f ${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm/Makefile
604 .if !defined(NO_KERNELDEPEND)
605 cd ${KRNLOBJDIR}/${_kernel}; \
606 ${MAKE} KERNEL=${INSTKERNNAME} depend
608 cd ${KRNLOBJDIR}/${_kernel}; \
609 ${MAKE} KERNEL=${INSTKERNNAME} all
610 @echo "--------------------------------------------------------------"
611 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
612 @echo "--------------------------------------------------------------"
615 # The quickkernel target rebuilds the specified kernels as quickly
616 # as possible. It will use the native tools or the buildworld cross tools
617 # based on whether the kernel was originally generated via buildkernel or
618 # nativekernel. Config is rerun but the object hierarchy is not rebuilt,
619 # nor is the make depend step run.
621 quickkernel: maybe_bk_tools bk_build_list bk_kernwarn
622 .for _kernel in ${BUILDKERNELS}
623 @echo "--------------------------------------------------------------"
624 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
625 @echo "--------------------------------------------------------------"
626 @echo "===> ${_kernel}"
627 .if exists(${KRNLOBJDIR}/${_kernel}/.buildkernel_run)
628 .if !defined(NO_KERNELCONFIG)
630 PATH=${STRICTTMPPATH} \
631 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
632 ${KERNCONFDIR}/${_kernel}
634 cd ${KRNLOBJDIR}/${_kernel}; \
635 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all
637 .if !defined(NO_KERNELCONFIG)
639 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
640 ${KERNCONFDIR}/${_kernel}
642 cd ${KRNLOBJDIR}/${_kernel}; \
643 ${MAKE} KERNEL=${INSTKERNNAME} all
645 @echo "--------------------------------------------------------------"
646 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
647 @echo "--------------------------------------------------------------"
653 # Install the kernel defined by INSTALLKERNEL
655 installkernel reinstallkernel:
656 .if exists(${KRNLOBJDIR}/${_kernel}/.buildkernel_run)
657 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
658 ${CROSSENV} ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//}
660 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
661 ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//}
667 # Update the source tree, by running sup and/or running cvs to update to the
671 .if defined(SUP_UPDATE)
672 @echo "--------------------------------------------------------------"
673 @echo ">>> Running ${SUP}"
674 @echo "--------------------------------------------------------------"
676 @${SUP} ${SUPFLAGS} ${SUPFILE}
678 .if defined(SUPFILE1)
679 @${SUP} ${SUPFLAGS} ${SUPFILE1}
681 .if defined(SUPFILE2)
682 @${SUP} ${SUPFLAGS} ${SUPFILE2}
684 .if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
685 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
687 .if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
688 @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
691 .if defined(CVS_UPDATE)
692 @echo "--------------------------------------------------------------"
693 @echo ">>> Updating ${.CURDIR} from cvs repository `cat ${.CURDIR}/CVS/Root`"
694 @echo "--------------------------------------------------------------"
696 cd ${.CURDIR}; cvs -q update -P -d
702 # Build most of the user binaries on the existing system libs and includes.
705 @echo "--------------------------------------------------------------"
706 @echo ">>> Building programs only"
707 @echo "--------------------------------------------------------------"
708 .for _dir in bin sbin libexec usr.bin usr.sbin gnu/libexec gnu/usr.bin gnu/usr.sbin
709 cd ${.CURDIR}/${_dir}; ${MAKE} DIRPRFX=${_dir}/ all
715 # Install the binaries built by the 'most' target. This does not include
716 # libraries or include files.
719 @echo "--------------------------------------------------------------"
720 @echo ">>> Installing programs only"
721 @echo "--------------------------------------------------------------"
722 .for _dir in bin sbin libexec usr.bin usr.sbin gnu/libexec gnu/usr.bin gnu/usr.sbin
723 cd ${.CURDIR}/${_dir}; ${MAKE} DIRPRFX=${_dir}/ install
727 # ------------------------------------------------------------------------
729 # From here onwards are utility targets used by the 'make world' and
730 # related targets. If your 'world' breaks, you may like to try to fix
731 # the problem and manually run the following targets to attempt to
732 # complete the build. Beware, this is *not* guaranteed to work, you
733 # need to have a pretty good grip on the current state of the system
734 # to attempt to manually finish it. If in doubt, 'make world' again.
737 # bootstrap-tools: Build all tools required to build all tools. Note that
738 # order is important in a number of cases and also note that the bootstrap
739 # and build tools stages have access to earlier binaries they themselves
742 # patch: older patch's do not have -i. This program must be built
743 # first so other bootstrap tools that need to apply patches
745 # [x]install: dependancies on various new install features
746 # rpcgen: old rpcgen used a hardwired cpp path, newer OBJFORMAT_PATH
747 # envs are not compatible with older objformat binaries.
749 .if exists(${.CURDIR}/games) && !defined(NO_GAMES)
750 _strfile= games/fortune/strfile
754 ${LN} -fs /bin/date ${BTOOLSDEST}/bin/date
755 .for _tool in ${_strfile} \
757 bin/chmod bin/cp bin/dd bin/mkdir bin/rm bin/echo bin/test \
758 bin/cat bin/ln bin/mv bin/csh bin/expr bin/sh \
759 bin/hostname bin/kill \
760 usr.bin/yacc usr.bin/colldef usr.bin/uudecode usr.bin/xinstall \
761 usr.bin/m4 usr.bin/rpcgen usr.bin/make usr.bin/awk usr.bin/stat \
762 usr.bin/find usr.bin/lex usr.bin/sed usr.bin/uname usr.bin/touch \
763 usr.bin/mkdep usr.bin/mktemp usr.bin/lorder usr.bin/file2c \
764 usr.bin/tsort usr.bin/tr usr.bin/join usr.bin/wc usr.bin/basename \
765 usr.bin/gencat usr.bin/chflags usr.bin/expand usr.bin/paste \
766 usr.bin/mklocale usr.bin/uuencode usr.bin/compile_et usr.bin/hexdump \
767 usr.bin/vi usr.bin/cap_mkdb usr.bin/vgrind usr.bin/true usr.bin/false \
768 usr.bin/cmp usr.bin/xargs usr.bin/id usr.bin/env usr.bin/dirname \
770 usr.sbin/chown usr.sbin/mtree usr.sbin/config \
771 usr.sbin/btxld usr.sbin/pwd_mkdb usr.sbin/zic usr.sbin/makewhatis \
772 gnu/usr.bin/texinfo gnu/usr.bin/grep gnu/usr.bin/sort \
773 usr.bin/gzip usr.bin/bzip2 usr.bin/mkcsmapper usr.bin/mkesdb
774 ${ECHODIR} "===> ${_tool} (bootstrap-tools)"; \
775 cd ${.CURDIR}/${_tool}; \
776 ${MAKE} DIRPRFX=${_tool}/ obj; \
777 ${MAKE} DIRPRFX=${_tool}/ depend; \
778 ${MAKE} DIRPRFX=${_tool}/ all; \
779 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${BTOOLSDEST} install
781 touch ${BTOOLSDEST}/.bootstrap_done
783 # build-tools: Build special purpose build tools.
785 # XXX we may be able to remove or consolidate this into bootstrap-tools
786 # now that we have the native helper (.nx/.no) infrastructure.
788 .if exists(${.CURDIR}/games) && !defined(NO_GAMES)
789 _games= games/adventure games/hack games/phantasia
792 .if exists(${.CURDIR}/share) && !defined(NO_SHARE)
793 _share= share/syscons/scrnmaps
796 _gcc34_cross= gnu/usr.bin/cc34
797 _gcc34_tools= gnu/usr.bin/cc34/cc_prep gnu/usr.bin/cc34/cc_tools
798 .if defined(WANT_GCC40)
799 _gcc40_cross= gnu/usr.bin/cc40
800 _gcc40_tools= gnu/usr.bin/cc40/cc_prep gnu/usr.bin/cc40/cc_tools
802 _binutils= gnu/usr.bin/binutils215
804 .if !defined(NO_FORTRAN)
805 _fortran= gnu/usr.bin/cc34/f771
808 .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
809 !defined(NO_CRYPT) && defined(WANT_KERBEROS)
810 _libkrb5= kerberos5/tools kerberos5/lib/libroken kerberos5/lib/libvers \
811 kerberos5/lib/libasn1 kerberos5/lib/libhdb kerberos5/lib/libsl
815 .for _tool in ${_gcc34_tools} ${_gcc40_tools} ${_fortran} ${_libkrb5} ${_share}
816 ${ECHODIR} "===> ${_tool} (build-tools)"; \
817 cd ${.CURDIR}/${_tool}; \
818 ${MAKE} DIRPRFX=${_tool}/ obj; \
819 ${MAKE} DIRPRFX=${_tool}/ depend; \
820 ${MAKE} DIRPRFX=${_tool}/ all; \
821 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${BTOOLSDEST} install
823 touch ${BTOOLSDEST}/.build_done
826 # cross-tools: Build cross-building tools
828 .if ${TARGET_ARCH} == "i386" && ${MACHINE_ARCH} != "i386"
829 _btxld= usr.sbin/btxld
833 .for _tool in ${_btxld} ${_binutils} \
834 usr.bin/objformat usr.sbin/crunch/crunchide \
835 ${_gcc34_cross} ${_gcc40_cross}
836 ${ECHODIR} "===> ${_tool} (cross-tools)"; \
837 cd ${.CURDIR}/${_tool}; \
838 ${MAKE} DIRPRFX=${_tool}/ obj; \
839 ${MAKE} DIRPRFX=${_tool}/ depend; \
840 ${MAKE} DIRPRFX=${_tool}/ all; \
841 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${CTOOLSDEST} install
843 touch ${CTOOLSDEST}/.cross_done
846 # hierarchy - ensure that all the needed directories are present
849 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs
852 # libraries - build all libraries, and install them under ${DESTDIR}.
854 # The list of libraries with dependents (${_prebuild_libs}) and their
855 # interdependencies (__L) are built automatically by the
856 # ${.CURDIR}/tools/make_libdeps.sh script.
858 # .makeenv does not work when bootstrapping from 4.x, so we must be sure
859 # to specify the correct CCVER or 'cc' will not exec the correct compiler.
863 HOST_CCVER=${HOST_CCVER} CCVER=gcc34 \
864 ${MAKE} -f Makefile.inc1 _startup_libs34;
865 .if defined(WANT_GCC40)
867 HOST_CCVER=${HOST_CCVER} CCVER=gcc40 \
868 ${MAKE} -f Makefile.inc1 _startup_libs40;
871 ${MAKE} -f Makefile.inc1 _startup_libs; \
872 ${MAKE} -f Makefile.inc1 _prebuild_libs; \
873 ${MAKE} -f Makefile.inc1 _generic_libs;
874 touch ${WORLDDEST}/.libraries_done
876 # These dependencies are not automatically generated:
878 # gnu/lib/${CCVER}/libgcc and lib/csu must be built before all
879 # shared libraries for ELF. The target for _startup_libs34 is
880 # specifically built using gcc34. Same goes for _startup_libs40.
882 _startup_libs34= gnu/lib/gcc34/libgcc
883 _startup_libs40= gnu/lib/gcc40/libgcc
884 _startup_libs= lib/csu/${MACHINE_ARCH}
885 _startup_libs+= lib/csu/common lib/libc lib/libc_rtld
887 _prebuild_libs= lib/libarchive
888 _prebuild_libs+= lib/libutil
890 _generic_libs= gnu/lib
892 .if !defined(NO_CRYPT) && defined(WANT_KERBEROS)
893 _prebuild_libs+= kerberos5/tools
894 _prebuild_libs+= kerberos5/lib/libasn1
895 _prebuild_libs+= kerberos5/lib/libgssapi
896 _prebuild_libs+= kerberos5/lib/libkrb5
897 _prebuild_libs+= kerberos5/lib/libroken
898 _generic_libs+= kerberos5/lib
901 _prebuild_libs+= lib/libcom_err lib/libcrypt lib/libmd \
902 lib/libncurses/libncurses lib/libopie lib/libradius \
903 lib/libskey lib/libtacplus lib/libz lib/libm lib/libpam
905 lib/libopie__L lib/libradius__L lib/libtacplus__L: lib/libmd__L
906 lib/libskey__L: lib/libcrypt__L lib/libmd__L
910 .if !defined(NO_CRYPT)
911 .if !defined(NO_OPENSSL)
912 _prebuild_libs+= secure/lib/libcrypto secure/lib/libssl
913 .if !defined(NO_OPENSSH)
914 _prebuild_libs+= secure/lib/libssh
915 secure/lib/libssh__L: secure/lib/libcrypto__L lib/libz__L
918 _generic_libs+= secure/lib
921 _generic_libs+= usr.bin/lex/lib
923 .for _lib in ${_startup_libs34} ${_startup_libs40} \
924 ${_startup_libs} ${_prebuild_libs} ${_generic_libs}
926 .if exists(${.CURDIR}/${_lib})
927 ${ECHODIR} "===> ${_lib}"; \
928 cd ${.CURDIR}/${_lib}; \
929 ${MAKE} DIRPRFX=${_lib}/ depend; \
930 ${MAKE} DIRPRFX=${_lib}/ all; \
931 ${MAKE} DIRPRFX=${_lib}/ install
935 _startup_libs: ${_startup_libs:S/$/__L/}
936 _startup_libs34: ${_startup_libs34:S/$/__L/}
937 _startup_libs40: ${_startup_libs40:S/$/__L/}
938 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
939 _generic_libs: ${_generic_libs:S/$/__L/}
941 # library targets must be ordered because there are inter-library
942 # races (e.g. generation of tconfig.h)
944 .ORDER: ${_startup_libs34:S/$/__L/}
945 .ORDER: ${_startup_libs40:S/$/__L/}
946 .ORDER: ${_startup_libs:S/$/__L/}
947 .ORDER: ${_prebuild_libs:S/$/__L/}
948 .ORDER: ${_generic_libs:S/$/__L/}
950 .for __target in clean cleandepend cleandir obj depend includes
951 .for entry in ${SUBDIR}
952 ${entry}.${__target}__D: .PHONY
953 @if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
954 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
955 edir=${entry}.${MACHINE_ARCH}; \
956 cd ${.CURDIR}/$${edir}; \
958 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \
960 cd ${.CURDIR}/$${edir}; \
962 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
964 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
965 .ORDER: ${SUBDIR:S/$/.${__target}__D/}
967 .ORDER: par-clean par-cleandepend par-cleandir par-obj par-depend par-includes
969 # The wmake target is used by /usr/bin/wmake to run make in a
970 # world build environment.
973 @echo '${WMAKEENV} ${MAKE} -m ${.CURDIR}/share/mk ${WMAKE_ARGS}'
976 @echo '${WMAKEENV} /bin/sh'
979 @echo '${BMAKEENV} ${MAKE} -m ${.CURDIR}/share/mk ${BMAKE_ARGS}'
982 @echo '${BMAKEENV} /bin/sh'
985 @echo '${TMAKEENV} ${MAKE} -m ${.CURDIR}/share/mk ${TMAKE_ARGS}'
988 @echo '${TMAKEENV} /bin/sh'
990 .include <bsd.subdir.mk>