1# 2# $FreeBSD: src/Makefile.inc1,v 1.141.2.62 2003/04/06 19:54:00 dwmalone Exp $ 3# $DragonFly: src/Makefile.inc1,v 1.84 2005/10/11 13:31:05 corecode Exp $ 4# 5# Build-time options are documented in make.conf(5). 6# 7# The intended user-driven targets are: 8# 9# buildworld - rebuild *everything*, including glue to help do upgrades 10# quickworld - skip the glue and do a depend+build on the meat 11# realquickworld - skip the glue and depend stages and just build the meat 12# crossworld - only build the glue (particularly the cross-build environment) 13# installworld- install everything built by "buildworld" 14# update - convenient way to update your source tree (eg: sup/cvs) 15# most - build user commands, no libraries or include files 16# installmost - install user commands, no libraries or include files 17# 18# Standard targets (not defined here) are documented in the makefiles in 19# /usr/share/mk. These include: 20# obj depend all install clean cleandepend cleanobj 21 22# Put initial settings here. 23SUBDIR= 24 25# We must do share/info early so that installation of info `dir' 26# entries works correctly. Do it first since it is less likely to 27# grow dependencies on include and lib than vice versa. 28.if exists(${.CURDIR}/share/info) 29SUBDIR+= share/info 30.endif 31 32# We must do include and lib early so that the perl *.ph generation 33# works correctly as it uses the header files installed by this. 34.if exists(${.CURDIR}/include) 35SUBDIR+= include 36.endif 37.if exists(${.CURDIR}/lib) 38SUBDIR+= lib 39.endif 40# This exists simply to ensure that the obj dir hierarchy is 41# intact for nrelease, allowing the nrelease Makefile's to 42# reference ${.OBJDIR}. 43# 44.if exists(${.CURDIR}/nrelease) 45SUBDIR+= nrelease 46.endif 47 48.if exists(${.CURDIR}/bin) 49SUBDIR+= bin 50.endif 51.if exists(${.CURDIR}/games) && !defined(NO_GAMES) 52SUBDIR+= games 53.endif 54.if exists(${.CURDIR}/gnu) 55SUBDIR+= gnu 56.endif 57.if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \ 58 !defined(NO_CRYPT) && !defined(NO_OPENSSL) && defined(WANT_KERBEROS) 59SUBDIR+= kerberos5 60.endif 61.if exists(${.CURDIR}/libexec) 62SUBDIR+= libexec 63.endif 64.if exists(${.CURDIR}/sbin) 65SUBDIR+= sbin 66.endif 67.if exists(${.CURDIR}/secure) && !defined(NO_CRYPT) 68SUBDIR+= secure 69.endif 70.if exists(${.CURDIR}/share) && !defined(NO_SHARE) 71SUBDIR+= share 72.endif 73.if exists(${.CURDIR}/sys) 74SUBDIR+= sys 75.endif 76.if exists(${.CURDIR}/usr.bin) 77SUBDIR+= usr.bin 78.endif 79.if exists(${.CURDIR}/usr.sbin) 80SUBDIR+= usr.sbin 81.endif 82 83# etc must be last for "distribute" to work 84.if exists(${.CURDIR}/etc) 85SUBDIR+= etc 86.endif 87 88# These are last, since it is nice to at least get the base system 89# rebuilt before you do them. 90.if defined(LOCAL_DIRS) 91.for _DIR in ${LOCAL_DIRS} 92.if exists(${.CURDIR}/${_DIR}) & exists(${.CURDIR}/${_DIR}/Makefile) 93SUBDIR+= ${_DIR} 94.endif 95.endfor 96.endif 97 98.if defined(SUBDIR_OVERRIDE) 99SUBDIR= ${SUBDIR_OVERRIDE} 100.endif 101 102.if defined(NOCLEANDIR) 103CLEANDIR= clean cleandepend 104.else 105CLEANDIR= cleandir 106.endif 107 108SUP?= /usr/local/bin/cvsup 109SUPFLAGS?= -g -L 2 -P - 110.if defined(SUPHOST) 111SUPFLAGS+= -h ${SUPHOST} 112.endif 113 114.if defined(NO_CLEAN) 115NOCLEAN= # defined 116.endif 117 118# Object directory base in primary make. Note that when we rerun make 119# from inside this file we change MAKEOBJDIRPREFIX to the appropriate 120# subdirectory because the rest of the build system needs it that way. 121# The original object directory base is saved in OBJTREE. 122# 123MAKEOBJDIRPREFIX?= /usr/obj 124OBJTREE?= ${MAKEOBJDIRPREFIX} 125 126# Used for stage installs and pathing 127# 128DESTDIRBASE?= ${OBJTREE}${.CURDIR} 129 130TARGET_ARCH?= ${MACHINE_ARCH} 131.if ${TARGET_ARCH} == ${MACHINE_ARCH} 132TARGET?= ${MACHINE} 133.else 134TARGET?= ${TARGET_ARCH} 135.endif 136.if make(buildworld) 137BUILD_ARCH!= sysctl -n hw.machine_arch 138.if ${MACHINE_ARCH} != ${BUILD_ARCH} 139.error To cross-build, set TARGET_ARCH. 140.endif 141.endif 142 143# BTOOLS (Natively built) All non-cross-development tools that the 144# main build needs. This includes things like 'mkdir' and 'rm'. 145# We will not use the native system's exec path once we start 146# on WORLD. (bootstrap-tools and build-tools or BTOOLS) 147# 148# CTOOLS (Natively built) Cross development tools which are specific 149# to the target architecture. 150# 151# WORLD (Cross built) Our ultimate buildworld, using only BTOOLS and 152# CTOOLS. 153# 154# MACHINE_ARCH Architecture we are building on 155# TARGET_ARCH Architecture we are building for 156# 157BTOOLSDEST= ${DESTDIRBASE}/btools_${MACHINE_ARCH} 158CTOOLSDEST= ${DESTDIRBASE}/ctools_${MACHINE_ARCH}_${TARGET_ARCH} 159WORLDDEST= ${DESTDIRBASE}/world_${TARGET_ARCH} 160 161# The bootstrap-tools path is used by the bootstrap-tools, build-tools, and 162# cross-tools stages to augment the existing command path to access newer 163# versions of certain utilities such as 'patch' that the cross-tools stage 164# might expect. 165# 166BTOOLSPATH= ${BTOOLSDEST}/usr/sbin:${BTOOLSDEST}/usr/bin:${BTOOLSDEST}/bin:${BTOOLSDEST}/usr/games 167 168# The strict temporary command path contains all binaries required 169# by the buildworld system after the cross-tools stage. 170# 171STRICTTMPPATH= ${CTOOLSDEST}/usr/sbin:${CTOOLSDEST}/usr/bin:${CTOOLSDEST}/bin:${CTOOLSDEST}/usr/games:${BTOOLSDEST}/usr/sbin:${BTOOLSDEST}/usr/bin:${BTOOLSDEST}/bin:${BTOOLSDEST}/usr/games 172 173TMPDIR?= /tmp 174TMPPID!= echo $$$$ 175 176# 177# Building a world goes through the following stages 178# 179# 1. bootstrap-tool stage [BMAKE] 180# This stage is responsible for creating programs that 181# are needed for backward compatibility reasons. They 182# are not built as cross-tools. 183# 2. build-tool stage [TMAKE] 184# This stage is responsible for creating the object 185# tree and building any tools that are needed during 186# the build process. 187# 3. cross-tool stage [XMAKE] 188# This stage is responsible for creating any tools that 189# are needed for cross-builds. A cross-compiler is one 190# of them. 191# 4. world stage [WMAKE] 192# This stage actually builds the world. 193# 5. install stage (optional) [IMAKE] 194# This stage installs a previously built world. 195# 196 197# bootstrap-tool stage 198# 199BMAKEENV= MAKEOBJDIRPREFIX=${BTOOLSDEST} \ 200 OBJTREE=${OBJTREE} \ 201 DESTDIR=${BTOOLSDEST} \ 202 PATH=${BTOOLSPATH}:${PATH} \ 203 INSTALL="sh ${.CURDIR}/tools/install.sh" 204 205BMAKE= ${BMAKEENV} ${MAKE} -f Makefile.inc1 -DBOOTSTRAPPING \ 206 -DNOINFO -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED \ 207 -DNO_WERROR -DNO_NLS 208 209# build-tool stage 210# 211TMAKEENV= MAKEOBJDIRPREFIX=${BTOOLSDEST} \ 212 OBJTREE=${OBJTREE} \ 213 DESTDIR= \ 214 PATH=${BTOOLSPATH}:${PATH} \ 215 INSTALL="sh ${.CURDIR}/tools/install.sh" 216 217TMAKE= ${TMAKEENV} ${MAKE} -f Makefile.inc1 -DBOOTSTRAPPING \ 218 -DNO_FORTRAN -DNOSHARED 219 220# cross-tool stage 221# 222# note: TOOLS_PREFIX points to the obj root holding the cross 223# compiler binaries, while USRDATA_PREFIX points to the obj root 224# holding the target environment (and also determines where cross-built 225# libraries, crt*.o, and include files are installed). 226# 227XMAKEENV= MAKEOBJDIRPREFIX=${CTOOLSDEST} \ 228 OBJTREE=${OBJTREE} \ 229 DESTDIR=${CTOOLSDEST} \ 230 INSTALL="sh ${.CURDIR}/tools/install.sh" \ 231 TOOLS_PREFIX=${CTOOLSDEST} \ 232 USRDATA_PREFIX=${WORLDDEST} \ 233 PATH=${BTOOLSPATH}:${PATH} 234 235XMAKE= ${XMAKEENV} ${MAKE} -f Makefile.inc1 -DNO_FORTRAN -DNO_GDB \ 236 -DBOOTSTRAPPING -DNOSHARED 237 238# world stage, note the strict path and note that TOOLS_PREFIX is left 239# unset and USRDATA_PREFIX (which defaults to TOOLS_PREFIX) is set to empty, 240# which is primarily for the compiler so it targets / (e.g. /usr/<blah>) 241# for both binary and library paths, even though it is being compiled to 242# WORLDDEST. None of the programs in the world stage are ever actually 243# executed during the buildworld/installworld. 244# 245CROSSENV= MAKEOBJDIRPREFIX=${WORLDDEST} \ 246 OBJTREE=${OBJTREE} \ 247 MACHINE_ARCH=${TARGET_ARCH} \ 248 MACHINE=${TARGET} \ 249 OBJFORMAT_PATH=${CTOOLSDEST} 250 251WMAKEENV= ${CROSSENV} \ 252 DESTDIR=${WORLDDEST} \ 253 INSTALL="sh ${.CURDIR}/tools/install.sh" \ 254 PATH=${STRICTTMPPATH} 255 256WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1 257 258# install stage 259# 260IMAKEENV= ${CROSSENV} \ 261 PATH=${STRICTTMPPATH} 262IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 263 264# kernel stage 265# 266KMAKEENV= ${WMAKEENV} 267 268# buildworld 269# 270# Attempt to rebuild the entire system, with reasonable chance of 271# success, regardless of how old your existing system is. 272# 273_worldtmp: 274 @echo 275 @echo "--------------------------------------------------------------" 276 @echo ">>> Rebuilding the temporary build tree" 277 @echo "--------------------------------------------------------------" 278.if !defined(NOCLEAN) 279 rm -rf ${BTOOLSDEST} ${CTOOLSDEST} ${WORLDDEST} 280.else 281 # XXX - These two can depend on any header file. 282 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c 283 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c 284.endif 285 mkdir -p ${DESTDIRBASE} ${BTOOLSDEST} ${CTOOLSDEST} ${WORLDDEST} 286.for _dir in ${WORLDDEST} ${BTOOLSDEST} ${CTOOLSDEST} 287 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \ 288 -p ${_dir}/ > /dev/null 289 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 290 -p ${_dir}/usr > /dev/null 291.endfor 292 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 293 -p ${WORLDDEST}/usr/include > /dev/null 294 ${LN} -sf ${.CURDIR}/sys ${WORLDDEST} 295 296_bootstrap-tools: 297 @echo 298 @echo "--------------------------------------------------------------" 299 @echo ">>> stage 1: bootstrap tools" 300 @echo "--------------------------------------------------------------" 301 cd ${.CURDIR}; ${BMAKE} bootstrap-tools 302_cleanobj: 303 @echo 304 @echo "--------------------------------------------------------------" 305 @echo ">>> stage 2a: cleaning up the object tree" 306 @echo "--------------------------------------------------------------" 307 cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/} 308_obj: 309 @echo 310 @echo "--------------------------------------------------------------" 311 @echo ">>> stage 2b: rebuilding the object tree" 312 @echo "--------------------------------------------------------------" 313 cd ${.CURDIR}; ${WMAKE} par-obj 314_build-tools: 315 @echo 316 @echo "--------------------------------------------------------------" 317 @echo ">>> stage 2c: build tools" 318 @echo "--------------------------------------------------------------" 319 cd ${.CURDIR}; ${TMAKE} build-tools 320_cross-tools: 321 @echo 322 @echo "--------------------------------------------------------------" 323 @echo ">>> stage 3: cross tools" 324 @echo "--------------------------------------------------------------" 325 cd ${.CURDIR}; ${XMAKE} cross-tools 326_includes: 327 @echo 328 @echo "--------------------------------------------------------------" 329 @echo ">>> stage 4a: populating ${WORLDDEST}/usr/include" 330 @echo "--------------------------------------------------------------" 331 cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes 332_libraries: 333 @echo 334 @echo "--------------------------------------------------------------" 335 @echo ">>> stage 4b: building libraries" 336 @echo "--------------------------------------------------------------" 337 cd ${.CURDIR}; ${WMAKE} -DNOHTML -DNOINFO -DNOMAN -DNOFSCHG libraries 338_depend: 339 @echo 340 @echo "--------------------------------------------------------------" 341 @echo ">>> stage 4c: make dependencies" 342 @echo "--------------------------------------------------------------" 343 cd ${.CURDIR}; ${WMAKE} par-depend 344everything: 345 @echo 346 @echo "--------------------------------------------------------------" 347 @echo ">>> stage 4d: building everything.." 348 @echo "--------------------------------------------------------------" 349 cd ${.CURDIR}; ${WMAKE} all 350 351# note: buildworld no longer depends on _cleanobj because we rm -rf the 352# entire object tree and built the bootstrap tools in a different location. 353# 354# buildworld - build everything from scratch 355# quickworld - skip the bootstrap, build, and cross-build steps 356# realquickworld - skip the bootstrap, build, crossbuild, and depend step. 357# 358# note: we include _obj in realquickworld to prevent accidental creation 359# of files in /usr/src. 360 361WMAKE_TGTS= 362.if !defined(SUBDIR_OVERRIDE) 363WMAKE_TGTS+= _worldtmp _bootstrap-tools 364.endif 365WMAKE_TGTS+= _obj _build-tools 366.if !defined(SUBDIR_OVERRIDE) 367WMAKE_TGTS+= _cross-tools 368.endif 369WMAKE_TGTS+= _includes _libraries _depend everything 370 371buildworld: ${WMAKE_TGTS} 372 373quickworld: _obj _includes _libraries _depend everything 374 375realquickworld: _obj _includes _libraries everything 376 377crossworld: _worldtmp _bootstrap-tools _obj _build-tools _cross-tools 378 379.ORDER: ${WMAKE_TGTS} 380 381# 382# installcheck 383# 384# Checks to be sure system is ready for installworld 385# 386installcheck: 387.if !defined(NO_SENDMAIL) 388 @pw usershow smmsp || (echo "You may need to run 'make preupgrade' first"; exit 1) 389 @pw groupshow smmsp || (echo "You may need to run 'make preupgrade' first"; exit 1) 390.endif 391 @pw usershow _pflogd || (echo "You may need to run 'make preupgrade' first"; exit 1) 392 @pw usershow _ntp || (echo "You may need to run 'make preupgrade' first"; exit 1) 393 @pw groupshow authpf || (echo "You may need to run 'make preupgrade' first"; exit 1) 394 @pw groupshow _pflogd || (echo "You may need to run 'make preupgrade' first"; exit 1) 395 @pw groupshow _ntp || (echo "You may need to run 'make preupgrade' first"; exit 1) 396.if !defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/" 397 @case `uname -r` in 1.2*|1.3-*|1.3.0-*|1.3.1-*|1.3.2-*|1.3.3-*|1.3.4-*) echo "You must upgrade your kernel to at least 1.3.5 and reboot before you can safely installworld, due to stat(2) and dirent ABI changes" ; exit 1;; esac 398.endif 399 400# distributeworld 401# 402# Distributes everything compiled by a `buildworld'. 403# 404# installworld 405# 406# Installs everything compiled by a 'buildworld'. 407# 408distributeworld installworld: installcheck 409 cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//} 410 411# 412# reinstall 413# 414# If you have a build server, you can NFS mount the source and obj directories 415# and do a 'make reinstall' on the *client* to install new binaries from the 416# most recent server build. 417# 418reinstall: 419 @echo "--------------------------------------------------------------" 420 @echo ">>> Making hierarchy" 421 @echo "--------------------------------------------------------------" 422 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy 423 @echo 424 @echo "--------------------------------------------------------------" 425 @echo ">>> Installing everything.." 426 @echo "--------------------------------------------------------------" 427 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install 428.if !defined(NOMAN) && !defined(NO_MAKEDB_RUN) 429 @echo 430 @echo "--------------------------------------------------------------" 431 @echo ">>> Rebuilding man page indices" 432 @echo "--------------------------------------------------------------" 433 cd ${.CURDIR}/share/man; ${MAKE} makedb 434.endif 435 436redistribute: 437 @echo "--------------------------------------------------------------" 438 @echo ">>> Distributing everything.." 439 @echo "--------------------------------------------------------------" 440 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute 441 442# 443# buildkernel, nativekernel, quickkernel, and installkernel 444# 445# Which kernels to build and/or install is specified by setting 446# KERNCONF. If not defined a GENERIC kernel is built/installed. 447# Only the existing (depending TARGET) config files are used 448# for building kernels and only the first of these is designated 449# as the one being installed. 450# 451# You can specify INSTALLSTRIPPED=1 if you wish the installed 452# kernel and modules to be stripped of its debug info (required 453# symbols are left intact). You can specify INSTALLSTRIPPEDMODULES 454# if you only want to strip the modules of their debug info. These 455# only apply if you have DEBUG=-g in your kernel config or make line. 456# 457# Note that we have to use TARGET instead of TARGET_ARCH when 458# we're in kernel-land. Since only TARGET_ARCH is (expected) to 459# be set to cross-build, we have to make sure TARGET is set 460# properly. 461 462.if !defined(KERNCONF) && defined(KERNEL) 463KERNCONF= ${KERNEL} 464KERNWARN= yes 465.else 466KERNCONF?= GENERIC 467.endif 468INSTKERNNAME?= kernel 469 470KRNLSRCDIR= ${.CURDIR}/sys 471KRNLCONFDIR= ${KRNLSRCDIR}/${TARGET}/conf 472KRNLOBJDIR= ${OBJTREE}${KRNLSRCDIR} 473KERNCONFDIR?= ${KRNLCONFDIR} 474 475BUILDKERNELS= 476INSTALLKERNEL= 477.for _kernel in ${KERNCONF} 478.if exists(${KERNCONFDIR}/${_kernel}) 479BUILDKERNELS+= ${_kernel} 480.if empty(INSTALLKERNEL) 481INSTALLKERNEL= ${_kernel} 482.endif 483.endif 484.endfor 485 486# kernel version numbers survive rm -rf 487# 488.for _kernel in ${BUILDKERNELS} 489.if exists(${KRNLOBJDIR}/${_kernel}/version) 490KERNEL_VERSION_${_kernel} != cat ${KRNLOBJDIR}/${_kernel}/version 491.endif 492.endfor 493 494# 495# buildkernel 496# 497# Builds all kernels defined by BUILDKERNELS. 498# 499bk_tools: 500 @if [ ! -f ${WORLDDEST}/.libraries_done ]; then \ 501 echo "You must buildworld before buildkernel. If you wish"; \ 502 echo "to build a kernel using native tools, config it manually"; \ 503 echo "or use the nativekernel target if you are in a rush"; \ 504 exit 1; \ 505 fi 506 507maybe_bk_tools: 508.for _kernel in ${BUILDKERNELS} 509 @if [ ! -f ${KRNLOBJDIR}/${_kernel}/.nativekernel_run ]; then \ 510 if [ ! -f ${WORLDDEST}/.libraries_done ]; then \ 511 echo "The kernel was build using buildworld tools which no" ; \ 512 echo "longer appear to exist, quickkernel failed!" ; \ 513 exit 1; \ 514 fi; \ 515 fi 516.endfor 517 518bk_build_list: 519.if empty(BUILDKERNELS) 520 @echo ">>> ERROR: Missing kernel configuration file(s) (${KERNCONF})." 521 @false 522.endif 523 524bk_kernwarn: 525.if defined(KERNWARN) 526 @echo "--------------------------------------------------------------" 527 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF=" 528 @echo "--------------------------------------------------------------" 529 @sleep 3 530.endif 531 @echo 532 533# The buildkernel target rebuilds the specified kernels from scratch 534# using the crossbuild tools generated by the last buildworld. It is 535# the safest (but also the most time consuming) way to build a new kernel. 536# 537buildkernel: bk_tools bk_build_list bk_kernwarn 538.for _kernel in ${BUILDKERNELS} 539 @echo "--------------------------------------------------------------" 540 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`" 541 @echo "--------------------------------------------------------------" 542 @echo "===> ${_kernel}" 543.if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN) 544 rm -rf ${KRNLOBJDIR}/${_kernel} 545.else 546 @if [ -f ${KRNLOBJDIR}/${_kernel}/.nativekernel_run ]; then \ 547 echo "YOU ARE REBUILDING WITH BUILDKERNEL, REMOVING OLD NATIVEKERNEL BUILD"; \ 548 rm -rf ${KRNLOBJDIR}/${_kernel}; fi 549.endif 550 mkdir -p ${KRNLOBJDIR} 551.if !defined(NO_KERNELCONFIG) 552 cd ${KRNLCONFDIR}; \ 553 PATH=${STRICTTMPPATH} \ 554 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \ 555 ${KERNCONFDIR}/${_kernel} 556.endif 557.if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN) && defined(KERNEL_VERSION_${_kernel}) 558 echo ${KERNEL_VERSION_${_kernel}} > ${KRNLOBJDIR}/${_kernel}/version 559.endif 560 touch ${KRNLOBJDIR}/${_kernel}/.buildkernel_run 561 cd ${KRNLOBJDIR}/${_kernel}; \ 562 MAKESRCPATH=${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm \ 563 ${MAKE} -DBOOTSTRAPPING -f ${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm/Makefile 564.if !defined(NO_KERNELDEPEND) 565 cd ${KRNLOBJDIR}/${_kernel}; \ 566 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend 567.endif 568 cd ${KRNLOBJDIR}/${_kernel}; \ 569 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all 570 @echo "--------------------------------------------------------------" 571 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`" 572 @echo "--------------------------------------------------------------" 573.endfor 574 575# The nativekernel target rebuilds the specified kernels from scratch 576# using the systems standard compiler rather then using the crossbuild 577# tools generated by the last buildworld. This is fairly safe if your 578# system is reasonable up-to-date. 579# 580nativekernel: bk_build_list bk_kernwarn 581.for _kernel in ${BUILDKERNELS} 582 @echo "--------------------------------------------------------------" 583 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`" 584 @echo "--------------------------------------------------------------" 585 @echo "===> ${_kernel}" 586.if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN) 587 rm -rf ${KRNLOBJDIR}/${_kernel} 588.else 589 @if [ -f ${KRNLOBJDIR}/${_kernel}/.buildkernel_run ]; then \ 590 echo "YOU ARE REBUILDING WITH NATIVEKERNEL, REMOVING OLD BUILDKERNEL BUILD"; \ 591 rm -rf ${KRNLOBJDIR}/${_kernel}; fi 592.endif 593 mkdir -p ${KRNLOBJDIR} 594.if !defined(NO_KERNELCONFIG) 595 cd ${KRNLCONFDIR}; \ 596 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \ 597 ${KERNCONFDIR}/${_kernel} 598.endif 599.if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN) && defined(KERNEL_VERSION_${_kernel}) 600 echo ${KERNEL_VERSION_${_kernel}} > ${KRNLOBJDIR}/${_kernel}/version 601.endif 602 touch ${KRNLOBJDIR}/${_kernel}/.nativekernel_run 603 cd ${KRNLOBJDIR}/${_kernel}; \ 604 MAKESRCPATH=${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm \ 605 ${MAKE} -DBOOTSTRAPPING -f ${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm/Makefile 606.if !defined(NO_KERNELDEPEND) 607 cd ${KRNLOBJDIR}/${_kernel}; \ 608 ${MAKE} KERNEL=${INSTKERNNAME} depend 609.endif 610 cd ${KRNLOBJDIR}/${_kernel}; \ 611 ${MAKE} KERNEL=${INSTKERNNAME} all 612 @echo "--------------------------------------------------------------" 613 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`" 614 @echo "--------------------------------------------------------------" 615.endfor 616 617# The quickkernel target rebuilds the specified kernels as quickly 618# as possible. It will use the native tools or the buildworld cross tools 619# based on whether the kernel was originally generated via buildkernel or 620# nativekernel. Config is rerun but the object hierarchy is not rebuilt, 621# nor is the make depend step run. 622# 623quickkernel: maybe_bk_tools bk_build_list bk_kernwarn 624.for _kernel in ${BUILDKERNELS} 625 @echo "--------------------------------------------------------------" 626 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`" 627 @echo "--------------------------------------------------------------" 628 @echo "===> ${_kernel}" 629.if exists(${KRNLOBJDIR}/${_kernel}/.buildkernel_run) 630.if !defined(NO_KERNELCONFIG) 631 cd ${KRNLCONFDIR}; \ 632 PATH=${STRICTTMPPATH} \ 633 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \ 634 ${KERNCONFDIR}/${_kernel} 635.endif 636 cd ${KRNLOBJDIR}/${_kernel}; \ 637 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all 638.else 639.if !defined(NO_KERNELCONFIG) 640 cd ${KRNLCONFDIR}; \ 641 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \ 642 ${KERNCONFDIR}/${_kernel} 643.endif 644 cd ${KRNLOBJDIR}/${_kernel}; \ 645 ${MAKE} KERNEL=${INSTKERNNAME} all 646.endif 647 @echo "--------------------------------------------------------------" 648 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`" 649 @echo "--------------------------------------------------------------" 650.endfor 651 652 653# installkernel 654# 655# Install the kernel defined by INSTALLKERNEL 656# 657installkernel reinstallkernel: 658.if exists(${KRNLOBJDIR}/${_kernel}/.buildkernel_run) 659 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ 660 ${CROSSENV} ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//} 661.else 662 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ 663 ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//} 664.endif 665 666# 667# update 668# 669# Update the source tree, by running sup and/or running cvs to update to the 670# latest copy. 671# 672update: 673.if defined(SUP_UPDATE) 674 @echo "--------------------------------------------------------------" 675 @echo ">>> Running ${SUP}" 676 @echo "--------------------------------------------------------------" 677.if defined(SUPFILE) 678 @${SUP} ${SUPFLAGS} ${SUPFILE} 679.endif 680.if defined(SUPFILE1) 681 @${SUP} ${SUPFLAGS} ${SUPFILE1} 682.endif 683.if defined(SUPFILE2) 684 @${SUP} ${SUPFLAGS} ${SUPFILE2} 685.endif 686.if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE) 687 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE} 688.endif 689.if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE) 690 @${SUP} ${SUPFLAGS} ${DOCSUPFILE} 691.endif 692.endif 693.if defined(CVS_UPDATE) 694 @echo "--------------------------------------------------------------" 695 @echo ">>> Updating ${.CURDIR} from cvs repository `cat ${.CURDIR}/CVS/Root`" 696 @echo "--------------------------------------------------------------" 697 @sleep 2 698 cd ${.CURDIR}; cvs -q update -P -d 699.endif 700 701# 702# most 703# 704# Build most of the user binaries on the existing system libs and includes. 705# 706most: 707 @echo "--------------------------------------------------------------" 708 @echo ">>> Building programs only" 709 @echo "--------------------------------------------------------------" 710.for _dir in bin sbin libexec usr.bin usr.sbin gnu/libexec gnu/usr.bin gnu/usr.sbin 711 cd ${.CURDIR}/${_dir}; ${MAKE} DIRPRFX=${_dir}/ all 712.endfor 713 714# 715# installmost 716# 717# Install the binaries built by the 'most' target. This does not include 718# libraries or include files. 719# 720installmost: 721 @echo "--------------------------------------------------------------" 722 @echo ">>> Installing programs only" 723 @echo "--------------------------------------------------------------" 724.for _dir in bin sbin libexec usr.bin usr.sbin gnu/libexec gnu/usr.bin gnu/usr.sbin 725 cd ${.CURDIR}/${_dir}; ${MAKE} DIRPRFX=${_dir}/ install 726.endfor 727 728# 729# ------------------------------------------------------------------------ 730# 731# From here onwards are utility targets used by the 'make world' and 732# related targets. If your 'world' breaks, you may like to try to fix 733# the problem and manually run the following targets to attempt to 734# complete the build. Beware, this is *not* guaranteed to work, you 735# need to have a pretty good grip on the current state of the system 736# to attempt to manually finish it. If in doubt, 'make world' again. 737# 738 739# bootstrap-tools: Build all tools required to build all tools. Note that 740# order is important in a number of cases and also note that the bootstrap 741# and build tools stages have access to earlier binaries they themselves 742# had generated. 743# 744# patch: older patch's do not have -i. This program must be built 745# first so other bootstrap tools that need to apply patches 746# can use it. 747# [x]install: dependancies on various new install features 748# rpcgen: old rpcgen used a hardwired cpp path, newer OBJFORMAT_PATH 749# envs are not compatible with older objformat binaries. 750# 751.if exists(${.CURDIR}/games) && !defined(NO_GAMES) 752_strfile= games/fortune/strfile 753.endif 754 755bootstrap-tools: 756 ${LN} -fs /bin/date ${BTOOLSDEST}/bin/date 757.for _tool in ${_strfile} \ 758 usr.bin/patch \ 759 bin/chmod bin/cp bin/dd bin/mkdir bin/rm bin/echo bin/test \ 760 bin/cat bin/ln bin/mv bin/csh bin/expr bin/sh \ 761 bin/hostname bin/kill \ 762 usr.bin/yacc usr.bin/colldef usr.bin/uudecode usr.bin/xinstall \ 763 usr.bin/m4 usr.bin/rpcgen usr.bin/make usr.bin/awk usr.bin/stat \ 764 usr.bin/find usr.bin/lex usr.bin/sed usr.bin/uname usr.bin/touch \ 765 usr.bin/mkdep usr.bin/mktemp usr.bin/lorder usr.bin/file2c \ 766 usr.bin/tsort usr.bin/tr usr.bin/join usr.bin/wc usr.bin/basename \ 767 usr.bin/gencat usr.bin/chflags usr.bin/expand usr.bin/paste \ 768 usr.bin/mklocale usr.bin/uuencode usr.bin/compile_et usr.bin/hexdump \ 769 usr.bin/vi usr.bin/cap_mkdb usr.bin/vgrind usr.bin/true usr.bin/false \ 770 usr.bin/cmp usr.bin/xargs usr.bin/id usr.bin/env usr.bin/dirname \ 771 usr.bin/tail \ 772 usr.sbin/chown usr.sbin/mtree usr.sbin/config \ 773 usr.sbin/btxld usr.sbin/pwd_mkdb usr.sbin/zic usr.sbin/makewhatis \ 774 gnu/usr.bin/texinfo gnu/usr.bin/grep gnu/usr.bin/sort \ 775 usr.bin/gzip usr.bin/bzip2 usr.bin/mkcsmapper usr.bin/mkesdb 776 ${ECHODIR} "===> ${_tool} (bootstrap-tools)"; \ 777 cd ${.CURDIR}/${_tool}; \ 778 ${MAKE} DIRPRFX=${_tool}/ obj; \ 779 ${MAKE} DIRPRFX=${_tool}/ depend; \ 780 ${MAKE} DIRPRFX=${_tool}/ all; \ 781 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${BTOOLSDEST} install 782.endfor 783 touch ${BTOOLSDEST}/.bootstrap_done 784 785# build-tools: Build special purpose build tools. 786# 787# XXX we may be able to remove or consolidate this into bootstrap-tools 788# now that we have the native helper (.nx/.no) infrastructure. 789# 790.if exists(${.CURDIR}/games) && !defined(NO_GAMES) 791_games= games/adventure games/hack games/phantasia 792.endif 793 794.if exists(${.CURDIR}/share) && !defined(NO_SHARE) 795_share= share/syscons/scrnmaps 796.endif 797 798_gcc34_cross= gnu/usr.bin/cc34 799_gcc34_tools= gnu/usr.bin/cc34/cc_prep gnu/usr.bin/cc34/cc_tools 800.if defined(WANT_GCC40) 801_gcc40_cross= gnu/usr.bin/cc40 802_gcc40_tools= gnu/usr.bin/cc40/cc_prep gnu/usr.bin/cc40/cc_tools 803.endif 804_binutils= gnu/usr.bin/binutils215 805 806.if !defined(NO_FORTRAN) 807_fortran= gnu/usr.bin/cc34/f771 808.endif 809 810.if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \ 811 !defined(NO_CRYPT) && defined(WANT_KERBEROS) 812_libkrb5= kerberos5/tools kerberos5/lib/libroken kerberos5/lib/libvers \ 813 kerberos5/lib/libasn1 kerberos5/lib/libhdb kerberos5/lib/libsl 814.endif 815 816build-tools: 817.for _tool in ${_gcc34_tools} ${_gcc40_tools} ${_fortran} ${_libkrb5} ${_share} 818 ${ECHODIR} "===> ${_tool} (build-tools)"; \ 819 cd ${.CURDIR}/${_tool}; \ 820 ${MAKE} DIRPRFX=${_tool}/ obj; \ 821 ${MAKE} DIRPRFX=${_tool}/ depend; \ 822 ${MAKE} DIRPRFX=${_tool}/ all; \ 823 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${BTOOLSDEST} install 824.endfor 825 touch ${BTOOLSDEST}/.build_done 826 827# 828# cross-tools: Build cross-building tools 829# 830.if ${TARGET_ARCH} == "i386" && ${MACHINE_ARCH} != "i386" 831_btxld= usr.sbin/btxld 832.endif 833 834cross-tools: 835.for _tool in ${_btxld} ${_binutils} \ 836 usr.bin/objformat usr.sbin/crunch/crunchide \ 837 ${_gcc34_cross} ${_gcc40_cross} 838 ${ECHODIR} "===> ${_tool} (cross-tools)"; \ 839 cd ${.CURDIR}/${_tool}; \ 840 ${MAKE} DIRPRFX=${_tool}/ obj; \ 841 ${MAKE} DIRPRFX=${_tool}/ depend; \ 842 ${MAKE} DIRPRFX=${_tool}/ all; \ 843 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${CTOOLSDEST} install 844.endfor 845 touch ${CTOOLSDEST}/.cross_done 846 847# 848# hierarchy - ensure that all the needed directories are present 849# 850hierarchy: 851 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs 852 853# 854# libraries - build all libraries, and install them under ${DESTDIR}. 855# 856# The list of libraries with dependents (${_prebuild_libs}) and their 857# interdependencies (__L) are built automatically by the 858# ${.CURDIR}/tools/make_libdeps.sh script. 859# 860# .makeenv does not work when bootstrapping from 4.x, so we must be sure 861# to specify the correct CCVER or 'cc' will not exec the correct compiler. 862# 863libraries: 864 cd ${.CURDIR}; \ 865 HOST_CCVER=${HOST_CCVER} CCVER=gcc34 \ 866 ${MAKE} -f Makefile.inc1 _startup_libs34; 867.if defined(WANT_GCC40) 868 cd ${.CURDIR}; \ 869 HOST_CCVER=${HOST_CCVER} CCVER=gcc40 \ 870 ${MAKE} -f Makefile.inc1 _startup_libs40; 871.endif 872 cd ${.CURDIR}; \ 873 ${MAKE} -f Makefile.inc1 _startup_libs; \ 874 ${MAKE} -f Makefile.inc1 _prebuild_libs; \ 875 ${MAKE} -f Makefile.inc1 _generic_libs; 876 touch ${WORLDDEST}/.libraries_done 877 878# These dependencies are not automatically generated: 879# 880# gnu/lib/${CCVER}/libgcc and lib/csu must be built before all 881# shared libraries for ELF. The target for _startup_libs34 is 882# specifically built using gcc34. Same goes for _startup_libs40. 883# 884_startup_libs34= gnu/lib/gcc34/libgcc 885_startup_libs40= gnu/lib/gcc40/libgcc 886_startup_libs= lib/csu/${MACHINE_ARCH} 887_startup_libs+= lib/csu/common lib/libc lib/libc_rtld 888 889_prebuild_libs= lib/libarchive 890_prebuild_libs+= lib/libutil 891 892_generic_libs= gnu/lib 893 894.if !defined(NO_CRYPT) && defined(WANT_KERBEROS) 895_prebuild_libs+= kerberos5/tools 896_prebuild_libs+= kerberos5/lib/libasn1 897_prebuild_libs+= kerberos5/lib/libgssapi 898_prebuild_libs+= kerberos5/lib/libkrb5 899_prebuild_libs+= kerberos5/lib/libroken 900_generic_libs+= kerberos5/lib 901.endif 902 903_prebuild_libs+= lib/libcom_err lib/libcrypt lib/libmd \ 904 lib/libncurses/libncurses lib/libopie lib/libradius \ 905 lib/libskey lib/libtacplus lib/libz lib/libm lib/libpam 906 907lib/libopie__L lib/libradius__L lib/libtacplus__L: lib/libmd__L 908lib/libskey__L: lib/libcrypt__L lib/libmd__L 909 910_generic_libs+= lib 911 912.if !defined(NO_CRYPT) 913.if !defined(NO_OPENSSL) 914_prebuild_libs+= secure/lib/libcrypto secure/lib/libssl 915.if !defined(NO_OPENSSH) 916_prebuild_libs+= secure/lib/libssh 917secure/lib/libssh__L: secure/lib/libcrypto__L lib/libz__L 918.endif 919.endif 920_generic_libs+= secure/lib 921.endif 922 923_generic_libs+= usr.bin/lex/lib 924 925.for _lib in ${_startup_libs34} ${_startup_libs40} \ 926 ${_startup_libs} ${_prebuild_libs} ${_generic_libs} 927${_lib}__L: .PHONY 928.if exists(${.CURDIR}/${_lib}) 929 ${ECHODIR} "===> ${_lib}"; \ 930 cd ${.CURDIR}/${_lib}; \ 931 ${MAKE} DIRPRFX=${_lib}/ depend; \ 932 ${MAKE} DIRPRFX=${_lib}/ all; \ 933 ${MAKE} DIRPRFX=${_lib}/ install 934.endif 935.endfor 936 937_startup_libs: ${_startup_libs:S/$/__L/} 938_startup_libs34: ${_startup_libs34:S/$/__L/} 939_startup_libs40: ${_startup_libs40:S/$/__L/} 940_prebuild_libs: ${_prebuild_libs:S/$/__L/} 941_generic_libs: ${_generic_libs:S/$/__L/} 942 943# library targets must be ordered because there are inter-library 944# races (e.g. generation of tconfig.h) 945# 946.ORDER: ${_startup_libs34:S/$/__L/} 947.ORDER: ${_startup_libs40:S/$/__L/} 948.ORDER: ${_startup_libs:S/$/__L/} 949.ORDER: ${_prebuild_libs:S/$/__L/} 950.ORDER: ${_generic_libs:S/$/__L/} 951 952.for __target in clean cleandepend cleandir obj depend includes 953.for entry in ${SUBDIR} 954${entry}.${__target}__D: .PHONY 955 @if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \ 956 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \ 957 edir=${entry}.${MACHINE_ARCH}; \ 958 cd ${.CURDIR}/$${edir}; \ 959 else \ 960 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \ 961 edir=${entry}; \ 962 cd ${.CURDIR}/$${edir}; \ 963 fi; \ 964 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/ 965.endfor 966par-${__target}: ${SUBDIR:S/$/.${__target}__D/} 967.ORDER: ${SUBDIR:S/$/.${__target}__D/} 968.endfor 969.ORDER: par-clean par-cleandepend par-cleandir par-obj par-depend par-includes 970 971# The wmake target is used by /usr/bin/wmake to run make in a 972# world build environment. 973# 974wmake: 975 @echo '${WMAKEENV} ${MAKE} -m ${.CURDIR}/share/mk ${WMAKE_ARGS}' 976 977wmakeenv: 978 @echo '${WMAKEENV} /bin/sh' 979 980bmake: 981 @echo '${BMAKEENV} ${MAKE} -m ${.CURDIR}/share/mk ${BMAKE_ARGS}' 982 983bmakeenv: 984 @echo '${BMAKEENV} /bin/sh' 985 986tmake: 987 @echo '${TMAKEENV} ${MAKE} -m ${.CURDIR}/share/mk ${TMAKE_ARGS}' 988 989tmakeenv: 990 @echo '${TMAKEENV} /bin/sh' 991 992.include <bsd.subdir.mk> 993 994