Makefile revision 36687
1# 2# $Id: Makefile,v 1.198 1998/06/06 01:13:21 bde 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.endif 259 @echo 260 @echo "--------------------------------------------------------------" 261 @echo " Making hierarchy" 262 @echo "--------------------------------------------------------------" 263 cd ${.CURDIR}; ${BMAKE} hierarchy 264.if !defined(NOCLEAN) 265 @echo 266 @echo "--------------------------------------------------------------" 267 @echo " Cleaning up the obj tree" 268 @echo "--------------------------------------------------------------" 269 cd ${.CURDIR}; ${BMAKE} ${CLEANDIR:S/^/par-/} 270.endif 271.if !defined(NOOBJDIR) 272 @echo 273 @echo "--------------------------------------------------------------" 274 @echo " Rebuilding the obj tree" 275 @echo "--------------------------------------------------------------" 276 cd ${.CURDIR}; ${BMAKE} par-${OBJDIR} 277.endif 278.if !defined(NOTOOLS) 279 @echo 280 @echo "--------------------------------------------------------------" 281 @echo " Rebuilding bootstrap tools" 282 @echo "--------------------------------------------------------------" 283 cd ${.CURDIR}; ${BMAKE} bootstrap 284 @echo 285 @echo "--------------------------------------------------------------" 286 @echo " Rebuilding tools necessary to build the include files" 287 @echo "--------------------------------------------------------------" 288 cd ${.CURDIR}; ${BMAKE} include-tools 289.endif 290 @echo 291 @echo "--------------------------------------------------------------" 292 @echo " Rebuilding ${DESTDIR}/usr/include" 293 @echo "--------------------------------------------------------------" 294 cd ${.CURDIR}; SHARED=copies ${BMAKE} includes 295 @echo 296 @echo "--------------------------------------------------------------" 297 @echo " Rebuilding bootstrap libraries" 298 @echo "--------------------------------------------------------------" 299 cd ${.CURDIR}; ${BMAKE} bootstrap-libraries 300.if !defined(NOTOOLS) 301 @echo 302 @echo "--------------------------------------------------------------" 303 @echo " Rebuilding tools needed to build libraries" 304 @echo "--------------------------------------------------------------" 305 cd ${.CURDIR}; ${BMAKE} lib-tools 306.endif 307.if !defined(NOTOOLS) 308 @echo 309 @echo "--------------------------------------------------------------" 310 @echo " Rebuilding all other tools needed to build the world" 311 @echo "--------------------------------------------------------------" 312 cd ${.CURDIR}; ${BMAKE} build-tools 313.endif 314.if !defined(_NODEPEND) 315 @echo 316 @echo "--------------------------------------------------------------" 317 @echo " Rebuilding dependencies" 318 @echo "--------------------------------------------------------------" 319 cd ${.CURDIR}; ${XMAKE} par-depend 320.endif 321 @echo 322 @echo "--------------------------------------------------------------" 323 @echo " Building libraries" 324 @echo "--------------------------------------------------------------" 325 cd ${.CURDIR}; ${XMAKE} -DNOINFO -DNOMAN libraries 326 @echo 327 @echo "--------------------------------------------------------------" 328 @echo " Building everything.." 329 @echo "--------------------------------------------------------------" 330 cd ${.CURDIR}; ${XMAKE} all 331 332# 333# installworld 334# 335# Installs everything compiled by a 'buildworld'. 336# 337installworld: 338 cd ${.CURDIR}; ${IXMAKE} reinstall 339 340# 341# reinstall 342# 343# If you have a build server, you can NFS mount the source and obj directories 344# and do a 'make reinstall' on the *client* to install new binaries from the 345# most recent server build. 346# 347reinstall: 348 @echo "--------------------------------------------------------------" 349 @echo " Making hierarchy" 350 @echo "--------------------------------------------------------------" 351 cd ${.CURDIR}; ${MAKE} hierarchy 352 @echo 353 @echo "--------------------------------------------------------------" 354 @echo " Installing everything.." 355 @echo "--------------------------------------------------------------" 356 cd ${.CURDIR}; ${MAKE} install 357.if ${MACHINE_ARCH} == "i386" 358 @echo 359 @echo "--------------------------------------------------------------" 360 @echo " Re-scanning the shared libraries.." 361 @echo "--------------------------------------------------------------" 362 cd ${.CURDIR}; /sbin/ldconfig -R 363.endif 364 @echo 365 @echo "--------------------------------------------------------------" 366 @echo " Rebuilding man page indexes" 367 @echo "--------------------------------------------------------------" 368 cd ${.CURDIR}/share/man; ${MAKE} makedb 369 370# 371# update 372# 373# Update the source tree, by running sup and/or running cvs to update to the 374# latest copy. 375# 376update: 377.if defined(SUP_UPDATE) 378 @echo "--------------------------------------------------------------" 379 @echo "Running ${SUP}" 380 @echo "--------------------------------------------------------------" 381 @${SUP} ${SUPFLAGS} ${SUPFILE} 382.if defined(SUPFILE1) 383 @${SUP} ${SUPFLAGS} ${SUPFILE1} 384.endif 385.if defined(SUPFILE2) 386 @${SUP} ${SUPFLAGS} ${SUPFILE2} 387.endif 388.endif 389.if defined(CVS_UPDATE) 390 @echo "--------------------------------------------------------------" 391 @echo "Updating /usr/src from cvs repository" ${CVSROOT} 392 @echo "--------------------------------------------------------------" 393 cd ${.CURDIR}; cvs -q update -P -d 394.endif 395 396# 397# most 398# 399# Build most of the user binaries on the existing system libs and includes. 400# 401most: 402 @echo "--------------------------------------------------------------" 403 @echo " Building programs only" 404 @echo "--------------------------------------------------------------" 405 cd ${.CURDIR}/bin; ${MAKE} all 406 cd ${.CURDIR}/sbin; ${MAKE} all 407 cd ${.CURDIR}/libexec; ${MAKE} all 408 cd ${.CURDIR}/usr.bin; ${MAKE} all 409 cd ${.CURDIR}/usr.sbin; ${MAKE} all 410 cd ${.CURDIR}/gnu/libexec; ${MAKE} all 411 cd ${.CURDIR}/gnu/usr.bin; ${MAKE} all 412 cd ${.CURDIR}/gnu/usr.sbin; ${MAKE} all 413#.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT) 414# cd ${.CURDIR}/kerberosIV; ${MAKE} most 415#.endif 416#.if !defined(NOSECURE) && !defined(NOCRYPT) 417# cd ${.CURDIR}/secure; ${MAKE} most 418#.endif 419 420# 421# installmost 422# 423# Install the binaries built by the 'most' target. This does not include 424# libraries or include files. 425# 426installmost: 427 @echo "--------------------------------------------------------------" 428 @echo " Installing programs only" 429 @echo "--------------------------------------------------------------" 430 cd ${.CURDIR}/bin; ${MAKE} install 431 cd ${.CURDIR}/sbin; ${MAKE} install 432 cd ${.CURDIR}/libexec; ${MAKE} install 433 cd ${.CURDIR}/usr.bin; ${MAKE} install 434 cd ${.CURDIR}/usr.sbin; ${MAKE} install 435 cd ${.CURDIR}/gnu/libexec; ${MAKE} install 436 cd ${.CURDIR}/gnu/usr.bin; ${MAKE} install 437 cd ${.CURDIR}/gnu/usr.sbin; ${MAKE} install 438#.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT) 439# cd ${.CURDIR}/kerberosIV; ${MAKE} installmost 440#.endif 441#.if !defined(NOSECURE) && !defined(NOCRYPT) 442# cd ${.CURDIR}/secure; ${MAKE} installmost 443#.endif 444 445# 446# ------------------------------------------------------------------------ 447# 448# From here onwards are utility targets used by the 'make world' and 449# related targets. If your 'world' breaks, you may like to try to fix 450# the problem and manually run the following targets to attempt to 451# complete the build. Beware, this is *not* guaranteed to work, you 452# need to have a pretty good grip on the current state of the system 453# to attempt to manually finish it. If in doubt, 'make world' again. 454# 455 456# 457# heirarchy - ensure that all the needed directories are present 458# 459hierarchy: 460 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs 461 462# 463# bootstrap - [re]build tools needed to run the actual build, this includes 464# tools needed by 'make depend', as some tools are needed to generate source 465# for the dependency information to be gathered from. 466# 467bootstrap: 468.if defined(DESTDIR) 469 rm -f ${DESTDIR}/usr/src/sys 470 ln -s ${.CURDIR}/sys ${DESTDIR}/usr/src 471 cd ${.CURDIR}/include; find -dx . | cpio -dump ${DESTDIR}/usr/include 472.for d in net netinet posix4 sys vm machine 473 if [ -h ${DESTDIR}/usr/include/$d ]; then \ 474 rm -f ${DESTDIR}/usr/include/$d ; \ 475 fi 476.endfor 477 cd ${.CURDIR}/sys; \ 478 find -dx net netinet posix4 sys vm -name '*.h' -o -type d | \ 479 cpio -dump ${DESTDIR}/usr/include 480 mkdir -p ${DESTDIR}/usr/include/machine 481 cd ${.CURDIR}/sys/${MACHINE_ARCH}/include; find -dx . -name '*.h' -o -type d | \ 482 cpio -dump ${DESTDIR}/usr/include/machine 483.endif 484 cd ${.CURDIR}/usr.bin/make; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 485 ${MAKE} ${MK_FLAGS} all; \ 486 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 487 cd ${.CURDIR}/usr.bin/xinstall; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 488 ${MAKE} ${MK_FLAGS} all; \ 489 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 490 cd ${.CURDIR}/usr.bin/lex; ${MAKE} bootstrap; \ 491 ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 492 ${MAKE} ${MK_FLAGS} -DNOLIB all; \ 493 ${MAKE} ${MK_FLAGS} -DNOLIB -B install ${CLEANDIR} 494.if !defined(NOOBJDIR) 495 cd ${.CURDIR}/usr.bin/lex; ${MAKE} ${OBJDIR} 496.endif 497 cd ${.CURDIR}/usr.sbin/mtree; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 498 ${MAKE} ${MK_FLAGS} all; \ 499 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 500.if defined(DESTDIR) 501 cd ${.CURDIR}/include && ${MAKE} copies 502.endif 503 504# 505# include-tools - generally the same as 'bootstrap', except that it's for 506# things that are specifically needed to generate include files. 507# 508# XXX should be merged with bootstrap, it's not worth keeeping them separate. 509# Well, maybe it is now. We force 'cleandepend' here to avoid dependencies 510# on cleaned away headers in ${WORLDTMP}. 511# 512include-tools: 513.for d in usr.bin/compile_et usr.bin/rpcgen 514 cd ${.CURDIR}/$d; ${MAKE} cleandepend; \ 515 ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 516 ${MAKE} ${MK_FLAGS} all; \ 517 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 518.endfor 519 520# 521# includes - possibly generate and install the include files. 522# 523includes: 524.if defined(CLOBBER) 525 rm -rf ${DESTDIR}/usr/include/* 526 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 527 -p ${DESTDIR}/usr/include 528.endif 529 cd ${.CURDIR}/include; ${MAKE} -B all install 530 cd ${.CURDIR}/gnu/include; ${MAKE} install 531 cd ${.CURDIR}/gnu/lib/libmp; ${MAKE} beforeinstall 532 cd ${.CURDIR}/gnu/lib/libobjc; ${MAKE} beforeinstall 533 cd ${.CURDIR}/gnu/lib/libreadline; ${MAKE} beforeinstall 534 cd ${.CURDIR}/gnu/lib/libregex; ${MAKE} beforeinstall 535 cd ${.CURDIR}/gnu/lib/libstdc++; ${MAKE} beforeinstall 536 cd ${.CURDIR}/gnu/lib/libg++; ${MAKE} beforeinstall 537 cd ${.CURDIR}/gnu/lib/libdialog; ${MAKE} beforeinstall 538 cd ${.CURDIR}/gnu/lib/libgmp; ${MAKE} beforeinstall 539.if exists(secure) && !defined(NOCRYPT) 540 cd ${.CURDIR}/secure/lib/libdes; ${MAKE} beforeinstall 541.endif 542.if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS4) 543 cd ${.CURDIR}/kerberosIV/lib/libacl; ${MAKE} beforeinstall 544 cd ${.CURDIR}/kerberosIV/lib/libkadm; ${MAKE} beforeinstall 545 cd ${.CURDIR}/kerberosIV/lib/libkafs; ${MAKE} beforeinstall 546 cd ${.CURDIR}/kerberosIV/lib/libkdb; ${MAKE} beforeinstall 547 cd ${.CURDIR}/kerberosIV/lib/libkrb; ${MAKE} beforeinstall 548 cd ${.CURDIR}/kerberosIV/lib/libtelnet; ${MAKE} beforeinstall 549.else 550 cd ${.CURDIR}/lib/libtelnet; ${MAKE} beforeinstall 551.endif 552.if exists(${.CURDIR}/lib/csu/${MACHINE}) 553 cd ${.CURDIR}/lib/csu/${MACHINE}; ${MAKE} beforeinstall 554.endif 555 cd ${.CURDIR}/lib/libalias; ${MAKE} beforeinstall 556 cd ${.CURDIR}/lib/libc; ${MAKE} beforeinstall 557 cd ${.CURDIR}/lib/libcalendar; ${MAKE} beforeinstall 558 cd ${.CURDIR}/lib/libcurses; ${MAKE} beforeinstall 559 cd ${.CURDIR}/lib/libdisk; ${MAKE} beforeinstall 560 cd ${.CURDIR}/lib/libedit; ${MAKE} beforeinstall 561 cd ${.CURDIR}/lib/libftpio; ${MAKE} beforeinstall 562 cd ${.CURDIR}/lib/libmd; ${MAKE} beforeinstall 563 cd ${.CURDIR}/lib/libmytinfo; ${MAKE} beforeinstall 564 cd ${.CURDIR}/lib/libncurses; ${MAKE} beforeinstall 565.if !defined(WANT_CSRG_LIBM) 566 cd ${.CURDIR}/lib/msun; ${MAKE} beforeinstall 567.endif 568 cd ${.CURDIR}/lib/libopie; ${MAKE} beforeinstall 569 cd ${.CURDIR}/lib/libpcap; ${MAKE} beforeinstall 570 cd ${.CURDIR}/lib/librpcsvc; ${MAKE} beforeinstall 571 cd ${.CURDIR}/lib/libskey; ${MAKE} beforeinstall 572.if !defined(NOTCL) && exists (${.CURDIR}/contrib/tcl) && \ 573 exists(${.CURDIR}/usr.bin/tclsh) && exists (${.CURDIR}/lib/libtcl) 574 cd ${.CURDIR}/lib/libtcl; ${MAKE} installhdrs 575.endif 576 cd ${.CURDIR}/lib/libtermcap; ${MAKE} beforeinstall 577 cd ${.CURDIR}/lib/libcom_err; ${MAKE} beforeinstall 578 cd ${.CURDIR}/lib/libss; ${MAKE} -B hdrs beforeinstall 579 cd ${.CURDIR}/lib/libscsi; ${MAKE} beforeinstall 580 cd ${.CURDIR}/lib/libutil; ${MAKE} beforeinstall 581 cd ${.CURDIR}/lib/libvgl; ${MAKE} beforeinstall 582 cd ${.CURDIR}/lib/libz; ${MAKE} beforeinstall 583 cd ${.CURDIR}/usr.bin/f2c; ${MAKE} beforeinstall 584 cd ${.CURDIR}/usr.bin/lex; ${MAKE} beforeinstall 585 586# 587# Declare tools if they are not required on all architectures. 588# 589.if ${MACHINE_ARCH} == "i386" 590# aout tools: 591_aout_ar = usr.bin/ar 592_aout_as = gnu/usr.bin/as 593_aout_ld = gnu/usr.bin/ld 594_aout_nm = usr.bin/nm 595_aout_ranlib = usr.bin/ranlib 596_aout_size = usr.bin/size 597_aout_strip = usr.bin/strip 598_objformat = usr.bin/objformat 599.endif 600 601# 602# lib-tools - build tools to compile and install the libraries. 603# 604# XXX gperf is required for cc 605# XXX a new ld and tsort is required for cc 606lib-tools: 607.for d in \ 608 gnu/usr.bin/gperf \ 609 ${_aout_ld} \ 610 usr.bin/tsort \ 611 ${_aout_as} \ 612 gnu/usr.bin/bison \ 613 gnu/usr.bin/cc \ 614 ${_aout_ar} \ 615 usr.bin/env \ 616 usr.bin/lex/lib \ 617 usr.bin/mk_cmds \ 618 ${_aout_nm} \ 619 ${_aout_ranlib} \ 620 ${_aout_strip} \ 621 gnu/usr.bin/binutils \ 622 usr.bin/uudecode \ 623 ${_objformat} 624 cd ${.CURDIR}/$d; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 625 ${MAKE} ${MK_FLAGS} all; \ 626 ${MAKE} ${MK_FLAGS} -B install; \ 627 ${MAKE} ${MK_FLAGS:S/-DNOPIC//} -B ${CLEANDIR} ${OBJDIR} 628.endfor 629 630# 631# We have to know too much about ordering and subdirs in the lib trees: 632# 633# To satisfy shared library linkage when only the libraries being built 634# are visible: 635# 636# libcom_err must be built before libss. 637# libcrypt and libmd must be built before libskey. 638# libm must be built before libtcl. 639# libmytinfo must be built before libdialog and libncurses. 640# libncurses must be built before libdialog. 641# libtermcap must be built before libcurses, libedit and libreadline. 642# 643# Some libraries are built conditionally and/or are in inconsistently 644# named directories: 645# 646.if exists(lib/csu/${MACHINE}.pcc) 647_csu=lib/csu/${MACHINE}.pcc 648.else 649_csu=lib/csu/${MACHINE} 650.endif 651 652.if !defined(NOSECURE) && !defined(NOCRYPT) 653_libcrypt= secure/lib/libcrypt lib/libcrypt 654.else 655_libcrypt= lib/libcrypt 656.endif 657 658.if defined(WANT_CSRG_LIBM) 659_libm= lib/libm 660.else 661_libm= lib/msun 662.endif 663 664# 665# bootstrap-libraries - build just enough libraries for the bootstrap 666# tools, and install them under ${WORLDTMP}. 667# 668# Build csu and libgcc early so that some tools get linked to the new 669# versions (too late for the main tools, however). Then build the 670# necessary prerequisite libraries (libtermcap just needs to be before 671# libcurses, and this only matters for the NOCLEAN case when NOPIC is 672# not set). 673# 674# This is mostly wrong. The build tools must run on the host system, 675# so they should use host libraries. We depend on the target being 676# similar enough to the host for new target libraries to work on the 677# host. 678# 679bootstrap-libraries: 680.for _lib in ${_csu} gnu/usr.bin/cc/libgcc lib/libtermcap \ 681 gnu/lib/libregex gnu/lib/libreadline lib/libc \ 682 ${_libcrypt} lib/libcurses lib/libedit ${_libm} \ 683 lib/libmd lib/libutil lib/libz usr.bin/lex/lib 684.if exists(${.CURDIR}/${_lib}) 685 cd ${.CURDIR}/${_lib}; \ 686 ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 687 ${MAKE} ${MK_FLAGS} all; \ 688 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 689.endif 690.endfor 691 692# 693# libraries - build all libraries, and install them under ${DESTDIR}. 694# 695# The ordering is not as special as for bootstrap-libraries. Build 696# the prerequisites first, then build almost everything else in 697# alphabetical order. 698# 699libraries: 700.for _lib in lib/libcom_err ${_libcrypt} ${_libm} lib/libmytinfo \ 701 lib/libncurses lib/libtermcap \ 702 gnu/lib gnu/usr.bin/cc/libgcc lib usr.bin/lex/lib usr.sbin/pcvt/keycap 703.if exists(${.CURDIR}/${_lib}) 704 cd ${.CURDIR}/${_lib}; ${MAKE} all; ${MAKE} -B install 705.endif 706.endfor 707.if exists(${.CURDIR}/secure/lib) && !defined(NOCRYPT) && !defined(NOSECURE) 708 cd ${.CURDIR}/secure/lib; ${MAKE} all; ${MAKE} -B install 709.endif 710.if exists(${.CURDIR}/kerberosIV/lib) && !defined(NOCRYPT) && \ 711 defined(MAKE_KERBEROS4) 712 cd ${.CURDIR}/kerberosIV/lib; ${MAKE} all; ${MAKE} -B install 713.endif 714 715# Exclude perl from the build-tools if NOPERL is defined. 716.if defined(NOPERL) 717_perl= 718.else 719_perl= gnu/usr.bin/perl/perl 720.endif 721 722# 723# build-tools - build and install any other tools needed to complete the 724# compile and install. 725# ifdef stale 726# bc and cpp are required to build groff. Otherwise, the order here is 727# mostly historical, i.e., bogus. 728# chmod is used to build gcc's tmpmultilib[2] at obscure times. 729# endif stale 730# XXX uname is a bug - the target should not depend on the host. 731# 732build-tools: 733.for d in \ 734 bin/cat \ 735 bin/chmod \ 736 bin/cp \ 737 bin/date \ 738 bin/dd \ 739 bin/echo \ 740 bin/expr \ 741 bin/hostname \ 742 bin/ln \ 743 bin/ls \ 744 bin/mkdir \ 745 bin/mv \ 746 bin/rm \ 747 bin/test \ 748 gnu/usr.bin/awk \ 749 gnu/usr.bin/bc \ 750 gnu/usr.bin/grep \ 751 gnu/usr.bin/groff \ 752 gnu/usr.bin/gzip \ 753 gnu/usr.bin/man/makewhatis \ 754 gnu/usr.bin/patch \ 755 ${_perl} \ 756 gnu/usr.bin/sort \ 757 gnu/usr.bin/texinfo \ 758 usr.bin/basename \ 759 usr.bin/cap_mkdb \ 760 usr.bin/chflags \ 761 usr.bin/cmp \ 762 usr.bin/col \ 763 usr.bin/cpp \ 764 usr.bin/expand \ 765 usr.bin/file2c \ 766 usr.bin/find \ 767 usr.bin/gencat \ 768 usr.bin/id \ 769 usr.bin/lorder \ 770 usr.bin/m4 \ 771 usr.bin/mkdep \ 772 usr.bin/paste \ 773 usr.bin/sed \ 774 ${_aout_size} \ 775 usr.bin/soelim \ 776 usr.bin/symorder \ 777 usr.bin/touch \ 778 usr.bin/tr \ 779 usr.bin/true \ 780 usr.bin/uname \ 781 usr.bin/uuencode \ 782 usr.bin/vgrind \ 783 usr.bin/vi \ 784 usr.bin/wc \ 785 usr.bin/xargs \ 786 usr.bin/yacc \ 787 usr.sbin/chown \ 788 usr.sbin/mtree \ 789 usr.sbin/zic \ 790 bin/sh 791 cd ${.CURDIR}/$d; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 792 ${MAKE} ${MK_FLAGS} all; \ 793 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 794.endfor 795 796.for __target in clean cleandepend cleandir depend obj 797.for entry in ${SUBDIR} 798${entry}.${__target}__D: .PHONY 799 @if test -d ${.CURDIR}/${entry}.${MACHINE}; then \ 800 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE}"; \ 801 edir=${entry}.${MACHINE}; \ 802 cd ${.CURDIR}/$${edir}; \ 803 else \ 804 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \ 805 edir=${entry}; \ 806 cd ${.CURDIR}/$${edir}; \ 807 fi; \ 808 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/ 809.endfor 810par-${__target}: ${SUBDIR:S/$/.${__target}__D/} 811.endfor 812 813.endif 814 815.include <bsd.subdir.mk> 816