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