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