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.76 2005/08/02 13:07:50 joerg Exp $
5 # Make command line options:
6 # -DMAKE_KERBEROS5 to build Kerberos5
7 # -DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
8 # -DNOCLEAN do not clean at all
9 # -DNOCRYPT will prevent building of crypt versions
10 # -DNOMAN do not build the manual pages
11 # -DNOPROFILE do not build profiled libraries
12 # -DNOGAMES do not go into games subdir
13 # -DNOSHARE do not go into share subdir
14 # -DNOINFO do not make or install info files
15 # -DNOLIBC_R do not build libc_r.
16 # -DNO_FORTRAN do not build g77 and related libraries.
17 # -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel
18 # -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel
19 # -DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel
20 # -DNO_PORTSUPDATE do not update ports in ${MAKE} update
21 # -DNO_DOCUPDATE do not update doc in ${MAKE} update
22 # LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
23 # TARGET_ARCH="arch" to crossbuild world to a different arch
25 # The intended user-driven targets are:
27 # buildworld - rebuild *everything*, including glue to help do upgrades
28 # quickworld - skip the glue and do a depend+build on the meat
29 # realquickworld - skip the glue and depend stages and just build the meat
30 # crossworld - only build the glue (particularly the cross-build environment)
31 # installworld- install everything built by "buildworld"
32 # update - convenient way to update your source tree (eg: sup/cvs)
33 # most - build user commands, no libraries or include files
34 # installmost - install user commands, no libraries or include files
36 # Standard targets (not defined here) are documented in the makefiles in
37 # /usr/share/mk. These include:
38 # obj depend all install clean cleandepend cleanobj
40 # Put initial settings here.
43 # We must do share/info early so that installation of info `dir'
44 # entries works correctly. Do it first since it is less likely to
45 # grow dependencies on include and lib than vice versa.
46 .if exists(${.CURDIR}/share/info)
50 # We must do include and lib early so that the perl *.ph generation
51 # works correctly as it uses the header files installed by this.
52 .if exists(${.CURDIR}/include)
55 .if exists(${.CURDIR}/lib)
58 # This exists simply to ensure that the obj dir hierarchy is
59 # intact for nrelease, allowing the nrelease Makefile's to
60 # reference ${.OBJDIR}.
62 .if exists(${.CURDIR}/nrelease)
66 .if exists(${.CURDIR}/bin)
69 .if exists(${.CURDIR}/games) && !defined(NOGAMES)
72 .if exists(${.CURDIR}/gnu)
75 .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
76 !defined(NOCRYPT) && !defined(NO_OPENSSL) && defined(MAKE_KERBEROS5)
79 .if exists(${.CURDIR}/libexec)
82 .if exists(${.CURDIR}/sbin)
85 .if exists(${.CURDIR}/secure) && !defined(NOCRYPT)
88 .if exists(${.CURDIR}/share) && !defined(NOSHARE)
91 .if exists(${.CURDIR}/sys)
94 .if exists(${.CURDIR}/usr.bin)
97 .if exists(${.CURDIR}/usr.sbin)
101 # etc must be last for "distribute" to work
102 .if exists(${.CURDIR}/etc)
106 # These are last, since it is nice to at least get the base system
107 # rebuilt before you do them.
108 .if defined(LOCAL_DIRS)
109 .for _DIR in ${LOCAL_DIRS}
110 .if exists(${.CURDIR}/${_DIR}) & exists(${.CURDIR}/${_DIR}/Makefile)
116 .if defined(SUBDIR_OVERRIDE)
117 SUBDIR= ${SUBDIR_OVERRIDE}
120 .if defined(NOCLEANDIR)
121 CLEANDIR= clean cleandepend
126 SUP?= /usr/local/bin/cvsup
127 SUPFLAGS?= -g -L 2 -P -
129 SUPFLAGS+= -h ${SUPHOST}
132 # Object directory base in primary make. Note that when we rerun make
133 # from inside this file we change MAKEOBJDIRPREFIX to the appropriate
134 # subdirectory because the rest of the build system needs it that way.
135 # The original object directory base is saved in OBJTREE.
137 MAKEOBJDIRPREFIX?= /usr/obj
138 OBJTREE?= ${MAKEOBJDIRPREFIX}
140 # Used for stage installs and pathing
142 DESTDIRBASE?= ${OBJTREE}${.CURDIR}
144 TARGET_ARCH?= ${MACHINE_ARCH}
145 .if ${TARGET_ARCH} == ${MACHINE_ARCH}
148 TARGET?= ${TARGET_ARCH}
151 BUILD_ARCH!= sysctl -n hw.machine_arch
152 .if ${MACHINE_ARCH} != ${BUILD_ARCH}
153 .error To cross-build, set TARGET_ARCH.
157 # BTOOLS (Natively built) All non-cross-development tools that the
158 # main build needs. This includes things like 'mkdir' and 'rm'.
159 # We will not use the native system's exec path once we start
160 # on WORLD. (bootstrap-tools and build-tools or BTOOLS)
162 # CTOOLS (Natively built) Cross development tools which are specific
163 # to the target architecture.
165 # WORLD (Cross built) Our ultimate buildworld, using only BTOOLS and
168 # MACHINE_ARCH Architecture we are building on
169 # TARGET_ARCH Architecture we are building for
171 BTOOLSDEST= ${DESTDIRBASE}/btools_${MACHINE_ARCH}
172 CTOOLSDEST= ${DESTDIRBASE}/ctools_${MACHINE_ARCH}_${TARGET_ARCH}
173 WORLDDEST= ${DESTDIRBASE}/world_${TARGET_ARCH}
175 # The bootstrap-tools path is used by the bootstrap-tools, build-tools, and
176 # cross-tools stages to augment the existing command path to access newer
177 # versions of certain utilities such as 'patch' that the cross-tools stage
180 BTOOLSPATH= ${BTOOLSDEST}/usr/sbin:${BTOOLSDEST}/usr/bin:${BTOOLSDEST}/bin:${BTOOLSDEST}/usr/games
182 # The strict temporary command path contains all binaries required
183 # by the buildworld system after the cross-tools stage.
185 STRICTTMPPATH= ${CTOOLSDEST}/usr/sbin:${CTOOLSDEST}/usr/bin:${CTOOLSDEST}/bin:${CTOOLSDEST}/usr/games:${BTOOLSDEST}/usr/sbin:${BTOOLSDEST}/usr/bin:${BTOOLSDEST}/bin:${BTOOLSDEST}/usr/games
191 # Building a world goes through the following stages
193 # 1. bootstrap-tool stage [BMAKE]
194 # This stage is responsible for creating programs that
195 # are needed for backward compatibility reasons. They
196 # are not built as cross-tools.
197 # 2. build-tool stage [TMAKE]
198 # This stage is responsible for creating the object
199 # tree and building any tools that are needed during
201 # 3. cross-tool stage [XMAKE]
202 # This stage is responsible for creating any tools that
203 # are needed for cross-builds. A cross-compiler is one
205 # 4. world stage [WMAKE]
206 # This stage actually builds the world.
207 # 5. install stage (optional) [IMAKE]
208 # This stage installs a previously built world.
211 # bootstrap-tool stage
213 BMAKEENV= MAKEOBJDIRPREFIX=${BTOOLSDEST} \
215 DESTDIR=${BTOOLSDEST} \
216 PATH=${BTOOLSPATH}:${PATH} \
217 INSTALL="sh ${.CURDIR}/tools/install.sh"
219 BMAKE= ${BMAKEENV} ${MAKE} -f Makefile.inc1 -DBOOTSTRAPPING \
220 -DNOHTML -DNOINFO -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED \
225 TMAKEENV= MAKEOBJDIRPREFIX=${BTOOLSDEST} \
228 PATH=${BTOOLSPATH}:${PATH} \
229 INSTALL="sh ${.CURDIR}/tools/install.sh"
231 TMAKE= ${TMAKEENV} ${MAKE} -f Makefile.inc1 -DBOOTSTRAPPING \
236 # note: TOOLS_PREFIX points to the obj root holding the cross
237 # compiler binaries, while USRDATA_PREFIX points to the obj root
238 # holding the target environment (and also determines where cross-built
239 # libraries, crt*.o, and include files are installed).
241 XMAKEENV= MAKEOBJDIRPREFIX=${CTOOLSDEST} \
243 DESTDIR=${CTOOLSDEST} \
244 INSTALL="sh ${.CURDIR}/tools/install.sh" \
245 TOOLS_PREFIX=${CTOOLSDEST} \
246 USRDATA_PREFIX=${WORLDDEST} \
247 PATH=${BTOOLSPATH}:${PATH}
249 XMAKE= ${XMAKEENV} ${MAKE} -f Makefile.inc1 -DNO_FORTRAN -DNO_GDB \
252 # world stage, note the strict path and note that TOOLS_PREFIX is left
253 # unset and USRDATA_PREFIX (which defaults to TOOLS_PREFIX) is set to empty,
254 # which is primarily for the compiler so it targets / (e.g. /usr/<blah>)
255 # for both binary and library paths, even though it is being compiled to
256 # WORLDDEST. None of the programs in the world stage are ever actually
257 # executed during the buildworld/installworld.
259 CROSSENV= MAKEOBJDIRPREFIX=${WORLDDEST} \
261 MACHINE_ARCH=${TARGET_ARCH} \
263 OBJFORMAT_PATH=${CTOOLSDEST}
265 WMAKEENV= ${CROSSENV} \
266 DESTDIR=${WORLDDEST} \
267 INSTALL="sh ${.CURDIR}/tools/install.sh" \
268 PATH=${STRICTTMPPATH}
270 WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1
274 IMAKEENV= ${CROSSENV} \
275 PATH=${STRICTTMPPATH}
276 IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1
280 KMAKEENV= ${WMAKEENV}
284 # Attempt to rebuild the entire system, with reasonable chance of
285 # success, regardless of how old your existing system is.
289 @echo "--------------------------------------------------------------"
290 @echo ">>> Rebuilding the temporary build tree"
291 @echo "--------------------------------------------------------------"
292 .if !defined(NOCLEAN)
293 rm -rf ${BTOOLSDEST} ${CTOOLSDEST} ${WORLDDEST}
295 # XXX - These two can depend on any header file.
296 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
297 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
299 mkdir -p ${DESTDIRBASE} ${BTOOLSDEST} ${CTOOLSDEST} ${WORLDDEST}
300 .for _dir in ${WORLDDEST} ${BTOOLSDEST} ${CTOOLSDEST}
301 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
302 -p ${_dir}/ > /dev/null
303 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
304 -p ${_dir}/usr > /dev/null
306 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
307 -p ${WORLDDEST}/usr/include > /dev/null
308 ${LN} -sf ${.CURDIR}/sys ${WORLDDEST}
312 @echo "--------------------------------------------------------------"
313 @echo ">>> stage 1: bootstrap tools"
314 @echo "--------------------------------------------------------------"
315 cd ${.CURDIR}; ${BMAKE} bootstrap-tools
318 @echo "--------------------------------------------------------------"
319 @echo ">>> stage 2a: cleaning up the object tree"
320 @echo "--------------------------------------------------------------"
321 cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
324 @echo "--------------------------------------------------------------"
325 @echo ">>> stage 2b: rebuilding the object tree"
326 @echo "--------------------------------------------------------------"
327 cd ${.CURDIR}; ${WMAKE} par-obj
330 @echo "--------------------------------------------------------------"
331 @echo ">>> stage 2c: build tools"
332 @echo "--------------------------------------------------------------"
333 cd ${.CURDIR}; ${TMAKE} build-tools
336 @echo "--------------------------------------------------------------"
337 @echo ">>> stage 3: cross tools"
338 @echo "--------------------------------------------------------------"
339 cd ${.CURDIR}; ${XMAKE} cross-tools
342 @echo "--------------------------------------------------------------"
343 @echo ">>> stage 4a: populating ${WORLDDEST}/usr/include"
344 @echo "--------------------------------------------------------------"
345 cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
348 @echo "--------------------------------------------------------------"
349 @echo ">>> stage 4b: building libraries"
350 @echo "--------------------------------------------------------------"
351 cd ${.CURDIR}; ${WMAKE} -DNOHTML -DNOINFO -DNOMAN -DNOFSCHG libraries
354 @echo "--------------------------------------------------------------"
355 @echo ">>> stage 4c: make dependencies"
356 @echo "--------------------------------------------------------------"
357 cd ${.CURDIR}; ${WMAKE} par-depend
360 @echo "--------------------------------------------------------------"
361 @echo ">>> stage 4d: building everything.."
362 @echo "--------------------------------------------------------------"
363 cd ${.CURDIR}; ${WMAKE} all
365 # note: buildworld no longer depends on _cleanobj because we rm -rf the
366 # entire object tree and built the bootstrap tools in a different location.
368 # buildworld - build everything from scratch
369 # quickworld - skip the bootstrap, build, and cross-build steps
370 # realquickworld - skip the bootstrap, build, crossbuild, and depend step.
372 # note: we include _obj in realquickworld to prevent accidental creation
373 # of files in /usr/src.
376 .if !defined(SUBDIR_OVERRIDE)
377 WMAKE_TGTS+= _worldtmp _bootstrap-tools
379 WMAKE_TGTS+= _obj _build-tools
380 .if !defined(SUBDIR_OVERRIDE)
381 WMAKE_TGTS+= _cross-tools
383 WMAKE_TGTS+= _includes _libraries _depend everything
385 buildworld: ${WMAKE_TGTS}
387 quickworld: _obj _includes _libraries _depend everything
389 realquickworld: _obj _includes _libraries everything
391 crossworld: _worldtmp _bootstrap-tools _obj _build-tools _cross-tools
393 .ORDER: ${WMAKE_TGTS}
398 # Checks to be sure system is ready for installworld
401 .if !defined(NO_SENDMAIL)
402 @pw usershow smmsp || (echo "You may need to run 'make preupgrade' first"; exit 1)
403 @pw groupshow smmsp || (echo "You may need to run 'make preupgrade' first"; exit 1)
405 @pw usershow _pflogd || (echo "You may need to run 'make preupgrade' first"; exit 1)
406 @pw usershow _ntp || (echo "You may need to run 'make preupgrade' first"; exit 1)
407 @pw groupshow authpf || (echo "You may need to run 'make preupgrade' first"; exit 1)
408 @pw groupshow _pflogd || (echo "You may need to run 'make preupgrade' first"; exit 1)
409 @pw groupshow _ntp || (echo "You may need to run 'make preupgrade' first"; exit 1)
410 .if !defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/"
411 @case `uname -r` in 1.2*|1.3-*|1.3.0-*|1.3.1-*|1.3.2-*|1.3.3-*) echo "You must upgrade your kernel to at least 1.3.4 and reboot before you can safely installworld, due to stat(2) ABI changes" ; exit 1;; esac
416 # Distributes everything compiled by a `buildworld'.
420 # Installs everything compiled by a 'buildworld'.
422 distributeworld installworld: installcheck
423 cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}
428 # If you have a build server, you can NFS mount the source and obj directories
429 # and do a 'make reinstall' on the *client* to install new binaries from the
430 # most recent server build.
433 @echo "--------------------------------------------------------------"
434 @echo ">>> Making hierarchy"
435 @echo "--------------------------------------------------------------"
436 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
438 @echo "--------------------------------------------------------------"
439 @echo ">>> Installing everything.."
440 @echo "--------------------------------------------------------------"
441 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
442 .if !defined(NOMAN) && !defined(NO_MAKEDB_RUN)
444 @echo "--------------------------------------------------------------"
445 @echo ">>> Rebuilding man page indices"
446 @echo "--------------------------------------------------------------"
447 cd ${.CURDIR}/share/man; ${MAKE} makedb
451 @echo "--------------------------------------------------------------"
452 @echo ">>> Distributing everything.."
453 @echo "--------------------------------------------------------------"
454 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
457 # buildkernel, nativekernel, quickkernel, and installkernel
459 # Which kernels to build and/or install is specified by setting
460 # KERNCONF. If not defined a GENERIC kernel is built/installed.
461 # Only the existing (depending TARGET) config files are used
462 # for building kernels and only the first of these is designated
463 # as the one being installed.
465 # You can specify INSTALLSTRIPPED=1 if you wish the installed
466 # kernel and modules to be stripped of its debug info (required
467 # symbols are left intact). You can specify INSTALLSTRIPPEDMODULES
468 # if you only want to strip the modules of their debug info. These
469 # only apply if you have DEBUG=-g in your kernel config or make line.
471 # Note that we have to use TARGET instead of TARGET_ARCH when
472 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
473 # be set to cross-build, we have to make sure TARGET is set
476 .if !defined(KERNCONF) && defined(KERNEL)
482 INSTKERNNAME?= kernel
484 KRNLSRCDIR= ${.CURDIR}/sys
485 KRNLCONFDIR= ${KRNLSRCDIR}/${TARGET}/conf
486 KRNLOBJDIR= ${OBJTREE}${KRNLSRCDIR}
487 KERNCONFDIR?= ${KRNLCONFDIR}
491 .for _kernel in ${KERNCONF}
492 .if exists(${KERNCONFDIR}/${_kernel})
493 BUILDKERNELS+= ${_kernel}
494 .if empty(INSTALLKERNEL)
495 INSTALLKERNEL= ${_kernel}
500 # kernel version numbers survive rm -rf
502 .for _kernel in ${BUILDKERNELS}
503 .if exists(${KRNLOBJDIR}/${_kernel}/version)
504 KERNEL_VERSION_${_kernel} != cat ${KRNLOBJDIR}/${_kernel}/version
511 # Builds all kernels defined by BUILDKERNELS.
514 @if [ ! -f ${WORLDDEST}/.libraries_done ]; then \
515 echo "You must buildworld before buildkernel. If you wish"; \
516 echo "to build a kernel using native tools, config it manually"; \
517 echo "or use the nativekernel target if you are in a rush"; \
522 .for _kernel in ${BUILDKERNELS}
523 @if [ ! -f ${KRNLOBJDIR}/${_kernel}/.nativekernel_run ]; then \
524 if [ ! -f ${WORLDDEST}/.libraries_done ]; then \
525 echo "The kernel was build using buildworld tools which no" ; \
526 echo "longer appear to exist, quickkernel failed!" ; \
533 .if empty(BUILDKERNELS)
534 @echo ">>> ERROR: Missing kernel configuration file(s) (${KERNCONF})."
539 .if defined(KERNWARN)
540 @echo "--------------------------------------------------------------"
541 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
542 @echo "--------------------------------------------------------------"
547 # The buildkernel target rebuilds the specified kernels from scratch
548 # using the crossbuild tools generated by the last buildworld. It is
549 # the safest (but also the most time consuming) way to build a new kernel.
551 buildkernel: bk_tools bk_build_list bk_kernwarn
552 .for _kernel in ${BUILDKERNELS}
553 @echo "--------------------------------------------------------------"
554 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
555 @echo "--------------------------------------------------------------"
556 @echo "===> ${_kernel}"
557 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
558 rm -rf ${KRNLOBJDIR}/${_kernel}
560 @if [ -f ${KRNLOBJDIR}/${_kernel}/.nativekernel_run ]; then \
561 echo "YOU ARE REBUILDING WITH BUILDKERNEL, REMOVING OLD NATIVEKERNEL BUILD"; \
562 rm -rf ${KRNLOBJDIR}/${_kernel}; fi
564 mkdir -p ${KRNLOBJDIR}
565 .if !defined(NO_KERNELCONFIG)
567 PATH=${STRICTTMPPATH} \
568 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
569 ${KERNCONFDIR}/${_kernel}
571 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN) && defined(KERNEL_VERSION_${_kernel})
572 echo ${KERNEL_VERSION_${_kernel}} > ${KRNLOBJDIR}/${_kernel}/version
574 touch ${KRNLOBJDIR}/${_kernel}/.buildkernel_run
575 cd ${KRNLOBJDIR}/${_kernel}; \
576 MAKESRCPATH=${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm \
577 ${MAKE} -DBOOTSTRAPPING -f ${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm/Makefile
578 .if !defined(NO_KERNELDEPEND)
579 cd ${KRNLOBJDIR}/${_kernel}; \
580 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend
582 cd ${KRNLOBJDIR}/${_kernel}; \
583 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all
584 @echo "--------------------------------------------------------------"
585 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
586 @echo "--------------------------------------------------------------"
589 # The nativekernel target rebuilds the specified kernels from scratch
590 # using the systems standard compiler rather then using the crossbuild
591 # tools generated by the last buildworld. This is fairly safe if your
592 # system is reasonable up-to-date.
594 nativekernel: bk_build_list bk_kernwarn
595 .for _kernel in ${BUILDKERNELS}
596 @echo "--------------------------------------------------------------"
597 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
598 @echo "--------------------------------------------------------------"
599 @echo "===> ${_kernel}"
600 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
601 rm -rf ${KRNLOBJDIR}/${_kernel}
603 @if [ -f ${KRNLOBJDIR}/${_kernel}/.buildkernel_run ]; then \
604 echo "YOU ARE REBUILDING WITH NATIVEKERNEL, REMOVING OLD BUILDKERNEL BUILD"; \
605 rm -rf ${KRNLOBJDIR}/${_kernel}; fi
607 mkdir -p ${KRNLOBJDIR}
608 .if !defined(NO_KERNELCONFIG)
610 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
611 ${KERNCONFDIR}/${_kernel}
613 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN) && defined(KERNEL_VERSION_${_kernel})
614 echo ${KERNEL_VERSION_${_kernel}} > ${KRNLOBJDIR}/${_kernel}/version
616 touch ${KRNLOBJDIR}/${_kernel}/.nativekernel_run
617 cd ${KRNLOBJDIR}/${_kernel}; \
618 MAKESRCPATH=${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm \
619 ${MAKE} -DBOOTSTRAPPING -f ${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm/Makefile
620 .if !defined(NO_KERNELDEPEND)
621 cd ${KRNLOBJDIR}/${_kernel}; \
622 ${MAKE} KERNEL=${INSTKERNNAME} depend
624 cd ${KRNLOBJDIR}/${_kernel}; \
625 ${MAKE} KERNEL=${INSTKERNNAME} all
626 @echo "--------------------------------------------------------------"
627 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
628 @echo "--------------------------------------------------------------"
631 # The quickkernel target rebuilds the specified kernels as quickly
632 # as possible. It will use the native tools or the buildworld cross tools
633 # based on whether the kernel was originally generated via buildkernel or
634 # nativekernel. Config is rerun but the object hierarchy is not rebuilt,
635 # nor is the make depend step run.
637 quickkernel: maybe_bk_tools bk_build_list bk_kernwarn
638 .for _kernel in ${BUILDKERNELS}
639 @echo "--------------------------------------------------------------"
640 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
641 @echo "--------------------------------------------------------------"
642 @echo "===> ${_kernel}"
643 .if exists(${KRNLOBJDIR}/${_kernel}/.buildkernel_run)
644 .if !defined(NO_KERNELCONFIG)
646 PATH=${STRICTTMPPATH} \
647 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
648 ${KERNCONFDIR}/${_kernel}
650 cd ${KRNLOBJDIR}/${_kernel}; \
651 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all
653 .if !defined(NO_KERNELCONFIG)
655 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
656 ${KERNCONFDIR}/${_kernel}
658 cd ${KRNLOBJDIR}/${_kernel}; \
659 ${MAKE} KERNEL=${INSTKERNNAME} all
661 @echo "--------------------------------------------------------------"
662 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
663 @echo "--------------------------------------------------------------"
669 # Install the kernel defined by INSTALLKERNEL
671 installkernel reinstallkernel:
672 .if exists(${KRNLOBJDIR}/${_kernel}/.buildkernel_run)
673 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
674 ${CROSSENV} ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//}
676 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
677 ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//}
683 # Update the source tree, by running sup and/or running cvs to update to the
687 .if defined(SUP_UPDATE)
688 @echo "--------------------------------------------------------------"
689 @echo ">>> Running ${SUP}"
690 @echo "--------------------------------------------------------------"
692 @${SUP} ${SUPFLAGS} ${SUPFILE}
694 .if defined(SUPFILE1)
695 @${SUP} ${SUPFLAGS} ${SUPFILE1}
697 .if defined(SUPFILE2)
698 @${SUP} ${SUPFLAGS} ${SUPFILE2}
700 .if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
701 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
703 .if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
704 @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
707 .if defined(CVS_UPDATE)
708 @echo "--------------------------------------------------------------"
709 @echo ">>> Updating ${.CURDIR} from cvs repository `cat ${.CURDIR}/CVS/Root`"
710 @echo "--------------------------------------------------------------"
712 cd ${.CURDIR}; cvs -q update -P -d
718 # Build most of the user binaries on the existing system libs and includes.
721 @echo "--------------------------------------------------------------"
722 @echo ">>> Building programs only"
723 @echo "--------------------------------------------------------------"
724 .for _dir in bin sbin libexec usr.bin usr.sbin gnu/libexec gnu/usr.bin gnu/usr.sbin
725 cd ${.CURDIR}/${_dir}; ${MAKE} DIRPRFX=${_dir}/ all
731 # Install the binaries built by the 'most' target. This does not include
732 # libraries or include files.
735 @echo "--------------------------------------------------------------"
736 @echo ">>> Installing programs only"
737 @echo "--------------------------------------------------------------"
738 .for _dir in bin sbin libexec usr.bin usr.sbin gnu/libexec gnu/usr.bin gnu/usr.sbin
739 cd ${.CURDIR}/${_dir}; ${MAKE} DIRPRFX=${_dir}/ install
743 # ------------------------------------------------------------------------
745 # From here onwards are utility targets used by the 'make world' and
746 # related targets. If your 'world' breaks, you may like to try to fix
747 # the problem and manually run the following targets to attempt to
748 # complete the build. Beware, this is *not* guaranteed to work, you
749 # need to have a pretty good grip on the current state of the system
750 # to attempt to manually finish it. If in doubt, 'make world' again.
753 # bootstrap-tools: Build all tools required to build all tools. Note that
754 # order is important in a number of cases and also note that the bootstrap
755 # and build tools stages have access to earlier binaries they themselves
758 # patch: older patch's do not have -i. This program must be built
759 # first so other bootstrap tools that need to apply patches
761 # [x]install: dependancies on various new install features
762 # rpcgen: old rpcgen used a hardwired cpp path, newer OBJFORMAT_PATH
763 # envs are not compatible with older objformat binaries.
765 .if exists(${.CURDIR}/games) && !defined(NOGAMES)
766 _strfile= games/fortune/strfile
770 ${LN} -fs /bin/date ${BTOOLSDEST}/bin/date
771 .for _tool in ${_strfile} \
773 bin/chmod bin/cp bin/dd bin/mkdir bin/rm bin/echo bin/test \
774 bin/cat bin/ln bin/mv bin/csh bin/expr bin/sh bin/ls \
775 bin/hostname bin/kill \
776 usr.bin/yacc usr.bin/colldef usr.bin/uudecode usr.bin/xinstall \
777 usr.bin/m4 usr.bin/rpcgen usr.bin/make usr.bin/awk \
778 usr.bin/find usr.bin/lex usr.bin/sed usr.bin/uname usr.bin/touch \
779 usr.bin/mkdep usr.bin/mktemp usr.bin/lorder usr.bin/file2c \
780 usr.bin/tsort usr.bin/tr usr.bin/join usr.bin/wc usr.bin/basename \
781 usr.bin/gencat usr.bin/chflags usr.bin/expand usr.bin/paste \
782 usr.bin/mklocale usr.bin/uuencode usr.bin/compile_et usr.bin/hexdump \
783 usr.bin/vi usr.bin/cap_mkdb usr.bin/vgrind usr.bin/true usr.bin/false \
784 usr.bin/cmp usr.bin/xargs usr.bin/id usr.bin/env usr.bin/dirname \
786 usr.sbin/chown usr.sbin/mtree usr.sbin/config \
787 usr.sbin/btxld usr.sbin/pwd_mkdb usr.sbin/zic usr.sbin/makewhatis \
788 gnu/usr.bin/texinfo gnu/usr.bin/grep gnu/usr.bin/sort \
789 usr.bin/gzip usr.bin/bzip2 usr.bin/mkcsmapper usr.bin/mkesdb
790 ${ECHODIR} "===> ${_tool} (bootstrap-tools)"; \
791 cd ${.CURDIR}/${_tool}; \
792 ${MAKE} DIRPRFX=${_tool}/ obj; \
793 ${MAKE} DIRPRFX=${_tool}/ depend; \
794 ${MAKE} DIRPRFX=${_tool}/ all; \
795 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${BTOOLSDEST} install
797 touch ${BTOOLSDEST}/.bootstrap_done
799 # build-tools: Build special purpose build tools.
801 # XXX we may be able to remove or consolidate this into bootstrap-tools
802 # now that we have the native helper (.nx/.no) infrastructure.
804 .if exists(${.CURDIR}/games) && !defined(NOGAMES)
805 _games= games/adventure games/hack games/phantasia
808 .if exists(${.CURDIR}/share) && !defined(NOSHARE)
809 _share= share/syscons/scrnmaps
812 _gcc34_cross= gnu/usr.bin/cc34
813 _gcc34_tools= gnu/usr.bin/cc34/cc_prep gnu/usr.bin/cc34/cc_tools
814 _binutils= gnu/usr.bin/binutils215
816 .if !defined(NO_FORTRAN)
817 _fortran= gnu/usr.bin/cc34/f771
820 .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
821 !defined(NOCRYPT) && defined(MAKE_KERBEROS5)
822 _libkrb5= kerberos5/tools kerberos5/lib/libroken kerberos5/lib/libvers \
823 kerberos5/lib/libasn1 kerberos5/lib/libhdb kerberos5/lib/libsl
826 .if defined(RELEASEDIR)
827 _sysinstall= release/sysinstall
831 .for _tool in ${_gcc34_tools} ${_fortran} ${_libkrb5} ${_share} ${_sysinstall}
832 ${ECHODIR} "===> ${_tool} (build-tools)"; \
833 cd ${.CURDIR}/${_tool}; \
834 ${MAKE} DIRPRFX=${_tool}/ obj; \
835 ${MAKE} DIRPRFX=${_tool}/ depend; \
836 ${MAKE} DIRPRFX=${_tool}/ all; \
837 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${BTOOLSDEST} install
839 touch ${BTOOLSDEST}/.build_done
842 # cross-tools: Build cross-building tools
844 .if ${TARGET_ARCH} == "i386" && ${MACHINE_ARCH} != "i386"
845 _btxld= usr.sbin/btxld
849 .for _tool in ${_btxld} ${_binutils} \
850 usr.bin/objformat usr.sbin/crunch/crunchide \
852 ${ECHODIR} "===> ${_tool} (cross-tools)"; \
853 cd ${.CURDIR}/${_tool}; \
854 ${MAKE} DIRPRFX=${_tool}/ obj; \
855 ${MAKE} DIRPRFX=${_tool}/ depend; \
856 ${MAKE} DIRPRFX=${_tool}/ all; \
857 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${CTOOLSDEST} install
859 touch ${CTOOLSDEST}/.cross_done
862 # hierarchy - ensure that all the needed directories are present
865 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs
868 # libraries - build all libraries, and install them under ${DESTDIR}.
870 # The list of libraries with dependents (${_prebuild_libs}) and their
871 # interdependencies (__L) are built automatically by the
872 # ${.CURDIR}/tools/make_libdeps.sh script.
874 # .makeenv does not work when bootstrapping from 4.x, so we must be sure
875 # to specify the correct CCVER or 'cc' will not exec the correct compiler.
879 HOST_CCVER=${HOST_CCVER} CCVER=gcc34 \
880 ${MAKE} -f Makefile.inc1 _startup_libs34; \
881 ${MAKE} -f Makefile.inc1 _startup_libs; \
882 ${MAKE} -f Makefile.inc1 _prebuild_libs; \
883 ${MAKE} -f Makefile.inc1 _generic_libs;
884 touch ${WORLDDEST}/.libraries_done
886 # These dependencies are not automatically generated:
888 # gnu/lib/${CCVER}/libgcc and lib/csu must be built before all
889 # shared libraries for ELF. The target for _startup_libs34 is
890 # specifically built using gcc34.
892 _startup_libs34= gnu/lib/gcc34/libgcc
893 _startup_libs= lib/csu/${MACHINE_ARCH}
894 _startup_libs+= lib/csu/common lib/libc lib/libc_rtld
896 _prebuild_libs= lib/libarchive
897 _prebuild_libs+= lib/libutil
899 _generic_libs= gnu/lib
901 .if !defined(NOCRYPT) && defined(MAKE_KERBEROS5)
902 _prebuild_libs+= kerberos5/tools
903 _prebuild_libs+= kerberos5/lib/libasn1
904 _prebuild_libs+= kerberos5/lib/libgssapi
905 _prebuild_libs+= kerberos5/lib/libkrb5
906 _prebuild_libs+= kerberos5/lib/libroken
907 _generic_libs+= kerberos5/lib
910 _prebuild_libs+= lib/libcom_err lib/libcrypt lib/libmd \
911 lib/libncurses/libncurses lib/libopie lib/libradius \
912 lib/libskey lib/libtacplus lib/libz lib/libm lib/libpam
914 lib/libopie__L lib/libradius__L lib/libtacplus__L: lib/libmd__L
915 lib/libskey__L: lib/libcrypt__L lib/libmd__L
919 .if !defined(NOCRYPT)
920 .if !defined(NO_OPENSSL)
921 _prebuild_libs+= secure/lib/libcrypto secure/lib/libssl
922 .if !defined(NO_OPENSSH)
923 _prebuild_libs+= secure/lib/libssh
924 secure/lib/libssh__L: secure/lib/libcrypto__L lib/libz__L
927 _generic_libs+= secure/lib
930 _generic_libs+= usr.bin/lex/lib
932 .for _lib in ${_startup_libs2} ${_startup_libs3} ${_startup_libs34} \
933 ${_startup_libs} ${_prebuild_libs} ${_generic_libs}
935 .if exists(${.CURDIR}/${_lib})
936 ${ECHODIR} "===> ${_lib}"; \
937 cd ${.CURDIR}/${_lib}; \
938 ${MAKE} DIRPRFX=${_lib}/ depend; \
939 ${MAKE} DIRPRFX=${_lib}/ all; \
940 ${MAKE} DIRPRFX=${_lib}/ install
944 _startup_libs: ${_startup_libs:S/$/__L/}
945 _startup_libs34: ${_startup_libs34:S/$/__L/}
946 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
947 _generic_libs: ${_generic_libs:S/$/__L/}
949 # library targets must be ordered because there are inter-library
950 # races (e.g. generation of tconfig.h)
952 .ORDER: ${_startup_libs34:S/$/__L/}
953 .ORDER: ${_startup_libs:S/$/__L/}
954 .ORDER: ${_prebuild_libs:S/$/__L/}
955 .ORDER: ${_generic_libs:S/$/__L/}
957 .for __target in clean cleandepend cleandir obj depend includes
958 .for entry in ${SUBDIR}
959 ${entry}.${__target}__D: .PHONY
960 @if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
961 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
962 edir=${entry}.${MACHINE_ARCH}; \
963 cd ${.CURDIR}/$${edir}; \
965 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \
967 cd ${.CURDIR}/$${edir}; \
969 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
971 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
972 .ORDER: ${SUBDIR:S/$/.${__target}__D/}
974 .ORDER: par-clean par-cleandepend par-cleandir par-obj par-depend par-includes
976 # The wmake target is used by /usr/bin/wmake to run make in a
977 # world build environment.
980 @echo '${WMAKEENV} ${MAKE} -m ${.CURDIR}/share/mk ${WMAKE_ARGS}'
983 @echo '${WMAKEENV} /bin/sh'
986 @echo '${BMAKEENV} ${MAKE} -m ${.CURDIR}/share/mk ${BMAKE_ARGS}'
989 @echo '${BMAKEENV} /bin/sh'
992 @echo '${TMAKEENV} ${MAKE} -m ${.CURDIR}/share/mk ${TMAKE_ARGS}'
995 @echo '${TMAKEENV} /bin/sh'
997 .include <bsd.subdir.mk>