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.82 2005/10/08 10:47:36 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 # Object directory base in primary make. Note that when we rerun make
115 # from inside this file we change MAKEOBJDIRPREFIX to the appropriate
116 # subdirectory because the rest of the build system needs it that way.
117 # The original object directory base is saved in OBJTREE.
119 MAKEOBJDIRPREFIX?= /usr/obj
120 OBJTREE?= ${MAKEOBJDIRPREFIX}
122 # Used for stage installs and pathing
124 DESTDIRBASE?= ${OBJTREE}${.CURDIR}
126 TARGET_ARCH?= ${MACHINE_ARCH}
127 .if ${TARGET_ARCH} == ${MACHINE_ARCH}
130 TARGET?= ${TARGET_ARCH}
133 BUILD_ARCH!= sysctl -n hw.machine_arch
134 .if ${MACHINE_ARCH} != ${BUILD_ARCH}
135 .error To cross-build, set TARGET_ARCH.
139 # BTOOLS (Natively built) All non-cross-development tools that the
140 # main build needs. This includes things like 'mkdir' and 'rm'.
141 # We will not use the native system's exec path once we start
142 # on WORLD. (bootstrap-tools and build-tools or BTOOLS)
144 # CTOOLS (Natively built) Cross development tools which are specific
145 # to the target architecture.
147 # WORLD (Cross built) Our ultimate buildworld, using only BTOOLS and
150 # MACHINE_ARCH Architecture we are building on
151 # TARGET_ARCH Architecture we are building for
153 BTOOLSDEST= ${DESTDIRBASE}/btools_${MACHINE_ARCH}
154 CTOOLSDEST= ${DESTDIRBASE}/ctools_${MACHINE_ARCH}_${TARGET_ARCH}
155 WORLDDEST= ${DESTDIRBASE}/world_${TARGET_ARCH}
157 # The bootstrap-tools path is used by the bootstrap-tools, build-tools, and
158 # cross-tools stages to augment the existing command path to access newer
159 # versions of certain utilities such as 'patch' that the cross-tools stage
162 BTOOLSPATH= ${BTOOLSDEST}/usr/sbin:${BTOOLSDEST}/usr/bin:${BTOOLSDEST}/bin:${BTOOLSDEST}/usr/games
164 # The strict temporary command path contains all binaries required
165 # by the buildworld system after the cross-tools stage.
167 STRICTTMPPATH= ${CTOOLSDEST}/usr/sbin:${CTOOLSDEST}/usr/bin:${CTOOLSDEST}/bin:${CTOOLSDEST}/usr/games:${BTOOLSDEST}/usr/sbin:${BTOOLSDEST}/usr/bin:${BTOOLSDEST}/bin:${BTOOLSDEST}/usr/games
173 # Building a world goes through the following stages
175 # 1. bootstrap-tool stage [BMAKE]
176 # This stage is responsible for creating programs that
177 # are needed for backward compatibility reasons. They
178 # are not built as cross-tools.
179 # 2. build-tool stage [TMAKE]
180 # This stage is responsible for creating the object
181 # tree and building any tools that are needed during
183 # 3. cross-tool stage [XMAKE]
184 # This stage is responsible for creating any tools that
185 # are needed for cross-builds. A cross-compiler is one
187 # 4. world stage [WMAKE]
188 # This stage actually builds the world.
189 # 5. install stage (optional) [IMAKE]
190 # This stage installs a previously built world.
193 # bootstrap-tool stage
195 BMAKEENV= MAKEOBJDIRPREFIX=${BTOOLSDEST} \
197 DESTDIR=${BTOOLSDEST} \
198 PATH=${BTOOLSPATH}:${PATH} \
199 INSTALL="sh ${.CURDIR}/tools/install.sh"
201 BMAKE= ${BMAKEENV} ${MAKE} -f Makefile.inc1 -DBOOTSTRAPPING \
202 -DNOINFO -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED \
207 TMAKEENV= MAKEOBJDIRPREFIX=${BTOOLSDEST} \
210 PATH=${BTOOLSPATH}:${PATH} \
211 INSTALL="sh ${.CURDIR}/tools/install.sh"
213 TMAKE= ${TMAKEENV} ${MAKE} -f Makefile.inc1 -DBOOTSTRAPPING \
214 -DNO_FORTRAN -DNOSHARED
218 # note: TOOLS_PREFIX points to the obj root holding the cross
219 # compiler binaries, while USRDATA_PREFIX points to the obj root
220 # holding the target environment (and also determines where cross-built
221 # libraries, crt*.o, and include files are installed).
223 XMAKEENV= MAKEOBJDIRPREFIX=${CTOOLSDEST} \
225 DESTDIR=${CTOOLSDEST} \
226 INSTALL="sh ${.CURDIR}/tools/install.sh" \
227 TOOLS_PREFIX=${CTOOLSDEST} \
228 USRDATA_PREFIX=${WORLDDEST} \
229 PATH=${BTOOLSPATH}:${PATH}
231 XMAKE= ${XMAKEENV} ${MAKE} -f Makefile.inc1 -DNO_FORTRAN -DNO_GDB \
232 -DBOOTSTRAPPING -DNOSHARED
234 # world stage, note the strict path and note that TOOLS_PREFIX is left
235 # unset and USRDATA_PREFIX (which defaults to TOOLS_PREFIX) is set to empty,
236 # which is primarily for the compiler so it targets / (e.g. /usr/<blah>)
237 # for both binary and library paths, even though it is being compiled to
238 # WORLDDEST. None of the programs in the world stage are ever actually
239 # executed during the buildworld/installworld.
241 CROSSENV= MAKEOBJDIRPREFIX=${WORLDDEST} \
243 MACHINE_ARCH=${TARGET_ARCH} \
245 OBJFORMAT_PATH=${CTOOLSDEST}
247 WMAKEENV= ${CROSSENV} \
248 DESTDIR=${WORLDDEST} \
249 INSTALL="sh ${.CURDIR}/tools/install.sh" \
250 PATH=${STRICTTMPPATH}
252 WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1
256 IMAKEENV= ${CROSSENV} \
257 PATH=${STRICTTMPPATH}
258 IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1
262 KMAKEENV= ${WMAKEENV}
266 # Attempt to rebuild the entire system, with reasonable chance of
267 # success, regardless of how old your existing system is.
271 @echo "--------------------------------------------------------------"
272 @echo ">>> Rebuilding the temporary build tree"
273 @echo "--------------------------------------------------------------"
274 .if !defined(NOCLEAN)
275 rm -rf ${BTOOLSDEST} ${CTOOLSDEST} ${WORLDDEST}
277 # XXX - These two can depend on any header file.
278 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
279 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
281 mkdir -p ${DESTDIRBASE} ${BTOOLSDEST} ${CTOOLSDEST} ${WORLDDEST}
282 .for _dir in ${WORLDDEST} ${BTOOLSDEST} ${CTOOLSDEST}
283 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
284 -p ${_dir}/ > /dev/null
285 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
286 -p ${_dir}/usr > /dev/null
288 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
289 -p ${WORLDDEST}/usr/include > /dev/null
290 ${LN} -sf ${.CURDIR}/sys ${WORLDDEST}
294 @echo "--------------------------------------------------------------"
295 @echo ">>> stage 1: bootstrap tools"
296 @echo "--------------------------------------------------------------"
297 cd ${.CURDIR}; ${BMAKE} bootstrap-tools
300 @echo "--------------------------------------------------------------"
301 @echo ">>> stage 2a: cleaning up the object tree"
302 @echo "--------------------------------------------------------------"
303 cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
306 @echo "--------------------------------------------------------------"
307 @echo ">>> stage 2b: rebuilding the object tree"
308 @echo "--------------------------------------------------------------"
309 cd ${.CURDIR}; ${WMAKE} par-obj
312 @echo "--------------------------------------------------------------"
313 @echo ">>> stage 2c: build tools"
314 @echo "--------------------------------------------------------------"
315 cd ${.CURDIR}; ${TMAKE} build-tools
318 @echo "--------------------------------------------------------------"
319 @echo ">>> stage 3: cross tools"
320 @echo "--------------------------------------------------------------"
321 cd ${.CURDIR}; ${XMAKE} cross-tools
324 @echo "--------------------------------------------------------------"
325 @echo ">>> stage 4a: populating ${WORLDDEST}/usr/include"
326 @echo "--------------------------------------------------------------"
327 cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
330 @echo "--------------------------------------------------------------"
331 @echo ">>> stage 4b: building libraries"
332 @echo "--------------------------------------------------------------"
333 cd ${.CURDIR}; ${WMAKE} -DNOHTML -DNOINFO -DNOMAN -DNOFSCHG libraries
336 @echo "--------------------------------------------------------------"
337 @echo ">>> stage 4c: make dependencies"
338 @echo "--------------------------------------------------------------"
339 cd ${.CURDIR}; ${WMAKE} par-depend
342 @echo "--------------------------------------------------------------"
343 @echo ">>> stage 4d: building everything.."
344 @echo "--------------------------------------------------------------"
345 cd ${.CURDIR}; ${WMAKE} all
347 # note: buildworld no longer depends on _cleanobj because we rm -rf the
348 # entire object tree and built the bootstrap tools in a different location.
350 # buildworld - build everything from scratch
351 # quickworld - skip the bootstrap, build, and cross-build steps
352 # realquickworld - skip the bootstrap, build, crossbuild, and depend step.
354 # note: we include _obj in realquickworld to prevent accidental creation
355 # of files in /usr/src.
358 .if !defined(SUBDIR_OVERRIDE)
359 WMAKE_TGTS+= _worldtmp _bootstrap-tools
361 WMAKE_TGTS+= _obj _build-tools
362 .if !defined(SUBDIR_OVERRIDE)
363 WMAKE_TGTS+= _cross-tools
365 WMAKE_TGTS+= _includes _libraries _depend everything
367 buildworld: ${WMAKE_TGTS}
369 quickworld: _obj _includes _libraries _depend everything
371 realquickworld: _obj _includes _libraries everything
373 crossworld: _worldtmp _bootstrap-tools _obj _build-tools _cross-tools
375 .ORDER: ${WMAKE_TGTS}
380 # Checks to be sure system is ready for installworld
383 .if !defined(NO_SENDMAIL)
384 @pw usershow smmsp || (echo "You may need to run 'make preupgrade' first"; exit 1)
385 @pw groupshow smmsp || (echo "You may need to run 'make preupgrade' first"; exit 1)
387 @pw usershow _pflogd || (echo "You may need to run 'make preupgrade' first"; exit 1)
388 @pw usershow _ntp || (echo "You may need to run 'make preupgrade' first"; exit 1)
389 @pw groupshow authpf || (echo "You may need to run 'make preupgrade' first"; exit 1)
390 @pw groupshow _pflogd || (echo "You may need to run 'make preupgrade' first"; exit 1)
391 @pw groupshow _ntp || (echo "You may need to run 'make preupgrade' first"; exit 1)
392 .if !defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/"
393 @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
398 # Distributes everything compiled by a `buildworld'.
402 # Installs everything compiled by a 'buildworld'.
404 distributeworld installworld: installcheck
405 cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}
410 # If you have a build server, you can NFS mount the source and obj directories
411 # and do a 'make reinstall' on the *client* to install new binaries from the
412 # most recent server build.
415 @echo "--------------------------------------------------------------"
416 @echo ">>> Making hierarchy"
417 @echo "--------------------------------------------------------------"
418 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
420 @echo "--------------------------------------------------------------"
421 @echo ">>> Installing everything.."
422 @echo "--------------------------------------------------------------"
423 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
424 .if !defined(NOMAN) && !defined(NO_MAKEDB_RUN)
426 @echo "--------------------------------------------------------------"
427 @echo ">>> Rebuilding man page indices"
428 @echo "--------------------------------------------------------------"
429 cd ${.CURDIR}/share/man; ${MAKE} makedb
433 @echo "--------------------------------------------------------------"
434 @echo ">>> Distributing everything.."
435 @echo "--------------------------------------------------------------"
436 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
439 # buildkernel, nativekernel, quickkernel, and installkernel
441 # Which kernels to build and/or install is specified by setting
442 # KERNCONF. If not defined a GENERIC kernel is built/installed.
443 # Only the existing (depending TARGET) config files are used
444 # for building kernels and only the first of these is designated
445 # as the one being installed.
447 # You can specify INSTALLSTRIPPED=1 if you wish the installed
448 # kernel and modules to be stripped of its debug info (required
449 # symbols are left intact). You can specify INSTALLSTRIPPEDMODULES
450 # if you only want to strip the modules of their debug info. These
451 # only apply if you have DEBUG=-g in your kernel config or make line.
453 # Note that we have to use TARGET instead of TARGET_ARCH when
454 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
455 # be set to cross-build, we have to make sure TARGET is set
458 .if !defined(KERNCONF) && defined(KERNEL)
464 INSTKERNNAME?= kernel
466 KRNLSRCDIR= ${.CURDIR}/sys
467 KRNLCONFDIR= ${KRNLSRCDIR}/${TARGET}/conf
468 KRNLOBJDIR= ${OBJTREE}${KRNLSRCDIR}
469 KERNCONFDIR?= ${KRNLCONFDIR}
473 .for _kernel in ${KERNCONF}
474 .if exists(${KERNCONFDIR}/${_kernel})
475 BUILDKERNELS+= ${_kernel}
476 .if empty(INSTALLKERNEL)
477 INSTALLKERNEL= ${_kernel}
482 # kernel version numbers survive rm -rf
484 .for _kernel in ${BUILDKERNELS}
485 .if exists(${KRNLOBJDIR}/${_kernel}/version)
486 KERNEL_VERSION_${_kernel} != cat ${KRNLOBJDIR}/${_kernel}/version
493 # Builds all kernels defined by BUILDKERNELS.
496 @if [ ! -f ${WORLDDEST}/.libraries_done ]; then \
497 echo "You must buildworld before buildkernel. If you wish"; \
498 echo "to build a kernel using native tools, config it manually"; \
499 echo "or use the nativekernel target if you are in a rush"; \
504 .for _kernel in ${BUILDKERNELS}
505 @if [ ! -f ${KRNLOBJDIR}/${_kernel}/.nativekernel_run ]; then \
506 if [ ! -f ${WORLDDEST}/.libraries_done ]; then \
507 echo "The kernel was build using buildworld tools which no" ; \
508 echo "longer appear to exist, quickkernel failed!" ; \
515 .if empty(BUILDKERNELS)
516 @echo ">>> ERROR: Missing kernel configuration file(s) (${KERNCONF})."
521 .if defined(KERNWARN)
522 @echo "--------------------------------------------------------------"
523 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
524 @echo "--------------------------------------------------------------"
529 # The buildkernel target rebuilds the specified kernels from scratch
530 # using the crossbuild tools generated by the last buildworld. It is
531 # the safest (but also the most time consuming) way to build a new kernel.
533 buildkernel: bk_tools bk_build_list bk_kernwarn
534 .for _kernel in ${BUILDKERNELS}
535 @echo "--------------------------------------------------------------"
536 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
537 @echo "--------------------------------------------------------------"
538 @echo "===> ${_kernel}"
539 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
540 rm -rf ${KRNLOBJDIR}/${_kernel}
542 @if [ -f ${KRNLOBJDIR}/${_kernel}/.nativekernel_run ]; then \
543 echo "YOU ARE REBUILDING WITH BUILDKERNEL, REMOVING OLD NATIVEKERNEL BUILD"; \
544 rm -rf ${KRNLOBJDIR}/${_kernel}; fi
546 mkdir -p ${KRNLOBJDIR}
547 .if !defined(NO_KERNELCONFIG)
549 PATH=${STRICTTMPPATH} \
550 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
551 ${KERNCONFDIR}/${_kernel}
553 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN) && defined(KERNEL_VERSION_${_kernel})
554 echo ${KERNEL_VERSION_${_kernel}} > ${KRNLOBJDIR}/${_kernel}/version
556 touch ${KRNLOBJDIR}/${_kernel}/.buildkernel_run
557 cd ${KRNLOBJDIR}/${_kernel}; \
558 MAKESRCPATH=${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm \
559 ${MAKE} -DBOOTSTRAPPING -f ${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm/Makefile
560 .if !defined(NO_KERNELDEPEND)
561 cd ${KRNLOBJDIR}/${_kernel}; \
562 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend
564 cd ${KRNLOBJDIR}/${_kernel}; \
565 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all
566 @echo "--------------------------------------------------------------"
567 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
568 @echo "--------------------------------------------------------------"
571 # The nativekernel target rebuilds the specified kernels from scratch
572 # using the systems standard compiler rather then using the crossbuild
573 # tools generated by the last buildworld. This is fairly safe if your
574 # system is reasonable up-to-date.
576 nativekernel: bk_build_list bk_kernwarn
577 .for _kernel in ${BUILDKERNELS}
578 @echo "--------------------------------------------------------------"
579 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
580 @echo "--------------------------------------------------------------"
581 @echo "===> ${_kernel}"
582 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
583 rm -rf ${KRNLOBJDIR}/${_kernel}
585 @if [ -f ${KRNLOBJDIR}/${_kernel}/.buildkernel_run ]; then \
586 echo "YOU ARE REBUILDING WITH NATIVEKERNEL, REMOVING OLD BUILDKERNEL BUILD"; \
587 rm -rf ${KRNLOBJDIR}/${_kernel}; fi
589 mkdir -p ${KRNLOBJDIR}
590 .if !defined(NO_KERNELCONFIG)
592 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
593 ${KERNCONFDIR}/${_kernel}
595 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN) && defined(KERNEL_VERSION_${_kernel})
596 echo ${KERNEL_VERSION_${_kernel}} > ${KRNLOBJDIR}/${_kernel}/version
598 touch ${KRNLOBJDIR}/${_kernel}/.nativekernel_run
599 cd ${KRNLOBJDIR}/${_kernel}; \
600 MAKESRCPATH=${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm \
601 ${MAKE} -DBOOTSTRAPPING -f ${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm/Makefile
602 .if !defined(NO_KERNELDEPEND)
603 cd ${KRNLOBJDIR}/${_kernel}; \
604 ${MAKE} KERNEL=${INSTKERNNAME} depend
606 cd ${KRNLOBJDIR}/${_kernel}; \
607 ${MAKE} KERNEL=${INSTKERNNAME} all
608 @echo "--------------------------------------------------------------"
609 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
610 @echo "--------------------------------------------------------------"
613 # The quickkernel target rebuilds the specified kernels as quickly
614 # as possible. It will use the native tools or the buildworld cross tools
615 # based on whether the kernel was originally generated via buildkernel or
616 # nativekernel. Config is rerun but the object hierarchy is not rebuilt,
617 # nor is the make depend step run.
619 quickkernel: maybe_bk_tools bk_build_list bk_kernwarn
620 .for _kernel in ${BUILDKERNELS}
621 @echo "--------------------------------------------------------------"
622 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
623 @echo "--------------------------------------------------------------"
624 @echo "===> ${_kernel}"
625 .if exists(${KRNLOBJDIR}/${_kernel}/.buildkernel_run)
626 .if !defined(NO_KERNELCONFIG)
628 PATH=${STRICTTMPPATH} \
629 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
630 ${KERNCONFDIR}/${_kernel}
632 cd ${KRNLOBJDIR}/${_kernel}; \
633 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all
635 .if !defined(NO_KERNELCONFIG)
637 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
638 ${KERNCONFDIR}/${_kernel}
640 cd ${KRNLOBJDIR}/${_kernel}; \
641 ${MAKE} KERNEL=${INSTKERNNAME} all
643 @echo "--------------------------------------------------------------"
644 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
645 @echo "--------------------------------------------------------------"
651 # Install the kernel defined by INSTALLKERNEL
653 installkernel reinstallkernel:
654 .if exists(${KRNLOBJDIR}/${_kernel}/.buildkernel_run)
655 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
656 ${CROSSENV} ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//}
658 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
659 ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//}
665 # Update the source tree, by running sup and/or running cvs to update to the
669 .if defined(SUP_UPDATE)
670 @echo "--------------------------------------------------------------"
671 @echo ">>> Running ${SUP}"
672 @echo "--------------------------------------------------------------"
674 @${SUP} ${SUPFLAGS} ${SUPFILE}
676 .if defined(SUPFILE1)
677 @${SUP} ${SUPFLAGS} ${SUPFILE1}
679 .if defined(SUPFILE2)
680 @${SUP} ${SUPFLAGS} ${SUPFILE2}
682 .if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
683 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
685 .if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
686 @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
689 .if defined(CVS_UPDATE)
690 @echo "--------------------------------------------------------------"
691 @echo ">>> Updating ${.CURDIR} from cvs repository `cat ${.CURDIR}/CVS/Root`"
692 @echo "--------------------------------------------------------------"
694 cd ${.CURDIR}; cvs -q update -P -d
700 # Build most of the user binaries on the existing system libs and includes.
703 @echo "--------------------------------------------------------------"
704 @echo ">>> Building programs only"
705 @echo "--------------------------------------------------------------"
706 .for _dir in bin sbin libexec usr.bin usr.sbin gnu/libexec gnu/usr.bin gnu/usr.sbin
707 cd ${.CURDIR}/${_dir}; ${MAKE} DIRPRFX=${_dir}/ all
713 # Install the binaries built by the 'most' target. This does not include
714 # libraries or include files.
717 @echo "--------------------------------------------------------------"
718 @echo ">>> Installing programs only"
719 @echo "--------------------------------------------------------------"
720 .for _dir in bin sbin libexec usr.bin usr.sbin gnu/libexec gnu/usr.bin gnu/usr.sbin
721 cd ${.CURDIR}/${_dir}; ${MAKE} DIRPRFX=${_dir}/ install
725 # ------------------------------------------------------------------------
727 # From here onwards are utility targets used by the 'make world' and
728 # related targets. If your 'world' breaks, you may like to try to fix
729 # the problem and manually run the following targets to attempt to
730 # complete the build. Beware, this is *not* guaranteed to work, you
731 # need to have a pretty good grip on the current state of the system
732 # to attempt to manually finish it. If in doubt, 'make world' again.
735 # bootstrap-tools: Build all tools required to build all tools. Note that
736 # order is important in a number of cases and also note that the bootstrap
737 # and build tools stages have access to earlier binaries they themselves
740 # patch: older patch's do not have -i. This program must be built
741 # first so other bootstrap tools that need to apply patches
743 # [x]install: dependancies on various new install features
744 # rpcgen: old rpcgen used a hardwired cpp path, newer OBJFORMAT_PATH
745 # envs are not compatible with older objformat binaries.
747 .if exists(${.CURDIR}/games) && !defined(NO_GAMES)
748 _strfile= games/fortune/strfile
752 ${LN} -fs /bin/date ${BTOOLSDEST}/bin/date
753 .for _tool in ${_strfile} \
755 bin/chmod bin/cp bin/dd bin/mkdir bin/rm bin/echo bin/test \
756 bin/cat bin/ln bin/mv bin/csh bin/expr bin/sh \
757 bin/hostname bin/kill \
758 usr.bin/yacc usr.bin/colldef usr.bin/uudecode usr.bin/xinstall \
759 usr.bin/m4 usr.bin/rpcgen usr.bin/make usr.bin/awk usr.bin/stat \
760 usr.bin/find usr.bin/lex usr.bin/sed usr.bin/uname usr.bin/touch \
761 usr.bin/mkdep usr.bin/mktemp usr.bin/lorder usr.bin/file2c \
762 usr.bin/tsort usr.bin/tr usr.bin/join usr.bin/wc usr.bin/basename \
763 usr.bin/gencat usr.bin/chflags usr.bin/expand usr.bin/paste \
764 usr.bin/mklocale usr.bin/uuencode usr.bin/compile_et usr.bin/hexdump \
765 usr.bin/vi usr.bin/cap_mkdb usr.bin/vgrind usr.bin/true usr.bin/false \
766 usr.bin/cmp usr.bin/xargs usr.bin/id usr.bin/env usr.bin/dirname \
768 usr.sbin/chown usr.sbin/mtree usr.sbin/config \
769 usr.sbin/btxld usr.sbin/pwd_mkdb usr.sbin/zic usr.sbin/makewhatis \
770 gnu/usr.bin/texinfo gnu/usr.bin/grep gnu/usr.bin/sort \
771 usr.bin/gzip usr.bin/bzip2 usr.bin/mkcsmapper usr.bin/mkesdb
772 ${ECHODIR} "===> ${_tool} (bootstrap-tools)"; \
773 cd ${.CURDIR}/${_tool}; \
774 ${MAKE} DIRPRFX=${_tool}/ obj; \
775 ${MAKE} DIRPRFX=${_tool}/ depend; \
776 ${MAKE} DIRPRFX=${_tool}/ all; \
777 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${BTOOLSDEST} install
779 touch ${BTOOLSDEST}/.bootstrap_done
781 # build-tools: Build special purpose build tools.
783 # XXX we may be able to remove or consolidate this into bootstrap-tools
784 # now that we have the native helper (.nx/.no) infrastructure.
786 .if exists(${.CURDIR}/games) && !defined(NO_GAMES)
787 _games= games/adventure games/hack games/phantasia
790 .if exists(${.CURDIR}/share) && !defined(NO_SHARE)
791 _share= share/syscons/scrnmaps
794 _gcc34_cross= gnu/usr.bin/cc34
795 _gcc34_tools= gnu/usr.bin/cc34/cc_prep gnu/usr.bin/cc34/cc_tools
796 .if defined(WANT_GCC40)
797 _gcc40_cross= gnu/usr.bin/cc40
798 _gcc40_tools= gnu/usr.bin/cc40/cc_prep gnu/usr.bin/cc40/cc_tools
800 _binutils= gnu/usr.bin/binutils215
802 .if !defined(NO_FORTRAN)
803 _fortran= gnu/usr.bin/cc34/f771
806 .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
807 !defined(NO_CRYPT) && defined(WANT_KERBEROS)
808 _libkrb5= kerberos5/tools kerberos5/lib/libroken kerberos5/lib/libvers \
809 kerberos5/lib/libasn1 kerberos5/lib/libhdb kerberos5/lib/libsl
813 .for _tool in ${_gcc34_tools} ${_gcc40_tools} ${_fortran} ${_libkrb5} ${_share}
814 ${ECHODIR} "===> ${_tool} (build-tools)"; \
815 cd ${.CURDIR}/${_tool}; \
816 ${MAKE} DIRPRFX=${_tool}/ obj; \
817 ${MAKE} DIRPRFX=${_tool}/ depend; \
818 ${MAKE} DIRPRFX=${_tool}/ all; \
819 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${BTOOLSDEST} install
821 touch ${BTOOLSDEST}/.build_done
824 # cross-tools: Build cross-building tools
826 .if ${TARGET_ARCH} == "i386" && ${MACHINE_ARCH} != "i386"
827 _btxld= usr.sbin/btxld
831 .for _tool in ${_btxld} ${_binutils} \
832 usr.bin/objformat usr.sbin/crunch/crunchide \
833 ${_gcc34_cross} ${_gcc40_cross}
834 ${ECHODIR} "===> ${_tool} (cross-tools)"; \
835 cd ${.CURDIR}/${_tool}; \
836 ${MAKE} DIRPRFX=${_tool}/ obj; \
837 ${MAKE} DIRPRFX=${_tool}/ depend; \
838 ${MAKE} DIRPRFX=${_tool}/ all; \
839 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${CTOOLSDEST} install
841 touch ${CTOOLSDEST}/.cross_done
844 # hierarchy - ensure that all the needed directories are present
847 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs
850 # libraries - build all libraries, and install them under ${DESTDIR}.
852 # The list of libraries with dependents (${_prebuild_libs}) and their
853 # interdependencies (__L) are built automatically by the
854 # ${.CURDIR}/tools/make_libdeps.sh script.
856 # .makeenv does not work when bootstrapping from 4.x, so we must be sure
857 # to specify the correct CCVER or 'cc' will not exec the correct compiler.
861 HOST_CCVER=${HOST_CCVER} CCVER=gcc34 \
862 ${MAKE} -f Makefile.inc1 _startup_libs34;
863 .if defined(WANT_GCC40)
865 HOST_CCVER=${HOST_CCVER} CCVER=gcc40 \
866 ${MAKE} -f Makefile.inc1 _startup_libs40;
869 ${MAKE} -f Makefile.inc1 _startup_libs; \
870 ${MAKE} -f Makefile.inc1 _prebuild_libs; \
871 ${MAKE} -f Makefile.inc1 _generic_libs;
872 touch ${WORLDDEST}/.libraries_done
874 # These dependencies are not automatically generated:
876 # gnu/lib/${CCVER}/libgcc and lib/csu must be built before all
877 # shared libraries for ELF. The target for _startup_libs34 is
878 # specifically built using gcc34. Same goes for _startup_libs40.
880 _startup_libs34= gnu/lib/gcc34/libgcc
881 _startup_libs40= gnu/lib/gcc40/libgcc
882 _startup_libs= lib/csu/${MACHINE_ARCH}
883 _startup_libs+= lib/csu/common lib/libc lib/libc_rtld
885 _prebuild_libs= lib/libarchive
886 _prebuild_libs+= lib/libutil
888 _generic_libs= gnu/lib
890 .if !defined(NO_CRYPT) && defined(WANT_KERBEROS)
891 _prebuild_libs+= kerberos5/tools
892 _prebuild_libs+= kerberos5/lib/libasn1
893 _prebuild_libs+= kerberos5/lib/libgssapi
894 _prebuild_libs+= kerberos5/lib/libkrb5
895 _prebuild_libs+= kerberos5/lib/libroken
896 _generic_libs+= kerberos5/lib
899 _prebuild_libs+= lib/libcom_err lib/libcrypt lib/libmd \
900 lib/libncurses/libncurses lib/libopie lib/libradius \
901 lib/libskey lib/libtacplus lib/libz lib/libm lib/libpam
903 lib/libopie__L lib/libradius__L lib/libtacplus__L: lib/libmd__L
904 lib/libskey__L: lib/libcrypt__L lib/libmd__L
908 .if !defined(NO_CRYPT)
909 .if !defined(NO_OPENSSL)
910 _prebuild_libs+= secure/lib/libcrypto secure/lib/libssl
911 .if !defined(NO_OPENSSH)
912 _prebuild_libs+= secure/lib/libssh
913 secure/lib/libssh__L: secure/lib/libcrypto__L lib/libz__L
916 _generic_libs+= secure/lib
919 _generic_libs+= usr.bin/lex/lib
921 .for _lib in ${_startup_libs34} ${_startup_libs40} \
922 ${_startup_libs} ${_prebuild_libs} ${_generic_libs}
924 .if exists(${.CURDIR}/${_lib})
925 ${ECHODIR} "===> ${_lib}"; \
926 cd ${.CURDIR}/${_lib}; \
927 ${MAKE} DIRPRFX=${_lib}/ depend; \
928 ${MAKE} DIRPRFX=${_lib}/ all; \
929 ${MAKE} DIRPRFX=${_lib}/ install
933 _startup_libs: ${_startup_libs:S/$/__L/}
934 _startup_libs34: ${_startup_libs34:S/$/__L/}
935 _startup_libs40: ${_startup_libs40:S/$/__L/}
936 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
937 _generic_libs: ${_generic_libs:S/$/__L/}
939 # library targets must be ordered because there are inter-library
940 # races (e.g. generation of tconfig.h)
942 .ORDER: ${_startup_libs34:S/$/__L/}
943 .ORDER: ${_startup_libs40:S/$/__L/}
944 .ORDER: ${_startup_libs:S/$/__L/}
945 .ORDER: ${_prebuild_libs:S/$/__L/}
946 .ORDER: ${_generic_libs:S/$/__L/}
948 .for __target in clean cleandepend cleandir obj depend includes
949 .for entry in ${SUBDIR}
950 ${entry}.${__target}__D: .PHONY
951 @if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
952 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
953 edir=${entry}.${MACHINE_ARCH}; \
954 cd ${.CURDIR}/$${edir}; \
956 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \
958 cd ${.CURDIR}/$${edir}; \
960 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
962 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
963 .ORDER: ${SUBDIR:S/$/.${__target}__D/}
965 .ORDER: par-clean par-cleandepend par-cleandir par-obj par-depend par-includes
967 # The wmake target is used by /usr/bin/wmake to run make in a
968 # world build environment.
971 @echo '${WMAKEENV} ${MAKE} -m ${.CURDIR}/share/mk ${WMAKE_ARGS}'
974 @echo '${WMAKEENV} /bin/sh'
977 @echo '${BMAKEENV} ${MAKE} -m ${.CURDIR}/share/mk ${BMAKE_ARGS}'
980 @echo '${BMAKEENV} /bin/sh'
983 @echo '${TMAKEENV} ${MAKE} -m ${.CURDIR}/share/mk ${TMAKE_ARGS}'
986 @echo '${TMAKEENV} /bin/sh'
988 .include <bsd.subdir.mk>