Remove IPsec and related code from the system.
[dragonfly.git] / Makefile.inc1
blob35cfbfb4d1fdd927409d4e1729c77863befb9047
2 # $FreeBSD: src/Makefile.inc1,v 1.141.2.62 2003/04/06 19:54:00 dwmalone Exp $
4 # Build-time options are documented in make.conf(5).
6 # The intended user-driven targets are:
8 # buildworld  - rebuild *everything*, including glue to help do upgrades
9 # quickworld  - skip the glue and do a depend+build on the meat
10 # realquickworld - skip the glue and depend stages and just build the meat
11 # crossworld  - only build the glue (particularly the cross-build environment)
12 # installworld- install everything built by "buildworld"
13 # backupworld - copies /bin /sbin /usr/bin /usr/sbin /usr/lib /usr/libexec
14 #               to manual backup dir
15 # rescue      - create rescue image
16 # restoreworld- installs binaries from manual backup dir to world
17 # restoreworld-auto - installs binaries from auto-backup dir to world
18 # most        - build user commands, no libraries or include files
19 # installmost - install user commands, no libraries or include files
20 # backup-clean - delete backup from manual backup dir
21 # backup-auto-clean - delete backup from auto-backup dir
23 # Standard targets (not defined here) are documented in the makefiles in
24 # /usr/share/mk.  These include:
25 #               obj depend all install clean cleandepend cleanobj
27 # Put initial settings here.
28 SUBDIR=
30 # /libexec/ld-elf.so.2 needs to be installed first
31 # Otherwise, install(1) beeing a dynamically linked binary will fail
32 # during the first upgrade from a static to a dynamic world
33 .if exists(${.CURDIR}/libexec)
34 SUBDIR+= libexec
35 .endif
37 # We need to do include and lib early.
39 .if exists(${.CURDIR}/include)
40 SUBDIR+= include
41 .endif
42 .if exists(${.CURDIR}/lib)
43 SUBDIR+= lib
44 .endif
45 # This exists simply to ensure that the obj dir hierarchy is
46 # intact for nrelease, allowing the nrelease Makefile's to
47 # reference ${.OBJDIR}.
49 .if exists(${.CURDIR}/nrelease)
50 SUBDIR+= nrelease
51 .endif
53 .if exists(${.CURDIR}/bin)
54 SUBDIR+= bin
55 .endif
56 .if exists(${.CURDIR}/games) && !defined(NO_GAMES)
57 SUBDIR+= games
58 .endif
59 .if exists(${.CURDIR}/gnu)
60 SUBDIR+= gnu
61 .endif
62 .if exists(${.CURDIR}/sbin)
63 SUBDIR+= sbin
64 .endif
65 .if exists(${.CURDIR}/share) && !defined(NO_SHARE)
66 SUBDIR+= share
67 .endif
68 .if exists(${.CURDIR}/sys)
69 SUBDIR+= sys
70 .endif
71 .if exists(${.CURDIR}/usr.bin)
72 SUBDIR+= usr.bin
73 .endif
74 .if exists(${.CURDIR}/usr.sbin)
75 SUBDIR+= usr.sbin
76 .endif
77 #.if exists(${.CURDIR}/llvm_clang)
78 #SUBDIR+= llvm_clang
79 #.endif
81 .if exists(${.CURDIR}/etc)
82 SUBDIR+= etc
83 .endif
85 # These are last, since it is nice to at least get the base system
86 # rebuilt before you do them.
87 .if defined(LOCAL_DIRS)
88 .for _DIR in ${LOCAL_DIRS}
89 .if exists(${.CURDIR}/${_DIR}) & exists(${.CURDIR}/${_DIR}/Makefile)
90 SUBDIR+= ${_DIR}
91 .endif
92 .endfor
93 .endif
95 .if defined(SUBDIR_OVERRIDE)
96 SUBDIR=         ${SUBDIR_OVERRIDE}
97 .endif
99 .if defined(NOCLEANDIR)
100 CLEANDIR=       clean cleandepend
101 .else
102 CLEANDIR=       cleandir
103 .endif
105 .if defined(NO_CLEAN)
106 NOCLEAN=        # defined
107 .endif
109 # Object directory base in primary make.  Note that when we rerun make
110 # from inside this file we change MAKEOBJDIRPREFIX to the appropriate
111 # subdirectory because the rest of the build system needs it that way.
112 # The original object directory base is saved in OBJTREE.
114 MAKEOBJDIRPREFIX?=      /usr/obj
115 OBJTREE?=               ${MAKEOBJDIRPREFIX}
117 # Used for stage installs and pathing
119 DESTDIRBASE:=           ${OBJTREE}${.CURDIR}
121 # Remove DESTDIR from MAKEFLAGS.  It is present in the environment
122 # anyhow, and we need to be able to override it for stage installs
123 .MAKEFLAGS:=    ${.MAKEFLAGS:NDESTDIR=*}
125 # This section sets the tools used to build the world/kernel
126 WORLD_CCVER?=           gcc50
127 WORLD_LDVER?=           ld.gold
128 WORLD_BINUTILSVER?=     binutils227
130 # Set the backup parameters if they are not already defined
132 WORLD_BACKUP?=          /var/backups/world_backup
133 AUTO_BACKUP?=           ${OBJTREE}/world_backup/${DESTDIR}
135 TARGET_ARCH?=   ${MACHINE_ARCH}
136 .if ${TARGET_ARCH} == ${MACHINE_ARCH}
137 TARGET?=        ${MACHINE}
138 .else
139 TARGET?=        ${TARGET_ARCH}
140 .endif
141 .if make(buildworld)
142 BUILD_ARCH!=    sysctl -n hw.machine_arch
144 # temporary until everybody has converted to x86_64
145 .if ${BUILD_ARCH} == "amd64"
146 BUILD_ARCH=     x86_64
147 .endif
149 .if ${MACHINE_ARCH} != ${BUILD_ARCH}
150 .error To cross-build, set TARGET_ARCH.
151 .endif
152 .endif
154 # XXX this is ugly and we need to come up with a nicer solution
155 .if !defined(TARGET_PLATFORM)
156 .if ${TARGET_ARCH} == "x86_64"
157 TARGET_PLATFORM= pc64
158 .else
159 .error Unknown target architecture.
160 .endif
161 .endif
163 THREAD_LIB?=    thread_xu
164 .if ${THREAD_LIB} == "c_r"
165 .if defined(NO_LIBC_R)
166 .error libc_r is chosen as the default thread library, but NO_LIBC_R is defined
167 .endif
168 .endif
170 # BTOOLS        (Natively built) All non-cross-development tools that the
171 #               main build needs.  This includes things like 'mkdir' and 'rm'.
172 #               We will not use the native system's exec path once we start
173 #               on WORLD.  (bootstrap-tools and build-tools or BTOOLS)
175 # CTOOLS        (Natively built) Cross development tools which are specific
176 #               to the target architecture.
178 # WORLD         (Cross built) Our ultimate buildworld, using only BTOOLS and
179 #               CTOOLS.
181 # MACHINE_PLATFORM Platform Architecture we are building on
182 # MACHINE       Machine Architecture (usually the same as MACHINE_ARCH)
183 # MACHINE_ARCH  Cpu Architecture we are building on
185 # TARGET_PLATFORM Platform Architecture we are building for
186 # TARGET        Machine Architecture we are building for
187 # TARGET_ARCH   Cpu Architecture we are building for
189 BTOOLSDEST=     ${DESTDIRBASE}/btools_${MACHINE_ARCH}
190 CTOOLSDEST=     ${DESTDIRBASE}/ctools_${MACHINE_ARCH}_${TARGET_ARCH}
191 WORLDDEST=      ${DESTDIRBASE}/world_${TARGET_ARCH}
193 # The bootstrap-tools path is used by the bootstrap-tools, build-tools, and
194 # cross-tools stages to augment the existing command path to access newer
195 # versions of certain utilities such as 'patch' that the cross-tools stage
196 # might expect.
198 BTOOLSPATH= ${BTOOLSDEST}/usr/sbin:${BTOOLSDEST}/usr/bin:${BTOOLSDEST}/sbin:${BTOOLSDEST}/bin
200 # The cross-tools path containing the cross-tools to cross build the
201 # ultimate world.
203 CTOOLSPATH= ${CTOOLSDEST}/usr/sbin:${CTOOLSDEST}/usr/bin:${CTOOLSDEST}/sbin:${CTOOLSDEST}/bin
205 # The strict temporary command path contains all binaries required
206 # by the buildworld system after the cross-tools stage.
208 # NOTE: Append '/usr/local/bin:/usr/pkg/bin' to support external compilers.
209 #       See compilers.conf(5) man page for more info.
211 STRICTTMPPATH= ${CTOOLSPATH}:${BTOOLSPATH}:/usr/local/bin:/usr/pkg/bin
213 TMPDIR?=        /tmp
214 TMPPID!=        echo $$$$
217 # Building a world goes through the following stages
219 # 1. bootstrap-tool stage [BMAKE]
220 #       This stage is responsible for creating programs that
221 #       are needed for backward compatibility reasons. They
222 #       are not built as cross-tools.
223 # 2. build-tool stage [TMAKE]
224 #       This stage is responsible for creating the object
225 #       tree and building any tools that are needed during
226 #       the build process.
227 # 3. cross-tool stage [XMAKE]
228 #       This stage is responsible for creating any tools that
229 #       are needed for cross-builds. A cross-compiler is one
230 #       of them.
231 # 4. world stage [WMAKE]
232 #       This stage actually builds the world.
233 # 5. install stage (optional) [IMAKE]
234 #       This stage installs a previously built world.
236 # In all cases we must carefully adjust the environment so the proper
237 # tools and header files are used.
239 # NOTE: The M4 environment variable is used by the [f]lex binary to
240 #       override the location of the 'm4' binary.  The override is
241 #       needed for certain buildworld version transitions, specifically
242 #       past a certain point in 3.3 because the older /usr/bin/m4 will
243 #       generate output that will blow up the newer [f]lex/yacc/bison
244 #       utilities.
247 # bootstrap-tool stage
249 BMAKEENV=       MAKEOBJDIRPREFIX=${BTOOLSDEST} \
250                 OBJTREE=${OBJTREE} \
251                 DESTDIR=${BTOOLSDEST} \
252                 LC_ALL=C \
253                 PATH=${BTOOLSPATH}:${PATH} \
254                 M4=${BTOOLSDEST}/usr/bin/m4 \
255                 INSTALL="sh ${.CURDIR}/tools/install.sh"
257 BMAKE=          ${BMAKEENV} make -f Makefile.inc1 -DBOOTSTRAPPING \
258                 -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED \
259                 -DNO_WERROR -DNO_NLS -DSYSBUILD
261 # build-tool stage
263 TMAKEENV=       MAKEOBJDIRPREFIX=${BTOOLSDEST} \
264                 OBJTREE=${OBJTREE} \
265                 DESTDIR= \
266                 LC_ALL=C \
267                 PATH=${BTOOLSPATH}:${PATH} \
268                 M4=${BTOOLSDEST}/usr/bin/m4 \
269                 INSTALL="sh ${.CURDIR}/tools/install.sh"
271 TMAKE=          ${TMAKEENV} make -f Makefile.inc1 -DBOOTSTRAPPING \
272                 -DNOSHARED -DSYSBUILD
274 # cross-tool stage
276 # note: TOOLS_PREFIX points to the obj root holding the cross
277 #       compiler binaries, while USRDATA_PREFIX points to the obj root
278 #       holding the target environment (and also determines where cross-built
279 #       libraries, crt*.o, and include files are installed).
281 XMAKEENV=       MAKEOBJDIRPREFIX=${CTOOLSDEST} \
282                 OBJTREE=${OBJTREE} \
283                 DESTDIR=${CTOOLSDEST} \
284                 LC_ALL=C \
285                 _SHLIBDIRPREFIX=${CTOOLSDEST} \
286                 INSTALL="sh ${.CURDIR}/tools/install.sh" \
287                 TOOLS_PREFIX=${CTOOLSDEST} \
288                 USRDATA_PREFIX=${WORLDDEST} \
289                 SELECT_LINKER=${WORLD_LDVER} \
290                 M4=${BTOOLSDEST}/usr/bin/m4 \
291                 PATH=${BTOOLSPATH}:${PATH}
293 XMAKE=          ${XMAKEENV} make -f Makefile.inc1 -DNO_GDB \
294                 -DBOOTSTRAPPING -DNOSHARED -DSYSBUILD
296 # world stage, note the strict path and note that TOOLS_PREFIX is left
297 # unset and USRDATA_PREFIX (which defaults to TOOLS_PREFIX) is set to empty,
298 # which is primarily for the compiler so it targets / (e.g. /usr/<blah>)
299 # for both binary and library paths, even though it is being compiled to
300 # WORLDDEST.  None of the programs in the world stage are ever actually
301 # executed during the buildworld/installworld.
303 CROSSENV=       MAKEOBJDIRPREFIX=${WORLDDEST} \
304                 OBJTREE=${OBJTREE} \
305                 MACHINE_ARCH=${TARGET_ARCH} \
306                 MACHINE=${TARGET} \
307                 MACHINE_PLATFORM=${TARGET_PLATFORM} \
308                 LC_ALL=C \
309                 OBJFORMAT_PATH=${CTOOLSDEST} \
310                 HOST_CCVER=${HOST_CCVER} \
311                 CCVER=${WORLD_CCVER} \
312                 LDVER=${WORLD_LDVER} \
313                 BINUTILSVER=${WORLD_BINUTILSVER}
315 WMAKEENV=       ${CROSSENV} \
316                 DESTDIR=${WORLDDEST} \
317                 _SHLIBDIRPREFIX=${WORLDDEST} \
318                 INSTALL="sh ${.CURDIR}/tools/install.sh" \
319                 M4=${BTOOLSDEST}/usr/bin/m4 \
320                 PATH=${STRICTTMPPATH}
322 WMAKE=          ${WMAKEENV} make -f Makefile.inc1 -DSYSBUILD
324 # install stage
326 IMAKEENV=       ${CROSSENV} \
327                 PATH=${STRICTTMPPATH}
328 IMAKE=          ${IMAKEENV} make -f Makefile.inc1 -DSYSBUILD
330 # kernel stage
332 KMAKEENV=       ${WMAKEENV}
334 # buildworld
336 # Attempt to rebuild the entire system, with reasonable chance of
337 # success, regardless of how old your existing system is.
339 _worldtmp: _cleantmp _mtreetmp
340 .ORDER: _cleantmp _mtreetmp
342 _cleantmp:
343         @echo
344         @echo "--------------------------------------------------------------"
345         @echo ">>> Rebuilding the temporary build tree"
346         @echo "--------------------------------------------------------------"
347 .if !defined(NOCLEAN)
348         rm -rf ${BTOOLSDEST} ${CTOOLSDEST} ${WORLDDEST}
349 .else
350         # XXX - These two can depend on any header file.
351         rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
352         rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
353 .endif
355 _mtreetmp:
356         mkdir -p ${DESTDIRBASE} ${BTOOLSDEST} ${CTOOLSDEST} ${WORLDDEST}
357 .for _dir in ${WORLDDEST} ${BTOOLSDEST} ${CTOOLSDEST}
358         mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist        \
359                 -p ${_dir}/  > /dev/null
360         mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist         \
361                 -p ${_dir}/usr > /dev/null
362 .endfor
363         mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist     \
364                 -p ${WORLDDEST}/usr/include > /dev/null
365         ${LN} -sf ${.CURDIR}/sys ${WORLDDEST}
367 _bootstrap-tools:
368         @echo
369         @echo "--------------------------------------------------------------"
370         @echo ">>> stage 1: bootstrap tools"
371         @echo "--------------------------------------------------------------"
372         cd ${.CURDIR}; ${BMAKE} bootstrap-tools
373 _cleanobj:
374         @echo
375         @echo "--------------------------------------------------------------"
376         @echo ">>> stage 2a: cleaning up the object tree"
377         @echo "--------------------------------------------------------------"
378         cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
379 _obj:
380         @echo
381         @echo "--------------------------------------------------------------"
382         @echo ">>> stage 2b: rebuilding the object tree"
383         @echo "--------------------------------------------------------------"
384         cd ${.CURDIR}; ${WMAKE} par-obj
385 _build-tools:
386         @echo
387         @echo "--------------------------------------------------------------"
388         @echo ">>> stage 2c: build tools"
389         @echo "--------------------------------------------------------------"
390         cd ${.CURDIR}; ${TMAKE} build-tools
391 _cross-tools:
392         @echo
393         @echo "--------------------------------------------------------------"
394         @echo ">>> stage 3: cross tools"
395         @echo "--------------------------------------------------------------"
396         cd ${.CURDIR}; ${XMAKE} cross-tools
397 _includes:
398         @echo
399         @echo "--------------------------------------------------------------"
400         @echo ">>> stage 4a: populating ${WORLDDEST}/usr/include"
401         @echo "--------------------------------------------------------------"
402         cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
403 _libraries:
404         @echo
405         @echo "--------------------------------------------------------------"
406         @echo ">>> stage 4b: building libraries"
407         @echo "--------------------------------------------------------------"
408         cd ${.CURDIR}; ${WMAKE} -DNOHTML -DNOMAN -DNOFSCHG libraries
409 _depend:
410         @echo
411         @echo "--------------------------------------------------------------"
412         @echo ">>> stage 4c: make dependencies"
413         @echo "--------------------------------------------------------------"
414         cd ${.CURDIR}; ${WMAKE} par-depend
415 everything:
416         @echo
417         @echo "--------------------------------------------------------------"
418         @echo ">>> stage 4d: building everything.."
419         @echo "--------------------------------------------------------------"
420         cd ${.CURDIR}; ${WMAKE} all
421 _bwinit:
422         @echo "--------------------------------------------------------------"
423         @echo ">>> starting buildworld target"
424         @echo "--------------------------------------------------------------"
425 _bwdone:
426         @echo "--------------------------------------------------------------"
427         @echo ">>> buildworld target complete"
428         @echo "--------------------------------------------------------------"
429 _qwinit:
430         @echo "--------------------------------------------------------------"
431         @echo ">>> starting quickworld target"
432         @echo "--------------------------------------------------------------"
433 _qwdone:
434         @echo "--------------------------------------------------------------"
435         @echo ">>> quickworld target complete"
436         @echo "--------------------------------------------------------------"
437 _iwinit:
438         @echo "--------------------------------------------------------------"
439         @echo ">>> starting installworld target"
440         @echo "--------------------------------------------------------------"
442 # note: buildworld no longer depends on _cleanobj because we rm -rf the
443 # entire object tree and built the bootstrap tools in a different location.
445 # buildworld    - build everything from scratch
446 # quickworld    - skip the bootstrap, build, and cross-build steps
447 # realquickworld - skip the bootstrap, build, crossbuild, and depend step.
449 # note: we include _obj in realquickworld to prevent accidental creation
450 # of files in /usr/src.
452 WMAKE_TGTS=
453 .if !defined(SUBDIR_OVERRIDE)
454 WMAKE_TGTS+=    _worldtmp _bootstrap-tools
455 .endif
456 WMAKE_TGTS+=    _obj _build-tools
457 .if !defined(SUBDIR_OVERRIDE)
458 WMAKE_TGTS+=    _cross-tools
459 .endif
460 WMAKE_TGTS+=    _includes _libraries _depend everything
462 buildworld: _bwinit ${WMAKE_TGTS} _bwdone
464 quickworld: _qwinit _mtreetmp _obj _includes _libraries _depend everything _qwdone
466 realquickworld: _qwinit _mtreetmp _obj _includes _libraries everything _qwdone
468 crossworld: _worldtmp _bootstrap-tools _obj _build-tools _cross-tools
470 .ORDER: _bwinit ${WMAKE_TGTS} _bwdone
471 .ORDER: _obj _includes
472 .ORDER: _qwinit _mtreetmp _obj
473 .ORDER: installcheck backupworld-auto
474 .ORDER: everything _qwdone
477 # installcheck
479 # Checks to be sure system is ready for installworld
481 installcheck: _iwinit
482         @pw usershow _pflogd || (echo "You may need to run 'make preupgrade' first"; /usr/bin/false)
483         @pw groupshow authpf || (echo "You may need to run 'make preupgrade' first"; /usr/bin/false)
484         @pw groupshow _pflogd || (echo "You may need to run 'make preupgrade' first"; /usr/bin/false)
485 .if !defined(OVERRIDE_CHECKS)
486 .if !defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/"
487         @case `uname -r` in 1.2*|1.3-*|1.3.*|1.4.*|1.5.0-*|1.5.1-*|1.5.2-*|1.5.3-*) echo "You must upgrade your kernel to at least 1.5.4 and reboot before you can safely installworld, due to libc/system call ABI changes" ; /usr/bin/false ; esac
488         @case `uname -r` in 1.*|2.*|3.0*|3.1*|3.2*|3.3*|3.4*|3.5*|3.6*) echo "Base is too old for a normal installworld, you need to use installworld-force" ; /usr/bin/false ; esac
489 .endif
490 .endif
493 # installworld
495 # Backs up the current world if ${AUTO_BACKUP} is writable.
496 # Installs everything compiled by a 'buildworld'.
498 # Includes sleep/sync safety before running mkinitrd.
500 installworld: installcheck
501         -@mkdir -p ${AUTO_BACKUP} > /dev/null 2>&1
502         @cd ${.CURDIR}; \
503             (touch ${AUTO_BACKUP}/.updating > /dev/null 2>&1 && \
504              ${IMAKE} backupworld-auto) || \
505             echo "Cannot write to ${AUTO_BACKUP} - world not backed up"
507         cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}
508         ${INSTALL} -o root -g wheel -m 644 ${.CURDIR}/Makefile_upgrade.inc ${DESTDIR}/etc/upgrade/
509         sync
510         @echo "--------------------------------------------------------------"
511         @echo ">>> installworld target complete"
512         @echo "--------------------------------------------------------------"
513         @echo "If things work as expected after a full reboot, consider updating the rescue"
514         @echo "image with 'make rescue'.  Do not do it until after rebooting."
516 installworld-force:
517         @echo "Doing a forced installworld.  This will install to a temporary directory,"
518         @echo "then copy the main binaries and libraries with a static cpdup to ${DESTDIR}/"
519         @echo "and finally will issue a normal installworld.  Starting in 5 seconds.".
520         @echo "^C to abort."
521         sleep 1
522         rm -rf /usr/obj/temp > /dev/null 2>& 1 || chflags -R noschg /usr/obj/temp
523         rm -rf /usr/obj/temp
524         mkdir -p /usr/obj/temp/cpdup/bin
525         (cd ${.CURDIR}/bin/cpdup; make clean; make obj; make clean; make CFLAGS=-static all install DESTDIR=/usr/obj/temp/cpdup NOMAN=TRUE)
526         @echo "XXXXXXXXX Installing to temporary XXXXXXXXX"
527         @sleep 1
528         (cd ${.CURDIR}; ${MAKE} installworld DESTDIR=/usr/obj/temp > /dev/null 2>&1)
529         @echo "XXXXXXXXX Blasting binaries and libraries XXXXXXXXX"
530         @sleep 1
531         /usr/obj/temp/cpdup/bin/cpdup -i0 /usr/obj/temp/bin /bin
532         /usr/obj/temp/cpdup/bin/cpdup -i0 /usr/obj/temp/sbin /sbin
533         /usr/obj/temp/cpdup/bin/cpdup -i0 /usr/obj/temp/lib /lib
534         /usr/obj/temp/cpdup/bin/cpdup -i0 /usr/obj/temp/usr/bin /usr/bin
535         /usr/obj/temp/cpdup/bin/cpdup -i0 /usr/obj/temp/usr/sbin /usr/sbin
536         /usr/obj/temp/cpdup/bin/cpdup -i0 /usr/obj/temp/usr/lib /usr/lib
537         /usr/obj/temp/cpdup/bin/cpdup -i0 /usr/obj/temp/libexec /libexec
538         /usr/obj/temp/cpdup/bin/cpdup -i0 /usr/obj/temp/usr/libexec /usr/libexec
539         @echo "XXXXXXXXX Doing final installworld XXXXXXXX"
540         sleep 5
541         (cd ${.CURDIR}; ${MAKE} installworld OVERRIDE_CHECKS=TRUE)
542         (cd ${.CURDIR}; ${MAKE} upgrade OVERRIDE_CHECKS=TRUE)
544 # Create a rescue image.  We no longer do this automatically for several
545 # reasons, primarily that users have had serious issue with mismatched 'vn'
546 # vs the kldload image that can crash the system.  But also, the rescue image
547 # is intended to be a rescue image, it is a bad idea to update it at the
548 # same time the world is installed.
550 rescue:
551         mkinitrd -b ${DESTDIR}/boot
554 # reinstall
556 # If you have a build server, you can NFS mount the source and obj directories
557 # and do a 'make reinstall' on the *client* to install new binaries from the
558 # most recent server build.
560 reinstall:
561         @echo "--------------------------------------------------------------"
562         @echo ">>> Making hierarchy"
563         @echo "--------------------------------------------------------------"
564         cd ${.CURDIR}; make -f Makefile.inc1 hierarchy
565         @echo
566         @echo "--------------------------------------------------------------"
567         @echo ">>> Installing everything.."
568         @echo "--------------------------------------------------------------"
569         cd ${.CURDIR}; make -f Makefile.inc1 install
572 # buildkernel, nativekernel, quickkernel, realquickkernel, and installkernel
574 # Which kernels to build and/or install is specified by setting
575 # KERNCONF. If not defined an X86_64_GENERIC kernel is built/installed.
576 # Only the existing (depending TARGET) config files are used
577 # for building kernels and only the first of these is designated
578 # as the one being installed.
580 # You can specify INSTALLSTRIPPED=1 if you wish the installed
581 # kernel and modules to be stripped of its debug info (required
582 # symbols are left intact).  You can specify INSTALLSTRIPPEDMODULES
583 # if you only want to strip the modules of their debug info.  These
584 # only apply if you have DEBUG=-g in your kernel config or make line.
586 # Note that we have to use TARGET instead of TARGET_ARCH when
587 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
588 # be set to cross-build, we have to make sure TARGET is set
589 # properly.
591 .if !defined(KERNCONF) && defined(KERNEL)
592 KERNCONF=       ${KERNEL}
593 KERNWARN=       yes
594 .else
595 # XXX makeshift fix to build the right kernel for the (target) architecture
596 # We should configure this in the platform files somehow
597 .if ${TARGET_ARCH} == "x86_64"
598 KERNCONF?=      X86_64_GENERIC
599 .endif
600 .endif
601 INSTKERNNAME?=  kernel
603 KRNLSRCDIR=     ${.CURDIR}/sys
604 KRNLCONFDIR=    ${KRNLSRCDIR}/config
605 KRNLOBJDIR=     ${OBJTREE}${KRNLSRCDIR}
606 KERNCONFDIR?=   ${KRNLCONFDIR}
608 BUILDKERNELS=
609 INSTALLKERNEL=
610 .for _kernel in ${KERNCONF}
611 .if exists(${KERNCONFDIR}/${_kernel})
612 BUILDKERNELS+=  ${_kernel}
613 .if empty(INSTALLKERNEL)
614 INSTALLKERNEL= ${_kernel}
615 .endif
616 .endif
617 .endfor
619 # kernel version numbers survive rm -rf
621 .for _kernel in ${BUILDKERNELS}
622 .if exists(${KRNLOBJDIR}/${_kernel}/version)
623 KERNEL_VERSION_${_kernel} != cat ${KRNLOBJDIR}/${_kernel}/version
624 .endif
625 .endfor
628 # buildkernel
630 # Builds all kernels defined by BUILDKERNELS.
632 bk_tools:
633         @if [ ! -f ${WORLDDEST}/.libraries_done ]; then \
634             echo "You must buildworld before buildkernel.  If you wish"; \
635             echo "to build a kernel using native tools, config it manually"; \
636             echo "or use the nativekernel target if you are in a rush"; \
637             /usr/bin/false; \
638         fi
640 maybe_bk_tools:
641 .for _kernel in ${BUILDKERNELS}
642         @if [ ! -f ${KRNLOBJDIR}/${_kernel}/.nativekernel_run ]; then \
643             if [ ! -f ${WORLDDEST}/.libraries_done ]; then \
644                 echo "The kernel was build using buildworld tools which no" ; \
645                 echo "longer appear to exist, (real)quickkernel failed!" ; \
646                 /usr/bin/false; \
647             fi; \
648         fi
649 .endfor
651 bk_build_list:
652 .if empty(BUILDKERNELS)
653         @echo ">>> ERROR: Missing kernel configuration file(s)."
654         @echo ">>> ${KERNCONF} not found in ${KERNCONFDIR}."
655         @false
656 .endif
658 bk_kernwarn:
659 .if defined(KERNWARN)
660         @echo "--------------------------------------------------------------"
661         @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
662         @echo "--------------------------------------------------------------"
663         @sleep 3
664 .endif
665         @echo
667 # The buildkernel target rebuilds the specified kernels from scratch
668 # using the crossbuild tools generated by the last buildworld.  It is
669 # the safest (but also the most time consuming) way to build a new kernel.
671 buildkernel:    bk_tools bk_build_list bk_kernwarn
672 .for _kernel in ${BUILDKERNELS}
673         @echo "--------------------------------------------------------------"
674         @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
675         @echo "--------------------------------------------------------------"
676         @echo "===> ${_kernel}"
677 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
678         rm -rf ${KRNLOBJDIR}/${_kernel}
679 .else
680         @if [ -f ${KRNLOBJDIR}/${_kernel}/.nativekernel_run ]; then \
681                 echo "YOU ARE REBUILDING WITH BUILDKERNEL, REMOVING OLD NATIVEKERNEL BUILD"; \
682                 rm -rf ${KRNLOBJDIR}/${_kernel}; fi
683 .endif
684         mkdir -p ${KRNLOBJDIR}
685 .if !defined(NO_KERNELCONFIG)
686         cd ${KRNLCONFDIR}; \
687                 PATH=${STRICTTMPPATH} \
688                     config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
689                         ${KERNCONFDIR}/${_kernel}
690 .endif
691 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN) && defined(KERNEL_VERSION_${_kernel})
692         echo ${KERNEL_VERSION_${_kernel}} > ${KRNLOBJDIR}/${_kernel}/version
693 .endif
694         touch ${KRNLOBJDIR}/${_kernel}/.buildkernel_run
695 .if !defined(NO_KERNELDEPEND)
696         cd ${KRNLOBJDIR}/${_kernel}; \
697             ${KMAKEENV} make KERNEL=${INSTKERNNAME} depend
698 .endif
699         cd ${KRNLOBJDIR}/${_kernel}; \
700             ${KMAKEENV} make KERNEL=${INSTKERNNAME} all
701         @echo "--------------------------------------------------------------"
702         @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
703         @echo "--------------------------------------------------------------"
704 .endfor
706 # The nativekernel target rebuilds the specified kernels from scratch
707 # using the system's standard compiler rather than using the crossbuild
708 # tools generated by the last buildworld.  This is fairly safe if your
709 # system is reasonable up-to-date.
711 nativekernel:   bk_build_list bk_kernwarn
712 .for _kernel in ${BUILDKERNELS}
713         @echo "--------------------------------------------------------------"
714         @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
715         @echo "--------------------------------------------------------------"
716         @echo "===> ${_kernel}"
717 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
718         rm -rf ${KRNLOBJDIR}/${_kernel}
719 .else
720         @if [ -f ${KRNLOBJDIR}/${_kernel}/.buildkernel_run ]; then \
721                 echo "YOU ARE REBUILDING WITH NATIVEKERNEL, REMOVING OLD BUILDKERNEL BUILD"; \
722                 rm -rf ${KRNLOBJDIR}/${_kernel}; fi
723 .endif
724         mkdir -p ${KRNLOBJDIR}
725 .if !defined(NO_KERNELCONFIG)
726         cd ${KRNLCONFDIR}; \
727                     config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
728                         ${KERNCONFDIR}/${_kernel}
729 .endif
730 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN) && defined(KERNEL_VERSION_${_kernel})
731         echo ${KERNEL_VERSION_${_kernel}} > ${KRNLOBJDIR}/${_kernel}/version
732 .endif
733         touch ${KRNLOBJDIR}/${_kernel}/.nativekernel_run
734 .if !defined(NO_KERNELDEPEND)
735         cd ${KRNLOBJDIR}/${_kernel}; \
736             make KERNEL=${INSTKERNNAME} depend
737 .endif
738         cd ${KRNLOBJDIR}/${_kernel}; \
739             make KERNEL=${INSTKERNNAME} all
740         @echo "--------------------------------------------------------------"
741         @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
742         @echo "--------------------------------------------------------------"
743 .endfor
745 # The (real)quickkernel target rebuilds the specified kernels as quickly
746 # as possible.  It will use the native tools or the buildworld cross tools
747 # based on whether the kernel was originally generated via buildkernel or
748 # nativekernel.  Config is rerun but the object hierarchy is not rebuilt.
749 # realquickkernel skips the depend step (analogous to realquickworld).
751 quickkernel realquickkernel:    maybe_bk_tools bk_build_list bk_kernwarn
752 .for _kernel in ${BUILDKERNELS}
753         @echo "--------------------------------------------------------------"
754         @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
755         @echo "--------------------------------------------------------------"
756         @echo "===> ${_kernel}"
757 .if exists(${KRNLOBJDIR}/${_kernel}/.buildkernel_run)
758 .if !defined(NO_KERNELCONFIG)
759         cd ${KRNLCONFDIR}; \
760                 PATH=${STRICTTMPPATH} \
761                     config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
762                         ${KERNCONFDIR}/${_kernel}
763 .endif
764 .if !defined(NO_KERNELDEPEND) && !target(realquickkernel)
765         cd ${KRNLOBJDIR}/${_kernel}; \
766             ${KMAKEENV} make KERNEL=${INSTKERNNAME} depend
767 .endif
768         cd ${KRNLOBJDIR}/${_kernel}; \
769             ${KMAKEENV} make KERNEL=${INSTKERNNAME} all
770 .else
771 .if !defined(NO_KERNELCONFIG)
772         cd ${KRNLCONFDIR}; \
773             config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
774                 ${KERNCONFDIR}/${_kernel}
775 .endif
776 .if !defined(NO_KERNELDEPEND) && !target(realquickkernel)
777         cd ${KRNLOBJDIR}/${_kernel}; \
778             make KERNEL=${INSTKERNNAME} depend
779 .endif
780         cd ${KRNLOBJDIR}/${_kernel}; \
781             make KERNEL=${INSTKERNNAME} all
782 .endif
783         @echo "--------------------------------------------------------------"
784         @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
785         @echo "--------------------------------------------------------------"
786 .endfor
789 # installkernel
791 # Install the kernel defined by INSTALLKERNEL
793 installkernel reinstallkernel:
794         @echo "--------------------------------------------------------------"
795         @echo ">>> Kernel install for ${INSTALLKERNEL} started on `LC_ALL=C date`"
796         @echo "--------------------------------------------------------------"
797 .if exists(${KRNLOBJDIR}/${INSTALLKERNEL}/.buildkernel_run)
798         cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
799             ${IMAKEENV} make KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//}
800 .else
801         cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
802             make KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//}
803 .endif
804         @echo "--------------------------------------------------------------"
805         @echo ">>> Kernel install for ${INSTALLKERNEL} completed on `LC_ALL=C date`"
806         @echo "--------------------------------------------------------------"
809 # most
811 # Build most of the user binaries on the existing system libs and includes.
813 most:
814         @echo "--------------------------------------------------------------"
815         @echo ">>> Building programs only"
816         @echo "--------------------------------------------------------------"
817 .for _dir in bin sbin libexec usr.bin usr.sbin gnu/libexec gnu/usr.bin gnu/usr.sbin
818         cd ${.CURDIR}/${_dir};          make DIRPRFX=${_dir}/ all
819 .endfor
822 # installmost
824 # Install the binaries built by the 'most' target.  This does not include
825 # libraries or include files.
827 installmost:
828         @echo "--------------------------------------------------------------"
829         @echo ">>> Installing programs only"
830         @echo "--------------------------------------------------------------"
831 .for _dir in bin sbin libexec usr.bin usr.sbin gnu/libexec gnu/usr.bin gnu/usr.sbin
832         cd ${.CURDIR}/${_dir};          make DIRPRFX=${_dir}/ install
833 .endfor
836 # ------------------------------------------------------------------------
838 # From here onwards are utility targets used by the 'make world' and
839 # related targets.  If your 'world' breaks, you may like to try to fix
840 # the problem and manually run the following targets to attempt to
841 # complete the build.  Beware, this is *not* guaranteed to work, you
842 # need to have a pretty good grip on the current state of the system
843 # to attempt to manually finish it.  If in doubt, 'make world' again.
846 # bootstrap-tools: Build all tools required to build all tools.  Note that
847 # order is important in a number of cases and also note that the bootstrap
848 # and build tools stages have access to earlier binaries they themselves
849 # had generated.
851 # patch:        older patch's do not have -i.  This program must be built
852 #               first so other bootstrap tools that need to apply patches
853 #               can use it.
854 # [x]install:   dependancies on various new install features
855 # rpcgen:       old rpcgen used a hardwired cpp path, newer OBJFORMAT_PATH
856 #               envs are not compatible with older objformat binaries.
859 # BSTRAPDIRS1 - must be built in strict order, no parallelism
861 # order is very important. yacc before m4 before flex.  flex exec's m4,
862 # m4's parser file needs the latest byacc (insanity!).
864 BSTRAPDIRS1= \
865         usr.bin/patch \
866         bin/chmod bin/cp bin/cpdup bin/dd bin/mkdir bin/rm bin/echo \
867         bin/test bin/cat bin/ln bin/mv bin/expr bin/sh \
868         bin/hostname bin/kill \
869         usr.bin/yacc usr.bin/m4 usr.bin/localedef \
870         usr.bin/uudecode usr.bin/xinstall \
871         usr.bin/rpcgen usr.bin/bmake usr.bin/awk usr.bin/stat \
872         usr.bin/find usr.bin/flex
874 # BSTRAPDIRS2 - may built in parallel
876 BSTRAPDIRS2= \
877         usr.bin/sed usr.bin/uname usr.bin/touch \
878         usr.bin/mkdep usr.bin/mktemp usr.bin/lorder usr.bin/file2c \
879         usr.bin/tsort usr.bin/tr usr.bin/join usr.bin/wc usr.bin/basename \
880         usr.bin/gencat usr.bin/chflags usr.bin/expand usr.bin/paste \
881         usr.bin/uuencode usr.bin/cap_mkdb usr.bin/true usr.bin/false \
882         usr.bin/cmp usr.bin/xargs usr.bin/id usr.bin/env usr.bin/dirname \
883         usr.bin/tail usr.bin/unifdef \
884         usr.sbin/chown usr.sbin/mtree usr.sbin/config \
885         usr.sbin/btxld usr.sbin/zic usr.sbin/makewhatis \
886         gnu/usr.bin/grep usr.bin/sort usr.bin/gzip \
887         usr.bin/mkcsmapper usr.bin/mkesdb usr.bin/crunch
889 bootstrap-tools: bootstrap-tools-before bootstrap-tools-targets1 bootstrap-tools-targets2
890         touch ${BTOOLSDEST}/.bootstrap_done
892 bootstrap-tools-before:
893         ${LN} -fs /bin/date ${BTOOLSDEST}/bin/date
895 bootstrap-tools-targets1: ${BSTRAPDIRS1:S/^/bstrap-/}
897 bootstrap-tools-targets2: ${BSTRAPDIRS2:S/^/bstrap-/}
899 .ORDER: bootstrap-tools-before bootstrap-tools-targets1 bootstrap-tools-targets2
901 .ORDER: ${BSTRAPDIRS1:S/^/bstrap-/}
903 .for _tool in ${BSTRAPDIRS1} ${BSTRAPDIRS2}
904 bstrap-${_tool}!
905         ${ECHODIR} "===> ${_tool} (bootstrap-tools)"; \
906                 cd ${.CURDIR}/${_tool}; \
907                 make DIRPRFX=${_tool}/ obj; \
908                 make DIRPRFX=${_tool}/ depend; \
909                 make DIRPRFX=${_tool}/ all; \
910                 make DIRPRFX=${_tool}/ DESTDIR=${BTOOLSDEST} install
911 .endfor
913 # build-tools: Build special purpose build tools.
915 # XXX we may be able to remove or consolidate this into bootstrap-tools
916 # now that we have the native helper (.nx/.no) infrastructure.
918 .if exists(${.CURDIR}/share) && !defined(NO_SHARE)
919 _share= share/syscons/scrnmaps
920 .endif
922 # XXX we should separate this into new Makefile.inc2.
923 # Just to prepare for reduction of ORDER: that slows down parallel crossworld.
925 # Make sure Makefile.inc1 logic is intact.
926 .if !defined(WORLD_ALTCOMPILER)
927 .warning undefined WORLD_ALTCOMPILER
928 .endif
930 _gcc_common_cross= lib/libz gnu/usr.bin/gmp gnu/usr.bin/mpfr gnu/usr.bin/mpc
931 _gcc50_cross= gnu/usr.bin/cc50
932 _gcc50_tools= gnu/usr.bin/cc50/cc_prep gnu/usr.bin/cc50/cc_tools
933 .if !defined(NO_ALTCOMPILER)
934 . if defined(WORLD_ALTCOMPILER) && (${WORLD_ALTCOMPILER} == "all" || ${WORLD_ALTCOMPILER:Mgcc47})
935 _gcc47_cross= gnu/usr.bin/cc47
936 _gcc47_tools= gnu/usr.bin/cc47/cc_prep gnu/usr.bin/cc47/cc_tools
937 _altcompiler_cross+= ${_gcc47_cross}
938 _altcompiler_tools+= _gcc47_tools
939 . endif
940 .endif
941 _custom_cross= libexec/customcc
942 _binutils= gnu/usr.bin/${WORLD_BINUTILSVER}
944 .for _atools in ${_altcompiler_tools}
945 BTOOLSDIRS+=    ${${_atools}}
946 .endfor
947 BTOOLSDIRS+=    ${_gcc50_tools}
948 BTOOLSDIRS+=    ${_share}
950 build-tools: build-tools-targets
951         touch ${BTOOLSDEST}/.build_done
953 build-tools-targets: ${BTOOLSDIRS:S/^/btools-/}
955 .for _atools in ${_altcompiler_tools}
956 .ORDER: ${${_atools}:C/^/btools-/}
957 .endfor
958 .ORDER: ${_gcc50_tools:S/^/btools-/}
960 .for _tool in ${BTOOLSDIRS}
961 btools-${_tool}!
962         ${ECHODIR} "===> ${_tool} (build-tools)"; \
963                 cd ${.CURDIR}/${_tool}; \
964                 make DIRPRFX=${_tool}/ obj; \
965                 make DIRPRFX=${_tool}/ depend; \
966                 make DIRPRFX=${_tool}/ all; \
967                 make DIRPRFX=${_tool}/ DESTDIR=${BTOOLSDEST} install
968 .endfor
971 # cross-tools: Build cross-building tools
973 .if ${TARGET_ARCH} == "i386" && ${MACHINE_ARCH} != "i386"
974 _btxld= usr.sbin/btxld
975 .endif
977 CTOOLSDIRS= ${_btxld} ${_binutils} \
978                 usr.bin/objformat usr.bin/crunch/crunchide \
979                 ${_gcc_common_cross} \
980                 ${_altcompiler_cross} \
981                 ${_gcc50_cross} ${_custom_cross}
983 cross-tools: cross-tools-targets
984         touch ${CTOOLSDEST}/.cross_done
986 cross-tools-targets: ${CTOOLSDIRS:S/^/ctools-/}
988 .for _tool in ${CTOOLSDIRS}
989 ctools-${_tool}!
990         ${ECHODIR} "===> ${_tool} (cross-tools)"; \
991                 cd ${.CURDIR}/${_tool}; \
992                 make DIRPRFX=${_tool}/ obj; \
993                 make DIRPRFX=${_tool}/ depend; \
994                 make DIRPRFX=${_tool}/ all; \
995                 make DIRPRFX=${_tool}/ DESTDIR=${CTOOLSDEST} install
996 .endfor
999 # hierarchy - ensure that all the needed directories are present
1001 hierarchy:
1002         cd ${.CURDIR}/etc;              make distrib-dirs
1005 # libraries - build all libraries, and install them under ${DESTDIR}.
1007 # The list of libraries with dependents (${_prebuild_libs}) and their
1008 # interdependencies (__L) are built automatically by the
1009 # ${.CURDIR}/tools/make_libdeps.sh script.
1011 # .makeenv does not work when bootstrapping from 4.x, so we must be sure
1012 # to specify the correct CCVER or 'cc' will not exec the correct compiler.
1014 libraries:
1015         cd ${.CURDIR}; \
1016             HOST_CCVER=${HOST_CCVER} CCVER=gcc50 \
1017                 make -f Makefile.inc1 _startup_libs50 -DSYSBUILD;
1018 .if !defined(NO_ALTCOMPILER)
1019 . if defined(WORLD_ALTCOMPILER) && (${WORLD_ALTCOMPILER} == "all" || ${WORLD_ALTCOMPILER:Mgcc47})
1020         cd ${.CURDIR}; \
1021             HOST_CCVER=${HOST_CCVER} CCVER=gcc47 \
1022                 make -f Makefile.inc1 _startup_libs47 -DSYSBUILD;
1023 . endif
1024 .endif
1025         cd ${.CURDIR}; \
1026             make -f Makefile.inc1 _startup_libs -DSYSBUILD; \
1027             make -f Makefile.inc1 _prebuild_libs -DSYSBUILD; \
1028             make -f Makefile.inc1 _generic_libs -DSYSBUILD;
1029         touch ${WORLDDEST}/.libraries_done
1031 # These dependencies are not automatically generated:
1033 # gnu/lib/${CCVER}/libgcc and gnu/lib/${CCVER}/csu must be built before all
1034 # shared libraries for ELF.  The target for _startup_libsXX is
1035 # specifically built using gccXX.
1037 .if !defined(NO_ALTCOMPILER)
1038 _startup_libs47=        gnu/usr.bin/cc47/cc_prep \
1039                         gnu/usr.bin/cc47/cc_tools \
1040                         gnu/lib/gcc47/csu \
1041                         gnu/lib/gcc47/libgcc \
1042                         gnu/lib/gcc47/libgcc_eh \
1043                         gnu/lib/gcc47/libgcc_pic
1044 . if defined(WORLD_ALTCOMPILER) && (${WORLD_ALTCOMPILER} == "all" || ${WORLD_ALTCOMPILER:Mgcc47})
1045 _startup_libs_alt+=     _startup_libs47
1046 . endif
1047 .endif
1048 _startup_libs50=        gnu/usr.bin/cc50/cc_prep \
1049                         gnu/usr.bin/cc50/cc_tools \
1050                         gnu/lib/gcc50/csu \
1051                         gnu/lib/gcc50/libgcc \
1052                         gnu/lib/gcc50/libgcc_eh \
1053                         gnu/lib/gcc50/libgcc_pic
1054 _startup_libs=          lib/csu lib/libc lib/libc_rtld
1056 _prebuild_libs=         lib/libbz2 lib/libz
1057 _prebuild_libs+=        lib/libutil
1059 _prebuild_libs+=        lib/libpcap
1061 _generic_libs=  gnu/lib
1063 _prebuild_libs+= lib/libcrypt lib/libmd \
1064                 lib/libncurses/libncurses
1066 lib/libopie__L lib/libradius__L lib/libtacplus__L: lib/libmd__L
1068 _generic_libs+= lib
1070 _prebuild_libs+=        lib/librecrypto lib/libressl
1071 _prebuild_libs+=        lib/libssh
1072 lib/libssh__L: lib/librecrypto__L lib/libz__L
1073 lib/libopie__L: lib/librecrypto__L
1075 _prebuild_libs+= lib/libopie
1077 _prebuild_libs+= lib/libradius lib/libsbuf lib/libtacplus lib/libm \
1078                 lib/libpam/libpam lib/libypclnt lib/lib${THREAD_LIB} \
1079                 lib/libpthread lib/liblzma lib/libprop lib/libdevattr
1081 _generic_libs+= usr.bin/flex/lib
1083 .for _alib in ${_startup_libs_alt}
1084 __startup_alibs+= ${${_alib}}
1085 .endfor
1087 .for _lib in ${__startup_alibs} ${_startup_libs50} \
1088                 ${_startup_libs} ${_prebuild_libs} ${_generic_libs}
1089 ${_lib}__L: .PHONY
1090 .if exists(${.CURDIR}/${_lib})
1091         @${ECHODIR} "===> ${_lib}"; \
1092                 cd ${.CURDIR}/${_lib}; \
1093                 echo "STEP DEP ${_lib}"; \
1094                 make DIRPRFX=${_lib}/ depend; \
1095                 echo "STEP ALL ${_lib}"; \
1096                 make DIRPRFX=${_lib}/ all; \
1097                 echo "STEP INSTALL ${_lib}"; \
1098                 make DIRPRFX=${_lib}/ install; \
1099                 echo "STEP DONE ${_lib}";
1100 .else
1101 .warning missing ${.CURDIR}/${_lib} directory.
1102 .endif
1103 .endfor
1105 _startup_libs: ${_startup_libs:S/$/__L/}
1106 .for _alib in ${_startup_libs_alt}
1107 ${_alib}: ${${_alib}:C/$/__L/}
1108 .endfor
1109 _startup_libs50: ${_startup_libs50:S/$/__L/}
1110 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
1111 _generic_libs: ${_generic_libs:S/$/__L/}
1113 # library targets must be ordered because there are inter-library
1114 # races (e.g. generation of tconfig.h)
1116 .for _alib in ${_startup_libs_alt}
1117 .ORDER: ${${_alib}:C/$/__L/}
1118 .endfor
1119 .ORDER: ${_startup_libs50:S/$/__L/}
1120 .ORDER: ${_startup_libs:S/$/__L/}
1121 .ORDER: ${_prebuild_libs:S/$/__L/}
1122 .ORDER: ${_generic_libs:S/$/__L/}
1124 .for __target in clean cleandepend cleandir obj depend includes
1125 .for entry in ${SUBDIR}
1126 ${entry}.${__target}__D: .PHONY
1127         @if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
1128                 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
1129                 edir=${entry}.${MACHINE_ARCH}; \
1130                 cd ${.CURDIR}/$${edir}; \
1131         else \
1132                 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \
1133                 edir=${entry}; \
1134                 cd ${.CURDIR}/$${edir}; \
1135         fi; \
1136         make ${__target} DIRPRFX=${DIRPRFX}$${edir}/
1137 .endfor
1138 par-${__target}: ${SUBDIR:C/$/.${__target}__D/}
1139 .ORDER: ${SUBDIR:C/$/.${__target}__D/}
1140 .endfor
1141 .ORDER: par-clean par-cleandepend par-cleandir par-obj par-depend par-includes
1143 # The wmake target is used by /usr/bin/wmake to run make in a
1144 # world build environment.
1146 wmake:
1147         @echo '${WMAKEENV} make ${WMAKE_ARGS} -DSYSBUILD'
1149 wmakeenv:
1150         @echo '${WMAKEENV} /bin/sh'
1152 bmake:
1153         @echo '${BMAKEENV} make ${BMAKE_ARGS} -DSYSBUILD'
1155 bmakeenv:
1156         @echo '${BMAKEENV} /bin/sh'
1158 tmake:
1159         @echo '${TMAKEENV} make ${TMAKE_ARGS} -DSYSBUILD'
1161 tmakeenv:
1162         @echo '${TMAKEENV} /bin/sh'
1164 xmake:
1165         @echo '${XMAKEENV} make ${XMAKE_ARGS} -DSYSBUILD'
1167 xmakeenv:
1168         @echo '${XMAKEENV} /bin/sh'
1170 backupworld: backup-clean
1171         @mkdir -p ${WORLD_BACKUP}
1172 .if (exists(${DESTDIR}/sbin) && exists(${DESTDIR}/bin) && \
1173      exists(${DESTDIR}/usr/sbin) && exists(${DESTDIR}/usr/bin) && \
1174      exists(${DESTDIR}/usr/lib) && exists(${DESTDIR}/usr/libexec))
1175         tar -czf ${WORLD_BACKUP}/binaries.tar.gz -C ${DESTDIR}/ \
1176                 --options gzip:compression-level=1 \
1177                 sbin bin usr/sbin usr/bin usr/lib usr/libexec
1178 .endif
1180 backupworld-auto:
1181 .if !defined(NO_BACKUP)
1182         rm -f ${AUTO_BACKUP}/binaries.tar.gz
1183         @mkdir -p ${AUTO_BACKUP}
1184 .if (exists(${DESTDIR}/sbin) && exists(${DESTDIR}/bin) && \
1185      exists(${DESTDIR}/usr/sbin) && exists(${DESTDIR}/usr/bin) && \
1186      exists(${DESTDIR}/usr/lib) && exists(${DESTDIR}/usr/libexec))
1187         /usr/bin/tar -czf ${AUTO_BACKUP}/binaries.tar.gz -C ${DESTDIR}/ \
1188                 --options gzip:compression-level=1 \
1189                 sbin bin usr/sbin usr/bin usr/lib usr/libexec
1190 .endif
1191 .endif
1193 backup-auto-clean:
1194         rm -f ${AUTO_BACKUP}/binaries.tar.gz
1196 backup-clean:
1197         rm -f ${WORLD_BACKUP}/binaries.tar.gz
1199 restoreworld:
1200 .if !exists(${WORLD_BACKUP}/binaries.tar.gz)
1201         @echo "There does not seem to be a valid archive present."
1202 .else
1203         @echo "Restoring system binaries from manual backup archive..."
1204         @chflags -R noschg ${DESTDIR}/sbin ${DESTDIR}/bin \
1205                 ${DESTDIR}/usr/sbin ${DESTDIR}/usr/bin \
1206                 ${DESTDIR}/usr/lib ${DESTDIR}/usr/libexec
1207         tar -xzf ${WORLD_BACKUP}/binaries.tar.gz -C ${DESTDIR}/
1208 .endif
1210 restoreworld-auto:
1211 .if !exists(${AUTO_BACKUP}/binaries.tar.gz)
1212         @echo "There does not seem to be a valid archive present."
1213 .else
1214         @echo "Restoring system binaries from auto-backup archive..."
1215         @chflags -R noschg ${DESTDIR}/sbin ${DESTDIR}/bin \
1216                 ${DESTDIR}/usr/sbin ${DESTDIR}/usr/bin \
1217                 ${DESTDIR}/usr/lib ${DESTDIR}/usr/libexec
1218         tar -xzf ${AUTO_BACKUP}/binaries.tar.gz -C ${DESTDIR}/
1219 .endif
1221 # Take advantage of bmake error response
1223 MAKE_PRINT_VAR_ON_ERROR= \
1224         .CURDIR \
1225         .OBJDIR \
1226         LD_LIBRARY_PATH \
1227         MACHINE_ARCH \
1228         MACHINE \
1229         MAKEFILE \
1230         WORLD_ALTCOMPILER \
1231         .TARGETS \
1232         .ERROR_TARGET \
1233         .MAKE.LEVEL
1235 .include <bsd.subdir.mk>