1# 2# $FreeBSD$ 3# 4# Make command line options: 5# -DNO_DYNAMICROOT do not link /bin and /sbin dynamically 6# -DNO_KERBEROS Do not build Heimdal (Kerberos 5) 7# -DNO_RESCUE do not build rescue binaries 8# -DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir 9# -DNOCLEAN do not clean at all 10# -DNOCRYPT will prevent building of crypt versions 11# -DNOMAN do not build the manual pages 12# -DNOPROFILE do not build profiled libraries 13# -DNOGAMES do not go into games subdir 14# -DNOSHARE do not go into share subdir 15# -DNOINFO do not make or install info files 16# -DNOLIBC_R do not build libc_r. 17# -DNO_FORTRAN do not build g77 and related libraries. 18# -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel 19# -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel 20# -DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel 21# -DNO_PORTSUPDATE do not update ports in ${MAKE} update 22# -DNO_DOCUPDATE do not update doc in ${MAKE} update 23# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list 24# TARGET_ARCH="arch" to crossbuild world to a different arch 25 26# 27# The intended user-driven targets are: 28# buildworld - rebuild *everything*, including glue to help do upgrades 29# installworld- install everything built by "buildworld" 30# update - convenient way to update your source tree (eg: sup/cvs) 31# 32# Standard targets (not defined here) are documented in the makefiles in 33# /usr/share/mk. These include: 34# obj depend all install clean cleandepend cleanobj 35 36# Put initial settings here. 37SUBDIR= 38 39# We must do share/info early so that installation of info `dir' 40# entries works correctly. Do it first since it is less likely to 41# grow dependencies on include and lib than vice versa. 42.if exists(${.CURDIR}/share/info) 43SUBDIR+= share/info 44.endif 45 46.if exists(${.CURDIR}/include) 47SUBDIR+= include 48.endif 49.if exists(${.CURDIR}/lib) 50SUBDIR+= lib 51.endif 52 53# When upgrading to a dynamically linked root, install the runtime 54# linker early into its new location before make(1) has a chance 55# to run the dynamically linked /bin/sh. 56.if !defined(NO_DYNAMICROOT) && !defined(NOPIC) && \ 57 (!defined(TARGET_ARCH) || ${TARGET_ARCH} == ${MACHINE_ARCH}) && \ 58 !defined(DISTDIR) && \ 59 (!defined(DESTDIR) || empty(DESTDIR) || ${DESTDIR} == "/") && \ 60 !exists(/libexec/ld-elf.so.1) 61SUBDIR+= libexec/rtld-elf 62.endif 63 64.if exists(${.CURDIR}/bin) 65SUBDIR+= bin 66.endif 67.if exists(${.CURDIR}/games) && !defined(NOGAMES) 68SUBDIR+= games 69.endif 70.if exists(${.CURDIR}/gnu) 71SUBDIR+= gnu 72.endif 73.if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \ 74 !defined(NOCRYPT) && !defined(NO_OPENSSL) && !defined(NO_KERBEROS) 75SUBDIR+= kerberos5 76.endif 77.if exists(${.CURDIR}/libexec) 78SUBDIR+= libexec 79.endif 80.if exists(${.CURDIR}/rescue) && !defined(NO_RESCUE) 81SUBDIR+= rescue 82.endif 83.if exists(${.CURDIR}/sbin) 84SUBDIR+= sbin 85.endif 86.if exists(${.CURDIR}/secure) && !defined(NOCRYPT) 87SUBDIR+= secure 88.endif 89.if exists(${.CURDIR}/share) && !defined(NOSHARE) 90SUBDIR+= share 91.endif 92.if exists(${.CURDIR}/sys) 93SUBDIR+= sys 94.endif 95.if exists(${.CURDIR}/usr.bin) 96SUBDIR+= usr.bin 97.endif 98.if exists(${.CURDIR}/usr.sbin) 99SUBDIR+= usr.sbin 100.endif 101 102# etc must be last for "distribute" to work 103.if exists(${.CURDIR}/etc) 104SUBDIR+= etc 105.endif 106 107# These are last, since it is nice to at least get the base system 108# rebuilt before you do them. 109.if defined(LOCAL_DIRS) 110.for _DIR in ${LOCAL_DIRS} 111.if exists(${.CURDIR}/${_DIR}) && exists(${.CURDIR}/${_DIR}/Makefile) 112SUBDIR+= ${_DIR} 113.endif 114.endfor 115.endif 116 117.if defined(SUBDIR_OVERRIDE) 118SUBDIR= ${SUBDIR_OVERRIDE} 119.endif 120 121.if defined(NOCLEANDIR) 122CLEANDIR= clean cleandepend 123.else 124CLEANDIR= cleandir 125.endif 126 127CVS?= cvs 128SUP?= /usr/local/bin/cvsup 129SUPFLAGS?= -g -L 2 -P - 130.if defined(SUPHOST) 131SUPFLAGS+= -h ${SUPHOST} 132.endif 133 134MAKEOBJDIRPREFIX?= /usr/obj 135.if !defined(OSRELDATE) 136.if exists(/usr/include/osreldate.h) 137OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \ 138 /usr/include/osreldate.h 139.else 140OSRELDATE= 0 141.endif 142.endif 143TARGET_ARCH?= ${MACHINE_ARCH} 144.if ${TARGET_ARCH} == ${MACHINE_ARCH} 145TARGET?= ${MACHINE} 146TARGET_CPUTYPE?=${CPUTYPE} 147.else 148TARGET?= ${TARGET_ARCH} 149TARGET_CPUTYPE?= 150.endif 151.if !empty(TARGET_CPUTYPE) 152_TARGET_CPUTYPE=${TARGET_CPUTYPE} 153.else 154_TARGET_CPUTYPE=dummy 155.endif 156_CPUTYPE!= ${MAKE} -f /dev/null -m ${.CURDIR}/share/mk \ 157 CPUTYPE=${_TARGET_CPUTYPE} -V CPUTYPE 158.if ${_CPUTYPE} != ${_TARGET_CPUTYPE} 159.error CPUTYPE global should be set with ?=. 160.endif 161.if make(buildworld) 162BUILD_ARCH!= sysctl -n hw.machine_arch 163.if ${MACHINE_ARCH} != ${BUILD_ARCH} 164.error To cross-build, set TARGET_ARCH. 165.endif 166.endif 167.if ${MACHINE} == ${TARGET} 168OBJTREE= ${MAKEOBJDIRPREFIX} 169.else 170OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET} 171.endif 172WORLDTMP= ${OBJTREE}${.CURDIR}/${MACHINE_ARCH} 173# /usr/games added for fortune which depend on strfile 174BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games 175XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games 176STRICTTMPPATH= ${BPATH}:${XPATH} 177TMPPATH= ${STRICTTMPPATH}:${PATH} 178 179INSTALLTMP!= /usr/bin/mktemp -d -u -t install 180 181# 182# Building a world goes through the following stages 183# 184# 1. legacy stage [BMAKE] 185# This stage is responsible for creating compatibility 186# shims that are needed by the bootstrap-tools, 187# build-tools and cross-tools stages. 188# 1. bootstrap-tools stage [BMAKE] 189# This stage is responsible for creating programs that 190# are needed for backward compatibility reasons. They 191# are not built as cross-tools. 192# 2. build-tools stage [TMAKE] 193# This stage is responsible for creating the object 194# tree and building any tools that are needed during 195# the build process. 196# 3. cross-tools stage [XMAKE] 197# This stage is responsible for creating any tools that 198# are needed for cross-builds. A cross-compiler is one 199# of them. 200# 4. world stage [WMAKE] 201# This stage actually builds the world. 202# 5. install stage (optional) [IMAKE] 203# This stage installs a previously built world. 204# 205 206BOOTSTRAPPING?= 0 207 208# Common environment for world related stages 209CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \ 210 MACHINE_ARCH=${TARGET_ARCH} \ 211 MACHINE=${TARGET} \ 212 CPUTYPE=${TARGET_CPUTYPE} \ 213 GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \ 214 GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \ 215 GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac 216 217# bootstrap-tools stage 218BMAKEENV= DESTDIR= \ 219 INSTALL="sh ${.CURDIR}/tools/install.sh" \ 220 PATH=${BPATH}:${PATH} \ 221 WORLDTMP=${WORLDTMP} \ 222 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" 223BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \ 224 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \ 225 BOOTSTRAPPING=${OSRELDATE} \ 226 -DNOHTML -DNOINFO -DNOLINT -DNOMAN -DNOPIC -DNOPROFILE \ 227 -DNOSHARED -DNO_CPU_CFLAGS -DNO_WARNS 228 229# build-tools stage 230TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \ 231 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \ 232 BOOTSTRAPPING=${OSRELDATE} -DNOLINT -DNO_CPU_CFLAGS -DNO_WARNS 233 234# cross-tools stage 235XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} -DNO_FORTRAN -DNO_GDB 236 237# world stage 238WMAKEENV= ${CROSSENV} \ 239 DESTDIR=${WORLDTMP} \ 240 _SHLIBDIRPREFIX=${WORLDTMP} \ 241 INSTALL="sh ${.CURDIR}/tools/install.sh" \ 242 PATH=${TMPPATH} 243WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1 244 245# install stage 246IMAKEENV= ${CROSSENV} \ 247 PATH=${STRICTTMPPATH}:${INSTALLTMP} 248IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 249 250# kernel stage 251KMAKEENV= ${WMAKEENV} 252 253# 254# buildworld 255# 256# Attempt to rebuild the entire system, with reasonable chance of 257# success, regardless of how old your existing system is. 258# 259_worldtmp: 260.if ${.CURDIR:C/[^,]//g} != "" 261# The m4 build of sendmail files doesn't like it if ',' is used 262# anywhere in the path of it's files. 263 @echo 264 @echo "*** Error: path to source tree contains a comma ','" 265 @echo 266 @false 267.endif 268 @echo 269 @echo "--------------------------------------------------------------" 270 @echo ">>> Rebuilding the temporary build tree" 271 @echo "--------------------------------------------------------------" 272.if !defined(NOCLEAN) 273 rm -rf ${WORLDTMP} 274.else 275 rm -rf ${WORLDTMP}/legacy/usr/include 276 # XXX - These two can depend on any header file. 277 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c 278 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c 279.endif 280.for _dir in \ 281 usr/bin usr/games usr/include/sys usr/lib \ 282 usr/libexec usr/sbin usr/share/dict \ 283 usr/share/groff_font/devX100 \ 284 usr/share/groff_font/devX100-12 \ 285 usr/share/groff_font/devX75 \ 286 usr/share/groff_font/devX75-12 \ 287 usr/share/groff_font/devascii \ 288 usr/share/groff_font/devcp1047 \ 289 usr/share/groff_font/devdvi \ 290 usr/share/groff_font/devhtml \ 291 usr/share/groff_font/devkoi8-r \ 292 usr/share/groff_font/devlatin1 \ 293 usr/share/groff_font/devlbp \ 294 usr/share/groff_font/devlj4 \ 295 usr/share/groff_font/devps \ 296 usr/share/groff_font/devutf8 \ 297 usr/share/tmac/mdoc usr/share/tmac/mm 298 mkdir -p ${WORLDTMP}/legacy/${_dir} 299.endfor 300.for _dir in \ 301 lib usr/bin usr/include usr/lib/compat/aout usr/libdata/ldscripts \ 302 usr/libexec usr/share/misc usr/share/bsnmp/defs usr/share/bsnmp/mibs 303 mkdir -p ${WORLDTMP}/${_dir} 304.endfor 305 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 306 -p ${WORLDTMP}/usr/include 307 ln -sf ${.CURDIR}/sys ${WORLDTMP} 308_legacy: 309 @echo 310 @echo "--------------------------------------------------------------" 311 @echo ">>> stage 1.1: legacy release compatibility shims" 312 @echo "--------------------------------------------------------------" 313 cd ${.CURDIR}; ${BMAKE} legacy 314_bootstrap-tools: 315 @echo 316 @echo "--------------------------------------------------------------" 317 @echo ">>> stage 1.2: bootstrap tools" 318 @echo "--------------------------------------------------------------" 319 cd ${.CURDIR}; ${BMAKE} bootstrap-tools 320_cleanobj: 321.if !defined(NOCLEAN) 322 @echo 323 @echo "--------------------------------------------------------------" 324 @echo ">>> stage 2.1: cleaning up the object tree" 325 @echo "--------------------------------------------------------------" 326 cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/} 327.endif 328_obj: 329 @echo 330 @echo "--------------------------------------------------------------" 331 @echo ">>> stage 2.2: rebuilding the object tree" 332 @echo "--------------------------------------------------------------" 333 cd ${.CURDIR}; ${WMAKE} par-obj 334_build-tools: 335 @echo 336 @echo "--------------------------------------------------------------" 337 @echo ">>> stage 2.3: build tools" 338 @echo "--------------------------------------------------------------" 339 cd ${.CURDIR}; ${TMAKE} build-tools 340_cross-tools: 341 @echo 342 @echo "--------------------------------------------------------------" 343 @echo ">>> stage 3: cross tools" 344 @echo "--------------------------------------------------------------" 345 cd ${.CURDIR}; ${XMAKE} cross-tools 346_includes: 347 @echo 348 @echo "--------------------------------------------------------------" 349 @echo ">>> stage 4.1: building includes" 350 @echo "--------------------------------------------------------------" 351 cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes 352_libraries: 353 @echo 354 @echo "--------------------------------------------------------------" 355 @echo ">>> stage 4.2: building libraries" 356 @echo "--------------------------------------------------------------" 357 cd ${.CURDIR}; ${WMAKE} -DNOHTML -DNOINFO -DNOMAN -DNOFSCHG -DNOLINT \ 358 libraries 359_depend: 360 @echo 361 @echo "--------------------------------------------------------------" 362 @echo ">>> stage 4.3: make dependencies" 363 @echo "--------------------------------------------------------------" 364 cd ${.CURDIR}; ${WMAKE} par-depend 365everything: 366 @echo 367 @echo "--------------------------------------------------------------" 368 @echo ">>> stage 4.4: building everything.." 369 @echo "--------------------------------------------------------------" 370 cd ${.CURDIR}; ${WMAKE} par-all 371 372 373WMAKE_TGTS= 374.if !defined(SUBDIR_OVERRIDE) 375WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools 376.endif 377WMAKE_TGTS+= _cleanobj _obj _build-tools 378.if !defined(SUBDIR_OVERRIDE) 379WMAKE_TGTS+= _cross-tools 380.endif 381WMAKE_TGTS+= _includes _libraries _depend everything 382 383buildworld: ${WMAKE_TGTS} 384.ORDER: ${WMAKE_TGTS} 385 386# 387# installcheck 388# 389# Checks to be sure system is ready for installworld 390# 391installcheck: 392.if !defined(NO_SENDMAIL) 393 @if ! `id -u smmsp > /dev/null`; then \ 394 echo "ERROR: Required smmsp user is missing, see /usr/src/UPDATING."; \ 395 false; \ 396 fi 397 @if ! `id -g smmsp > /dev/null`; then \ 398 echo "ERROR: Required smmsp group is missing, see /usr/src/UPDATING."; \ 399 false; \ 400 fi 401.endif 402 403# 404# distributeworld 405# 406# Distributes everything compiled by a `buildworld'. 407# 408# installworld 409# 410# Installs everything compiled by a 'buildworld'. 411# 412distributeworld installworld: installcheck 413 mkdir -p ${INSTALLTMP} 414 for prog in [ awk cap_mkdb cat chflags chmod chown \ 415 date echo egrep find grep \ 416 ln make mkdir mtree mv pwd_mkdb rm sed sh sysctl \ 417 test true uname wc zic; do \ 418 cp `which $$prog` ${INSTALLTMP}; \ 419 done 420 cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//} 421 rm -rf ${INSTALLTMP} 422 423# 424# reinstall 425# 426# If you have a build server, you can NFS mount the source and obj directories 427# and do a 'make reinstall' on the *client* to install new binaries from the 428# most recent server build. 429# 430reinstall: 431 @echo "--------------------------------------------------------------" 432 @echo ">>> Making hierarchy" 433 @echo "--------------------------------------------------------------" 434 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy 435 @echo 436 @echo "--------------------------------------------------------------" 437 @echo ">>> Installing everything.." 438 @echo "--------------------------------------------------------------" 439 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install 440.if !defined(NOMAN) && !defined(NO_MAKEDB_RUN) 441 @echo 442 @echo "--------------------------------------------------------------" 443 @echo ">>> Rebuilding man page indices" 444 @echo "--------------------------------------------------------------" 445 cd ${.CURDIR}/share/man; ${MAKE} makedb 446.endif 447 448redistribute: 449 @echo "--------------------------------------------------------------" 450 @echo ">>> Distributing everything.." 451 @echo "--------------------------------------------------------------" 452 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute 453 454# 455# buildkernel and installkernel 456# 457# Which kernels to build and/or install is specified by setting 458# KERNCONF. If not defined a GENERIC kernel is built/installed. 459# Only the existing (depending TARGET) config files are used 460# for building kernels and only the first of these is designated 461# as the one being installed. 462# 463# Note that we have to use TARGET instead of TARGET_ARCH when 464# we're in kernel-land. Since only TARGET_ARCH is (expected) to 465# be set to cross-build, we have to make sure TARGET is set 466# properly. 467 468.if !defined(KERNCONF) && defined(KERNEL) 469KERNCONF= ${KERNEL} 470KERNWARN= yes 471.else 472KERNCONF?= GENERIC 473.endif 474INSTKERNNAME?= kernel 475 476KERNSRCDIR?= ${.CURDIR}/sys 477KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf 478KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR} 479KERNCONFDIR?= ${KRNLCONFDIR} 480 481BUILDKERNELS= 482INSTALLKERNEL= 483.for _kernel in ${KERNCONF} 484.if exists(${KERNCONFDIR}/${_kernel}) 485BUILDKERNELS+= ${_kernel} 486.if empty(INSTALLKERNEL) 487INSTALLKERNEL= ${_kernel} 488.endif 489.endif 490.endfor 491 492# 493# buildkernel 494# 495# Builds all kernels defined by BUILDKERNELS. 496# 497buildkernel: 498.if empty(BUILDKERNELS) 499 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; 500 @false 501.endif 502.if defined(KERNWARN) 503 @echo "--------------------------------------------------------------" 504 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF=" 505 @echo "--------------------------------------------------------------" 506 @sleep 3 507.endif 508 @echo 509.for _kernel in ${BUILDKERNELS} 510 @echo "--------------------------------------------------------------" 511 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`" 512 @echo "--------------------------------------------------------------" 513 @echo "===> ${_kernel}" 514 mkdir -p ${KRNLOBJDIR} 515.if !defined(NO_KERNELCONFIG) 516 cd ${KRNLCONFDIR}; \ 517 PATH=${TMPPATH} \ 518 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \ 519 ${KERNCONFDIR}/${_kernel} 520.endif 521.if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN) 522 cd ${KRNLOBJDIR}/${_kernel}; \ 523 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} ${CLEANDIR} 524.endif 525 cd ${KRNLOBJDIR}/${_kernel}; \ 526 MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \ 527 ${MAKE} -DNO_CPU_CFLAGS -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile 528 cd ${KRNLOBJDIR}/${_kernel}; \ 529 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} obj 530# XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case. 531.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules) 532.for target in obj depend all 533 cd ${.CURDIR}/sys/modules/aic7xxx/aicasm; \ 534 MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \ 535 ${MAKE} -DNO_CPU_CFLAGS ${target} 536.endfor 537.endif 538.if !defined(NO_KERNELDEPEND) 539 cd ${KRNLOBJDIR}/${_kernel}; \ 540 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend -DNO_MODULES_OBJ 541.endif 542 cd ${KRNLOBJDIR}/${_kernel}; \ 543 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all -DNO_MODULES_OBJ 544 @echo "--------------------------------------------------------------" 545 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`" 546 @echo "--------------------------------------------------------------" 547.endfor 548 549# 550# installkernel 551# 552# Install the kernel defined by INSTALLKERNEL 553# 554installkernel reinstallkernel installkernel.debug reinstallkernel.debug: 555.if empty(INSTALLKERNEL) 556 @echo "ERROR: No kernel \"${KERNCONF}\" to install." 557 @false 558.endif 559 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ 560 ${CROSSENV} PATH=${TMPPATH} \ 561 ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//} 562 563# 564# update 565# 566# Update the source tree, by running sup and/or running cvs to update to the 567# latest copy. 568# 569update: 570.if defined(SUP_UPDATE) 571 @echo "--------------------------------------------------------------" 572 @echo ">>> Running ${SUP}" 573 @echo "--------------------------------------------------------------" 574.if defined(SUPFILE) 575 @${SUP} ${SUPFLAGS} ${SUPFILE} 576.endif 577.if defined(SUPFILE1) 578 @${SUP} ${SUPFLAGS} ${SUPFILE1} 579.endif 580.if defined(SUPFILE2) 581 @${SUP} ${SUPFLAGS} ${SUPFILE2} 582.endif 583.if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE) 584 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE} 585.endif 586.if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE) 587 @${SUP} ${SUPFLAGS} ${DOCSUPFILE} 588.endif 589.endif 590.if defined(CVS_UPDATE) 591 @echo "--------------------------------------------------------------" 592 @echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT} 593 @echo "--------------------------------------------------------------" 594 cd ${.CURDIR}; ${CVS} -R -q update -A -P -d 595.endif 596 597# 598# ------------------------------------------------------------------------ 599# 600# From here onwards are utility targets used by the 'make world' and 601# related targets. If your 'world' breaks, you may like to try to fix 602# the problem and manually run the following targets to attempt to 603# complete the build. Beware, this is *not* guaranteed to work, you 604# need to have a pretty good grip on the current state of the system 605# to attempt to manually finish it. If in doubt, 'make world' again. 606# 607 608# 609# legacy: Build compatibility shims for the next three targets 610# 611legacy: 612.for _tool in tools/build 613 @${ECHODIR} "===> ${_tool}"; \ 614 cd ${.CURDIR}/${_tool}; \ 615 ${MAKE} DIRPRFX=${_tool}/ obj; \ 616 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \ 617 ${MAKE} DIRPRFX=${_tool}/ depend; \ 618 ${MAKE} DIRPRFX=${_tool}/ all; \ 619 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install 620.endfor 621 622# 623# bootstrap-tools: Build tools needed for compatibility 624# 625.if exists(${.CURDIR}/games) && !defined(NOGAMES) 626_strfile= games/fortune/strfile 627.endif 628 629.if !defined(NO_CXX) 630_gperf= gnu/usr.bin/gperf 631.if ${BOOTSTRAPPING} < 500113 632_groff= gnu/usr.bin/groff 633.else 634_groff= gnu/usr.bin/groff/tmac 635.endif 636.endif 637 638.if ${BOOTSTRAPPING} < 450005 || \ 639 ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500034 640_uudecode= usr.bin/uudecode 641.endif 642 643.if ${BOOTSTRAPPING} < 430002 || \ 644 ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500019 645_xargs= usr.bin/xargs 646.endif 647 648.if ${BOOTSTRAPPING} < 430002 || \ 649 ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500018 650_yacc= usr.bin/yacc 651.endif 652 653.if !defined(NO_RESCUE) && \ 654 ${BOOTSTRAPPING} < 501100 655_crunchgen= usr.sbin/crunch/crunchgen 656.endif 657 658.if ${BOOTSTRAPPING} < 500019 659_kbdcontrol= usr.sbin/kbdcontrol 660.endif 661 662bootstrap-tools: 663.for _tool in \ 664 ${_strfile} \ 665 ${_gperf} \ 666 ${_groff} \ 667 gnu/usr.bin/texinfo \ 668 usr.bin/colldef \ 669 usr.bin/makewhatis \ 670 usr.bin/rpcgen \ 671 ${_uudecode} \ 672 ${_xargs} \ 673 usr.bin/xinstall \ 674 ${_yacc} \ 675 usr.sbin/config \ 676 ${_crunchgen} \ 677 ${_kbdcontrol} 678 @${ECHODIR} "===> ${_tool}"; \ 679 cd ${.CURDIR}/${_tool}; \ 680 ${MAKE} DIRPRFX=${_tool}/ obj; \ 681 ${MAKE} DIRPRFX=${_tool}/ depend; \ 682 ${MAKE} DIRPRFX=${_tool}/ all; \ 683 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install 684.endfor 685 686# 687# build-tools: Build special purpose build tools 688# 689.if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules) 690_aicasm= sys/modules/aic7xxx/aicasm 691.endif 692 693.if exists(${.CURDIR}/share) && !defined(NOSHARE) 694_share= share/syscons/scrnmaps 695.endif 696 697.if !defined(NO_FORTRAN) 698_fortran= gnu/usr.bin/cc/f771 699.endif 700 701.if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \ 702 !defined(NOCRYPT) && !defined(NO_OPENSSL) && !defined(NO_KERBEROS) 703_libkrb5= kerberos5/lib/libroken kerberos5/lib/libvers \ 704 kerberos5/lib/libasn1 kerberos5/lib/libhdb kerberos5/lib/libsl 705.endif 706 707.if exists(${.CURDIR}/rescue) && !defined(NO_RESCUE) 708_rescue= rescue/rescue 709.endif 710 711build-tools: 712.for _tool in \ 713 bin/csh \ 714 bin/sh \ 715 ${_rescue} \ 716 gnu/usr.bin/cc/cc_tools \ 717 ${_fortran} \ 718 ${_libkrb5} \ 719 lib/libncurses \ 720 ${_share} \ 721 ${_aicasm} \ 722 usr.bin/awk \ 723 usr.bin/file \ 724 usr.sbin/sysinstall 725 @${ECHODIR} "===> ${_tool}"; \ 726 cd ${.CURDIR}/${_tool}; \ 727 ${MAKE} DIRPRFX=${_tool}/ obj; \ 728 ${MAKE} DIRPRFX=${_tool}/ build-tools 729.endfor 730 731# 732# cross-tools: Build cross-building tools 733# 734.if ${TARGET_ARCH} == "sparc64" && ${TARGET_ARCH} != ${MACHINE_ARCH} && \ 735 ${BOOTSTRAPPING} < 500037 736_elf2aout= usr.bin/elf2aout 737.endif 738 739.if ${TARGET_ARCH} == "i386" && ${TARGET_ARCH} != ${MACHINE_ARCH} 740_btxld= usr.sbin/btxld 741.endif 742 743.if (!defined(NO_RESCUE) || \ 744 defined(RELEASEDIR)) && \ 745 (${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 501101) 746_crunchide= usr.sbin/crunch/crunchide 747.endif 748 749.if ${TARGET_ARCH} == "alpha" && ${TARGET_ARCH} != ${MACHINE_ARCH} 750_elf2exe= usr.sbin/elf2exe 751.endif 752 753.if ${TARGET_ARCH} == "i386" && ${TARGET_ARCH} != ${MACHINE_ARCH} && \ 754 defined(RELEASEDIR) 755_kgzip= usr.sbin/kgzip 756.endif 757 758cross-tools: 759.for _tool in \ 760 gnu/usr.bin/binutils \ 761 gnu/usr.bin/cc \ 762 ${_elf2aout} \ 763 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \ 764 ${_btxld} \ 765 ${_crunchide} \ 766 ${_elf2exe} \ 767 ${_kgzip} 768 @${ECHODIR} "===> ${_tool}"; \ 769 cd ${.CURDIR}/${_tool}; \ 770 ${MAKE} DIRPRFX=${_tool}/ obj; \ 771 ${MAKE} DIRPRFX=${_tool}/ depend; \ 772 ${MAKE} DIRPRFX=${_tool}/ all; \ 773 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install 774.endfor 775 776# 777# hierarchy - ensure that all the needed directories are present 778# 779hierarchy: 780 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs 781 782# 783# libraries - build all libraries, and install them under ${DESTDIR}. 784# 785# The list of libraries with dependents (${_prebuild_libs}) and their 786# interdependencies (__L) are built automatically by the 787# ${.CURDIR}/tools/make_libdeps.sh script. 788# 789libraries: 790 cd ${.CURDIR}; \ 791 ${MAKE} -f Makefile.inc1 _startup_libs; \ 792 ${MAKE} -f Makefile.inc1 _prebuild_libs; \ 793 ${MAKE} -f Makefile.inc1 _generic_libs; 794 795# These dependencies are not automatically generated: 796# 797# gnu/lib/csu, gnu/lib/libgcc and lib/csu must be built before all 798# shared libraries for ELF. 799# 800_startup_libs= gnu/lib/csu gnu/lib/libgcc 801.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf) 802_startup_libs+= lib/csu/${MACHINE_ARCH}-elf 803.else 804_startup_libs+= lib/csu/${MACHINE_ARCH} 805.endif 806 807_prebuild_libs= 808 809_generic_libs= gnu/lib 810 811.if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \ 812 !defined(NOCRYPT) && !defined(NO_OPENSSL) && !defined(NO_KERBEROS) 813_prebuild_libs+= kerberos5/lib/libasn1 814_prebuild_libs+= kerberos5/lib/libgssapi 815_prebuild_libs+= kerberos5/lib/libkrb5 816_prebuild_libs+= kerberos5/lib/libroken 817_generic_libs+= kerberos5/lib 818.endif 819 820_prebuild_libs+= lib/libcom_err lib/libcrypt lib/libexpat \ 821 lib/libkvm lib/libmd \ 822 lib/libncurses lib/libnetgraph lib/libopie lib/libpam \ 823 lib/libradius lib/librpcsvc \ 824 lib/libsbuf lib/libtacplus lib/libutil lib/libypclnt \ 825 lib/libz lib/msun 826 827lib/libopie__L lib/libradius__L lib/libtacplus__L: lib/libmd__L 828lib/libypclnt__L: lib/librpcsvc__L 829 830_generic_libs+= lib 831 832.if !defined(NOCRYPT) 833.if !defined(NO_OPENSSL) 834_prebuild_libs+= secure/lib/libcrypto secure/lib/libssl 835.if !defined(NO_OPENSSH) 836_prebuild_libs+= secure/lib/libssh 837secure/lib/libssh__L: secure/lib/libcrypto__L lib/libz__L 838.endif 839.endif 840_generic_libs+= secure/lib 841.endif 842 843_generic_libs+= usr.bin/lex/lib 844 845.if ${MACHINE_ARCH} == "i386" 846_generic_libs+= usr.sbin/pcvt/keycap 847.endif 848 849.for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs} 850${_lib}__L: .PHONY 851.if exists(${.CURDIR}/${_lib}) 852 @${ECHODIR} "===> ${_lib}"; \ 853 cd ${.CURDIR}/${_lib}; \ 854 ${MAKE} DIRPRFX=${_lib}/ depend; \ 855 ${MAKE} DIRPRFX=${_lib}/ all; \ 856 ${MAKE} DIRPRFX=${_lib}/ install 857.endif 858.endfor 859 860# libpam is special: we need to build static PAM modules before 861# static PAM library, and dynamic PAM library before dynamic PAM 862# modules. 863lib/libpam__L: .PHONY 864 @${ECHODIR} "===> lib/libpam"; \ 865 cd ${.CURDIR}/lib/libpam; \ 866 ${MAKE} DIRPRFX=lib/libpam/ depend; \ 867 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \ 868 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install 869 870_startup_libs: ${_startup_libs:S/$/__L/} 871_prebuild_libs: ${_prebuild_libs:S/$/__L/} 872_generic_libs: ${_generic_libs:S/$/__L/} 873 874.for __target in all clean cleandepend cleandir depend includes obj 875.for entry in ${SUBDIR} 876${entry}.${__target}__D: .PHONY 877 @if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \ 878 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \ 879 edir=${entry}.${MACHINE_ARCH}; \ 880 cd ${.CURDIR}/$${edir}; \ 881 else \ 882 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \ 883 edir=${entry}; \ 884 cd ${.CURDIR}/$${edir}; \ 885 fi; \ 886 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/ 887.endfor 888par-${__target}: ${SUBDIR:S/$/.${__target}__D/} 889.endfor 890 891.include <bsd.subdir.mk> 892