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.43 2004/10/27 16:09:32 drhodus 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} \
264 PERL5LIB=${WORLDDEST}/usr/libdata/perl/5.00503 \
265 GROFF_BIN_PATH=${BTOOLSDEST}/usr/bin \
266 GROFF_FONT_PATH=${BTOOLSDEST}/usr/share/groff_font \
267 GROFF_TMAC_PATH=${BTOOLSDEST}/usr/share/tmac
269 WMAKEENV= ${CROSSENV} \
270 DESTDIR=${WORLDDEST} \
271 INSTALL="sh ${.CURDIR}/tools/install.sh" \
272 PATH=${STRICTTMPPATH}
274 WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1
278 IMAKEENV= ${CROSSENV} \
279 PATH=${STRICTTMPPATH}
280 IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1
284 KMAKEENV= ${WMAKEENV}
288 # Attempt to rebuild the entire system, with reasonable chance of
289 # success, regardless of how old your existing system is.
293 @echo "--------------------------------------------------------------"
294 @echo ">>> Rebuilding the temporary build tree"
295 @echo "--------------------------------------------------------------"
296 .if !defined(NOCLEAN)
297 rm -rf ${BTOOLSDEST} ${CTOOLSDEST} ${WORLDDEST}
299 # XXX - These two can depend on any header file.
300 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
301 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
303 mkdir -p ${DESTDIRBASE} ${BTOOLSDEST} ${CTOOLSDEST} ${WORLDDEST}
304 .for _dir in ${WORLDDEST} ${BTOOLSDEST} ${CTOOLSDEST}
305 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
306 -p ${_dir}/ > /dev/null
307 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
308 -p ${_dir}/usr > /dev/null
310 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
311 -p ${WORLDDEST}/usr/include > /dev/null
312 ln -sf ${.CURDIR}/sys ${WORLDDEST}
316 @echo "--------------------------------------------------------------"
317 @echo ">>> stage 1: bootstrap tools"
318 @echo "--------------------------------------------------------------"
319 cd ${.CURDIR}; ${BMAKE} bootstrap-tools
322 @echo "--------------------------------------------------------------"
323 @echo ">>> stage 2a: cleaning up the object tree"
324 @echo "--------------------------------------------------------------"
325 cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
328 @echo "--------------------------------------------------------------"
329 @echo ">>> stage 2b: rebuilding the object tree"
330 @echo "--------------------------------------------------------------"
331 cd ${.CURDIR}; ${WMAKE} par-obj
334 @echo "--------------------------------------------------------------"
335 @echo ">>> stage 2c: build tools"
336 @echo "--------------------------------------------------------------"
337 cd ${.CURDIR}; ${TMAKE} build-tools
340 @echo "--------------------------------------------------------------"
341 @echo ">>> stage 3: cross tools"
342 @echo "--------------------------------------------------------------"
343 cd ${.CURDIR}; ${XMAKE} cross-tools
346 @echo "--------------------------------------------------------------"
347 @echo ">>> stage 4a: populating ${WORLDDEST}/usr/include"
348 @echo "--------------------------------------------------------------"
349 cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
352 @echo "--------------------------------------------------------------"
353 @echo ">>> stage 4b: building libraries"
354 @echo "--------------------------------------------------------------"
355 cd ${.CURDIR}; ${WMAKE} -DNOHTML -DNOINFO -DNOMAN -DNOFSCHG libraries
358 @echo "--------------------------------------------------------------"
359 @echo ">>> stage 4c: make dependencies"
360 @echo "--------------------------------------------------------------"
361 cd ${.CURDIR}; ${WMAKE} par-depend
364 @echo "--------------------------------------------------------------"
365 @echo ">>> stage 4d: building everything.."
366 @echo "--------------------------------------------------------------"
367 cd ${.CURDIR}; ${WMAKE} all
369 # note: buildworld no longer depends on _cleanobj because we rm -rf the
370 # entire object tree and built the bootstrap tools in a different location.
372 # buildworld - build everything from scratch
373 # quickworld - skip the bootstrap, build, and cross-build steps
374 # realquickworld - skip the bootstrap, build, crossbuild, and depend step.
376 # note: we include _obj in realquickworld to prevent accidental creation
377 # of files in /usr/src.
380 .if !defined(SUBDIR_OVERRIDE)
381 WMAKE_TGTS+= _worldtmp _bootstrap-tools
383 WMAKE_TGTS+= _obj _build-tools
384 .if !defined(SUBDIR_OVERRIDE)
385 WMAKE_TGTS+= _cross-tools
387 WMAKE_TGTS+= _includes _libraries _depend everything
389 buildworld: ${WMAKE_TGTS}
391 quickworld: _obj _includes _libraries _depend everything
393 realquickworld: _obj _includes _libraries everything
395 crossworld: _worldtmp _bootstrap-tools _obj _build-tools _cross-tools
397 .ORDER: ${WMAKE_TGTS}
402 # Checks to be sure system is ready for installworld
405 .if !defined(NO_SENDMAIL)
406 @if ! `id -u smmsp > /dev/null`; then \
407 echo "ERROR: Required smmsp user is missing, see /usr/src/UPDATING."; \
410 @if ! `id -g smmsp > /dev/null`; then \
411 echo "ERROR: Required smmsp group is missing, see /usr/src/UPDATING."; \
416 #Check that authpf user and group is installed
418 @if ! `grep -q '^authpf:' /etc/group`; then \
419 echo "ERROR: Required authpf group is missing, see /usr/src/UPDATING."; \
425 # Distributes everything compiled by a `buildworld'.
429 # Installs everything compiled by a 'buildworld'.
431 distributeworld installworld: installcheck
432 cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}
437 # If you have a build server, you can NFS mount the source and obj directories
438 # and do a 'make reinstall' on the *client* to install new binaries from the
439 # most recent server build.
442 @echo "--------------------------------------------------------------"
443 @echo ">>> Making hierarchy"
444 @echo "--------------------------------------------------------------"
445 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
447 @echo "--------------------------------------------------------------"
448 @echo ">>> Installing everything.."
449 @echo "--------------------------------------------------------------"
450 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
451 .if !defined(NOMAN) && !defined(NO_MAKEDB_RUN)
453 @echo "--------------------------------------------------------------"
454 @echo ">>> Rebuilding man page indices"
455 @echo "--------------------------------------------------------------"
456 cd ${.CURDIR}/share/man; ${MAKE} makedb
460 @echo "--------------------------------------------------------------"
461 @echo ">>> Distributing everything.."
462 @echo "--------------------------------------------------------------"
463 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
466 # buildkernel, nativekernel, quickkernel, and installkernel
468 # Which kernels to build and/or install is specified by setting
469 # KERNCONF. If not defined a GENERIC kernel is built/installed.
470 # Only the existing (depending TARGET) config files are used
471 # for building kernels and only the first of these is designated
472 # as the one being installed.
474 # You can specify INSTALLSTRIPPED=1 if you wish the installed
475 # kernel and modules to be stripped of its debug info (required
476 # symbols are left intact). You can specify INSTALLSTRIPPEDMODULES
477 # if you only want to strip the modules of their debug info. These
478 # only apply if you have DEBUG=-g in your kernel config or make line.
480 # Note that we have to use TARGET instead of TARGET_ARCH when
481 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
482 # be set to cross-build, we have to make sure TARGET is set
485 .if !defined(KERNCONF) && defined(KERNEL)
491 INSTKERNNAME?= kernel
493 KRNLSRCDIR= ${.CURDIR}/sys
494 KRNLCONFDIR= ${KRNLSRCDIR}/${TARGET}/conf
495 KRNLOBJDIR= ${OBJTREE}${KRNLSRCDIR}
496 KERNCONFDIR?= ${KRNLCONFDIR}
500 .for _kernel in ${KERNCONF}
501 .if exists(${KERNCONFDIR}/${_kernel})
502 BUILDKERNELS+= ${_kernel}
503 .if empty(INSTALLKERNEL)
504 INSTALLKERNEL= ${_kernel}
512 # Builds all kernels defined by BUILDKERNELS.
515 @if [ ! -f ${WORLDDEST}/.libraries_done ]; then \
516 echo "You must buildworld before buildkernel. If you wish"; \
517 echo "to build a kernel using native tools, config it manually"; \
518 echo "or use the nativekernel target if you are in a rush"; \
523 .for _kernel in ${BUILDKERNELS}
524 @if [ ! -f ${KRNLOBJDIR}/${_kernel}/.nativekernel_run ]; then \
525 if [ ! -f ${WORLDDEST}/.libraries_done ]; then \
526 echo "The kernel was build using buildworld tools which no" ; \
527 echo "longer appear to exist, quickkernel failed!" ; \
534 .if empty(BUILDKERNELS)
535 @echo ">>> ERROR: Missing kernel configuration file(s) (${KERNCONF})."
540 .if defined(KERNWARN)
541 @echo "--------------------------------------------------------------"
542 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
543 @echo "--------------------------------------------------------------"
548 # The buildkernel target rebuilds the specified kernels from scratch
549 # using the crossbuild tools generated by the last buildworld. It is
550 # the safest (but also the most time consuming) way to build a new kernel.
552 buildkernel: bk_tools bk_build_list bk_kernwarn
553 .for _kernel in ${BUILDKERNELS}
554 @echo "--------------------------------------------------------------"
555 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
556 @echo "--------------------------------------------------------------"
557 @echo "===> ${_kernel}"
558 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
559 rm -rf ${KRNLOBJDIR}/${_kernel}
561 @if [ -f ${KRNLOBJDIR}/${_kernel}/.nativekernel_run ]; then \
562 echo "YOU ARE REBUILDING WITH BUILDKERNEL, REMOVING OLD NATIVEKERNEL BUILD"; \
563 rm -rf ${KRNLOBJDIR}/${_kernel}; fi
565 mkdir -p ${KRNLOBJDIR}
566 .if !defined(NO_KERNELCONFIG)
568 PATH=${STRICTTMPPATH} \
569 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
570 ${KERNCONFDIR}/${_kernel}
572 touch ${KRNLOBJDIR}/${_kernel}/.buildkernel_run
573 cd ${KRNLOBJDIR}/${_kernel}; \
574 MAKESRCPATH=${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm \
575 ${MAKE} -DBOOTSTRAPPING -f ${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm/Makefile
576 .if !defined(NO_KERNELDEPEND)
577 cd ${KRNLOBJDIR}/${_kernel}; \
578 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend
580 cd ${KRNLOBJDIR}/${_kernel}; \
581 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all
582 @echo "--------------------------------------------------------------"
583 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
584 @echo "--------------------------------------------------------------"
587 # The nativekernel target rebuilds the specified kernels from scratch
588 # using the systems standard compiler rather then using the crossbuild
589 # tools generated by the last buildworld. This is fairly safe if your
590 # system is reasonable up-to-date.
592 nativekernel: bk_build_list bk_kernwarn
593 .for _kernel in ${BUILDKERNELS}
594 @echo "--------------------------------------------------------------"
595 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
596 @echo "--------------------------------------------------------------"
597 @echo "===> ${_kernel}"
598 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
599 rm -rf ${KRNLOBJDIR}/${_kernel}
601 @if [ -f ${KRNLOBJDIR}/${_kernel}/.buildkernel_run ]; then \
602 echo "YOU ARE REBUILDING WITH NATIVEKERNEL, REMOVING OLD BUILDKERNEL BUILD"; \
603 rm -rf ${KRNLOBJDIR}/${_kernel}; fi
605 mkdir -p ${KRNLOBJDIR}
606 .if !defined(NO_KERNELCONFIG)
608 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
609 ${KERNCONFDIR}/${_kernel}
611 touch ${KRNLOBJDIR}/${_kernel}/.nativekernel_run
612 cd ${KRNLOBJDIR}/${_kernel}; \
613 MAKESRCPATH=${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm \
614 ${MAKE} -DBOOTSTRAPPING -f ${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm/Makefile
615 .if !defined(NO_KERNELDEPEND)
616 cd ${KRNLOBJDIR}/${_kernel}; \
617 ${MAKE} KERNEL=${INSTKERNNAME} depend
619 cd ${KRNLOBJDIR}/${_kernel}; \
620 ${MAKE} KERNEL=${INSTKERNNAME} all
621 @echo "--------------------------------------------------------------"
622 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
623 @echo "--------------------------------------------------------------"
626 # The quickkernel target rebuilds the specified kernels as quickly
627 # as possible. It will use the native tools or the buildworld cross tools
628 # based on whether the kernel was originally generated via buildkernel or
629 # nativekernel. Config is rerun but the object hierarchy is not rebuilt,
630 # nor is the make depend step run.
632 quickkernel: maybe_bk_tools bk_build_list bk_kernwarn
633 .for _kernel in ${BUILDKERNELS}
634 @echo "--------------------------------------------------------------"
635 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
636 @echo "--------------------------------------------------------------"
637 @echo "===> ${_kernel}"
638 .if exists(${KRNLOBJDIR}/${_kernel}/.buildkernel_run)
639 .if !defined(NO_KERNELCONFIG)
641 PATH=${STRICTTMPPATH} \
642 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
643 ${KERNCONFDIR}/${_kernel}
645 cd ${KRNLOBJDIR}/${_kernel}; \
646 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all
648 .if !defined(NO_KERNELCONFIG)
650 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
651 ${KERNCONFDIR}/${_kernel}
653 cd ${KRNLOBJDIR}/${_kernel}; \
654 ${MAKE} KERNEL=${INSTKERNNAME} all
656 @echo "--------------------------------------------------------------"
657 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
658 @echo "--------------------------------------------------------------"
664 # Install the kernel defined by INSTALLKERNEL
666 installkernel reinstallkernel:
667 .if exists(${KRNLOBJDIR}/${_kernel}/.buildkernel_run)
668 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
669 ${CROSSENV} ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//}
671 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
672 ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//}
678 # Update the source tree, by running sup and/or running cvs to update to the
682 .if defined(SUP_UPDATE)
683 @echo "--------------------------------------------------------------"
684 @echo ">>> Running ${SUP}"
685 @echo "--------------------------------------------------------------"
687 @${SUP} ${SUPFLAGS} ${SUPFILE}
689 .if defined(SUPFILE1)
690 @${SUP} ${SUPFLAGS} ${SUPFILE1}
692 .if defined(SUPFILE2)
693 @${SUP} ${SUPFLAGS} ${SUPFILE2}
695 .if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
696 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
698 .if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
699 @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
702 .if defined(CVS_UPDATE)
703 @echo "--------------------------------------------------------------"
704 @echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT}
705 @echo "--------------------------------------------------------------"
706 cd ${.CURDIR}; cvs -q update -rRELENG_4 -P -d
712 # Build most of the user binaries on the existing system libs and includes.
715 @echo "--------------------------------------------------------------"
716 @echo ">>> Building programs only"
717 @echo "--------------------------------------------------------------"
718 .for _dir in bin sbin libexec usr.bin usr.sbin gnu/libexec gnu/usr.bin gnu/usr.sbin
719 cd ${.CURDIR}/${_dir}; ${MAKE} DIRPRFX=${_dir}/ all
725 # Install the binaries built by the 'most' target. This does not include
726 # libraries or include files.
729 @echo "--------------------------------------------------------------"
730 @echo ">>> Installing programs only"
731 @echo "--------------------------------------------------------------"
732 .for _dir in bin sbin libexec usr.bin usr.sbin gnu/libexec gnu/usr.bin gnu/usr.sbin
733 cd ${.CURDIR}/${_dir}; ${MAKE} DIRPRFX=${_dir}/ install
737 # ------------------------------------------------------------------------
739 # From here onwards are utility targets used by the 'make world' and
740 # related targets. If your 'world' breaks, you may like to try to fix
741 # the problem and manually run the following targets to attempt to
742 # complete the build. Beware, this is *not* guaranteed to work, you
743 # need to have a pretty good grip on the current state of the system
744 # to attempt to manually finish it. If in doubt, 'make world' again.
747 # bootstrap-tools: Build all tools required to build all tools. Note that
748 # order is important in a number of cases and also note that the bootstrap
749 # and build tools stages have access to earlier binaries they themselves
752 # patch: older patch's do not have -i. This program must be built
753 # first so other bootstrap tools that need to apply patches
755 # [x]install: dependancies on various new install features
756 # rpcgen: old rpcgen used a hardwired cpp path, newer OBJFORMAT_PATH
757 # envs are not compatible with older objformat binaries.
759 .if exists(${.CURDIR}/games) && !defined(NOGAMES)
760 _strfile= games/fortune/strfile
764 .for _tool in ${_strfile} \
766 bin/chmod bin/cp bin/dd bin/mkdir bin/rm bin/echo bin/test \
767 bin/cat bin/date bin/ln bin/mv bin/csh bin/expr bin/sh bin/ls \
768 bin/hostname bin/kill \
770 usr.bin/yacc usr.bin/colldef usr.bin/uudecode usr.bin/xinstall \
771 usr.bin/m4 usr.bin/rpcgen usr.bin/make usr.bin/awk usr.bin/file \
772 usr.bin/find usr.bin/lex usr.bin/sed usr.bin/uname usr.bin/touch \
773 usr.bin/mkdep usr.bin/mktemp usr.bin/lorder usr.bin/file2c \
774 usr.bin/tsort usr.bin/tr usr.bin/join usr.bin/wc usr.bin/basename \
775 usr.bin/gencat usr.bin/chflags usr.bin/expand usr.bin/paste \
776 usr.bin/mklocale usr.bin/uuencode usr.bin/compile_et usr.bin/hexdump \
777 usr.bin/vi usr.bin/cap_mkdb usr.bin/vgrind usr.bin/true usr.bin/false \
778 usr.bin/cmp usr.bin/xargs usr.bin/id usr.bin/env usr.bin/dirname \
779 usr.sbin/chown usr.sbin/mtree usr.sbin/config \
780 usr.sbin/btxld usr.sbin/pwd_mkdb usr.sbin/zic usr.sbin/makewhatis \
781 gnu/usr.bin/gperf gnu/usr.bin/groff gnu/usr.bin/texinfo \
782 gnu/usr.bin/grep gnu/usr.bin/sort \
783 gnu/usr.bin/gzip usr.bin/bzip2
784 ${ECHODIR} "===> ${_tool} (bootstrap-tools)"; \
785 cd ${.CURDIR}/${_tool}; \
786 ${MAKE} DIRPRFX=${_tool}/ obj; \
787 ${MAKE} DIRPRFX=${_tool}/ depend; \
788 ${MAKE} DIRPRFX=${_tool}/ all; \
789 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${BTOOLSDEST} install
791 touch ${BTOOLSDEST}/.bootstrap_done
793 # build-tools: Build special purpose build tools. gcc2 related tools are
794 # only built under the i386 architecture. Other architectures are
797 # XXX we may be able to remove or consolidate this into bootstrap-tools
798 # now that we have the native helper (.nx/.no) infrastructure.
800 .if exists(${.CURDIR}/games) && !defined(NOGAMES)
801 _games= games/adventure games/hack games/phantasia
804 .if exists(${.CURDIR}/share) && !defined(NOSHARE)
805 _share= share/syscons/scrnmaps
808 _gcc34_cross= gnu/usr.bin/cc34
809 _gcc34_tools= gnu/usr.bin/cc34/cc_prep gnu/usr.bin/cc34/cc_tools
810 .if ${MACHINE_ARCH} == "i386" && ${TARGET_ARCH} == "i386"
811 _gcc2_cross= gnu/usr.bin/cc
812 _gcc2_tools= gnu/usr.bin/cc/cc_tools
813 _binutils= gnu/usr.bin/binutils gnu/usr.bin/binutils214
815 _binutils= gnu/usr.bin/binutils214
818 .if !defined(NO_FORTRAN)
819 .if ${TARGET_ARCH} == "i386"
820 _fortran= gnu/usr.bin/cc/f771
822 _fortran= gnu/usr.bin/cc34/f771
827 _perl= gnu/usr.bin/perl/miniperl
830 .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
831 !defined(NOCRYPT) && defined(MAKE_KERBEROS5)
832 _libkrb5= kerberos5/lib/libroken kerberos5/lib/libvers \
833 kerberos5/lib/libasn1 kerberos5/lib/libhdb kerberos5/lib/libsl
836 .if defined(RELEASEDIR)
837 _sysinstall= release/sysinstall
841 .for _tool in ${_gcc2_tools} ${_gcc34_tools} \
842 ${_fortran} ${_perl} ${_libroken4} ${_libkrb5} \
843 ${_share} ${_sysinstall}
844 ${ECHODIR} "===> ${_tool} (build-tools)"; \
845 cd ${.CURDIR}/${_tool}; \
846 ${MAKE} DIRPRFX=${_tool}/ obj; \
847 ${MAKE} DIRPRFX=${_tool}/ depend; \
848 ${MAKE} DIRPRFX=${_tool}/ all; \
849 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${BTOOLSDEST} install
851 touch ${BTOOLSDEST}/.build_done
854 # cross-tools: Build cross-building tools
856 .if ${TARGET_ARCH} == "alpha" && ${MACHINE_ARCH} != "alpha"
857 _elf2exe= usr.sbin/elf2exe
860 .if ${TARGET_ARCH} == "i386" && ${MACHINE_ARCH} != "i386"
861 _btxld= usr.sbin/btxld
865 .for _tool in ${_btxld} ${_elf2exe} ${_binutils} \
866 usr.bin/objformat usr.sbin/crunch/crunchide \
867 ${_gcc2_cross} ${_gcc34_cross}
868 ${ECHODIR} "===> ${_tool} (cross-tools)"; \
869 cd ${.CURDIR}/${_tool}; \
870 ${MAKE} DIRPRFX=${_tool}/ obj; \
871 ${MAKE} DIRPRFX=${_tool}/ depend; \
872 ${MAKE} DIRPRFX=${_tool}/ all; \
873 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${CTOOLSDEST} install
875 touch ${CTOOLSDEST}/.cross_done
878 # hierarchy - ensure that all the needed directories are present
881 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs
884 # libraries - build all libraries, and install them under ${DESTDIR}.
886 # The list of libraries with dependents (${_prebuild_libs}) and their
887 # interdependencies (__L) are built automatically by the
888 # ${.CURDIR}/tools/make_libdeps.sh script.
890 # .makeenv does not work when bootstrapping from 4.x, so we must be sure
891 # to specify the correct CCVER or 'cc' will not exec the correct compiler.
895 HOST_CCVER=${HOST_CCVER} CCVER=gcc2 \
896 ${MAKE} -f Makefile.inc1 _startup_libs2; \
897 HOST_CCVER=${HOST_CCVER} CCVER=gcc34 \
898 ${MAKE} -f Makefile.inc1 _startup_libs34; \
899 ${MAKE} -f Makefile.inc1 _startup_libs; \
900 ${MAKE} -f Makefile.inc1 _prebuild_libs; \
901 ${MAKE} -f Makefile.inc1 _generic_libs;
902 touch ${WORLDDEST}/.libraries_done
904 # These dependencies are not automatically generated:
906 # gnu/lib/libgcc and lib/csu must be built before all
907 # shared libraries for ELF. The targets for _startup_libs{2,3} are
908 # specifically built using gcc{2,3}.
910 _startup_libs2= gnu/lib/gcc2/libgcc
911 _startup_libs34= gnu/lib/gcc34/libgcc
912 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
913 _startup_libs= lib/csu/${MACHINE_ARCH}-elf
915 _startup_libs= lib/csu/${MACHINE_ARCH}
917 _startup_libs+= lib/csu/common lib/libc
921 _generic_libs= gnu/lib
924 _generic_libs+= gnu/usr.bin/perl/libperl
927 .if !defined(NOCRYPT) && defined(MAKE_KERBEROS5)
928 _prebuild_libs+= kerberos5/lib/libasn1
929 _prebuild_libs+= kerberos5/lib/libgssapi
930 _prebuild_libs+= kerberos5/lib/libkrb5
931 _prebuild_libs+= kerberos5/lib/libroken
932 _generic_libs+= kerberos5/lib
935 _prebuild_libs+= lib/libcom_err lib/libcrypt lib/libmd \
936 lib/libncurses lib/libopie lib/libradius lib/libskey \
937 lib/libtacplus lib/libutil \
940 lib/libopie__L lib/libradius__L lib/libtacplus__L: lib/libmd__L
941 lib/libskey__L: lib/libcrypt__L lib/libmd__L
945 .if !defined(NOCRYPT)
946 .if !defined(NO_OPENSSL)
947 _prebuild_libs+= secure/lib/libcrypto secure/lib/libssl
948 .if !defined(NO_OPENSSH)
949 _prebuild_libs+= secure/lib/libssh
950 secure/lib/libssh__L: secure/lib/libcrypto__L lib/libz__L
953 _generic_libs+= secure/lib
956 _generic_libs+= usr.bin/lex/lib
958 .if ${MACHINE_ARCH} == "i386"
959 _generic_libs+= usr.sbin/pcvt/keycap
962 .for _lib in ${_startup_libs2} ${_startup_libs3} ${_startup_libs34} \
963 ${_startup_libs} ${_prebuild_libs} ${_generic_libs}
965 .if exists(${.CURDIR}/${_lib})
966 ${ECHODIR} "===> ${_lib}"; \
967 cd ${.CURDIR}/${_lib}; \
968 ${MAKE} DIRPRFX=${_lib}/ depend; \
969 ${MAKE} DIRPRFX=${_lib}/ all; \
970 ${MAKE} DIRPRFX=${_lib}/ install
974 # only mess with gcc2 for i386 architectures.
976 _startup_libs: ${_startup_libs:S/$/__L/}
977 .if ${TARGET_ARCH} == "i386"
978 _startup_libs2: ${_startup_libs2:S/$/__L/}
982 _startup_libs3: ${_startup_libs3:S/$/__L/}
983 _startup_libs34: ${_startup_libs34:S/$/__L/}
984 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
985 _generic_libs: ${_generic_libs:S/$/__L/}
987 # library targets must be ordered because there are inter-library
988 # races (e.g. generation of tconfig.h)
990 .ORDER: ${_startup_libs2:S/$/__L/}
991 .ORDER: ${_startup_libs3:S/$/__L/}
992 .ORDER: ${_startup_libs34:S/$/__L/}
993 .ORDER: ${_startup_libs:S/$/__L/}
994 .ORDER: ${_prebuild_libs:S/$/__L/}
995 .ORDER: ${_generic_libs:S/$/__L/}
997 .for __target in clean cleandepend cleandir obj depend includes
998 .for entry in ${SUBDIR}
999 ${entry}.${__target}__D: .PHONY
1000 @if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
1001 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
1002 edir=${entry}.${MACHINE_ARCH}; \
1003 cd ${.CURDIR}/$${edir}; \
1005 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \
1007 cd ${.CURDIR}/$${edir}; \
1009 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
1011 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
1012 .ORDER: ${SUBDIR:S/$/.${__target}__D/}
1014 .ORDER: par-clean par-cleandepend par-cleandir par-obj par-depend par-includes
1016 # The wmake target is used by /usr/bin/wmake to run make in a
1017 # world build environment.
1020 @echo '${WMAKEENV} ${MAKE} -m ${.CURDIR}/share/mk ${WMAKE_ARGS}'
1023 @echo '${WMAKEENV} /bin/sh'
1026 @echo '${BMAKEENV} ${MAKE} -m ${.CURDIR}/share/mk ${BMAKE_ARGS}'
1029 @echo '${BMAKEENV} /bin/sh'
1032 @echo '${TMAKEENV} ${MAKE} -m ${.CURDIR}/share/mk ${TMAKE_ARGS}'
1035 @echo '${TMAKEENV} /bin/sh'
1037 .include <bsd.subdir.mk>