1# 2# $FreeBSD$ 3# 4# Make command line options: 5# -DMAKE_KERBEROS4 to build KerberosIV 6# -DMAKE_KERBEROS5 to build Kerberos5 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# -DNOPROFILE do not build profiled libraries 11# -DNOSECURE do not go into secure subdir 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 24# 25# The intended user-driven targets are: 26# buildworld - rebuild *everything*, including glue to help do upgrades 27# installworld- install everything built by "buildworld" 28# update - convenient way to update your source tree (eg: sup/cvs) 29# most - build user commands, no libraries or include files 30# installmost - install user commands, no libraries or include files 31# 32# Standard targets (not defined here) are documented in the makefiles in 33# /usr/share/mk. These include: 34# obj depend all install clean cleandepend cleanobj 35 36# Put initial settings here. 37SUBDIR= 38 39# We must do share/info early so that installation of info `dir' 40# entries works correctly. Do it first since it is less likely to 41# grow dependencies on include and lib than vice versa. 42.if exists(${.CURDIR}/share/info) 43SUBDIR+= share/info 44.endif 45 46# We must do include and lib early so that the perl *.ph generation 47# works correctly as it uses the header files installed by this. 48.if exists(${.CURDIR}/include) 49SUBDIR+= include 50.endif 51.if exists(${.CURDIR}/lib) 52SUBDIR+= lib 53.endif 54 55.if exists(${.CURDIR}/bin) 56SUBDIR+= bin 57.endif 58.if exists(${.CURDIR}/games) && !defined(NOGAMES) 59SUBDIR+= games 60.endif 61.if exists(${.CURDIR}/gnu) 62SUBDIR+= gnu 63.endif 64.if exists(${.CURDIR}/kerberosIV) && exists(${.CURDIR}/crypto) && \ 65 !defined(NOCRYPT) && !defined(NO_OPENSSL) && defined(MAKE_KERBEROS4) 66SUBDIR+= kerberosIV 67.endif 68.if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \ 69 !defined(NOCRYPT) && !defined(NO_OPENSSL) && defined(MAKE_KERBEROS5) 70SUBDIR+= kerberos5 71.endif 72.if exists(${.CURDIR}/libexec) 73SUBDIR+= libexec 74.endif 75.if exists(${.CURDIR}/sbin) 76SUBDIR+= sbin 77.endif 78.if exists(${.CURDIR}/share) && !defined(NOSHARE) 79SUBDIR+= share 80.endif 81.if exists(${.CURDIR}/sys) 82SUBDIR+= sys 83.endif 84.if exists(${.CURDIR}/usr.bin) 85SUBDIR+= usr.bin 86.endif 87.if exists(${.CURDIR}/usr.sbin) 88SUBDIR+= usr.sbin 89.endif 90.if exists(${.CURDIR}/secure) && !defined(NOCRYPT) && !defined(NOSECURE) 91SUBDIR+= secure 92.endif 93 94# etc must be last for "distribute" to work 95.if exists(${.CURDIR}/etc) 96SUBDIR+= etc 97.endif 98 99# These are last, since it is nice to at least get the base system 100# rebuilt before you do them. 101.if defined(LOCAL_DIRS) 102.for _DIR in ${LOCAL_DIRS} 103.if exists(${.CURDIR}/${_DIR}) & exists(${.CURDIR}/${_DIR}/Makefile) 104SUBDIR+= ${_DIR} 105.endif 106.endfor 107.endif 108 109.if defined(NOCLEANDIR) 110CLEANDIR= clean cleandepend 111.else 112CLEANDIR= cleandir 113.endif 114 115SUP?= cvsup 116SUPFLAGS?= -g -L 2 -P - 117.if defined(SUPHOST) 118SUPFLAGS+= -h ${SUPHOST} 119.endif 120 121MAKEOBJDIRPREFIX?= /usr/obj 122TARGET_ARCH?= ${MACHINE_ARCH} 123BUILD_ARCH!= sysctl -n hw.machine_arch 124.if ${BUILD_ARCH} == ${MACHINE_ARCH} 125OBJTREE= ${MAKEOBJDIRPREFIX} 126.else 127OBJTREE= ${MAKEOBJDIRPREFIX}/${MACHINE_ARCH} 128.endif 129WORLDTMP= ${OBJTREE}${.CURDIR}/${BUILD_ARCH} 130# /usr/games added for fortune which depend on strfile 131STRICTTMPPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games 132TMPPATH= ${STRICTTMPPATH}:${PATH} 133OBJFORMAT_PATH?= /usr/libexec 134 135TMPDIR?= /tmp 136TMPPID!= echo $$$$ 137INSTALLTMP= ${TMPDIR}/install.${TMPPID} 138 139# 140# Building a world goes through the following stages 141# 142# 1. bootstrap-tool stage [BMAKE] 143# This stage is responsible for creating programs that 144# are needed for backward compatibility reasons. They 145# are not built as cross-tools. 146# 2. build-tool stage [TMAKE] 147# This stage is responsible for creating the object 148# tree and building any tools that are needed during 149# the build process. 150# 3. cross-tool stage [XMAKE] 151# This stage is responsible for creating any tools that 152# are needed for cross-builds. A cross-compiler is one 153# of them. 154# 4. world stage [WMAKE] 155# This stage actually builds the world. 156# 5. install stage (optional) [IMAKE] 157# This stage installs a previously built world. 158# 159 160# Common environment for bootstrap related stages 161BOOTSTRAPENV= MAKEOBJDIRPREFIX=${WORLDTMP} \ 162 DESTDIR=${WORLDTMP} \ 163 INSTALL="sh ${.CURDIR}/tools/install.sh" \ 164 MACHINE_ARCH=${BUILD_ARCH} \ 165 TOOLS_PREFIX=${WORLDTMP} \ 166 PATH=${TMPPATH} 167 168# Common environment for world related stages 169CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \ 170 COMPILER_PATH=${WORLDTMP}/usr/libexec:${WORLDTMP}/usr/bin \ 171 LIBRARY_PATH=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib \ 172 OBJFORMAT_PATH=${WORLDTMP}/usr/libexec \ 173 PERL5LIB=${WORLDTMP}/usr/libdata/perl/5.6.0 174 175# bootstrap-tool stage 176BMAKEENV= ${BOOTSTRAPENV} 177BMAKE= ${BMAKEENV} ${MAKE} -f Makefile.inc1 -DNOHTML -DNOINFO \ 178 -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED 179 180# build-tool stage 181TMAKEENV= MAKEOBJDIRPREFIX=${OBJTREE} \ 182 INSTALL="sh ${.CURDIR}/tools/install.sh" \ 183 PATH=${TMPPATH} 184TMAKE= ${TMAKEENV} ${MAKE} -f Makefile.inc1 185 186# cross-tool stage 187XMAKEENV= ${BOOTSTRAPENV} \ 188 TARGET_ARCH=${MACHINE_ARCH} 189XMAKE= ${XMAKEENV} ${MAKE} -f Makefile.inc1 -DNO_FORTRAN -DNO_GDB \ 190 -DNOHTML -DNOINFO -DNOMAN -DNOPIC -DNOPROFILE \ 191 -DNOSHARED 192 193# world stage 194WMAKEENV= ${CROSSENV} \ 195 DESTDIR=${WORLDTMP} \ 196 INSTALL="sh ${.CURDIR}/tools/install.sh" \ 197 PATH=${TMPPATH} 198WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1 199 200# install stage 201IMAKEENV= ${CROSSENV} \ 202 PATH=${STRICTTMPPATH}:${INSTALLTMP} 203IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 204 205# kernel stage 206KMAKEENV= ${WMAKEENV} \ 207 OBJFORMAT_PATH=${WORLDTMP}/usr/libexec:${OBJFORMAT_PATH} 208 209USRDIRS= usr/bin usr/lib/compat/aout usr/games usr/libdata/ldscripts \ 210 usr/libexec/${OBJFORMAT} usr/sbin usr/share/misc 211 212INCDIRS= arpa g++/std objc protocols readline rpc rpcsvc openssl \ 213 security ss 214 215# 216# buildworld 217# 218# Attempt to rebuild the entire system, with reasonable chance of 219# success, regardless of how old your existing system is. 220# 221buildworld: 222 @echo 223 @echo "--------------------------------------------------------------" 224 @echo ">>> Rebuilding the temporary build tree" 225 @echo "--------------------------------------------------------------" 226.if !defined(NOCLEAN) 227 rm -rf ${WORLDTMP} 228.else 229 for dir in bin games include lib sbin; do \ 230 rm -rf ${WORLDTMP}/usr/$$dir; \ 231 done 232 rm -f ${WORLDTMP}/sys 233 # XXX - Work-around for broken cc/cc_tools/Makefile. 234 # This is beyond dirty... 235 rm -f ${OBJTREE}${.CURDIR}/gnu/usr.bin/cc/cc_tools/.depend 236.endif 237.for _dir in ${USRDIRS} 238 mkdir -p ${WORLDTMP}/${_dir} 239.endfor 240.for _dir in ${INCDIRS} 241 mkdir -p ${WORLDTMP}/usr/include/${_dir} 242.endfor 243 ln -sf ${.CURDIR}/sys ${WORLDTMP}/sys 244 @echo 245 @echo "--------------------------------------------------------------" 246 @echo ">>> stage 1: bootstrap tools" 247 @echo "--------------------------------------------------------------" 248 cd ${.CURDIR}; ${BMAKE} bootstrap-tools 249.if !defined(NOCLEAN) 250 @echo 251 @echo "--------------------------------------------------------------" 252 @echo ">>> stage 2: cleaning up the object tree" 253 @echo "--------------------------------------------------------------" 254 cd ${.CURDIR}; ${TMAKE} ${CLEANDIR:S/^/par-/} 255.endif 256 @echo 257 @echo "--------------------------------------------------------------" 258 @echo ">>> stage 2: rebuilding the object tree" 259 @echo "--------------------------------------------------------------" 260 cd ${.CURDIR}; ${TMAKE} par-obj 261 @echo 262 @echo "--------------------------------------------------------------" 263 @echo ">>> stage 2: build tools" 264 @echo "--------------------------------------------------------------" 265 cd ${.CURDIR}; ${TMAKE} build-tools 266 @echo 267 @echo "--------------------------------------------------------------" 268 @echo ">>> stage 3: cross tools" 269 @echo "--------------------------------------------------------------" 270 cd ${.CURDIR}; ${XMAKE} cross-tools 271 @echo 272 @echo "--------------------------------------------------------------" 273 @echo ">>> stage 4: populating ${WORLDTMP}/usr/include" 274 @echo "--------------------------------------------------------------" 275 cd ${.CURDIR}; ${WMAKE} SHARED=symlinks includes 276 @echo 277 @echo "--------------------------------------------------------------" 278 @echo ">>> stage 4: building libraries" 279 @echo "--------------------------------------------------------------" 280 cd ${.CURDIR}; ${WMAKE} -DNOHTML -DNOINFO -DNOMAN -DNOFSCHG libraries 281 @echo 282 @echo "--------------------------------------------------------------" 283 @echo ">>> stage 4: make dependencies" 284 @echo "--------------------------------------------------------------" 285 cd ${.CURDIR}; ${WMAKE} par-depend 286 @echo 287 @echo "--------------------------------------------------------------" 288 @echo ">>> stage 4: building everything.." 289 @echo "--------------------------------------------------------------" 290 cd ${.CURDIR}; ${WMAKE} all 291 292everything: 293 @echo "--------------------------------------------------------------" 294 @echo ">>> Building everything.." 295 @echo "--------------------------------------------------------------" 296 cd ${.CURDIR}; ${WMAKE} all 297 298# 299# installworld 300# 301# Installs everything compiled by a 'buildworld'. 302# 303installworld: 304 mkdir -p ${INSTALLTMP} 305 for prog in [ awk cat chflags chmod chown date echo egrep find grep \ 306 install ln make makewhatis mtree mv perl rm sed sh sysctl \ 307 test true uname wc zic; do \ 308 cp `which $$prog` ${INSTALLTMP}; \ 309 done 310 cd ${.CURDIR}; ${IMAKE} reinstall 311 rm -rf ${INSTALLTMP} 312 313# 314# reinstall 315# 316# If you have a build server, you can NFS mount the source and obj directories 317# and do a 'make reinstall' on the *client* to install new binaries from the 318# most recent server build. 319# 320reinstall: 321 @echo "--------------------------------------------------------------" 322 @echo ">>> Making hierarchy" 323 @echo "--------------------------------------------------------------" 324 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy 325 @echo 326 @echo "--------------------------------------------------------------" 327 @echo ">>> Installing everything.." 328 @echo "--------------------------------------------------------------" 329 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install 330.if !defined(NOMAN) 331 @echo 332 @echo "--------------------------------------------------------------" 333 @echo ">>> Rebuilding man page indices" 334 @echo "--------------------------------------------------------------" 335 cd ${.CURDIR}/share/man; ${MAKE} makedb 336.endif 337 338# 339# distribworld 340# 341# Front-end to distribute to make sure the search path contains 342# the object directory. Needed for miniperl. 343# 344distribworld: 345 cd ${.CURDIR}; PATH=${TMPPATH} ${MAKE} -f Makefile.inc1 distribute 346 347# 348# buildkernel and installkernel 349# 350# Which kernels to build and/or install is specified by setting 351# KERNCONF. If not defined a GENERIC kernel is built/installed. 352# Only the existing (depending MACHINE) config files are used 353# for building kernels and only the first of these is designated 354# as the one being installed. 355# 356# Note that we have to use MACHINE instead of MACHINE_ARCH when 357# we're in kernel-land. Since only MACHINE_ARCH is (expected) to 358# be set to cross-build, we have to make sure MACHINE is set 359# properly. 360 361.if !defined(KERNCONF) && defined(KERNEL) 362KERNCONF= ${KERNEL} 363KERNWARN= yes 364.else 365KERNCONF?= GENERIC 366.endif 367INSTKERNNAME?= kernel 368 369# The only exotic MACHINE_ARCH/MACHINE combination valid at this 370# time is i386/pc98. In all other cases set MACHINE equal to 371# MACHINE_ARCH. 372.if ${MACHINE_ARCH} != "i386" || ${MACHINE} != "pc98" 373MACHINE= ${MACHINE_ARCH} 374.endif 375 376KRNLSRCDIR= ${.CURDIR}/sys 377KRNLCONFDIR= ${KRNLSRCDIR}/${MACHINE}/conf 378KRNLOBJDIR= ${OBJTREE}${KRNLSRCDIR} 379 380BUILDKERNELS= 381INSTALLKERNEL= 382.for _kernel in ${KERNCONF} 383.if exists(${KRNLCONFDIR}/${_kernel}) 384BUILDKERNELS+= ${_kernel} 385.if empty(INSTALLKERNEL) 386INSTALLKERNEL= ${_kernel} 387.endif 388.endif 389.endfor 390 391# 392# buildkernel 393# 394# Builds all kernels defined by BUILDKERNELS. 395# 396buildkernel: 397.if empty(BUILDKERNELS) 398 @echo ">>> ERROR: Missing kernel configuration file(s) (${KERNCONF})." 399 @false 400.endif 401.if defined(KERNWARN) 402 @echo "--------------------------------------------------------------" 403 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF=" 404 @echo "--------------------------------------------------------------" 405 @sleep 3 406.endif 407 @echo 408.for _kernel in ${BUILDKERNELS} 409 @echo "--------------------------------------------------------------" 410 @echo ">>> Kernel build for ${_kernel} started on `LC_TIME=C date`" 411 @echo "--------------------------------------------------------------" 412 @echo "===> ${_kernel}" 413 mkdir -p ${KRNLOBJDIR} 414.if !defined(NO_KERNELCONFIG) 415 cd ${KRNLCONFDIR}; \ 416 PATH=${TMPPATH} \ 417 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} ${_kernel} 418.endif 419.if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN) 420 cd ${KRNLOBJDIR}/${_kernel}; \ 421 ${KMAKEENV} MACHINE=${MACHINE} ${MAKE} KERNEL=${INSTKERNNAME} clean 422.endif 423 cd ${KRNLOBJDIR}/${_kernel}; \ 424 MAKESRCPATH=${KRNLSRCDIR}/dev/aic7xxx/aicasm \ 425 ${MAKE} -f ${KRNLSRCDIR}/dev/aic7xxx/aicasm/Makefile 426.if !defined(NO_KERNELDEPEND) 427 cd ${KRNLOBJDIR}/${_kernel}; \ 428 ${KMAKEENV} MACHINE=${MACHINE} ${MAKE} KERNEL=${INSTKERNNAME} depend 429.endif 430 cd ${KRNLOBJDIR}/${_kernel}; \ 431 ${KMAKEENV} MACHINE=${MACHINE} ${MAKE} KERNEL=${INSTKERNNAME} all 432 @echo "--------------------------------------------------------------" 433 @echo ">>> Kernel build for ${_kernel} completed on `LC_TIME=C date`" 434 @echo "--------------------------------------------------------------" 435.endfor 436 437# 438# installkernel 439# 440# Install the kernel defined by INSTALLKERNEL 441# 442installkernel: 443 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ 444 ${CROSSENV} MACHINE=${MACHINE} ${MAKE} KERNEL=${INSTKERNNAME} install 445reinstallkernel: 446 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ 447 ${CROSSENV} MACHINE=${MACHINE} ${MAKE} KERNEL=${INSTKERNNAME} reinstall 448 449# 450# kernel 451# 452# Short hand for `make buildkernel installkernel' 453# 454kernel: buildkernel installkernel 455 456# 457# update 458# 459# Update the source tree, by running sup and/or running cvs to update to the 460# latest copy. 461# 462update: 463.if defined(SUP_UPDATE) 464 @echo "--------------------------------------------------------------" 465 @echo ">>> Running ${SUP}" 466 @echo "--------------------------------------------------------------" 467.if defined(SUPFILE) 468 @${SUP} ${SUPFLAGS} ${SUPFILE} 469.endif 470.if defined(SUPFILE1) 471 @${SUP} ${SUPFLAGS} ${SUPFILE1} 472.endif 473.if defined(SUPFILE2) 474 @${SUP} ${SUPFLAGS} ${SUPFILE2} 475.endif 476.if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE) 477 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE} 478.endif 479.if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE) 480 @${SUP} ${SUPFLAGS} ${DOCSUPFILE} 481.endif 482.endif 483.if defined(CVS_UPDATE) 484 @echo "--------------------------------------------------------------" 485 @echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT} 486 @echo "--------------------------------------------------------------" 487 cd ${.CURDIR}; cvs -q update -A -P -d 488.endif 489 490# 491# most 492# 493# Build most of the user binaries on the existing system libs and includes. 494# 495most: 496 @echo "--------------------------------------------------------------" 497 @echo ">>> Building programs only" 498 @echo "--------------------------------------------------------------" 499 cd ${.CURDIR}/bin; ${MAKE} all 500 cd ${.CURDIR}/sbin; ${MAKE} all 501 cd ${.CURDIR}/libexec; ${MAKE} all 502 cd ${.CURDIR}/usr.bin; ${MAKE} all 503 cd ${.CURDIR}/usr.sbin; ${MAKE} all 504 cd ${.CURDIR}/gnu/libexec; ${MAKE} all 505 cd ${.CURDIR}/gnu/usr.bin; ${MAKE} all 506 cd ${.CURDIR}/gnu/usr.sbin; ${MAKE} all 507 508# 509# installmost 510# 511# Install the binaries built by the 'most' target. This does not include 512# libraries or include files. 513# 514installmost: 515 @echo "--------------------------------------------------------------" 516 @echo ">>> Installing programs only" 517 @echo "--------------------------------------------------------------" 518 cd ${.CURDIR}/bin; ${MAKE} install 519 cd ${.CURDIR}/sbin; ${MAKE} install 520 cd ${.CURDIR}/libexec; ${MAKE} install 521 cd ${.CURDIR}/usr.bin; ${MAKE} install 522 cd ${.CURDIR}/usr.sbin; ${MAKE} install 523 cd ${.CURDIR}/gnu/libexec; ${MAKE} install 524 cd ${.CURDIR}/gnu/usr.bin; ${MAKE} install 525 cd ${.CURDIR}/gnu/usr.sbin; ${MAKE} install 526 527# 528# ------------------------------------------------------------------------ 529# 530# From here onwards are utility targets used by the 'make world' and 531# related targets. If your 'world' breaks, you may like to try to fix 532# the problem and manually run the following targets to attempt to 533# complete the build. Beware, this is *not* guaranteed to work, you 534# need to have a pretty good grip on the current state of the system 535# to attempt to manually finish it. If in doubt, 'make world' again. 536# 537 538# 539# bootstrap-tools: Build tools needed for compatibility 540# 541.if exists(${.CURDIR}/games) && !defined(NOGAMES) 542_strfile= games/fortune/strfile 543.endif 544 545bootstrap-tools: 546.for _tool in ${_strfile} usr.bin/yacc usr.bin/colldef usr.sbin/config \ 547 gnu/usr.bin/gperf gnu/usr.bin/texinfo 548 cd ${.CURDIR}/${_tool}; \ 549 ${MAKE} obj; \ 550 ${MAKE} depend; \ 551 ${MAKE} all; \ 552 ${MAKE} install 553.endfor 554 555# 556# build-tools: Build special purpose build tools 557# 558.if exists(${.CURDIR}/games) && !defined(NOGAMES) 559_games= games/adventure games/hack games/phantasia 560.endif 561 562.if exists(${.CURDIR}/share) && !defined(NOSHARE) 563_share= share/syscons/scrnmaps 564.endif 565 566.if !defined(NO_FORTRAN) 567_fortran= gnu/usr.bin/cc/f771 568.endif 569 570.if exists(${.CURDIR}/kerberosIV) && exists(${.CURDIR}/crypto) && \ 571 !defined(NOCRYPT) && defined(MAKE_KERBEROS4) 572_libroken4= kerberosIV/lib/libroken 573.endif 574 575.if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \ 576 !defined(NOCRYPT) && defined(MAKE_KERBEROS5) 577_libkrb5= kerberos5/lib/libasn1 kerberos5/lib/libhdb kerberos5/lib/libsl 578.endif 579 580build-tools: 581.for _tool in bin/csh bin/sh ${_games} gnu/usr.bin/cc/cc_tools ${_fortran} \ 582 ${_libroken4} ${_libkrb5} lib/libncurses ${_share} usr.sbin/sysinstall 583 cd ${.CURDIR}/${_tool}; ${MAKE} build-tools 584.endfor 585 586# 587# cross-tools: Build cross-building tools 588# 589# WARNING: Because the bootstrap tools are expected to run on the 590# build-machine, MACHINE_ARCH is *always* set to BUILD_ARCH when this 591# target is being made. TARGET_ARCH is *always* set to reflect the 592# target-machine (which you can set by specifying MACHINE_ARCH on 593# make's command-line, get it?). 594# The reason is simple: we build these tools not to be run on the 595# architecture we're cross-building, but on the architecture we're 596# currently building on (ie the host-machine) and we expect these 597# tools to produce output for the architecture we're trying to 598# cross-build. 599# 600.if ${TARGET_ARCH} == "alpha" && ${MACHINE_ARCH} != "alpha" 601_elf2exe= usr.sbin/elf2exe 602.endif 603 604.if ${TARGET_ARCH} == "i386" && ${MACHINE_ARCH} != "i386" 605_btxld= usr.sbin/btxld 606.endif 607 608.if !defined(NOPERL) 609_perl= gnu/usr.bin/perl/libperl gnu/usr.bin/perl/miniperl 610.endif 611 612cross-tools: 613.for _tool in ${_btxld} ${_elf2exe} ${_perl} usr.bin/genassym \ 614 usr.bin/gensetdefs gnu/usr.bin/binutils usr.bin/objformat gnu/usr.bin/cc 615 cd ${.CURDIR}/${_tool}; \ 616 ${MAKE} obj; \ 617 ${MAKE} depend; \ 618 ${MAKE} all; \ 619 ${MAKE} install 620.endfor 621 622# 623# hierarchy - ensure that all the needed directories are present 624# 625hierarchy: 626 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs 627 628# 629# includes - possibly generate and install the include files. 630# 631includes: 632 cd ${.CURDIR}/include; ${MAKE} -B all install 633 cd ${.CURDIR}/gnu/include; ${MAKE} install 634 cd ${.CURDIR}/gnu/lib/libmp; ${MAKE} beforeinstall 635 cd ${.CURDIR}/gnu/lib/libobjc; ${MAKE} beforeinstall 636 cd ${.CURDIR}/gnu/lib/libreadline/readline; ${MAKE} beforeinstall 637 cd ${.CURDIR}/gnu/lib/libregex; ${MAKE} beforeinstall 638 cd ${.CURDIR}/gnu/lib/libstdc++; ${MAKE} beforeinstall 639 cd ${.CURDIR}/gnu/lib/libdialog; ${MAKE} beforeinstall 640 cd ${.CURDIR}/gnu/lib/libgmp; ${MAKE} beforeinstall 641 cd ${.CURDIR}/gnu/usr.bin/cc/cc1plus; ${MAKE} beforeinstall 642.if exists(${.CURDIR}/secure) && !defined(NOCRYPT) 643.if exists(${.CURDIR}/secure/lib/libcrypto) 644 cd ${.CURDIR}/secure/lib/libcrypto; ${MAKE} beforeinstall 645.endif 646.if exists(${.CURDIR}/secure/lib/libssl) 647 cd ${.CURDIR}/secure/lib/libssl; ${MAKE} beforeinstall 648.endif 649.endif 650.if exists(${.CURDIR}/kerberosIV) && !defined(NOCRYPT) && \ 651 defined(MAKE_KERBEROS4) 652 cd ${.CURDIR}/kerberosIV/lib/libacl; ${MAKE} beforeinstall 653 cd ${.CURDIR}/kerberosIV/lib/libkadm; ${MAKE} beforeinstall 654 cd ${.CURDIR}/kerberosIV/lib/libkafs; ${MAKE} beforeinstall 655 cd ${.CURDIR}/kerberosIV/lib/libkdb; ${MAKE} beforeinstall 656 cd ${.CURDIR}/kerberosIV/lib/libkrb; ${MAKE} beforeinstall 657 cd ${.CURDIR}/kerberosIV/lib/libtelnet; ${MAKE} beforeinstall 658.else 659 cd ${.CURDIR}/lib/libtelnet; ${MAKE} beforeinstall 660.endif 661.if exists(${.CURDIR}/kerberos5) && !defined(NOCRYPT) && \ 662 defined(MAKE_KERBEROS5) 663 cd ${.CURDIR}/kerberos5/lib/libasn1; ${MAKE} beforeinstall 664 cd ${.CURDIR}/kerberos5/lib/libhdb; ${MAKE} beforeinstall 665 cd ${.CURDIR}/kerberos5/lib/libkadm5clnt; ${MAKE} beforeinstall 666 cd ${.CURDIR}/kerberos5/lib/libkadm5srv; ${MAKE} beforeinstall 667 cd ${.CURDIR}/kerberos5/lib/libkafs5; ${MAKE} beforeinstall 668 cd ${.CURDIR}/kerberos5/lib/libkrb5; ${MAKE} beforeinstall 669 cd ${.CURDIR}/kerberos5/lib/libsl; ${MAKE} beforeinstall 670.endif 671.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}) 672 cd ${.CURDIR}/lib/csu/${MACHINE_ARCH}; ${MAKE} beforeinstall 673.endif 674 cd ${.CURDIR}/gnu/lib/csu; ${MAKE} beforeinstall 675 cd ${.CURDIR}/lib/libalias; ${MAKE} beforeinstall 676 cd ${.CURDIR}/lib/libatm; ${MAKE} beforeinstall 677 cd ${.CURDIR}/lib/libdevstat; ${MAKE} beforeinstall 678 cd ${.CURDIR}/lib/libc; ${MAKE} beforeinstall 679 cd ${.CURDIR}/lib/libcalendar; ${MAKE} beforeinstall 680 cd ${.CURDIR}/lib/libcam; ${MAKE} beforeinstall 681 cd ${.CURDIR}/lib/libdisk; ${MAKE} beforeinstall 682 cd ${.CURDIR}/lib/libedit; ${MAKE} beforeinstall 683 cd ${.CURDIR}/lib/libfetch; ${MAKE} beforeinstall 684 cd ${.CURDIR}/lib/libftpio; ${MAKE} beforeinstall 685 cd ${.CURDIR}/lib/libkvm; ${MAKE} beforeinstall 686 cd ${.CURDIR}/lib/libmd; ${MAKE} beforeinstall 687.if !defined(WANT_CSRG_LIBM) 688 cd ${.CURDIR}/lib/msun; ${MAKE} beforeinstall 689.endif 690 cd ${.CURDIR}/lib/libncp; ${MAKE} beforeinstall 691 cd ${.CURDIR}/lib/libncurses; ${MAKE} beforeinstall 692 cd ${.CURDIR}/lib/libnetgraph; ${MAKE} beforeinstall 693 cd ${.CURDIR}/lib/libopie; ${MAKE} beforeinstall 694 cd ${.CURDIR}/lib/libpam/libpam; ${MAKE} beforeinstall 695 cd ${.CURDIR}/lib/libpcap; ${MAKE} beforeinstall 696 cd ${.CURDIR}/lib/libradius; ${MAKE} beforeinstall 697 cd ${.CURDIR}/lib/librpcsvc; ${MAKE} beforeinstall 698 cd ${.CURDIR}/lib/libskey; ${MAKE} beforeinstall 699 cd ${.CURDIR}/lib/libstand; ${MAKE} beforeinstall 700 cd ${.CURDIR}/lib/libtacplus; ${MAKE} beforeinstall 701 cd ${.CURDIR}/lib/libcom_err; ${MAKE} beforeinstall 702 cd ${.CURDIR}/lib/libss; ${MAKE} -B hdrs beforeinstall 703 cd ${.CURDIR}/lib/libutil; ${MAKE} beforeinstall 704 cd ${.CURDIR}/lib/libvgl; ${MAKE} beforeinstall 705 cd ${.CURDIR}/lib/libwrap; ${MAKE} beforeinstall 706 cd ${.CURDIR}/lib/libz; ${MAKE} beforeinstall 707 cd ${.CURDIR}/usr.bin/lex; ${MAKE} beforeinstall 708 709# 710# libraries - build all libraries, and install them under ${DESTDIR}. 711# 712# The following dependencies exist between the libraries: 713# 714# lib*: csu libgcc_pic 715# libatm: libmd 716# libcrypt: libmd 717# libdialog: libncurses 718# libedit: libncurses 719# libg++: libm 720# libkrb: libcrypt 721# libopie: libmd 722# libpam: libcom_err libcrypt libcrypto libkrb libopie libradius \ 723# libskey libtacplus libutil libz libssh 724# libradius: libmd 725# libreadline: libncurses 726# libskey: libcrypt libmd 727# libss: libcom_err 728# libstc++: libm 729# libtacplus: libmd 730# 731# Across directories this comes down to (rougly): 732# 733# gnu/lib: lib/libm lib/libncurses 734# kerberosIV/lib kerberos5/lib: lib/libcrypt 735# lib/libpam: secure/lib/libcrypto kerberosIV/lib/libkrb \ 736# secure/lib/libssh lib/libz 737# secure/lib: lib/libmd 738# 739.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}.pcc) 740_csu= lib/csu/${MACHINE_ARCH}.pcc 741.elif ${MACHINE_ARCH} == "i386" && ${OBJFORMAT} == "elf" 742_csu= lib/csu/i386-elf 743.else 744_csu= lib/csu/${MACHINE_ARCH} 745.endif 746 747.if !defined(NOSECURE) && !defined(NOCRYPT) 748_secure_lib= secure/lib 749.endif 750 751.if !defined(NOCRYPT) && defined(MAKE_KERBEROS4) 752_kerberosIV_lib= kerberosIV/lib 753.endif 754 755.if !defined(NOCRYPT) && defined(MAKE_KERBEROS5) 756_kerberos5_lib= kerberos5/lib 757.endif 758 759.if defined(WANT_CSRG_LIBM) 760_libm= lib/libm 761.else 762_libm= lib/msun 763.endif 764 765.if ${MACHINE_ARCH} == "i386" 766_libkeycap= usr.sbin/pcvt/keycap 767.endif 768 769.if !defined(NOPERL) 770_libperl= gnu/usr.bin/perl/libperl 771.endif 772 773libraries: 774.for _lib in ${_csu} gnu/lib/csu gnu/lib/libgcc lib/libmd lib/libcrypt \ 775 ${_secure_lib} ${_kerberosIV_lib} \ 776 ${_kerberos5_lib} lib/libcom_err ${_libm} lib/libncurses \ 777 lib/libopie lib/libradius lib/libskey lib/libtacplus lib/libutil \ 778 lib/libz lib gnu/lib ${_libperl} usr.bin/lex/lib ${_libkeycap} 779.if exists(${.CURDIR}/${_lib}) 780 cd ${.CURDIR}/${_lib}; \ 781 ${MAKE} depend; \ 782 ${MAKE} all; \ 783 ${MAKE} install 784.endif 785.endfor 786 787.for __target in clean cleandepend cleandir depend obj 788.for entry in ${SUBDIR} 789${entry}.${__target}__D: .PHONY 790 @if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \ 791 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \ 792 edir=${entry}.${MACHINE_ARCH}; \ 793 cd ${.CURDIR}/$${edir}; \ 794 else \ 795 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \ 796 edir=${entry}; \ 797 cd ${.CURDIR}/$${edir}; \ 798 fi; \ 799 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/ 800.endfor 801par-${__target}: ${SUBDIR:S/$/.${__target}__D/} 802.endfor 803 804.include <bsd.subdir.mk> 805