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