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