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