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