1# 2# $Id: Makefile,v 1.208 1998/08/04 16:00:47 peter Exp $ 3# 4# While porting to the another architecture include the bootstrap instead 5# of the normal build. 6# 7.if exists(${.CURDIR}/Makefile.${MACHINE}) && defined(BOOTSTRAP_WORLD) 8.include "${.CURDIR}/Makefile.${MACHINE}" 9.else 10# 11# Make command line options: 12# -DCLOBBER will remove /usr/include 13# -DMAKE_KERBEROS4 to build KerberosIV 14# -DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir 15# -DNOCLEAN do not clean at all 16# -DNOTOOLS do not rebuild any tools first 17# -DNOCRYPT will prevent building of crypt versions 18# -DNOLKM do not build loadable kernel modules 19# -DNOOBJDIR do not run ``${MAKE} obj'' 20# -DNOPROFILE do not build profiled libraries 21# -DNOSECURE do not go into secure subdir 22# -DNOGAMES do not go into games subdir 23# -DNOSHARE do not go into share subdir 24# -DNOINFO do not make or install info files 25# -DNOLIBC_R do not build libc_r. 26# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list 27 28# 29# The intended user-driven targets are: 30# buildworld - rebuild *everything*, including glue to help do upgrades 31# installworld- install everything built by "buildworld" 32# world - buildworld + installworld 33# update - convenient way to update your source tree (eg: sup/cvs) 34# most - build user commands, no libraries or include files 35# installmost - install user commands, no libraries or include files 36# 37# Standard targets (not defined here) are documented in the makefiles in 38# /usr/share/mk. These include: 39# obj depend all install clean cleandepend cleanobj 40 41.if (!make(world)) && (!make(buildworld)) && (!make(installworld)) 42.MAKEFLAGS:= -m ${.CURDIR}/share/mk ${.MAKEFLAGS} 43.endif 44 45# 46# Pick up any macros that are defined in the src-relative bsd.own.mk 47# but not in the "system" bsd.own.mk. The "system" version has 48# unfortunately already been included by the "system" sys.mk, so this 49# only works for new macros. First undefine old macros that cause 50# problems. 51# 52.undef LIBDIR 53.include "${.CURDIR}/share/mk/bsd.own.mk" 54 55# Put initial settings here. 56SUBDIR= 57 58# We must do share/info early so that installation of info `dir' 59# entries works correctly. Do it first since it is less likely to 60# grow dependencies on include and lib than vice versa. 61.if exists(share/info) 62SUBDIR+= share/info 63.endif 64 65# We must do include and lib early so that the perl *.ph generation 66# works correctly as it uses the header files installed by this. 67.if exists(include) 68SUBDIR+= include 69.endif 70.if exists(lib) 71SUBDIR+= lib 72.endif 73 74.if exists(bin) 75SUBDIR+= bin 76.endif 77.if exists(games) && !defined(NOGAMES) 78SUBDIR+= games 79.endif 80.if exists(gnu) 81SUBDIR+= gnu 82.endif 83.if exists(kerberosIV) && exists(crypto) && !defined(NOCRYPT) && \ 84 defined(MAKE_KERBEROS4) 85SUBDIR+= kerberosIV 86.endif 87.if exists(libexec) 88SUBDIR+= libexec 89.endif 90.if exists(sbin) 91SUBDIR+= sbin 92.endif 93.if exists(share) && !defined(NOSHARE) 94SUBDIR+= share 95.endif 96.if exists(sys) 97SUBDIR+= sys 98.endif 99.if exists(usr.bin) 100SUBDIR+= usr.bin 101.endif 102.if exists(usr.sbin) 103SUBDIR+= usr.sbin 104.endif 105.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE) 106SUBDIR+= secure 107.endif 108.if exists(lkm) && !defined(NOLKM) 109SUBDIR+= lkm 110.endif 111 112# etc must be last for "distribute" to work 113.if exists(etc) 114SUBDIR+= etc 115.endif 116 117# These are last, since it is nice to at least get the base system 118# rebuilt before you do them. 119.if defined(LOCAL_DIRS) 120.for _DIR in ${LOCAL_DIRS} 121.if exists(${_DIR}) & exists(${_DIR}/Makefile) 122SUBDIR+= ${_DIR} 123.endif 124.endfor 125.endif 126 127# Handle -DNOOBJDIR, -DNOCLEAN and -DNOCLEANDIR 128.if defined(NOOBJDIR) 129OBJDIR= 130.else 131OBJDIR= obj 132.endif 133 134.if defined(NOCLEAN) 135CLEANDIR= 136.else 137.if defined(NOCLEANDIR) 138CLEANDIR= clean cleandepend 139.else 140CLEANDIR= cleandir 141.endif 142.endif 143 144.if !defined(NOCLEAN) 145_NODEPEND= true 146.endif 147.if defined(_NODEPEND) 148_DEPEND= cleandepend 149.else 150_DEPEND= depend 151.endif 152 153SUP?= cvsup 154SUPFLAGS?= -g -L 2 -P - 155 156# 157# While building tools for bootstrapping, we don't need to waste time on 158# shared or profiled libraries, shared linkage, or documentation, except 159# when the tools won't get cleaned we must use the defaults for shared 160# libraries and shared linkage (and this doesn't waste time). 161# XXX actually, we do need to waste time building shared libraries. 162# 163.if defined(NOCLEAN) 164MK_FLAGS= -DNOINFO -DNOMAN -DNOPROFILE 165.else 166MK_FLAGS= -DNOINFO -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED 167.endif 168 169# 170# world 171# 172# Attempt to rebuild and reinstall *everything*, with reasonable chance of 173# success, regardless of how old your existing system is. 174# 175# >> Beware, it overwrites the local build environment! << 176# 177world: 178 @echo "--------------------------------------------------------------" 179 @echo "make world started on `LC_TIME=C date`" 180 @echo "--------------------------------------------------------------" 181.if target(pre-world) 182 @echo 183 @echo "--------------------------------------------------------------" 184 @echo " Making 'pre-world' target" 185 @echo "--------------------------------------------------------------" 186 cd ${.CURDIR}; ${MAKE} pre-world 187.endif 188 cd ${.CURDIR}; ${MAKE} buildworld 189 cd ${.CURDIR}; ${MAKE} -B installworld 190.if target(post-world) 191 @echo 192 @echo "--------------------------------------------------------------" 193 @echo " Making 'post-world' target" 194 @echo "--------------------------------------------------------------" 195 cd ${.CURDIR}; ${MAKE} post-world 196.endif 197 @echo 198 @echo "--------------------------------------------------------------" 199 @echo "make world completed on `LC_TIME=C date`" 200 @echo "--------------------------------------------------------------" 201 202.if defined(MAKEOBJDIRPREFIX) 203WORLDTMP= ${MAKEOBJDIRPREFIX}${.CURDIR}/tmp 204.else 205WORLDTMP= /usr/obj${.CURDIR}/tmp 206.endif 207STRICTTMPPATH= ${WORLDTMP}/sbin:${WORLDTMP}/usr/sbin:${WORLDTMP}/bin:${WORLDTMP}/usr/bin 208TMPPATH= ${STRICTTMPPATH}:${PATH} 209 210# XXX COMPILER_PATH is needed for finding cc1, ld and as 211# XXX GCC_EXEC_PREFIX is for *crt.o. It is probably unnecessary now 212# that LIBRARY_PATH is set. We still can't use -nostdlib, since gcc 213# wouldn't link *crt.o or libgcc if it were used. 214# XXX LD_LIBRARY_PATH is for ld.so. It is also used by ld, although we don't 215# want that - all compile-time library paths should be resolved by gcc. 216# It fails for set[ug]id executables (are any used?). 217COMPILER_ENV= BISON_SIMPLE=${WORLDTMP}/usr/share/misc/bison.simple \ 218 COMPILER_PATH=${WORLDTMP}/usr/libexec:${WORLDTMP}/usr/bin \ 219 GCC_EXEC_PREFIX=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib/ \ 220 LD_LIBRARY_PATH=${WORLDTMP}${SHLIBDIR} \ 221 LIBRARY_PATH=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib 222 223BMAKEENV= PATH=${TMPPATH} ${COMPILER_ENV} NOEXTRADEPEND=t \ 224 OBJFORMAT_PATH=${WORLDTMP}/usr/libexec:/usr/libexec 225XMAKEENV= PATH=${STRICTTMPPATH} ${COMPILER_ENV} \ 226 OBJFORMAT_PATH=${WORLDTMP}/usr/libexec \ 227 CFLAGS="-nostdinc ${CFLAGS}" # XXX -nostdlib 228 229# used to compile and install 'make' in temporary build tree 230MAKETMP= ${WORLDTMP}/make 231IBMAKE= ${BMAKEENV} MAKEOBJDIR=${MAKETMP} ${MAKE} DESTDIR=${WORLDTMP} 232# bootstrap make 233BMAKE= ${BMAKEENV} ${WORLDTMP}/usr/bin/make DESTDIR=${WORLDTMP} 234# cross make used for compilation 235XMAKE= ${XMAKEENV} ${WORLDTMP}/usr/bin/make DESTDIR=${WORLDTMP} 236# cross make used for final installation 237IXMAKE= ${XMAKEENV} ${WORLDTMP}/usr/bin/make 238 239# 240# buildworld 241# 242# Attempt to rebuild the entire system, with reasonable chance of 243# success, regardless of how old your existing system is. 244# 245buildworld: 246.if !defined(NOCLEAN) 247 @echo 248 @echo "--------------------------------------------------------------" 249 @echo " Cleaning up the temporary build tree" 250 @echo "--------------------------------------------------------------" 251 mkdir -p ${WORLDTMP} 252 chflags -R noschg ${WORLDTMP}/ 253 rm -rf ${WORLDTMP} 254.endif 255.if !defined(NOTOOLS) 256 @echo 257 @echo "--------------------------------------------------------------" 258 @echo " Making make" 259 @echo "--------------------------------------------------------------" 260 mkdir -p ${WORLDTMP}/usr/bin ${MAKETMP} 261 ( \ 262 cd ${.CURDIR}/usr.bin/make; \ 263 MAKEOBJDIRPREFIX=""; unset MAKEOBJDIRPREFIX; \ 264 ${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} all; \ 265 ${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} install; \ 266 ${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} clean \ 267 ) 268 @echo 269 @echo "--------------------------------------------------------------" 270 @echo " Making mtree" 271 @echo "--------------------------------------------------------------" 272 mkdir -p ${WORLDTMP}/usr/sbin ${WORLDTMP}/mtree 273 ( \ 274 cd ${.CURDIR}/usr.sbin/mtree; \ 275 MAKEOBJDIRPREFIX=""; unset MAKEOBJDIRPREFIX; \ 276 export MAKEOBJDIR=${WORLDTMP}/mtree; \ 277 ${BMAKE} ${MK_FLAGS} all; \ 278 ${BMAKE} ${MK_FLAGS} -B install clean \ 279 ) 280.endif 281 @echo 282 @echo "--------------------------------------------------------------" 283 @echo " Making hierarchy" 284 @echo "--------------------------------------------------------------" 285 cd ${.CURDIR}; ${BMAKE} hierarchy 286.if !defined(NOCLEAN) 287 @echo 288 @echo "--------------------------------------------------------------" 289 @echo " Cleaning up the obj tree" 290 @echo "--------------------------------------------------------------" 291 cd ${.CURDIR}; ${BMAKE} ${CLEANDIR:S/^/par-/} 292.endif 293.if !defined(NOOBJDIR) 294 @echo 295 @echo "--------------------------------------------------------------" 296 @echo " Rebuilding the obj tree" 297 @echo "--------------------------------------------------------------" 298 cd ${.CURDIR}; ${BMAKE} par-${OBJDIR} 299.endif 300.if !defined(NOTOOLS) 301 @echo 302 @echo "--------------------------------------------------------------" 303 @echo " Rebuilding bootstrap tools" 304 @echo "--------------------------------------------------------------" 305 cd ${.CURDIR}; ${BMAKE} bootstrap 306 @echo 307 @echo "--------------------------------------------------------------" 308 @echo " Rebuilding tools necessary to build the include files" 309 @echo "--------------------------------------------------------------" 310 cd ${.CURDIR}; ${BMAKE} include-tools 311.endif 312 @echo 313 @echo "--------------------------------------------------------------" 314 @echo " Rebuilding ${DESTDIR}/usr/include" 315 @echo "--------------------------------------------------------------" 316 cd ${.CURDIR}; SHARED=copies ${BMAKE} includes 317 @echo 318 @echo "--------------------------------------------------------------" 319 @echo " Rebuilding bootstrap libraries" 320 @echo "--------------------------------------------------------------" 321 cd ${.CURDIR}; ${BMAKE} bootstrap-libraries 322.if !defined(NOTOOLS) 323 @echo 324 @echo "--------------------------------------------------------------" 325 @echo " Rebuilding tools needed to build libraries" 326 @echo "--------------------------------------------------------------" 327 cd ${.CURDIR}; ${BMAKE} lib-tools 328.endif 329.if !defined(NOTOOLS) 330 @echo 331 @echo "--------------------------------------------------------------" 332 @echo " Rebuilding all other tools needed to build the world" 333 @echo "--------------------------------------------------------------" 334 cd ${.CURDIR}; ${BMAKE} build-tools 335.endif 336.if !defined(_NODEPEND) 337 @echo 338 @echo "--------------------------------------------------------------" 339 @echo " Rebuilding dependencies" 340 @echo "--------------------------------------------------------------" 341 cd ${.CURDIR}; ${XMAKE} par-depend 342.endif 343 @echo 344 @echo "--------------------------------------------------------------" 345 @echo " Building libraries" 346 @echo "--------------------------------------------------------------" 347 cd ${.CURDIR}; ${XMAKE} -DNOINFO -DNOMAN libraries 348 @echo 349 @echo "--------------------------------------------------------------" 350 @echo " Building everything.." 351 @echo "--------------------------------------------------------------" 352 cd ${.CURDIR}; ${XMAKE} all 353 354# 355# installworld 356# 357# Installs everything compiled by a 'buildworld'. 358# 359installworld: 360 cd ${.CURDIR}; ${IXMAKE} reinstall 361 362# 363# reinstall 364# 365# If you have a build server, you can NFS mount the source and obj directories 366# and do a 'make reinstall' on the *client* to install new binaries from the 367# most recent server build. 368# 369reinstall: 370 @echo "--------------------------------------------------------------" 371 @echo " Making hierarchy" 372 @echo "--------------------------------------------------------------" 373 cd ${.CURDIR}; ${MAKE} hierarchy 374 @echo 375 @echo "--------------------------------------------------------------" 376 @echo " Installing everything.." 377 @echo "--------------------------------------------------------------" 378 cd ${.CURDIR}; ${MAKE} install 379.if ${MACHINE_ARCH} == "i386" 380 @echo 381 @echo "--------------------------------------------------------------" 382 @echo " Re-scanning the shared libraries.." 383 @echo "--------------------------------------------------------------" 384 cd ${.CURDIR}; /sbin/ldconfig -R 385.endif 386 @echo 387 @echo "--------------------------------------------------------------" 388 @echo " Rebuilding man page indexes" 389 @echo "--------------------------------------------------------------" 390 cd ${.CURDIR}/share/man; ${MAKE} makedb 391 392# 393# update 394# 395# Update the source tree, by running sup and/or running cvs to update to the 396# latest copy. 397# 398update: 399.if defined(SUP_UPDATE) 400 @echo "--------------------------------------------------------------" 401 @echo "Running ${SUP}" 402 @echo "--------------------------------------------------------------" 403 @${SUP} ${SUPFLAGS} ${SUPFILE} 404.if defined(SUPFILE1) 405 @${SUP} ${SUPFLAGS} ${SUPFILE1} 406.endif 407.if defined(SUPFILE2) 408 @${SUP} ${SUPFLAGS} ${SUPFILE2} 409.endif 410.endif 411.if defined(CVS_UPDATE) 412 @echo "--------------------------------------------------------------" 413 @echo "Updating /usr/src from cvs repository" ${CVSROOT} 414 @echo "--------------------------------------------------------------" 415 cd ${.CURDIR}; cvs -q update -P -d 416.endif 417 418# 419# most 420# 421# Build most of the user binaries on the existing system libs and includes. 422# 423most: 424 @echo "--------------------------------------------------------------" 425 @echo " Building programs only" 426 @echo "--------------------------------------------------------------" 427 cd ${.CURDIR}/bin; ${MAKE} all 428 cd ${.CURDIR}/sbin; ${MAKE} all 429 cd ${.CURDIR}/libexec; ${MAKE} all 430 cd ${.CURDIR}/usr.bin; ${MAKE} all 431 cd ${.CURDIR}/usr.sbin; ${MAKE} all 432 cd ${.CURDIR}/gnu/libexec; ${MAKE} all 433 cd ${.CURDIR}/gnu/usr.bin; ${MAKE} all 434 cd ${.CURDIR}/gnu/usr.sbin; ${MAKE} all 435#.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT) 436# cd ${.CURDIR}/kerberosIV; ${MAKE} most 437#.endif 438#.if !defined(NOSECURE) && !defined(NOCRYPT) 439# cd ${.CURDIR}/secure; ${MAKE} most 440#.endif 441 442# 443# installmost 444# 445# Install the binaries built by the 'most' target. This does not include 446# libraries or include files. 447# 448installmost: 449 @echo "--------------------------------------------------------------" 450 @echo " Installing programs only" 451 @echo "--------------------------------------------------------------" 452 cd ${.CURDIR}/bin; ${MAKE} install 453 cd ${.CURDIR}/sbin; ${MAKE} install 454 cd ${.CURDIR}/libexec; ${MAKE} install 455 cd ${.CURDIR}/usr.bin; ${MAKE} install 456 cd ${.CURDIR}/usr.sbin; ${MAKE} install 457 cd ${.CURDIR}/gnu/libexec; ${MAKE} install 458 cd ${.CURDIR}/gnu/usr.bin; ${MAKE} install 459 cd ${.CURDIR}/gnu/usr.sbin; ${MAKE} install 460#.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT) 461# cd ${.CURDIR}/kerberosIV; ${MAKE} installmost 462#.endif 463#.if !defined(NOSECURE) && !defined(NOCRYPT) 464# cd ${.CURDIR}/secure; ${MAKE} installmost 465#.endif 466 467# 468# ------------------------------------------------------------------------ 469# 470# From here onwards are utility targets used by the 'make world' and 471# related targets. If your 'world' breaks, you may like to try to fix 472# the problem and manually run the following targets to attempt to 473# complete the build. Beware, this is *not* guaranteed to work, you 474# need to have a pretty good grip on the current state of the system 475# to attempt to manually finish it. If in doubt, 'make world' again. 476# 477 478# 479# heirarchy - ensure that all the needed directories are present 480# 481hierarchy: 482 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs 483 484# 485# bootstrap - [re]build tools needed to run the actual build, this includes 486# tools needed by 'make depend', as some tools are needed to generate source 487# for the dependency information to be gathered from. 488# 489bootstrap: 490.if defined(DESTDIR) 491 rm -f ${DESTDIR}/usr/src/sys 492 ln -s ${.CURDIR}/sys ${DESTDIR}/usr/src 493 cd ${.CURDIR}/include; find -dx . | cpio -dump ${DESTDIR}/usr/include 494.for d in net netinet posix4 sys vm machine 495 if [ -h ${DESTDIR}/usr/include/$d ]; then \ 496 rm -f ${DESTDIR}/usr/include/$d ; \ 497 fi 498.endfor 499 cd ${.CURDIR}/sys; \ 500 find -dx net netinet posix4 sys vm -name '*.h' -o -type d | \ 501 cpio -dump ${DESTDIR}/usr/include 502 mkdir -p ${DESTDIR}/usr/include/machine 503 cd ${.CURDIR}/sys/${MACHINE_ARCH}/include; find -dx . -name '*.h' -o -type d | \ 504 cpio -dump ${DESTDIR}/usr/include/machine 505.endif 506 cd ${.CURDIR}/usr.bin/make; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 507 ${MAKE} ${MK_FLAGS} all; \ 508 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 509 cd ${.CURDIR}/usr.bin/xinstall; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 510 ${MAKE} ${MK_FLAGS} all; \ 511 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 512 cd ${.CURDIR}/usr.bin/yacc; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 513 ${MAKE} ${MK_FLAGS} all; \ 514 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 515 cd ${.CURDIR}/usr.bin/lex; ${MAKE} bootstrap; \ 516 ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 517 ${MAKE} ${MK_FLAGS} -DNOLIB all; \ 518 ${MAKE} ${MK_FLAGS} -DNOLIB -B install ${CLEANDIR} 519.if !defined(NOOBJDIR) 520 cd ${.CURDIR}/usr.bin/lex; ${MAKE} ${OBJDIR} 521.endif 522 cd ${.CURDIR}/usr.sbin/mtree; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 523 ${MAKE} ${MK_FLAGS} all; \ 524 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 525.if defined(DESTDIR) 526 cd ${.CURDIR}/include && ${MAKE} copies 527.endif 528 529# 530# include-tools - generally the same as 'bootstrap', except that it's for 531# things that are specifically needed to generate include files. 532# 533# XXX should be merged with bootstrap, it's not worth keeeping them separate. 534# Well, maybe it is now. We force 'cleandepend' here to avoid dependencies 535# on cleaned away headers in ${WORLDTMP}. 536# 537include-tools: 538.for d in usr.bin/compile_et usr.bin/rpcgen 539 cd ${.CURDIR}/$d; ${MAKE} cleandepend; \ 540 ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 541 ${MAKE} ${MK_FLAGS} all; \ 542 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 543.endfor 544 545# 546# includes - possibly generate and install the include files. 547# 548includes: 549.if defined(CLOBBER) 550 rm -rf ${DESTDIR}/usr/include/* 551 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 552 -p ${DESTDIR}/usr/include 553.endif 554 cd ${.CURDIR}/include; ${MAKE} -B all install 555 cd ${.CURDIR}/gnu/include; ${MAKE} install 556 cd ${.CURDIR}/gnu/lib/libmp; ${MAKE} beforeinstall 557 cd ${.CURDIR}/gnu/lib/libobjc; ${MAKE} beforeinstall 558 cd ${.CURDIR}/gnu/lib/libreadline; ${MAKE} beforeinstall 559 cd ${.CURDIR}/gnu/lib/libregex; ${MAKE} beforeinstall 560 cd ${.CURDIR}/gnu/lib/libstdc++; ${MAKE} beforeinstall 561 cd ${.CURDIR}/gnu/lib/libg++; ${MAKE} beforeinstall 562 cd ${.CURDIR}/gnu/lib/libdialog; ${MAKE} beforeinstall 563 cd ${.CURDIR}/gnu/lib/libgmp; ${MAKE} beforeinstall 564.if exists(secure) && !defined(NOCRYPT) 565 cd ${.CURDIR}/secure/lib/libdes; ${MAKE} beforeinstall 566.endif 567.if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS4) 568 cd ${.CURDIR}/kerberosIV/lib/libacl; ${MAKE} beforeinstall 569 cd ${.CURDIR}/kerberosIV/lib/libkadm; ${MAKE} beforeinstall 570 cd ${.CURDIR}/kerberosIV/lib/libkafs; ${MAKE} beforeinstall 571 cd ${.CURDIR}/kerberosIV/lib/libkdb; ${MAKE} beforeinstall 572 cd ${.CURDIR}/kerberosIV/lib/libkrb; ${MAKE} beforeinstall 573 cd ${.CURDIR}/kerberosIV/lib/libtelnet; ${MAKE} beforeinstall 574.else 575 cd ${.CURDIR}/lib/libtelnet; ${MAKE} beforeinstall 576.endif 577.if exists(${.CURDIR}/lib/csu/${MACHINE}) 578 cd ${.CURDIR}/lib/csu/${MACHINE}; ${MAKE} beforeinstall 579.endif 580 cd ${.CURDIR}/lib/libalias; ${MAKE} beforeinstall 581 cd ${.CURDIR}/lib/libc; ${MAKE} beforeinstall 582 cd ${.CURDIR}/lib/libcalendar; ${MAKE} beforeinstall 583 cd ${.CURDIR}/lib/libcurses; ${MAKE} beforeinstall 584 cd ${.CURDIR}/lib/libdisk; ${MAKE} beforeinstall 585 cd ${.CURDIR}/lib/libedit; ${MAKE} beforeinstall 586 cd ${.CURDIR}/lib/libftpio; ${MAKE} beforeinstall 587 cd ${.CURDIR}/lib/libmd; ${MAKE} beforeinstall 588 cd ${.CURDIR}/lib/libmytinfo; ${MAKE} beforeinstall 589 cd ${.CURDIR}/lib/libncurses; ${MAKE} beforeinstall 590.if !defined(WANT_CSRG_LIBM) 591 cd ${.CURDIR}/lib/msun; ${MAKE} beforeinstall 592.endif 593 cd ${.CURDIR}/lib/libopie; ${MAKE} beforeinstall 594 cd ${.CURDIR}/lib/libpcap; ${MAKE} beforeinstall 595 cd ${.CURDIR}/lib/librpcsvc; ${MAKE} beforeinstall 596 cd ${.CURDIR}/lib/libskey; ${MAKE} beforeinstall 597.if !defined(NOTCL) && exists (${.CURDIR}/contrib/tcl) && \ 598 exists(${.CURDIR}/usr.bin/tclsh) && exists (${.CURDIR}/lib/libtcl) 599 cd ${.CURDIR}/lib/libtcl; ${MAKE} installhdrs 600.endif 601 cd ${.CURDIR}/lib/libtermcap; ${MAKE} beforeinstall 602 cd ${.CURDIR}/lib/libcom_err; ${MAKE} beforeinstall 603 cd ${.CURDIR}/lib/libss; ${MAKE} -B hdrs beforeinstall 604 cd ${.CURDIR}/lib/libscsi; ${MAKE} beforeinstall 605 cd ${.CURDIR}/lib/libutil; ${MAKE} beforeinstall 606 cd ${.CURDIR}/lib/libvgl; ${MAKE} beforeinstall 607 cd ${.CURDIR}/lib/libz; ${MAKE} beforeinstall 608 cd ${.CURDIR}/usr.bin/f2c; ${MAKE} beforeinstall 609 cd ${.CURDIR}/usr.bin/lex; ${MAKE} beforeinstall 610 611# 612# Declare tools if they are not required on all architectures. 613# 614.if ${MACHINE_ARCH} == "i386" 615# aout tools: 616_aout_ar = usr.bin/ar 617_aout_as = gnu/usr.bin/as 618_aout_ld = gnu/usr.bin/ld 619_aout_nm = usr.bin/nm 620_aout_ranlib = usr.bin/ranlib 621_aout_size = usr.bin/size 622_aout_strip = usr.bin/strip 623_objformat = usr.bin/objformat 624.endif 625 626# 627# lib-tools - build tools to compile and install the libraries. 628# 629# XXX gperf is required for cc 630# XXX a new ld and tsort is required for cc 631lib-tools: 632.for d in \ 633 gnu/usr.bin/gperf \ 634 ${_aout_ld} \ 635 usr.bin/tsort \ 636 ${_aout_as} \ 637 gnu/usr.bin/bison \ 638 gnu/usr.bin/cc \ 639 ${_aout_ar} \ 640 usr.bin/env \ 641 usr.bin/lex/lib \ 642 usr.bin/mk_cmds \ 643 ${_aout_nm} \ 644 ${_aout_ranlib} \ 645 ${_aout_strip} \ 646 gnu/usr.bin/binutils \ 647 usr.bin/uudecode \ 648 ${_objformat} 649 cd ${.CURDIR}/$d; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 650 ${MAKE} ${MK_FLAGS} all; \ 651 ${MAKE} ${MK_FLAGS} -B install; \ 652 ${MAKE} ${MK_FLAGS:S/-DNOPIC//} -B ${CLEANDIR} ${OBJDIR} 653.endfor 654 655# 656# We have to know too much about ordering and subdirs in the lib trees: 657# 658# To satisfy shared library linkage when only the libraries being built 659# are visible: 660# 661# libcom_err must be built before libss. 662# libcrypt and libmd must be built before libskey. 663# libm must be built before libtcl. 664# libmytinfo must be built before libdialog and libncurses. 665# libncurses must be built before libdialog. 666# libtermcap must be built before libcurses, libedit and libreadline. 667# 668# Some libraries are built conditionally and/or are in inconsistently 669# named directories: 670# 671.if exists(lib/csu/${MACHINE}.pcc) 672_csu=lib/csu/${MACHINE}.pcc 673.else 674_csu=lib/csu/${MACHINE} 675.endif 676 677.if !defined(NOSECURE) && !defined(NOCRYPT) 678_libcrypt= secure/lib/libcrypt lib/libcrypt 679.else 680_libcrypt= lib/libcrypt 681.endif 682 683.if defined(WANT_CSRG_LIBM) 684_libm= lib/libm 685.else 686_libm= lib/msun 687.endif 688 689# 690# bootstrap-libraries - build just enough libraries for the bootstrap 691# tools, and install them under ${WORLDTMP}. 692# 693# Build csu and libgcc early so that some tools get linked to the new 694# versions (too late for the main tools, however). Then build the 695# necessary prerequisite libraries (libtermcap just needs to be before 696# libcurses, and this only matters for the NOCLEAN case when NOPIC is 697# not set). 698# 699# This is mostly wrong. The build tools must run on the host system, 700# so they should use host libraries. We depend on the target being 701# similar enough to the host for new target libraries to work on the 702# host. 703# 704bootstrap-libraries: 705.for _lib in ${_csu} gnu/usr.bin/cc/libgcc lib/libtermcap \ 706 gnu/lib/libregex gnu/lib/libreadline lib/libc \ 707 ${_libcrypt} lib/libcurses lib/libedit ${_libm} \ 708 lib/libmd lib/libutil lib/libz usr.bin/lex/lib 709.if exists(${.CURDIR}/${_lib}) 710 cd ${.CURDIR}/${_lib}; \ 711 ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 712 ${MAKE} ${MK_FLAGS} all; \ 713 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 714.endif 715.endfor 716 717# 718# libraries - build all libraries, and install them under ${DESTDIR}. 719# 720# The ordering is not as special as for bootstrap-libraries. Build 721# the prerequisites first, then build almost everything else in 722# alphabetical order. 723# 724libraries: 725.for _lib in lib/libcom_err ${_libcrypt} ${_libm} lib/libmytinfo \ 726 lib/libncurses lib/libtermcap \ 727 gnu/lib gnu/usr.bin/cc/libgcc lib usr.bin/lex/lib usr.sbin/pcvt/keycap 728.if exists(${.CURDIR}/${_lib}) 729 cd ${.CURDIR}/${_lib}; ${MAKE} all; ${MAKE} -B install 730.endif 731.endfor 732.if exists(${.CURDIR}/secure/lib) && !defined(NOCRYPT) && !defined(NOSECURE) 733 cd ${.CURDIR}/secure/lib; ${MAKE} all; ${MAKE} -B install 734.endif 735.if exists(${.CURDIR}/kerberosIV/lib) && !defined(NOCRYPT) && \ 736 defined(MAKE_KERBEROS4) 737 cd ${.CURDIR}/kerberosIV/lib; ${MAKE} all; ${MAKE} -B install 738.endif 739 740# 741# Exclude unused tools from build-tools. 742# 743.if !defined(NOGAMES) && exists(${.CURDIR}/games) 744_adventure= games/adventure 745_caesar= games/caesar 746_hack= games/hack 747_phantasia= games/phantasia 748_strfile= games/fortune/strfile 749.endif 750.if !defined(NOPERL) 751_perl= gnu/usr.bin/perl/perl 752.endif 753.if !defined(NOSHARE) && exists(${.CURDIR}/share) 754_scrnmaps= share/syscons/scrnmaps 755.endif 756.if !defined(NOLKM) && exists(${.CURDIR}/lkm) 757_linux= lkm/linux 758.endif 759 760BTMAKEFLAGS= ${MK_FLAGS} -D_BUILD_TOOLS 761 762# 763# build-tools - build and install any other tools needed to complete the 764# compile and install. 765# ifdef stale 766# bc and cpp are required to build groff. Otherwise, the order here is 767# mostly historical, i.e., bogus. 768# chmod is used to build gcc's tmpmultilib[2] at obscure times. 769# endif stale 770# XXX uname is a bug - the target should not depend on the host. 771# 772build-tools: 773.for d in \ 774 bin/cat \ 775 bin/chmod \ 776 bin/cp \ 777 bin/date \ 778 bin/dd \ 779 bin/echo \ 780 bin/expr \ 781 bin/hostname \ 782 bin/ln \ 783 bin/ls \ 784 bin/mkdir \ 785 bin/mv \ 786 bin/rm \ 787 bin/test \ 788 ${_caesar} \ 789 ${_strfile} \ 790 gnu/usr.bin/awk \ 791 gnu/usr.bin/bc \ 792 gnu/usr.bin/grep \ 793 gnu/usr.bin/groff \ 794 gnu/usr.bin/gzip \ 795 gnu/usr.bin/man/makewhatis \ 796 gnu/usr.bin/patch \ 797 ${_perl} \ 798 gnu/usr.bin/sort \ 799 gnu/usr.bin/texinfo \ 800 usr.bin/basename \ 801 usr.bin/cap_mkdb \ 802 usr.bin/chflags \ 803 usr.bin/cmp \ 804 usr.bin/col \ 805 usr.bin/colldef \ 806 usr.bin/cpp \ 807 usr.bin/expand \ 808 usr.bin/file2c \ 809 usr.bin/find \ 810 usr.bin/gencat \ 811 usr.bin/id \ 812 usr.bin/join \ 813 usr.bin/lorder \ 814 usr.bin/m4 \ 815 usr.bin/mkdep \ 816 usr.bin/mklocale \ 817 usr.bin/paste \ 818 usr.bin/sed \ 819 ${_aout_size} \ 820 usr.bin/soelim \ 821 usr.bin/symorder \ 822 usr.bin/touch \ 823 usr.bin/tr \ 824 usr.bin/true \ 825 usr.bin/uname \ 826 usr.bin/uuencode \ 827 usr.bin/vgrind \ 828 usr.bin/vi \ 829 usr.bin/wc \ 830 usr.bin/xargs \ 831 usr.bin/yacc \ 832 usr.sbin/chown \ 833 usr.sbin/mtree \ 834 usr.sbin/zic \ 835 bin/sh 836 cd ${.CURDIR}/$d; ${MAKE} ${BTMAKEFLAGS} ${_DEPEND}; \ 837 ${MAKE} ${BTMAKEFLAGS} all; \ 838 ${MAKE} ${BTMAKEFLAGS} -B install ${CLEANDIR} ${OBJDIR} 839.endfor 840.if !defined(NOGAMES) && exists(${.CURDIR}/games) 841 cd ${DESTDIR}/usr/games; cp -p caesar strfile ${DESTDIR}/usr/bin 842.endif 843.for d in \ 844 bin/sh \ 845 ${_adventure} \ 846 ${_hack} \ 847 ${_phantasia} \ 848 gnu/usr.bin/cc/cc_tools \ 849 lib/libmytinfo \ 850 ${_linux} \ 851 ${_scrnmaps} \ 852 sys/i386/boot/netboot 853 cd ${.CURDIR}/$d; ${MAKE} ${BTMAKEFLAGS} build-tools 854.endfor 855 cd ${.CURDIR}/usr.bin/tn3270/tools; ${MAKE} ${BTMAKEFLAGS} all 856 857.for __target in clean cleandepend cleandir depend obj 858.for entry in ${SUBDIR} 859${entry}.${__target}__D: .PHONY 860 @if test -d ${.CURDIR}/${entry}.${MACHINE}; then \ 861 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE}"; \ 862 edir=${entry}.${MACHINE}; \ 863 cd ${.CURDIR}/$${edir}; \ 864 else \ 865 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \ 866 edir=${entry}; \ 867 cd ${.CURDIR}/$${edir}; \ 868 fi; \ 869 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/ 870.endfor 871par-${__target}: ${SUBDIR:S/$/.${__target}__D/} 872.endfor 873 874.endif 875 876.include <bsd.subdir.mk> 877