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