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.80 2005/09/25 12:43:58 asmodai 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 -DNOPROFILE -DNOSHARED -DNO_WERROR
206 TMAKEENV= MAKEOBJDIRPREFIX=${BTOOLSDEST} \
209 PATH=${BTOOLSPATH}:${PATH} \
210 INSTALL="sh ${.CURDIR}/tools/install.sh"
212 TMAKE= ${TMAKEENV} ${MAKE} -f Makefile.inc1 -DBOOTSTRAPPING \
217 # note: TOOLS_PREFIX points to the obj root holding the cross
218 # compiler binaries, while USRDATA_PREFIX points to the obj root
219 # holding the target environment (and also determines where cross-built
220 # libraries, crt*.o, and include files are installed).
222 XMAKEENV= MAKEOBJDIRPREFIX=${CTOOLSDEST} \
224 DESTDIR=${CTOOLSDEST} \
225 INSTALL="sh ${.CURDIR}/tools/install.sh" \
226 TOOLS_PREFIX=${CTOOLSDEST} \
227 USRDATA_PREFIX=${WORLDDEST} \
228 PATH=${BTOOLSPATH}:${PATH}
230 XMAKE= ${XMAKEENV} ${MAKE} -f Makefile.inc1 -DNO_FORTRAN -DNO_GDB \
233 # world stage, note the strict path and note that TOOLS_PREFIX is left
234 # unset and USRDATA_PREFIX (which defaults to TOOLS_PREFIX) is set to empty,
235 # which is primarily for the compiler so it targets / (e.g. /usr/<blah>)
236 # for both binary and library paths, even though it is being compiled to
237 # WORLDDEST. None of the programs in the world stage are ever actually
238 # executed during the buildworld/installworld.
240 CROSSENV= MAKEOBJDIRPREFIX=${WORLDDEST} \
242 MACHINE_ARCH=${TARGET_ARCH} \
244 OBJFORMAT_PATH=${CTOOLSDEST}
246 WMAKEENV= ${CROSSENV} \
247 DESTDIR=${WORLDDEST} \
248 INSTALL="sh ${.CURDIR}/tools/install.sh" \
249 PATH=${STRICTTMPPATH}
251 WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1
255 IMAKEENV= ${CROSSENV} \
256 PATH=${STRICTTMPPATH}
257 IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1
261 KMAKEENV= ${WMAKEENV}
265 # Attempt to rebuild the entire system, with reasonable chance of
266 # success, regardless of how old your existing system is.
270 @echo "--------------------------------------------------------------"
271 @echo ">>> Rebuilding the temporary build tree"
272 @echo "--------------------------------------------------------------"
273 .if !defined(NOCLEAN)
274 rm -rf ${BTOOLSDEST} ${CTOOLSDEST} ${WORLDDEST}
276 # XXX - These two can depend on any header file.
277 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
278 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
280 mkdir -p ${DESTDIRBASE} ${BTOOLSDEST} ${CTOOLSDEST} ${WORLDDEST}
281 .for _dir in ${WORLDDEST} ${BTOOLSDEST} ${CTOOLSDEST}
282 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
283 -p ${_dir}/ > /dev/null
284 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
285 -p ${_dir}/usr > /dev/null
287 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
288 -p ${WORLDDEST}/usr/include > /dev/null
289 ${LN} -sf ${.CURDIR}/sys ${WORLDDEST}
293 @echo "--------------------------------------------------------------"
294 @echo ">>> stage 1: bootstrap tools"
295 @echo "--------------------------------------------------------------"
296 cd ${.CURDIR}; ${BMAKE} bootstrap-tools
299 @echo "--------------------------------------------------------------"
300 @echo ">>> stage 2a: cleaning up the object tree"
301 @echo "--------------------------------------------------------------"
302 cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
305 @echo "--------------------------------------------------------------"
306 @echo ">>> stage 2b: rebuilding the object tree"
307 @echo "--------------------------------------------------------------"
308 cd ${.CURDIR}; ${WMAKE} par-obj
311 @echo "--------------------------------------------------------------"
312 @echo ">>> stage 2c: build tools"
313 @echo "--------------------------------------------------------------"
314 cd ${.CURDIR}; ${TMAKE} build-tools
317 @echo "--------------------------------------------------------------"
318 @echo ">>> stage 3: cross tools"
319 @echo "--------------------------------------------------------------"
320 cd ${.CURDIR}; ${XMAKE} cross-tools
323 @echo "--------------------------------------------------------------"
324 @echo ">>> stage 4a: populating ${WORLDDEST}/usr/include"
325 @echo "--------------------------------------------------------------"
326 cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
329 @echo "--------------------------------------------------------------"
330 @echo ">>> stage 4b: building libraries"
331 @echo "--------------------------------------------------------------"
332 cd ${.CURDIR}; ${WMAKE} -DNOHTML -DNOINFO -DNOMAN -DNOFSCHG libraries
335 @echo "--------------------------------------------------------------"
336 @echo ">>> stage 4c: make dependencies"
337 @echo "--------------------------------------------------------------"
338 cd ${.CURDIR}; ${WMAKE} par-depend
341 @echo "--------------------------------------------------------------"
342 @echo ">>> stage 4d: building everything.."
343 @echo "--------------------------------------------------------------"
344 cd ${.CURDIR}; ${WMAKE} all
346 # note: buildworld no longer depends on _cleanobj because we rm -rf the
347 # entire object tree and built the bootstrap tools in a different location.
349 # buildworld - build everything from scratch
350 # quickworld - skip the bootstrap, build, and cross-build steps
351 # realquickworld - skip the bootstrap, build, crossbuild, and depend step.
353 # note: we include _obj in realquickworld to prevent accidental creation
354 # of files in /usr/src.
357 .if !defined(SUBDIR_OVERRIDE)
358 WMAKE_TGTS+= _worldtmp _bootstrap-tools
360 WMAKE_TGTS+= _obj _build-tools
361 .if !defined(SUBDIR_OVERRIDE)
362 WMAKE_TGTS+= _cross-tools
364 WMAKE_TGTS+= _includes _libraries _depend everything
366 buildworld: ${WMAKE_TGTS}
368 quickworld: _obj _includes _libraries _depend everything
370 realquickworld: _obj _includes _libraries everything
372 crossworld: _worldtmp _bootstrap-tools _obj _build-tools _cross-tools
374 .ORDER: ${WMAKE_TGTS}
379 # Checks to be sure system is ready for installworld
382 .if !defined(NO_SENDMAIL)
383 @pw usershow smmsp || (echo "You may need to run 'make preupgrade' first"; exit 1)
384 @pw groupshow smmsp || (echo "You may need to run 'make preupgrade' first"; exit 1)
386 @pw usershow _pflogd || (echo "You may need to run 'make preupgrade' first"; exit 1)
387 @pw usershow _ntp || (echo "You may need to run 'make preupgrade' first"; exit 1)
388 @pw groupshow authpf || (echo "You may need to run 'make preupgrade' first"; exit 1)
389 @pw groupshow _pflogd || (echo "You may need to run 'make preupgrade' first"; exit 1)
390 @pw groupshow _ntp || (echo "You may need to run 'make preupgrade' first"; exit 1)
391 .if !defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/"
392 @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
397 # Distributes everything compiled by a `buildworld'.
401 # Installs everything compiled by a 'buildworld'.
403 distributeworld installworld: installcheck
404 cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}
409 # If you have a build server, you can NFS mount the source and obj directories
410 # and do a 'make reinstall' on the *client* to install new binaries from the
411 # most recent server build.
414 @echo "--------------------------------------------------------------"
415 @echo ">>> Making hierarchy"
416 @echo "--------------------------------------------------------------"
417 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
419 @echo "--------------------------------------------------------------"
420 @echo ">>> Installing everything.."
421 @echo "--------------------------------------------------------------"
422 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
423 .if !defined(NOMAN) && !defined(NO_MAKEDB_RUN)
425 @echo "--------------------------------------------------------------"
426 @echo ">>> Rebuilding man page indices"
427 @echo "--------------------------------------------------------------"
428 cd ${.CURDIR}/share/man; ${MAKE} makedb
432 @echo "--------------------------------------------------------------"
433 @echo ">>> Distributing everything.."
434 @echo "--------------------------------------------------------------"
435 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
438 # buildkernel, nativekernel, quickkernel, and installkernel
440 # Which kernels to build and/or install is specified by setting
441 # KERNCONF. If not defined a GENERIC kernel is built/installed.
442 # Only the existing (depending TARGET) config files are used
443 # for building kernels and only the first of these is designated
444 # as the one being installed.
446 # You can specify INSTALLSTRIPPED=1 if you wish the installed
447 # kernel and modules to be stripped of its debug info (required
448 # symbols are left intact). You can specify INSTALLSTRIPPEDMODULES
449 # if you only want to strip the modules of their debug info. These
450 # only apply if you have DEBUG=-g in your kernel config or make line.
452 # Note that we have to use TARGET instead of TARGET_ARCH when
453 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
454 # be set to cross-build, we have to make sure TARGET is set
457 .if !defined(KERNCONF) && defined(KERNEL)
463 INSTKERNNAME?= kernel
465 KRNLSRCDIR= ${.CURDIR}/sys
466 KRNLCONFDIR= ${KRNLSRCDIR}/${TARGET}/conf
467 KRNLOBJDIR= ${OBJTREE}${KRNLSRCDIR}
468 KERNCONFDIR?= ${KRNLCONFDIR}
472 .for _kernel in ${KERNCONF}
473 .if exists(${KERNCONFDIR}/${_kernel})
474 BUILDKERNELS+= ${_kernel}
475 .if empty(INSTALLKERNEL)
476 INSTALLKERNEL= ${_kernel}
481 # kernel version numbers survive rm -rf
483 .for _kernel in ${BUILDKERNELS}
484 .if exists(${KRNLOBJDIR}/${_kernel}/version)
485 KERNEL_VERSION_${_kernel} != cat ${KRNLOBJDIR}/${_kernel}/version
492 # Builds all kernels defined by BUILDKERNELS.
495 @if [ ! -f ${WORLDDEST}/.libraries_done ]; then \
496 echo "You must buildworld before buildkernel. If you wish"; \
497 echo "to build a kernel using native tools, config it manually"; \
498 echo "or use the nativekernel target if you are in a rush"; \
503 .for _kernel in ${BUILDKERNELS}
504 @if [ ! -f ${KRNLOBJDIR}/${_kernel}/.nativekernel_run ]; then \
505 if [ ! -f ${WORLDDEST}/.libraries_done ]; then \
506 echo "The kernel was build using buildworld tools which no" ; \
507 echo "longer appear to exist, quickkernel failed!" ; \
514 .if empty(BUILDKERNELS)
515 @echo ">>> ERROR: Missing kernel configuration file(s) (${KERNCONF})."
520 .if defined(KERNWARN)
521 @echo "--------------------------------------------------------------"
522 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
523 @echo "--------------------------------------------------------------"
528 # The buildkernel target rebuilds the specified kernels from scratch
529 # using the crossbuild tools generated by the last buildworld. It is
530 # the safest (but also the most time consuming) way to build a new kernel.
532 buildkernel: bk_tools bk_build_list bk_kernwarn
533 .for _kernel in ${BUILDKERNELS}
534 @echo "--------------------------------------------------------------"
535 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
536 @echo "--------------------------------------------------------------"
537 @echo "===> ${_kernel}"
538 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
539 rm -rf ${KRNLOBJDIR}/${_kernel}
541 @if [ -f ${KRNLOBJDIR}/${_kernel}/.nativekernel_run ]; then \
542 echo "YOU ARE REBUILDING WITH BUILDKERNEL, REMOVING OLD NATIVEKERNEL BUILD"; \
543 rm -rf ${KRNLOBJDIR}/${_kernel}; fi
545 mkdir -p ${KRNLOBJDIR}
546 .if !defined(NO_KERNELCONFIG)
548 PATH=${STRICTTMPPATH} \
549 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
550 ${KERNCONFDIR}/${_kernel}
552 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN) && defined(KERNEL_VERSION_${_kernel})
553 echo ${KERNEL_VERSION_${_kernel}} > ${KRNLOBJDIR}/${_kernel}/version
555 touch ${KRNLOBJDIR}/${_kernel}/.buildkernel_run
556 cd ${KRNLOBJDIR}/${_kernel}; \
557 MAKESRCPATH=${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm \
558 ${MAKE} -DBOOTSTRAPPING -f ${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm/Makefile
559 .if !defined(NO_KERNELDEPEND)
560 cd ${KRNLOBJDIR}/${_kernel}; \
561 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend
563 cd ${KRNLOBJDIR}/${_kernel}; \
564 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all
565 @echo "--------------------------------------------------------------"
566 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
567 @echo "--------------------------------------------------------------"
570 # The nativekernel target rebuilds the specified kernels from scratch
571 # using the systems standard compiler rather then using the crossbuild
572 # tools generated by the last buildworld. This is fairly safe if your
573 # system is reasonable up-to-date.
575 nativekernel: bk_build_list bk_kernwarn
576 .for _kernel in ${BUILDKERNELS}
577 @echo "--------------------------------------------------------------"
578 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
579 @echo "--------------------------------------------------------------"
580 @echo "===> ${_kernel}"
581 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
582 rm -rf ${KRNLOBJDIR}/${_kernel}
584 @if [ -f ${KRNLOBJDIR}/${_kernel}/.buildkernel_run ]; then \
585 echo "YOU ARE REBUILDING WITH NATIVEKERNEL, REMOVING OLD BUILDKERNEL BUILD"; \
586 rm -rf ${KRNLOBJDIR}/${_kernel}; fi
588 mkdir -p ${KRNLOBJDIR}
589 .if !defined(NO_KERNELCONFIG)
591 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
592 ${KERNCONFDIR}/${_kernel}
594 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN) && defined(KERNEL_VERSION_${_kernel})
595 echo ${KERNEL_VERSION_${_kernel}} > ${KRNLOBJDIR}/${_kernel}/version
597 touch ${KRNLOBJDIR}/${_kernel}/.nativekernel_run
598 cd ${KRNLOBJDIR}/${_kernel}; \
599 MAKESRCPATH=${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm \
600 ${MAKE} -DBOOTSTRAPPING -f ${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm/Makefile
601 .if !defined(NO_KERNELDEPEND)
602 cd ${KRNLOBJDIR}/${_kernel}; \
603 ${MAKE} KERNEL=${INSTKERNNAME} depend
605 cd ${KRNLOBJDIR}/${_kernel}; \
606 ${MAKE} KERNEL=${INSTKERNNAME} all
607 @echo "--------------------------------------------------------------"
608 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
609 @echo "--------------------------------------------------------------"
612 # The quickkernel target rebuilds the specified kernels as quickly
613 # as possible. It will use the native tools or the buildworld cross tools
614 # based on whether the kernel was originally generated via buildkernel or
615 # nativekernel. Config is rerun but the object hierarchy is not rebuilt,
616 # nor is the make depend step run.
618 quickkernel: maybe_bk_tools bk_build_list bk_kernwarn
619 .for _kernel in ${BUILDKERNELS}
620 @echo "--------------------------------------------------------------"
621 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
622 @echo "--------------------------------------------------------------"
623 @echo "===> ${_kernel}"
624 .if exists(${KRNLOBJDIR}/${_kernel}/.buildkernel_run)
625 .if !defined(NO_KERNELCONFIG)
627 PATH=${STRICTTMPPATH} \
628 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
629 ${KERNCONFDIR}/${_kernel}
631 cd ${KRNLOBJDIR}/${_kernel}; \
632 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all
634 .if !defined(NO_KERNELCONFIG)
636 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
637 ${KERNCONFDIR}/${_kernel}
639 cd ${KRNLOBJDIR}/${_kernel}; \
640 ${MAKE} KERNEL=${INSTKERNNAME} all
642 @echo "--------------------------------------------------------------"
643 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
644 @echo "--------------------------------------------------------------"
650 # Install the kernel defined by INSTALLKERNEL
652 installkernel reinstallkernel:
653 .if exists(${KRNLOBJDIR}/${_kernel}/.buildkernel_run)
654 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
655 ${CROSSENV} ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//}
657 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
658 ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//}
664 # Update the source tree, by running sup and/or running cvs to update to the
668 .if defined(SUP_UPDATE)
669 @echo "--------------------------------------------------------------"
670 @echo ">>> Running ${SUP}"
671 @echo "--------------------------------------------------------------"
673 @${SUP} ${SUPFLAGS} ${SUPFILE}
675 .if defined(SUPFILE1)
676 @${SUP} ${SUPFLAGS} ${SUPFILE1}
678 .if defined(SUPFILE2)
679 @${SUP} ${SUPFLAGS} ${SUPFILE2}
681 .if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
682 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
684 .if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
685 @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
688 .if defined(CVS_UPDATE)
689 @echo "--------------------------------------------------------------"
690 @echo ">>> Updating ${.CURDIR} from cvs repository `cat ${.CURDIR}/CVS/Root`"
691 @echo "--------------------------------------------------------------"
693 cd ${.CURDIR}; cvs -q update -P -d
699 # Build most of the user binaries on the existing system libs and includes.
702 @echo "--------------------------------------------------------------"
703 @echo ">>> Building programs only"
704 @echo "--------------------------------------------------------------"
705 .for _dir in bin sbin libexec usr.bin usr.sbin gnu/libexec gnu/usr.bin gnu/usr.sbin
706 cd ${.CURDIR}/${_dir}; ${MAKE} DIRPRFX=${_dir}/ all
712 # Install the binaries built by the 'most' target. This does not include
713 # libraries or include files.
716 @echo "--------------------------------------------------------------"
717 @echo ">>> Installing programs only"
718 @echo "--------------------------------------------------------------"
719 .for _dir in bin sbin libexec usr.bin usr.sbin gnu/libexec gnu/usr.bin gnu/usr.sbin
720 cd ${.CURDIR}/${_dir}; ${MAKE} DIRPRFX=${_dir}/ install
724 # ------------------------------------------------------------------------
726 # From here onwards are utility targets used by the 'make world' and
727 # related targets. If your 'world' breaks, you may like to try to fix
728 # the problem and manually run the following targets to attempt to
729 # complete the build. Beware, this is *not* guaranteed to work, you
730 # need to have a pretty good grip on the current state of the system
731 # to attempt to manually finish it. If in doubt, 'make world' again.
734 # bootstrap-tools: Build all tools required to build all tools. Note that
735 # order is important in a number of cases and also note that the bootstrap
736 # and build tools stages have access to earlier binaries they themselves
739 # patch: older patch's do not have -i. This program must be built
740 # first so other bootstrap tools that need to apply patches
742 # [x]install: dependancies on various new install features
743 # rpcgen: old rpcgen used a hardwired cpp path, newer OBJFORMAT_PATH
744 # envs are not compatible with older objformat binaries.
746 .if exists(${.CURDIR}/games) && !defined(NO_GAMES)
747 _strfile= games/fortune/strfile
751 ${LN} -fs /bin/date ${BTOOLSDEST}/bin/date
752 .for _tool in ${_strfile} \
754 bin/chmod bin/cp bin/dd bin/mkdir bin/rm bin/echo bin/test \
755 bin/cat bin/ln bin/mv bin/csh bin/expr bin/sh bin/ls \
756 bin/hostname bin/kill \
757 usr.bin/yacc usr.bin/colldef usr.bin/uudecode usr.bin/xinstall \
758 usr.bin/m4 usr.bin/rpcgen usr.bin/make usr.bin/awk usr.bin/stat \
759 usr.bin/find usr.bin/lex usr.bin/sed usr.bin/uname usr.bin/touch \
760 usr.bin/mkdep usr.bin/mktemp usr.bin/lorder usr.bin/file2c \
761 usr.bin/tsort usr.bin/tr usr.bin/join usr.bin/wc usr.bin/basename \
762 usr.bin/gencat usr.bin/chflags usr.bin/expand usr.bin/paste \
763 usr.bin/mklocale usr.bin/uuencode usr.bin/compile_et usr.bin/hexdump \
764 usr.bin/vi usr.bin/cap_mkdb usr.bin/vgrind usr.bin/true usr.bin/false \
765 usr.bin/cmp usr.bin/xargs usr.bin/id usr.bin/env usr.bin/dirname \
767 usr.sbin/chown usr.sbin/mtree usr.sbin/config \
768 usr.sbin/btxld usr.sbin/pwd_mkdb usr.sbin/zic usr.sbin/makewhatis \
769 gnu/usr.bin/texinfo gnu/usr.bin/grep gnu/usr.bin/sort \
770 usr.bin/gzip usr.bin/bzip2 usr.bin/mkcsmapper usr.bin/mkesdb
771 ${ECHODIR} "===> ${_tool} (bootstrap-tools)"; \
772 cd ${.CURDIR}/${_tool}; \
773 ${MAKE} DIRPRFX=${_tool}/ obj; \
774 ${MAKE} DIRPRFX=${_tool}/ depend; \
775 ${MAKE} DIRPRFX=${_tool}/ all; \
776 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${BTOOLSDEST} install
778 touch ${BTOOLSDEST}/.bootstrap_done
780 # build-tools: Build special purpose build tools.
782 # XXX we may be able to remove or consolidate this into bootstrap-tools
783 # now that we have the native helper (.nx/.no) infrastructure.
785 .if exists(${.CURDIR}/games) && !defined(NO_GAMES)
786 _games= games/adventure games/hack games/phantasia
789 .if exists(${.CURDIR}/share) && !defined(NO_SHARE)
790 _share= share/syscons/scrnmaps
793 _gcc34_cross= gnu/usr.bin/cc34
794 _gcc34_tools= gnu/usr.bin/cc34/cc_prep gnu/usr.bin/cc34/cc_tools
795 .if defined(WANT_GCC40)
796 _gcc40_cross= gnu/usr.bin/cc40
797 _gcc40_tools= gnu/usr.bin/cc40/cc_prep gnu/usr.bin/cc40/cc_tools
799 _binutils= gnu/usr.bin/binutils215
801 .if !defined(NO_FORTRAN)
802 _fortran= gnu/usr.bin/cc34/f771
805 .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
806 !defined(NO_CRYPT) && defined(WANT_KERBEROS)
807 _libkrb5= kerberos5/tools kerberos5/lib/libroken kerberos5/lib/libvers \
808 kerberos5/lib/libasn1 kerberos5/lib/libhdb kerberos5/lib/libsl
811 .if defined(RELEASEDIR)
812 _sysinstall= release/sysinstall
816 .for _tool in ${_gcc34_tools} ${_gcc40_tools} ${_fortran} ${_libkrb5} ${_share}
817 ${ECHODIR} "===> ${_tool} (build-tools)"; \
818 cd ${.CURDIR}/${_tool}; \
819 ${MAKE} DIRPRFX=${_tool}/ obj; \
820 ${MAKE} DIRPRFX=${_tool}/ depend; \
821 ${MAKE} DIRPRFX=${_tool}/ all; \
822 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${BTOOLSDEST} install
824 touch ${BTOOLSDEST}/.build_done
827 # cross-tools: Build cross-building tools
829 .if ${TARGET_ARCH} == "i386" && ${MACHINE_ARCH} != "i386"
830 _btxld= usr.sbin/btxld
834 .for _tool in ${_btxld} ${_binutils} \
835 usr.bin/objformat usr.sbin/crunch/crunchide \
836 ${_gcc34_cross} ${_gcc40_cross}
837 ${ECHODIR} "===> ${_tool} (cross-tools)"; \
838 cd ${.CURDIR}/${_tool}; \
839 ${MAKE} DIRPRFX=${_tool}/ obj; \
840 ${MAKE} DIRPRFX=${_tool}/ depend; \
841 ${MAKE} DIRPRFX=${_tool}/ all; \
842 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${CTOOLSDEST} install
844 touch ${CTOOLSDEST}/.cross_done
847 # hierarchy - ensure that all the needed directories are present
850 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs
853 # libraries - build all libraries, and install them under ${DESTDIR}.
855 # The list of libraries with dependents (${_prebuild_libs}) and their
856 # interdependencies (__L) are built automatically by the
857 # ${.CURDIR}/tools/make_libdeps.sh script.
859 # .makeenv does not work when bootstrapping from 4.x, so we must be sure
860 # to specify the correct CCVER or 'cc' will not exec the correct compiler.
864 HOST_CCVER=${HOST_CCVER} CCVER=gcc34 \
865 ${MAKE} -f Makefile.inc1 _startup_libs34;
866 .if defined(WANT_GCC40)
868 HOST_CCVER=${HOST_CCVER} CCVER=gcc40 \
869 ${MAKE} -f Makefile.inc1 _startup_libs40;
872 ${MAKE} -f Makefile.inc1 _startup_libs; \
873 ${MAKE} -f Makefile.inc1 _prebuild_libs; \
874 ${MAKE} -f Makefile.inc1 _generic_libs;
875 touch ${WORLDDEST}/.libraries_done
877 # These dependencies are not automatically generated:
879 # gnu/lib/${CCVER}/libgcc and lib/csu must be built before all
880 # shared libraries for ELF. The target for _startup_libs34 is
881 # specifically built using gcc34. Same goes for _startup_libs40.
883 _startup_libs34= gnu/lib/gcc34/libgcc
884 _startup_libs40= gnu/lib/gcc40/libgcc
885 _startup_libs= lib/csu/${MACHINE_ARCH}
886 _startup_libs+= lib/csu/common lib/libc lib/libc_rtld
888 _prebuild_libs= lib/libarchive
889 _prebuild_libs+= lib/libutil
891 _generic_libs= gnu/lib
893 .if !defined(NO_CRYPT) && defined(WANT_KERBEROS)
894 _prebuild_libs+= kerberos5/tools
895 _prebuild_libs+= kerberos5/lib/libasn1
896 _prebuild_libs+= kerberos5/lib/libgssapi
897 _prebuild_libs+= kerberos5/lib/libkrb5
898 _prebuild_libs+= kerberos5/lib/libroken
899 _generic_libs+= kerberos5/lib
902 _prebuild_libs+= lib/libcom_err lib/libcrypt lib/libmd \
903 lib/libncurses/libncurses lib/libopie lib/libradius \
904 lib/libskey lib/libtacplus lib/libz lib/libm lib/libpam
906 lib/libopie__L lib/libradius__L lib/libtacplus__L: lib/libmd__L
907 lib/libskey__L: lib/libcrypt__L lib/libmd__L
911 .if !defined(NO_CRYPT)
912 .if !defined(NO_OPENSSL)
913 _prebuild_libs+= secure/lib/libcrypto secure/lib/libssl
914 .if !defined(NO_OPENSSH)
915 _prebuild_libs+= secure/lib/libssh
916 secure/lib/libssh__L: secure/lib/libcrypto__L lib/libz__L
919 _generic_libs+= secure/lib
922 _generic_libs+= usr.bin/lex/lib
924 .for _lib in ${_startup_libs34} ${_startup_libs40} \
925 ${_startup_libs} ${_prebuild_libs} ${_generic_libs}
927 .if exists(${.CURDIR}/${_lib})
928 ${ECHODIR} "===> ${_lib}"; \
929 cd ${.CURDIR}/${_lib}; \
930 ${MAKE} DIRPRFX=${_lib}/ depend; \
931 ${MAKE} DIRPRFX=${_lib}/ all; \
932 ${MAKE} DIRPRFX=${_lib}/ install
936 _startup_libs: ${_startup_libs:S/$/__L/}
937 _startup_libs34: ${_startup_libs34:S/$/__L/}
938 _startup_libs40: ${_startup_libs40:S/$/__L/}
939 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
940 _generic_libs: ${_generic_libs:S/$/__L/}
942 # library targets must be ordered because there are inter-library
943 # races (e.g. generation of tconfig.h)
945 .ORDER: ${_startup_libs34:S/$/__L/}
946 .ORDER: ${_startup_libs40:S/$/__L/}
947 .ORDER: ${_startup_libs:S/$/__L/}
948 .ORDER: ${_prebuild_libs:S/$/__L/}
949 .ORDER: ${_generic_libs:S/$/__L/}
951 .for __target in clean cleandepend cleandir obj depend includes
952 .for entry in ${SUBDIR}
953 ${entry}.${__target}__D: .PHONY
954 @if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
955 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
956 edir=${entry}.${MACHINE_ARCH}; \
957 cd ${.CURDIR}/$${edir}; \
959 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \
961 cd ${.CURDIR}/$${edir}; \
963 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
965 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
966 .ORDER: ${SUBDIR:S/$/.${__target}__D/}
968 .ORDER: par-clean par-cleandepend par-cleandir par-obj par-depend par-includes
970 # The wmake target is used by /usr/bin/wmake to run make in a
971 # world build environment.
974 @echo '${WMAKEENV} ${MAKE} -m ${.CURDIR}/share/mk ${WMAKE_ARGS}'
977 @echo '${WMAKEENV} /bin/sh'
980 @echo '${BMAKEENV} ${MAKE} -m ${.CURDIR}/share/mk ${BMAKE_ARGS}'
983 @echo '${BMAKEENV} /bin/sh'
986 @echo '${TMAKEENV} ${MAKE} -m ${.CURDIR}/share/mk ${TMAKE_ARGS}'
989 @echo '${TMAKEENV} /bin/sh'
991 .include <bsd.subdir.mk>