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