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