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