2 # $FreeBSD: src/Makefile.inc1,v 1.141.2.62 2003/04/06 19:54:00 dwmalone Exp $
4 # This file defines the user-driven targets.
6 # Standard targets are documented in the makefiles in /usr/share/mk and include:
7 # obj depend all install clean cleandepend cleanobj
9 # Build-time options are documented in make.conf(5).
12 DFLYVERSION!= awk '/^\#define[[:blank:]]__DragonFly_version/ {print $$3}' \
13 < ${.CURDIR}/sys/sys/param.h
15 OSREL!= echo ${DFLYVERSION} | \
16 awk '{a=int($$1/100000); b=int(($$1-(a*100000))/100); \
19 # Put initial settings here.
22 # /libexec/ld-elf.so.2 needs to be installed first
23 # Otherwise, install(1) beeing a dynamically linked binary will fail
24 # during the first upgrade from a static to a dynamic world
27 # We need to do include and lib early.
33 .if !defined(NO_GAMES)
38 .if !defined(NO_SHARE)
48 # These are last, since it is nice to at least get the base system
49 # rebuilt before you do them.
50 .if defined(LOCAL_DIRS)
51 .for _DIR in ${LOCAL_DIRS}
52 .if exists(${.CURDIR}/${_DIR}) & exists(${.CURDIR}/${_DIR}/Makefile)
58 .if defined(SUBDIR_OVERRIDE)
59 SUBDIR= ${SUBDIR_OVERRIDE}
62 .if defined(NOCLEANDIR)
63 CLEANDIR= clean cleandepend
72 # Base of the checked-out dports repo to use when WITH_DPORTS is enabled.
73 # This will be null-mounted and merged with /usr/src/dports.base in the
74 # chroot (buildportschroot) via build-all and install-all.
76 DPORTSBASE?= /usr/dports
78 # Object directory base in primary make. Note that when we rerun make
79 # from inside this file we change MAKEOBJDIRPREFIX to the appropriate
80 # subdirectory because the rest of the build system needs it that way.
81 # The original object directory base is saved in OBJTREE.
83 MAKEOBJDIRPREFIX?= /usr/obj
84 OBJTREE?= ${MAKEOBJDIRPREFIX}
86 # Used for stage installs and pathing
88 DESTDIRBASE:= ${OBJTREE}${.CURDIR}
90 # Remove DESTDIR from MAKEFLAGS. It is present in the environment
91 # anyhow, and we need to be able to override it for stage installs
92 .MAKEFLAGS:= ${.MAKEFLAGS:NDESTDIR=*}
94 # This section sets the tools used to build the world/kernel
97 WORLD_BINUTILSVER?= binutils234
99 .if !defined(NO_BACKUP)
100 # Set the backup parameters if they are not already defined
102 WORLD_BACKUP?= /var/backups/world_backup
103 AUTO_BACKUP?= ${OBJTREE}/world_backup/${DESTDIR}
106 TARGET_ARCH?= ${MACHINE_ARCH}
107 .if ${TARGET_ARCH} == ${MACHINE_ARCH}
110 TARGET?= ${TARGET_ARCH}
113 BUILD_ARCH!= sysctl -n hw.machine_arch
115 # temporary until everybody has converted to x86_64
116 .if ${BUILD_ARCH} == "amd64"
120 .if ${MACHINE_ARCH} != ${BUILD_ARCH}
121 .error To cross-build, set TARGET_ARCH.
125 # XXX this is ugly and we need to come up with a nicer solution
126 .if !defined(TARGET_PLATFORM)
127 .if ${TARGET_ARCH} == "x86_64"
128 TARGET_PLATFORM= pc64
130 .error Unknown target architecture.
134 THREAD_LIB?= thread_xu
136 # BTOOLS (Natively built) All non-cross-development tools that the
137 # main build needs. This includes things like 'mkdir' and 'rm'.
138 # We will not use the native system's exec path once we start
139 # on WORLD. (bootstrap-tools and build-tools or BTOOLS)
141 # CTOOLS (Natively built) Cross development tools which are specific
142 # to the target architecture.
144 # WORLD (Cross built) Our ultimate buildworld, using only BTOOLS and
147 # MACHINE_PLATFORM Platform Architecture we are building on
148 # MACHINE Machine Architecture (usually the same as MACHINE_ARCH)
149 # MACHINE_ARCH CPU Architecture we are building on
151 # TARGET_PLATFORM Platform Architecture we are building for
152 # TARGET Machine Architecture we are building for
153 # TARGET_ARCH CPU Architecture we are building for
155 BTOOLSDEST= ${DESTDIRBASE}/btools_${MACHINE_ARCH}
156 CTOOLSDEST= ${DESTDIRBASE}/ctools_${MACHINE_ARCH}_${TARGET_ARCH}
157 WORLDDEST= ${DESTDIRBASE}/world_${TARGET_ARCH}
159 # The bootstrap-tools path is used by the bootstrap-tools, build-tools, and
160 # cross-tools stages to augment the existing command path to access newer
161 # versions of certain utilities that the cross-tools stage might expect.
163 BTOOLSPATH= ${BTOOLSDEST}/usr/sbin:${BTOOLSDEST}/usr/bin:${BTOOLSDEST}/sbin:${BTOOLSDEST}/bin
165 # The cross-tools path containing the cross-tools to cross build the
168 CTOOLSPATH= ${CTOOLSDEST}/usr/sbin:${CTOOLSDEST}/usr/bin:${CTOOLSDEST}/sbin:${CTOOLSDEST}/bin
170 # The strict temporary command path contains all binaries required
171 # by the buildworld system after the cross-tools stage.
173 # NOTE: Append '/usr/local/bin:/usr/local/sbin' to support external compilers.
174 # See compilers.conf(5) man page for more info.
176 STRICTTMPPATH= ${CTOOLSPATH}:${BTOOLSPATH}:/usr/local/bin:/usr/local/sbin
182 # Building a world goes through the following stages
184 # 1. bootstrap-tool stage [BMAKE]
185 # This stage is responsible for creating programs that
186 # are needed for backward compatibility reasons. They
187 # are not built as cross-tools.
188 # 2. build-tool stage [TMAKE]
189 # This stage is responsible for creating the object
190 # tree and building any tools that are needed during
192 # 3. cross-tool stage [XMAKE]
193 # This stage is responsible for creating any tools that
194 # are needed for cross-builds. A cross-compiler is one
196 # 4. world stage [WMAKE]
197 # This stage actually builds the world.
198 # 5. install stage (optional) [IMAKE]
199 # This stage installs a previously built world.
201 # In all cases we must carefully adjust the environment so the proper
202 # tools and header files are used.
204 # NOTE: The M4 environment variable is used by the [f]lex binary to
205 # override the location of the 'm4' binary. The override is
206 # needed for certain buildworld version transitions, specifically
207 # past a certain point in 3.3 because the older /usr/bin/m4 will
208 # generate output that will blow up the newer [f]lex/yacc/bison
212 # bootstrap-tool stage
214 BMAKEENV= MAKEOBJDIRPREFIX=${BTOOLSDEST} \
216 DESTDIR=${BTOOLSDEST} \
218 _SHLIBDIRPREFIX=${BTOOLSDEST} \
219 PATH=${BTOOLSPATH}:${PATH} \
220 M4=${BTOOLSDEST}/usr/bin/m4 \
221 INSTALL="sh ${.CURDIR}/tools/install.sh"
223 BMAKE= ${BMAKEENV} make -f Makefile.inc1 -DBOOTSTRAPPING \
224 -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED \
225 -DNO_WERROR -DNO_NLS -DSYSBUILD
229 TMAKEENV= MAKEOBJDIRPREFIX=${BTOOLSDEST} \
233 PATH=${BTOOLSPATH}:${PATH} \
234 M4=${BTOOLSDEST}/usr/bin/m4 \
235 INSTALL="sh ${.CURDIR}/tools/install.sh"
237 TMAKE= ${TMAKEENV} make -f Makefile.inc1 -DBOOTSTRAPPING \
238 -DNOSHARED -DSYSBUILD
242 # note: TOOLS_PREFIX points to the obj root holding the cross
243 # compiler binaries, while USRDATA_PREFIX points to the obj root
244 # holding the target environment (and also determines where cross-built
245 # libraries, crt*.o, and include files are installed).
247 XMAKEENV= MAKEOBJDIRPREFIX=${CTOOLSDEST} \
249 DESTDIR=${CTOOLSDEST} \
251 _SHLIBDIRPREFIX=${CTOOLSDEST} \
252 INSTALL="sh ${.CURDIR}/tools/install.sh" \
253 TOOLS_PREFIX=${CTOOLSDEST} \
254 USRDATA_PREFIX=${WORLDDEST} \
255 SELECT_LINKER=${WORLD_LDVER} \
256 M4=${BTOOLSDEST}/usr/bin/m4 \
257 PATH=${BTOOLSPATH}:${PATH}
259 XMAKE= ${XMAKEENV} make -f Makefile.inc1 -DNO_GDB \
260 -DBOOTSTRAPPING -DNOMAN -DNOSHARED -DSYSBUILD
262 # world stage, note the strict path and note that TOOLS_PREFIX is left
263 # unset and USRDATA_PREFIX (which defaults to TOOLS_PREFIX) is set to empty,
264 # which is primarily for the compiler so it targets / (e.g. /usr/<blah>)
265 # for both binary and library paths, even though it is being compiled to
266 # WORLDDEST. None of the programs in the world stage are ever actually
267 # executed during the buildworld/installworld.
269 CROSSENV= MAKEOBJDIRPREFIX=${WORLDDEST} \
271 MACHINE_ARCH=${TARGET_ARCH} \
273 MACHINE_PLATFORM=${TARGET_PLATFORM} \
275 OBJFORMAT_PATH=${CTOOLSDEST} \
276 HOST_CCVER=${HOST_CCVER} \
277 CCVER=${WORLD_CCVER} \
278 LDVER=${WORLD_LDVER} \
279 BINUTILSVER=${WORLD_BINUTILSVER}
281 WMAKEENV= ${CROSSENV} \
283 DESTDIR=${WORLDDEST} \
284 _SHLIBDIRPREFIX=${WORLDDEST} \
285 INSTALL="sh ${.CURDIR}/tools/install.sh" \
286 M4=${BTOOLSDEST}/usr/bin/m4 \
287 PATH=${STRICTTMPPATH}
289 WMAKE= ${WMAKEENV} make -f Makefile.inc1 -DSYSBUILD
293 IMAKEENV= ${CROSSENV} \
294 PATH=${STRICTTMPPATH}
295 IMAKE= ${IMAKEENV} make -f Makefile.inc1 -DSYSBUILD
299 KMAKEENV= ${WMAKEENV}
303 # Attempt to rebuild the entire system, with reasonable chance of
304 # success, regardless of how old your existing system is.
306 _worldtmp: _cleantmp _mtreetmp
307 .ORDER: _cleantmp _mtreetmp
310 .if !defined(NOCLEAN)
311 -chflags -R noschg ${BTOOLSDEST} ${CTOOLSDEST} ${WORLDDEST}
312 rm -rf ${BTOOLSDEST} ${CTOOLSDEST} ${WORLDDEST}
314 # XXX - These two can depend on any header file.
315 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
316 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
321 @echo "--------------------------------------------------------------"
322 @echo ">>> Rebuilding the temporary build tree"
323 @echo "--------------------------------------------------------------"
324 mkdir -p ${DESTDIRBASE} ${BTOOLSDEST} ${CTOOLSDEST} ${WORLDDEST}
325 .for _dir in ${WORLDDEST} ${BTOOLSDEST} ${CTOOLSDEST}
326 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
327 -p ${_dir}/ > /dev/null
328 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
329 -p ${_dir}/usr > /dev/null
331 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
332 -p ${WORLDDEST}/usr/include > /dev/null
333 ${LN} -sf ${.CURDIR}/sys ${WORLDDEST}
335 _bwcleanup: umountports
336 mkdir -p ${DESTDIRBASE}
337 chflags -R noschg ${DESTDIRBASE}
338 rm -rxf ${DESTDIRBASE}
341 @echo "--------------------------------------------------------------"
342 @echo ">>> starting buildworld target"
343 @echo "--------------------------------------------------------------"
346 @echo "--------------------------------------------------------------"
347 @echo ">>> stage 1: bootstrap tools"
348 @echo "--------------------------------------------------------------"
349 cd ${.CURDIR}; ${BMAKE} bootstrap-tools
352 @echo "--------------------------------------------------------------"
353 @echo ">>> stage 2a: cleaning up the object tree"
354 @echo "--------------------------------------------------------------"
355 cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
358 @echo "--------------------------------------------------------------"
359 @echo ">>> stage 2b: rebuilding the object tree"
360 @echo "--------------------------------------------------------------"
361 cd ${.CURDIR}; ${WMAKE} par-obj
364 @echo "--------------------------------------------------------------"
365 @echo ">>> stage 2c: build tools"
366 @echo "--------------------------------------------------------------"
367 cd ${.CURDIR}; ${TMAKE} build-tools
370 @echo "--------------------------------------------------------------"
371 @echo ">>> stage 3: cross tools"
372 @echo "--------------------------------------------------------------"
373 cd ${.CURDIR}; ${XMAKE} cross-tools
376 @echo "--------------------------------------------------------------"
377 @echo ">>> stage 4a: populating ${WORLDDEST}/usr/include"
378 @echo "--------------------------------------------------------------"
379 cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
382 @echo "--------------------------------------------------------------"
383 @echo ">>> stage 4b: building libraries"
384 @echo "--------------------------------------------------------------"
385 cd ${.CURDIR}; ${WMAKE} -DNOHTML -DNOMAN -DNOFSCHG libraries
388 @echo "--------------------------------------------------------------"
389 @echo ">>> stage 4c: make dependencies"
390 @echo "--------------------------------------------------------------"
391 cd ${.CURDIR}; ${WMAKE} par-depend
394 @echo "--------------------------------------------------------------"
395 @echo ">>> stage 4d: building everything"
396 @echo "--------------------------------------------------------------"
397 cd ${.CURDIR}; ${WMAKE} all
400 @echo "--------------------------------------------------------------"
401 @echo ">>> stage 5: building rescue and initrd"
402 @echo "--------------------------------------------------------------"
403 .if !defined(NO_INITRD)
404 cd ${.CURDIR}/initrd; ${WMAKEENV} make all
407 @echo "--------------------------------------------------------------"
408 @echo ">>> buildworld target complete"
409 @echo "--------------------------------------------------------------"
411 @echo "--------------------------------------------------------------"
412 @echo ">>> starting quickworld target"
413 @echo "--------------------------------------------------------------"
415 @echo "--------------------------------------------------------------"
416 @echo ">>> quickworld target complete"
417 @echo "--------------------------------------------------------------"
419 @echo "--------------------------------------------------------------"
420 @echo ">>> starting installworld target"
421 @echo "--------------------------------------------------------------"
423 # note: buildworld no longer depends on _cleanobj because we rm -rf the
424 # entire object tree and built the bootstrap tools in a different location.
426 # buildworld - build everything from scratch
427 # quickworld - skip the bootstrap, build, and cross-build steps
428 # realquickworld - skip the bootstrap, build, crossbuild, and depend step.
430 # note: we include _obj in realquickworld to prevent accidental creation
431 # of files in /usr/src.
434 .if !defined(SUBDIR_OVERRIDE)
435 WMAKE_TGTS+= _worldtmp _bootstrap-tools
437 WMAKE_TGTS+= _obj _build-tools
438 .if !defined(SUBDIR_OVERRIDE)
439 WMAKE_TGTS+= _cross-tools
441 WMAKE_TGTS+= _includes _libraries _depend everything _initrd
443 .if defined(WMAKE_TGTS_OVERRIDE)
445 WMAKE_TGTS= ${WMAKE_TGTS_OVERRIDE}
448 QMAKE_TGTS= _mtreetmp _obj _includes _libraries _depend everything _initrd
450 buildworld: _bwinit ${WMAKE_TGTS} _bwdone
452 quickworld: _qwinit ${QMAKE_TGTS} _qwdone
454 realquickworld: _qwinit _mtreetmp _obj _includes _libraries everything _qwdone
456 crossworld: _worldtmp _bootstrap-tools _obj _build-tools _cross-tools
458 .ORDER: umountports mountports
459 GENLOGDIR= /usr/obj${.CURDIR}
461 # Build a chroot environment for buildports
463 # The chroot environment is built by doing a fresh make installworld
464 # and make distribution, mounting expected filesystems, doing the
465 # initial ldconfig setup, and copying resolv.conf to hopefully get
466 # a working network. Without these elements, various parts of dsynth
467 # and the pkg system will bail.
469 buildportschroot: umountports
470 mkdir -p ${WORLDDEST}/chroot
471 mkdir -p ${WORLDDEST}/chroot/usr/src
472 @echo "building chroot, logfile in: ${GENLOGDIR}/chroot.out"
473 @(cd ${.CURDIR}; ${MAKE} -j `sysctl -n hw.ncpu` installworld DESTDIR=${WORLDDEST}/chroot > ${GENLOGDIR}/chroot.out 2>&1)
474 @(cd ${.CURDIR}/etc; ${MAKE} -j `sysctl -n hw.ncpu` distribution DESTDIR=${WORLDDEST}/chroot >> ${GENLOGDIR}/chroot.out 2>&1)
475 @echo "mounting procfs, devfs, tmpfs in chroot"
476 @(cd ${.CURDIR}; ${MAKE} mountports >> ${GENLOGDIR}/chroot.out 2>&1)
477 chroot ${WORLDDEST}/chroot /bin/csh -c "cd /etc/rc.d; sh ldconfig start"
478 cp /etc/resolv.conf ${WORLDDEST}/chroot/etc/
479 @(cd ${.CURDIR}; ${MAKE} umountports >> ${GENLOGDIR}/chroot.out 2>&1)
481 # Build dragonfly/base dports using the chroot environment setup by
484 # NOTE: The real system's /usr/distfiles.base is shared with the chroot and
485 # dsynth will fetch source dists as necessary. If the real system
486 # is not yet fully up-to-date, it might not have its /usr/distfiles.base
487 # yet though so create it if necessary.
489 buildports: umountports mountports
490 mkdir -p ${WORLDDEST}/chroot
491 mkdir -p ${WORLDDEST}/chroot/build/synth
492 mkdir -p ${WORLDDEST}/chroot/build/synth/live_packages
493 mkdir -p ${WORLDDEST}/chroot/build/synth/logs
494 mkdir -p ${WORLDDEST}/chroot/build/synth/options
495 mkdir -p ${WORLDDEST}/chroot/build/synth/build
496 mkdir -p /usr/distfiles.base
497 cp ${.CURDIR}/dports.base/dsynth.ini ${WORLDDEST}/chroot/build/synth/
498 cp ${.CURDIR}/dports.base/pkg.conf ${WORLDDEST}/chroot/build/
499 @echo "dsynth logs will be stored in ${WORLDDEST}/chroot/build/synth/logs"
500 @echo "pkg file path: file:///${WORLDDEST}/chroot/build/synth/live_packages/"
501 chroot ${WORLDDEST}/chroot dsynth -SS -y -C /build/synth build dragonfly/base
502 @(cd ${.CURDIR}; ${MAKE} umountports)
504 # Install base system ports (does not require the chroot but does require
505 # the dports stuff that was built in the chroot)
507 # NOTE: At the moment, the pkg install command may require interactivity,
508 # do not redirect. We have to adjust pkg.conf's paths because
509 # we are installing relative to the real root and not the chroot.
511 installports: umountports mountports
512 cd ${WORLDDEST} && tar xvzpf ${WORLDDEST}/chroot/build/synth/live_packages/All/pkg-*.pkg > /dev/null 2>&1
513 cat ${.CURDIR}/dports.base/pkg.conf | sed -e 's#/build#${WORLDDEST}/chroot/build#' > ${WORLDDEST}/chroot/build/pkg.conf
514 ${WORLDDEST}/usr/local/sbin/pkg-static --rootdir ${DESTDIR}/ -R ${WORLDDEST}/chroot/build install dragonfly-base
515 @(cd ${.CURDIR}; ${MAKE} umountports)
517 .ORDER: build-all install-all
520 @echo "mounting for ports chroot"
521 mount_devfs dummy ${WORLDDEST}/chroot/dev
522 mount_procfs dummy ${WORLDDEST}/chroot/proc
523 mount_tmpfs dummy ${WORLDDEST}/chroot/tmp
524 mount_tmpfs dummy ${WORLDDEST}/chroot/var/tmp
525 mount_null ${.CURDIR} ${WORLDDEST}/chroot/usr/src
526 mount_null ${DPORTSBASE} ${WORLDDEST}/chroot/usr/src/dports.base
527 mkdir -p ${WORLDDEST}/chroot/usr/src/dports.base/dragonfly
528 mount_null ${.CURDIR}/dports.base/dragonfly ${WORLDDEST}/chroot/usr/src/dports.base/dragonfly
529 mount_null /usr/distfiles.base ${WORLDDEST}/chroot/usr/distfiles.base
531 # Cleanup the chroot's mounts but otherwise leave it intact
533 # Strange make lines avoid junk reporting to stderr
536 @echo "cleanup any old dsynth mounts (if any)"
537 -@chroot ${WORLDDEST}/chroot dsynth -SS -y -C /build/synth cleanup > /dev/null 2>&1 || true
538 @echo "unmount old chroot devfs, procfs, etc (if any)"
539 -@umount -f ${WORLDDEST}/chroot/usr/distfiles.base > /dev/null 2>&1 || true
540 -@umount -f ${WORLDDEST}/chroot/usr/src/dports.base/dragonfly > /dev/null 2>&1 || true
541 -@umount -f ${WORLDDEST}/chroot/usr/src/dports.base > /dev/null 2>&1 || true
542 -@umount -f ${WORLDDEST}/chroot/usr/src > /dev/null 2>&1 || true
543 -@umount -f ${WORLDDEST}/chroot/dev > /dev/null 2>&1 || true
544 -@umount -f ${WORLDDEST}/chroot/proc > /dev/null 2>&1 || true
545 -@umount -f ${WORLDDEST}/chroot/tmp > /dev/null 2>&1 || true
546 -@umount -f ${WORLDDEST}/chroot/var/tmp > /dev/null 2>&1 || true
551 build-all: _bwcleanup
552 @echo "Building world, log file in ${GENLOGDIR}/bw.out"
553 @mkdir -p ${GENLOGDIR}
554 @(cd ${.CURDIR}; ${MAKE} -j `sysctl -n hw.ncpu` buildworld > ${GENLOGDIR}/bw.out 2>&1)
556 @echo "Building kernel, log file in ${GENLOGDIR}/bk.out"
557 @(cd ${.CURDIR}; ${MAKE} -j `sysctl -n hw.ncpu` buildkernel > ${GENLOGDIR}/bk.out 2>&1)
558 @echo "build-all main buildworld and buildkernel completed ok"
560 .if defined(WITH_DPORTS)
561 @echo "Building dragonfly/base dports, logs in ${GENLOGDIR}/bp.out"
562 @echo "IF YOU INTERRUPT THE MAKE, THEN RUN make umountports"
563 @(cd ${.CURDIR}; ${MAKE} -j `sysctl -n hw.ncpu` buildportschroot > ${GENLOGDIR}/bp.out 2>&1)
564 @(cd ${.CURDIR}; ${MAKE} -j `sysctl -n hw.ncpu` buildports > ${GENLOGDIR}/bp.out 2>&1)
568 @echo "Installing kernel, log file in ${GENLOGDIR}/bk.out"
569 @mkdir -p ${GENLOGDIR}
570 @(cd ${.CURDIR}; ${MAKE} -j 1 installkernel >> ${GENLOGDIR}/bk.out 2>&1)
572 @echo "Installing world, log file in ${GENLOGDIR}/bw.out"
573 @(cd ${.CURDIR}; ${MAKE} -j 1 installworld >> ${GENLOGDIR}/bw.out 2>&1)
575 @echo "Upgrading world"
576 @(cd ${.CURDIR}; ${MAKE} -j 1 upgrade >> ${GENLOGDIR}/bw.out 2>&1)
578 @echo "install-all main world and kernel completed ok."
579 .if defined(WITH_DPORTS)
580 @echo "Installing dragonfly/base dports, log file in ${GENLOGDIR}/bp.out"
581 @(cd ${.CURDIR}; ${MAKE} -j `sysctl -n hw.ncpu` installports)
582 @(cd ${.CURDIR}; ${MAKE} -j `sysctl -n hw.ncpu` umountports >> ${GENLOGDIR}/bp.out 2>&1)
584 @echo "reboot recommended and after that, "
585 @echo "when doing a major upgrade, 'pkg upgrade -f' after rebooting"
587 .ORDER: _bwinit ${WMAKE_TGTS} _bwdone
588 .ORDER: _obj _includes
589 .ORDER: _qwinit _mtreetmp _obj
590 .ORDER: _bwcleanup _bwinit
591 .ORDER: installcheck backupworld-auto
592 .ORDER: everything _qwdone
597 # Checks to be sure system is ready for installworld
599 installcheck: _iwinit
600 .if !defined(OVERRIDE_CHECKS)
601 .if !defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/"
602 @case `uname -r` in \
603 1.2*|1.3-*|1.3.*|1.4.*|1.5.0-*|1.5.1-*|1.5.2-*|1.5.3-*) \
604 echo "You must upgrade your kernel to at least 1.5.4" \
605 "and reboot before you can safely installworld," \
606 "due to libc/system call ABI changes."; \
609 @case `uname -r` in \
610 1.*|2.*|3.0*|3.1*|3.2*|3.3*|3.4*|3.5*|3.6*) \
611 echo "The system is too old for a normal installworld," \
612 "you need to use 'installworld-force'."; \
620 # Backs up the current world if ${AUTO_BACKUP} is writable.
621 # Installs everything compiled by a 'buildworld'.
623 installworld: installcheck
624 .if !defined(NO_BACKUP)
625 -@mkdir -p ${AUTO_BACKUP} > /dev/null 2>&1
627 (touch ${AUTO_BACKUP}/.updating > /dev/null 2>&1 && \
628 ${IMAKE} backupworld-auto) || \
629 echo "Cannot write to ${AUTO_BACKUP} - world not backed up"
631 cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}
632 ${INSTALL} -o root -g wheel -m 644 ${.CURDIR}/Makefile_upgrade.inc \
633 ${DESTDIR}/etc/upgrade/
634 cd ${.CURDIR}; ${IMAKE} -DWORLDINSTALL os-release
635 .if !defined(NO_INITRD)
636 cd ${.CURDIR}; ${IMAKE} -DWORLDINSTALL initrd
639 @echo "--------------------------------------------------------------"
640 @echo ">>> installworld target complete"
641 @echo "--------------------------------------------------------------"
644 @echo "NAME=DragonFly" > ${DESTDIR}/etc/os-release
645 @echo "VERSION=${OSREL}-SYNTH" >> ${DESTDIR}/etc/os-release
646 @echo "VERSION_ID=${OSREL}" >> ${DESTDIR}/etc/os-release
647 @echo "ID=dragonfly" >> ${DESTDIR}/etc/os-release
648 @echo "ANSI_COLOR=\"0;32\"" >> ${DESTDIR}/etc/os-release
649 @echo "PRETTY_NAME=\"DragonFlyBSD ${OSREL}-SYNTH\"" >> ${DESTDIR}/etc/os-release
650 @echo "CPE_NAME=\"cpe:/o:dragonflybsd:dragonfly:${OSREL}\"" >> ${DESTDIR}/etc/os-release
651 @echo "SUPPORT_URL=\"http://chat.efnet.org:9090/?nick=dflynick&channels=%23dragonflybsd&Login=Login\"" >> ${DESTDIR}/etc/os-release
652 @echo "HOME_URL=\"https://www.dragonflybsd.org/\"" >> ${DESTDIR}/etc/os-release
653 @echo "BUG_REPORT_URL=\"https://bugs.dragonflybsd.org/\"" >> ${DESTDIR}/etc/os-release
654 @echo "MACHINE_ARCH=${MACHINE_ARCH}" >> ${DESTDIR}/etc/os-release
655 @echo "MACHINE=${MACHINE}" >> ${DESTDIR}/etc/os-release
656 @echo "DFLYVERSION=${DFLYVERSION}" >> ${DESTDIR}/etc/os-release
659 @echo "Doing a forced installworld. This will install to a temporary directory,"
660 @echo "then copy the main binaries and libraries with a static cpdup to ${DESTDIR}/"
661 @echo "and finally will issue a normal installworld."
663 @echo "Starting in 5 seconds. ^C to abort."
666 rm -rf /usr/obj/temp > /dev/null 2>&1 || chflags -R noschg /usr/obj/temp
668 mkdir -p /usr/obj/temp/cpdup/bin
669 (cd ${.CURDIR}/bin/cpdup; \
673 make CFLAGS=-static all install DESTDIR=/usr/obj/temp/cpdup NOMAN=TRUE)
674 @echo "XXXXXXXXX Installing to temporary XXXXXXXXX"
676 (cd ${.CURDIR}; ${MAKE} installworld DESTDIR=/usr/obj/temp > /dev/null 2>&1)
677 @echo "XXXXXXXXX Blasting binaries and libraries XXXXXXXXX"
679 /usr/obj/temp/cpdup/bin/cpdup -i0 /usr/obj/temp/bin /bin
680 /usr/obj/temp/cpdup/bin/cpdup -i0 /usr/obj/temp/sbin /sbin
681 /usr/obj/temp/cpdup/bin/cpdup -i0 /usr/obj/temp/lib /lib
682 /usr/obj/temp/cpdup/bin/cpdup -i0 /usr/obj/temp/usr/bin /usr/bin
683 /usr/obj/temp/cpdup/bin/cpdup -i0 /usr/obj/temp/usr/sbin /usr/sbin
684 /usr/obj/temp/cpdup/bin/cpdup -i0 /usr/obj/temp/usr/lib /usr/lib
685 /usr/obj/temp/cpdup/bin/cpdup -i0 /usr/obj/temp/libexec /libexec
686 /usr/obj/temp/cpdup/bin/cpdup -i0 /usr/obj/temp/usr/libexec /usr/libexec
687 @echo "XXXXXXXXX Doing final installworld XXXXXXXX"
689 (cd ${.CURDIR}; ${MAKE} installworld OVERRIDE_CHECKS=TRUE)
690 (cd ${.CURDIR}; ${MAKE} upgrade OVERRIDE_CHECKS=TRUE)
691 .if !defined(NO_INITRD)
692 (cd ${.CURDIR}; ${MAKE} initrd)
697 # If you have a build server, you can NFS mount the source and obj directories
698 # and do a 'make reinstall' on the *client* to install new binaries from the
699 # most recent server build.
702 @echo "--------------------------------------------------------------"
703 @echo ">>> Making hierarchy"
704 @echo "--------------------------------------------------------------"
705 cd ${.CURDIR}; make -f Makefile.inc1 hierarchy
707 @echo "--------------------------------------------------------------"
708 @echo ">>> Installing everything"
709 @echo "--------------------------------------------------------------"
710 cd ${.CURDIR}; make -f Makefile.inc1 install
714 # Install the rescue tools and the initrd image built by 'buildworld'.
717 (cd ${.CURDIR}/initrd; ${IMAKEENV} make install)
720 # buildkernel, nativekernel, quickkernel, realquickkernel, and installkernel
722 # Which kernels to build and/or install is specified by setting
723 # KERNCONF. If not defined an X86_64_GENERIC kernel is built/installed.
724 # Only the existing (depending TARGET) config files are used
725 # for building kernels and only the first of these is designated
726 # as the one being installed.
728 # You can specify INSTALLSTRIPPED=1 if you wish the installed
729 # kernel and modules to be stripped of its debug info (required
730 # symbols are left intact). You can specify INSTALLSTRIPPEDMODULES
731 # if you only want to strip the modules of their debug info. These
732 # only apply if you have DEBUG=-g in your kernel config or make line.
734 # Note that we have to use TARGET instead of TARGET_ARCH when
735 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
736 # be set to cross-build, we have to make sure TARGET is set
739 .if !defined(KERNCONF) && defined(KERNEL)
743 # XXX makeshift fix to build the right kernel for the (target) architecture
744 # We should configure this in the platform files somehow
745 .if ${TARGET_ARCH} == "x86_64"
746 KERNCONF?= X86_64_GENERIC
749 INSTKERNNAME?= kernel
751 KRNLSRCDIR= ${.CURDIR}/sys
752 KRNLCONFDIR= ${KRNLSRCDIR}/config
753 KRNLOBJDIR= ${OBJTREE}${KRNLSRCDIR}
754 KERNCONFDIR?= ${KRNLCONFDIR}
758 .for _kernel in ${KERNCONF}
759 .if exists(${KERNCONFDIR}/${_kernel})
760 BUILDKERNELS+= ${_kernel}
761 .if empty(INSTALLKERNEL)
762 INSTALLKERNEL= ${_kernel}
767 # kernel version numbers survive rm -rf
769 .for _kernel in ${BUILDKERNELS}
770 .if exists(${KRNLOBJDIR}/${_kernel}/version)
771 KERNEL_VERSION_${_kernel} != cat ${KRNLOBJDIR}/${_kernel}/version
777 # Builds all kernels defined by BUILDKERNELS.
780 @if [ ! -f ${WORLDDEST}/.libraries_done ]; then \
781 echo "You must buildworld before buildkernel. If you wish"; \
782 echo "to build a kernel using native tools, config it manually"; \
783 echo "or use the nativekernel target if you are in a rush"; \
788 .for _kernel in ${BUILDKERNELS}
789 @if [ ! -f ${KRNLOBJDIR}/${_kernel}/.nativekernel_run ]; then \
790 if [ ! -f ${WORLDDEST}/.libraries_done ]; then \
791 echo "The kernel was built using buildworld tools which no" ; \
792 echo "longer appear to exist, (real)quickkernel failed!" ; \
799 .if empty(BUILDKERNELS)
800 @echo ">>> ERROR: Missing kernel configuration file(s)."
801 @echo ">>> ${KERNCONF} not found in ${KERNCONFDIR}."
806 .if defined(KERNWARN)
807 @echo "--------------------------------------------------------------"
808 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
809 @echo "--------------------------------------------------------------"
814 # The buildkernel target rebuilds the specified kernels from scratch
815 # using the crossbuild tools generated by the last buildworld. It is
816 # the safest (but also the most time consuming) way to build a new kernel.
818 buildkernel: bk_tools bk_build_list bk_kernwarn
819 .for _kernel in ${BUILDKERNELS}
820 @echo "--------------------------------------------------------------"
821 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
822 @echo "--------------------------------------------------------------"
823 @echo "===> ${_kernel}"
824 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
825 rm -rf ${KRNLOBJDIR}/${_kernel}
827 @if [ -f ${KRNLOBJDIR}/${_kernel}/.nativekernel_run ]; then \
828 echo "YOU ARE REBUILDING WITH BUILDKERNEL, REMOVING OLD NATIVEKERNEL BUILD"; \
829 rm -rf ${KRNLOBJDIR}/${_kernel}; fi
831 mkdir -p ${KRNLOBJDIR}
832 .if !defined(NO_KERNELCONFIG)
834 PATH=${STRICTTMPPATH} \
835 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
836 ${KERNCONFDIR}/${_kernel}
838 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN) && defined(KERNEL_VERSION_${_kernel})
839 echo ${KERNEL_VERSION_${_kernel}} > ${KRNLOBJDIR}/${_kernel}/version
841 touch ${KRNLOBJDIR}/${_kernel}/.buildkernel_run
842 .if !defined(NO_KERNELDEPEND)
843 cd ${KRNLOBJDIR}/${_kernel}; \
844 ${KMAKEENV} make KERNEL=${INSTKERNNAME} depend
846 cd ${KRNLOBJDIR}/${_kernel}; \
847 ${KMAKEENV} make KERNEL=${INSTKERNNAME} all
848 @echo "--------------------------------------------------------------"
849 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
850 @echo "--------------------------------------------------------------"
853 # The nativekernel target rebuilds the specified kernels from scratch
854 # using the system's standard compiler rather than using the crossbuild
855 # tools generated by the last buildworld. This is fairly safe if your
856 # system is reasonable up-to-date.
858 nativekernel: bk_build_list bk_kernwarn
859 .for _kernel in ${BUILDKERNELS}
860 @echo "--------------------------------------------------------------"
861 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
862 @echo "--------------------------------------------------------------"
863 @echo "===> ${_kernel}"
864 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
865 rm -rf ${KRNLOBJDIR}/${_kernel}
867 @if [ -f ${KRNLOBJDIR}/${_kernel}/.buildkernel_run ]; then \
868 echo "YOU ARE REBUILDING WITH NATIVEKERNEL, REMOVING OLD BUILDKERNEL BUILD"; \
869 rm -rf ${KRNLOBJDIR}/${_kernel}; fi
871 mkdir -p ${KRNLOBJDIR}
872 .if !defined(NO_KERNELCONFIG)
874 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
875 ${KERNCONFDIR}/${_kernel}
877 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN) && defined(KERNEL_VERSION_${_kernel})
878 echo ${KERNEL_VERSION_${_kernel}} > ${KRNLOBJDIR}/${_kernel}/version
880 touch ${KRNLOBJDIR}/${_kernel}/.nativekernel_run
881 .if !defined(NO_KERNELDEPEND)
882 cd ${KRNLOBJDIR}/${_kernel}; \
883 make KERNEL=${INSTKERNNAME} depend
885 cd ${KRNLOBJDIR}/${_kernel}; \
886 make KERNEL=${INSTKERNNAME} all
887 @echo "--------------------------------------------------------------"
888 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
889 @echo "--------------------------------------------------------------"
892 # The (real)quickkernel target rebuilds the specified kernels as quickly
893 # as possible. It will use the native tools or the buildworld cross tools
894 # based on whether the kernel was originally generated via buildkernel or
895 # nativekernel. Config is rerun but the object hierarchy is not rebuilt.
896 # realquickkernel skips the depend step (analogous to realquickworld).
898 quickkernel realquickkernel: maybe_bk_tools bk_build_list bk_kernwarn
899 .for _kernel in ${BUILDKERNELS}
900 @echo "--------------------------------------------------------------"
901 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
902 @echo "--------------------------------------------------------------"
903 @echo "===> ${_kernel}"
904 .if exists(${KRNLOBJDIR}/${_kernel}/.buildkernel_run)
905 .if !defined(NO_KERNELCONFIG)
907 PATH=${STRICTTMPPATH} \
908 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
909 ${KERNCONFDIR}/${_kernel}
911 .if !defined(NO_KERNELDEPEND) && !make(realquickkernel)
912 cd ${KRNLOBJDIR}/${_kernel}; \
913 ${KMAKEENV} make KERNEL=${INSTKERNNAME} depend
915 cd ${KRNLOBJDIR}/${_kernel}; \
916 ${KMAKEENV} make KERNEL=${INSTKERNNAME} all
918 .if !defined(NO_KERNELCONFIG)
920 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
921 ${KERNCONFDIR}/${_kernel}
923 .if !defined(NO_KERNELDEPEND) && !make(realquickkernel)
924 cd ${KRNLOBJDIR}/${_kernel}; \
925 make KERNEL=${INSTKERNNAME} depend
927 cd ${KRNLOBJDIR}/${_kernel}; \
928 make KERNEL=${INSTKERNNAME} all
930 @echo "--------------------------------------------------------------"
931 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
932 @echo "--------------------------------------------------------------"
938 # Install the kernel defined by INSTALLKERNEL
940 installkernel reinstallkernel:
941 @echo "--------------------------------------------------------------"
942 @echo ">>> Kernel install for ${INSTALLKERNEL} started on `LC_ALL=C date`"
943 @echo "--------------------------------------------------------------"
944 .if exists(${KRNLOBJDIR}/${INSTALLKERNEL}/.buildkernel_run)
945 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
946 ${IMAKEENV} make KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//}
948 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
949 make KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//}
951 @echo "--------------------------------------------------------------"
952 @echo ">>> Kernel install for ${INSTALLKERNEL} completed on `LC_ALL=C date`"
953 @echo "--------------------------------------------------------------"
956 # ------------------------------------------------------------------------
958 # From here onwards are utility targets used by the 'make world' and
959 # related targets. If your 'world' breaks, you may like to try to fix
960 # the problem and manually run the following targets to attempt to
961 # complete the build. Beware, this is *not* guaranteed to work, you
962 # need to have a pretty good grip on the current state of the system
963 # to attempt to manually finish it. If in doubt, 'make world' again.
966 # bootstrap-tools: Build all tools required to build all tools. Note that
967 # order is important in a number of cases and also note that the bootstrap
968 # and build tools stages have access to earlier binaries they themselves
971 # [x]install: dependencies on various new install features
972 # rpcgen: old rpcgen used a hardwired cpp path, newer OBJFORMAT_PATH
973 # envs are not compatible with older objformat binaries.
976 # BSTRAPDIRS1 - must be built in strict order, no parallelism
978 # order is very important. yacc before m4 before flex. flex exec's m4,
979 # m4's parser file needs the latest byacc (insanity!).
982 bin/chmod bin/cp bin/cpdup bin/dd bin/mkdir bin/rm bin/echo \
983 bin/test bin/cat bin/ln bin/mv bin/expr bin/sh \
984 bin/hostname bin/kill \
985 usr.bin/yacc usr.bin/m4 usr.bin/localedef \
986 usr.bin/uudecode usr.bin/xinstall \
987 usr.bin/rpcgen usr.bin/bmake usr.bin/awk usr.bin/stat \
988 usr.bin/find usr.bin/flex
990 # BSTRAPDIRS2 - may built in parallel
993 usr.bin/sed usr.bin/uname usr.bin/touch \
994 usr.bin/mkdep usr.bin/mktemp usr.bin/lorder usr.bin/file2c \
995 usr.bin/tsort usr.bin/tr usr.bin/join usr.bin/wc usr.bin/basename \
996 usr.bin/gencat usr.bin/chflags \
997 usr.bin/uuencode usr.bin/cap_mkdb usr.bin/true usr.bin/false \
998 usr.bin/cmp usr.bin/xargs usr.bin/env usr.bin/dirname \
999 usr.bin/tail usr.bin/unifdef \
1000 usr.sbin/chown usr.sbin/mtree usr.sbin/config \
1001 usr.sbin/tzsetup usr.sbin/zic usr.sbin/pwd_mkdb \
1002 gnu/usr.bin/grep usr.bin/sort usr.bin/gzip \
1003 usr.bin/mkcsmapper usr.bin/mkesdb usr.bin/crunch
1005 bootstrap-tools: bootstrap-tools-before bootstrap-tools-targets1 bootstrap-tools-targets2
1006 touch ${BTOOLSDEST}/.bootstrap_done
1008 bootstrap-tools-before:
1009 ${LN} -fs /bin/date ${BTOOLSDEST}/bin/date
1011 bootstrap-tools-targets1: ${BSTRAPDIRS1:S/^/bstrap-/}
1013 bootstrap-tools-targets2: ${BSTRAPDIRS2:S/^/bstrap-/}
1015 .ORDER: bootstrap-tools-before bootstrap-tools-targets1 bootstrap-tools-targets2
1017 .ORDER: ${BSTRAPDIRS1:S/^/bstrap-/}
1019 .for _tool in ${BSTRAPDIRS1} ${BSTRAPDIRS2}
1021 ${ECHODIR} "===> ${_tool} (bootstrap-tools)"; \
1022 cd ${.CURDIR}/${_tool}; \
1023 make DIRPRFX=${_tool}/ obj && \
1024 make DIRPRFX=${_tool}/ depend && \
1025 make DIRPRFX=${_tool}/ all && \
1026 make DIRPRFX=${_tool}/ DESTDIR=${BTOOLSDEST} install
1029 # build-tools: Build special purpose build tools.
1031 # XXX we may be able to remove or consolidate this into bootstrap-tools
1032 # now that we have the native helper (.nx/.no) infrastructure.
1034 # XXX we should separate this into new Makefile.inc2.
1035 # Just to prepare for reduction of ORDER: that slows down parallel crossworld.
1037 # Make sure Makefile.inc1 logic is intact.
1038 .if !defined(WORLD_ALTCOMPILER)
1039 .warning undefined WORLD_ALTCOMPILER
1042 # gcc80 is now the default compiler. See sys.mk for WORLD_ALTCOMPILER default
1043 # and this file for WORLD_CCVER.
1045 _gcc47_cross= gnu/usr.bin/cc47
1046 _gcc80_cross= gnu/usr.bin/cc80
1047 _gcc_common_cross= lib/libz gnu/usr.bin/gmp gnu/usr.bin/mpfr gnu/usr.bin/mpc
1049 .if !defined(NO_ALTCOMPILER)
1050 . if defined(WORLD_ALTCOMPILER) && (${WORLD_ALTCOMPILER} == "all" || ${WORLD_ALTCOMPILER:Mgcc47})
1051 _altcompiler_cross+= ${_gcc47_cross}
1055 _basecompiler_cross= ${_gcc80_cross}
1057 _custom_cross= libexec/customcc
1058 _binutils= gnu/usr.bin/${WORLD_BINUTILSVER}
1060 build-tools: build-tools-targets
1061 touch ${BTOOLSDEST}/.build_done
1063 build-tools-targets: ${BTOOLSDIRS:S/^/btools-/}
1066 # cross-tools: Build cross-building tools
1069 CTOOLSDIRS= usr.bin/objformat
1071 CTOOLSDIRS+= ${_binutils} \
1072 ${_gcc_common_cross} \
1073 ${_altcompiler_cross} \
1074 ${_basecompiler_cross} ${_custom_cross}
1076 cross-tools: cross-tools-targets
1077 touch ${CTOOLSDEST}/.cross_done
1079 cross-tools-targets: ${CTOOLSDIRS:S/^/ctools-/}
1081 .for _tool in ${CTOOLSDIRS}
1083 ${ECHODIR} "===> ${_tool} (cross-tools)"; \
1084 cd ${.CURDIR}/${_tool}; \
1085 make DIRPRFX=${_tool}/ obj && \
1086 make DIRPRFX=${_tool}/ depend && \
1087 make DIRPRFX=${_tool}/ all && \
1088 make DIRPRFX=${_tool}/ DESTDIR=${CTOOLSDEST} install
1092 # hierarchy - ensure that all the needed directories are present
1095 cd ${.CURDIR}/etc; make distrib-dirs
1098 # libraries - build all libraries, and install them under ${DESTDIR}.
1100 # The list of libraries with dependents (${_prebuild_libs}) and their
1101 # interdependencies (__L) are built automatically by the
1102 # ${.CURDIR}/tools/make_libdeps.sh script.
1104 # .makeenv does not work when bootstrapping from 4.x, so we must be sure
1105 # to specify the correct CCVER or 'cc' will not exec the correct compiler.
1109 HOST_CCVER=${HOST_CCVER} CCVER=gcc80 \
1110 make -f Makefile.inc1 _startup_libs80 -DSYSBUILD -DLIBGCC_ONLY;
1111 .if !defined(NO_ALTCOMPILER)
1112 . if defined(WORLD_ALTCOMPILER) && (${WORLD_ALTCOMPILER} == "all" || ${WORLD_ALTCOMPILER:Mgcc47})
1114 HOST_CCVER=${HOST_CCVER} CCVER=gcc47 \
1115 make -f Makefile.inc1 _startup_libs47 -DSYSBUILD -DLIBGCC_ONLY;
1119 make -f Makefile.inc1 _startup_libs -DSYSBUILD && \
1120 make -f Makefile.inc1 _prebuild_libs -DSYSBUILD && \
1121 make -f Makefile.inc1 _generic_libs -DSYSBUILD && \
1122 touch ${WORLDDEST}/.libraries_done
1124 # These dependencies are not automatically generated:
1126 # gnu/lib/${CCVER}/libgcc and gnu/lib/${CCVER}/csu must be built before all
1127 # shared libraries for ELF. The target for _startup_libsXX is
1128 # specifically built using gccXX.
1130 _startup_libs47= gnu/usr.bin/cc47/cc_prep \
1131 gnu/usr.bin/cc47/cc_tools \
1133 gnu/lib/gcc47/libgcc \
1134 gnu/lib/gcc47/libgcc_eh \
1135 gnu/lib/gcc47/libgcc_pic
1137 _startup_libs80= gnu/usr.bin/cc80/cc_prep \
1138 gnu/usr.bin/cc80/cc_tools \
1140 gnu/lib/gcc80/libgcc \
1141 gnu/lib/gcc80/libgcc_eh \
1142 gnu/lib/gcc80/libgcc_pic
1144 .if !defined(NO_ALTCOMPILER)
1145 . if defined(WORLD_ALTCOMPILER) && (${WORLD_ALTCOMPILER} == "all" || ${WORLD_ALTCOMPILER:Mgcc47})
1146 _startup_libs_alt+= _startup_libs47
1150 _startup_libs_base= _startup_libs80
1152 _startup_libs= lib/csu lib/libc lib/libc_rtld
1153 lib/libc__L: lib/csu__L
1155 _prebuild_libs= lib/libbz2 lib/liblzma lib/libz lib/libzstd
1156 _prebuild_libs+= lib/libutil
1158 _prebuild_libs+= lib/libpcap
1160 _generic_libs= gnu/lib
1162 _prebuild_libs+= lib/libcrypt lib/libncurses/libncurses
1166 _prebuild_libs+= lib/librecrypto lib/libressl
1167 lib/libressl__L: lib/librecrypto__L
1169 _prebuild_libs+= lib/libldns
1170 lib/libldns__L: lib/librecrypto__L
1172 _prebuild_libs+= lib/libsbuf lib/libm \
1173 lib/libpam/libpam lib/libypclnt lib/lib${THREAD_LIB} \
1174 lib/libpthread lib/libprop
1176 _generic_libs+= usr.bin/flex/lib
1178 .for _alib in ${_startup_libs_alt} ${_startup_libs_base}
1179 __startup_alibs+= ${${_alib}}
1182 .for _lib in ${__startup_alibs} \
1183 ${_startup_libs} ${_prebuild_libs} ${_generic_libs}
1185 .if exists(${.CURDIR}/${_lib})
1186 @${ECHODIR} "===> ${_lib}"; \
1187 cd ${.CURDIR}/${_lib}; \
1188 echo "STEP DEP ${_lib}" && \
1189 make DIRPRFX=${_lib}/ depend && \
1190 echo "STEP ALL ${_lib}" && \
1191 make DIRPRFX=${_lib}/ all && \
1192 echo "STEP INSTALL ${_lib}" && \
1193 make DIRPRFX=${_lib}/ install && \
1194 echo "STEP DONE ${_lib}";
1196 .warning missing ${.CURDIR}/${_lib} directory.
1200 _startup_libs: ${_startup_libs:S/$/__L/}
1201 .for _alib in ${_startup_libs_alt} ${_startup_libs_base}
1202 ${_alib}: ${${_alib}:C/$/__L/}
1204 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
1205 _generic_libs: ${_generic_libs:S/$/__L/}
1207 # library targets must be ordered because there are inter-library
1208 # races (e.g. generation of tconfig.h)
1210 .for _alib in ${_startup_libs_base} ${_startup_libs_alt}
1211 .ORDER: ${${_alib}:C/$/__L/}
1214 # uncomment if there are missing dependencies
1216 .ORDER: ${_prebuild_libs:S/$/__L/}
1217 # we can disable this one, no lib/* depend on libstdc++
1218 .ORDER: ${_generic_libs:S/$/__L/}
1221 .for __target in clean cleandepend cleandir obj depend includes
1222 .for entry in ${SUBDIR}
1223 ${entry}.${__target}__D: .PHONY
1224 @if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
1225 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
1226 edir=${entry}.${MACHINE_ARCH}; \
1227 cd ${.CURDIR}/$${edir}; \
1229 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \
1231 cd ${.CURDIR}/$${edir}; \
1233 make ${__target} DIRPRFX=${DIRPRFX}$${edir}/
1235 par-${__target}: ${SUBDIR:C/$/.${__target}__D/}
1236 .ORDER: ${SUBDIR:C/$/.${__target}__D/}
1238 .ORDER: par-clean par-cleandepend par-cleandir par-obj par-depend par-includes
1240 # The wmake target is used by /usr/bin/wmake to run make in a
1241 # world build environment.
1244 @echo '${WMAKEENV} make ${WMAKE_ARGS} -DSYSBUILD'
1247 @echo '${WMAKEENV} /bin/sh'
1250 @echo '${BMAKEENV} make ${BMAKE_ARGS} -DSYSBUILD'
1253 @echo '${BMAKEENV} /bin/sh'
1256 @echo '${TMAKEENV} make ${TMAKE_ARGS} -DSYSBUILD'
1259 @echo '${TMAKEENV} /bin/sh'
1262 @echo '${XMAKEENV} make ${XMAKE_ARGS} -DSYSBUILD'
1265 @echo '${XMAKEENV} /bin/sh'
1267 .if !defined(NO_BACKUP)
1268 backupworld: backup-clean
1269 @mkdir -p ${WORLD_BACKUP}
1270 .if (exists(${DESTDIR}/sbin) && exists(${DESTDIR}/bin) && \
1271 exists(${DESTDIR}/usr/sbin) && exists(${DESTDIR}/usr/bin) && \
1272 exists(${DESTDIR}/usr/lib) && exists(${DESTDIR}/usr/libexec))
1273 tar -czf ${WORLD_BACKUP}/binaries.tar.gz -C ${DESTDIR}/ \
1274 --options gzip:compression-level=1 \
1275 sbin bin usr/sbin usr/bin usr/lib usr/libexec
1279 rm -f ${AUTO_BACKUP}/binaries.tar.gz
1280 @mkdir -p ${AUTO_BACKUP}
1281 .if (exists(${DESTDIR}/sbin) && exists(${DESTDIR}/bin) && \
1282 exists(${DESTDIR}/usr/sbin) && exists(${DESTDIR}/usr/bin) && \
1283 exists(${DESTDIR}/usr/lib) && exists(${DESTDIR}/usr/libexec))
1284 /usr/bin/tar -czf ${AUTO_BACKUP}/binaries.tar.gz -C ${DESTDIR}/ \
1285 --options gzip:compression-level=1 \
1286 sbin bin usr/sbin usr/bin usr/lib usr/libexec
1290 rm -f ${AUTO_BACKUP}/binaries.tar.gz
1293 rm -f ${WORLD_BACKUP}/binaries.tar.gz
1296 .if !exists(${WORLD_BACKUP}/binaries.tar.gz)
1297 @echo "There does not seem to be a valid archive present."
1299 @echo "Restoring system binaries from manual backup archive..."
1300 @chflags -R noschg ${DESTDIR}/sbin ${DESTDIR}/bin \
1301 ${DESTDIR}/usr/sbin ${DESTDIR}/usr/bin \
1302 ${DESTDIR}/usr/lib ${DESTDIR}/usr/libexec
1303 tar -xzf ${WORLD_BACKUP}/binaries.tar.gz -C ${DESTDIR}/
1307 .if !exists(${AUTO_BACKUP}/binaries.tar.gz)
1308 @echo "There does not seem to be a valid archive present."
1310 @echo "Restoring system binaries from auto-backup archive..."
1311 @chflags -R noschg ${DESTDIR}/sbin ${DESTDIR}/bin \
1312 ${DESTDIR}/usr/sbin ${DESTDIR}/usr/bin \
1313 ${DESTDIR}/usr/lib ${DESTDIR}/usr/libexec
1314 tar -xzf ${AUTO_BACKUP}/binaries.tar.gz -C ${DESTDIR}/
1318 # Take advantage of bmake error response
1320 MAKE_PRINT_VAR_ON_ERROR= \
1337 .if ${.MAKE.LEVEL} > 0
1338 MAKE_PRINT_VAR_ON_ERROR+= .MAKE.MAKEFILES .PATH
1341 .include <bsd.subdir.mk>