1# 2# $Id: Makefile,v 1.205 1998/07/07 09:59:48 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 @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 !defined(MACHINE_ARCH) || ${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/yacc; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 503 ${MAKE} ${MK_FLAGS} all; \ 504 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 505 cd ${.CURDIR}/usr.bin/lex; ${MAKE} bootstrap; \ 506 ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 507 ${MAKE} ${MK_FLAGS} -DNOLIB all; \ 508 ${MAKE} ${MK_FLAGS} -DNOLIB -B install ${CLEANDIR} 509.if !defined(NOOBJDIR) 510 cd ${.CURDIR}/usr.bin/lex; ${MAKE} ${OBJDIR} 511.endif 512 cd ${.CURDIR}/usr.sbin/mtree; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 513 ${MAKE} ${MK_FLAGS} all; \ 514 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 515.if defined(DESTDIR) 516 cd ${.CURDIR}/include && ${MAKE} copies 517.endif 518 519# 520# include-tools - generally the same as 'bootstrap', except that it's for 521# things that are specifically needed to generate include files. 522# 523# XXX should be merged with bootstrap, it's not worth keeeping them separate. 524# Well, maybe it is now. We force 'cleandepend' here to avoid dependencies 525# on cleaned away headers in ${WORLDTMP}. 526# 527include-tools: 528.for d in usr.bin/compile_et usr.bin/rpcgen 529 cd ${.CURDIR}/$d; ${MAKE} cleandepend; \ 530 ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 531 ${MAKE} ${MK_FLAGS} all; \ 532 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 533.endfor 534 535# 536# includes - possibly generate and install the include files. 537# 538includes: 539.if defined(CLOBBER) 540 rm -rf ${DESTDIR}/usr/include/* 541 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 542 -p ${DESTDIR}/usr/include 543.endif 544 cd ${.CURDIR}/include; ${MAKE} -B all install 545 cd ${.CURDIR}/gnu/include; ${MAKE} install 546 cd ${.CURDIR}/gnu/lib/libmp; ${MAKE} beforeinstall 547 cd ${.CURDIR}/gnu/lib/libobjc; ${MAKE} beforeinstall 548 cd ${.CURDIR}/gnu/lib/libreadline; ${MAKE} beforeinstall 549 cd ${.CURDIR}/gnu/lib/libregex; ${MAKE} beforeinstall 550 cd ${.CURDIR}/gnu/lib/libstdc++; ${MAKE} beforeinstall 551 cd ${.CURDIR}/gnu/lib/libg++; ${MAKE} beforeinstall 552 cd ${.CURDIR}/gnu/lib/libdialog; ${MAKE} beforeinstall 553 cd ${.CURDIR}/gnu/lib/libgmp; ${MAKE} beforeinstall 554.if exists(secure) && !defined(NOCRYPT) 555 cd ${.CURDIR}/secure/lib/libdes; ${MAKE} beforeinstall 556.endif 557.if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS4) 558 cd ${.CURDIR}/kerberosIV/lib/libacl; ${MAKE} beforeinstall 559 cd ${.CURDIR}/kerberosIV/lib/libkadm; ${MAKE} beforeinstall 560 cd ${.CURDIR}/kerberosIV/lib/libkafs; ${MAKE} beforeinstall 561 cd ${.CURDIR}/kerberosIV/lib/libkdb; ${MAKE} beforeinstall 562 cd ${.CURDIR}/kerberosIV/lib/libkrb; ${MAKE} beforeinstall 563 cd ${.CURDIR}/kerberosIV/lib/libtelnet; ${MAKE} beforeinstall 564.else 565 cd ${.CURDIR}/lib/libtelnet; ${MAKE} beforeinstall 566.endif 567.if exists(${.CURDIR}/lib/csu/${MACHINE}) 568 cd ${.CURDIR}/lib/csu/${MACHINE}; ${MAKE} beforeinstall 569.endif 570 cd ${.CURDIR}/lib/libalias; ${MAKE} beforeinstall 571 cd ${.CURDIR}/lib/libc; ${MAKE} beforeinstall 572 cd ${.CURDIR}/lib/libcalendar; ${MAKE} beforeinstall 573 cd ${.CURDIR}/lib/libcurses; ${MAKE} beforeinstall 574 cd ${.CURDIR}/lib/libdisk; ${MAKE} beforeinstall 575 cd ${.CURDIR}/lib/libedit; ${MAKE} beforeinstall 576 cd ${.CURDIR}/lib/libftpio; ${MAKE} beforeinstall 577 cd ${.CURDIR}/lib/libmd; ${MAKE} beforeinstall 578 cd ${.CURDIR}/lib/libmytinfo; ${MAKE} beforeinstall 579 cd ${.CURDIR}/lib/libncurses; ${MAKE} beforeinstall 580.if !defined(WANT_CSRG_LIBM) 581 cd ${.CURDIR}/lib/msun; ${MAKE} beforeinstall 582.endif 583 cd ${.CURDIR}/lib/libopie; ${MAKE} beforeinstall 584 cd ${.CURDIR}/lib/libpcap; ${MAKE} beforeinstall 585 cd ${.CURDIR}/lib/librpcsvc; ${MAKE} beforeinstall 586 cd ${.CURDIR}/lib/libskey; ${MAKE} beforeinstall 587.if !defined(NOTCL) && exists (${.CURDIR}/contrib/tcl) && \ 588 exists(${.CURDIR}/usr.bin/tclsh) && exists (${.CURDIR}/lib/libtcl) 589 cd ${.CURDIR}/lib/libtcl; ${MAKE} installhdrs 590.endif 591 cd ${.CURDIR}/lib/libtermcap; ${MAKE} beforeinstall 592 cd ${.CURDIR}/lib/libcom_err; ${MAKE} beforeinstall 593 cd ${.CURDIR}/lib/libss; ${MAKE} -B hdrs beforeinstall 594 cd ${.CURDIR}/lib/libscsi; ${MAKE} beforeinstall 595 cd ${.CURDIR}/lib/libutil; ${MAKE} beforeinstall 596 cd ${.CURDIR}/lib/libvgl; ${MAKE} beforeinstall 597 cd ${.CURDIR}/lib/libz; ${MAKE} beforeinstall 598 cd ${.CURDIR}/usr.bin/f2c; ${MAKE} beforeinstall 599 cd ${.CURDIR}/usr.bin/lex; ${MAKE} beforeinstall 600 601# 602# Declare tools if they are not required on all architectures. 603# 604.if !defined(MACHINE_ARCH) || ${MACHINE_ARCH} == "i386" 605# aout tools: 606_aout_ar = usr.bin/ar 607_aout_as = gnu/usr.bin/as 608_aout_ld = gnu/usr.bin/ld 609_aout_nm = usr.bin/nm 610_aout_ranlib = usr.bin/ranlib 611_aout_size = usr.bin/size 612_aout_strip = usr.bin/strip 613_objformat = usr.bin/objformat 614.endif 615 616# 617# lib-tools - build tools to compile and install the libraries. 618# 619# XXX gperf is required for cc 620# XXX a new ld and tsort is required for cc 621lib-tools: 622.for d in \ 623 gnu/usr.bin/gperf \ 624 ${_aout_ld} \ 625 usr.bin/tsort \ 626 ${_aout_as} \ 627 gnu/usr.bin/bison \ 628 gnu/usr.bin/cc \ 629 ${_aout_ar} \ 630 usr.bin/env \ 631 usr.bin/lex/lib \ 632 usr.bin/mk_cmds \ 633 ${_aout_nm} \ 634 ${_aout_ranlib} \ 635 ${_aout_strip} \ 636 gnu/usr.bin/binutils \ 637 usr.bin/uudecode \ 638 ${_objformat} 639 cd ${.CURDIR}/$d; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 640 ${MAKE} ${MK_FLAGS} all; \ 641 ${MAKE} ${MK_FLAGS} -B install; \ 642 ${MAKE} ${MK_FLAGS:S/-DNOPIC//} -B ${CLEANDIR} ${OBJDIR} 643.endfor 644 645# 646# We have to know too much about ordering and subdirs in the lib trees: 647# 648# To satisfy shared library linkage when only the libraries being built 649# are visible: 650# 651# libcom_err must be built before libss. 652# libcrypt and libmd must be built before libskey. 653# libm must be built before libtcl. 654# libmytinfo must be built before libdialog and libncurses. 655# libncurses must be built before libdialog. 656# libtermcap must be built before libcurses, libedit and libreadline. 657# 658# Some libraries are built conditionally and/or are in inconsistently 659# named directories: 660# 661.if exists(lib/csu/${MACHINE}.pcc) 662_csu=lib/csu/${MACHINE}.pcc 663.else 664_csu=lib/csu/${MACHINE} 665.endif 666 667.if !defined(NOSECURE) && !defined(NOCRYPT) 668_libcrypt= secure/lib/libcrypt lib/libcrypt 669.else 670_libcrypt= lib/libcrypt 671.endif 672 673.if defined(WANT_CSRG_LIBM) 674_libm= lib/libm 675.else 676_libm= lib/msun 677.endif 678 679# 680# bootstrap-libraries - build just enough libraries for the bootstrap 681# tools, and install them under ${WORLDTMP}. 682# 683# Build csu and libgcc early so that some tools get linked to the new 684# versions (too late for the main tools, however). Then build the 685# necessary prerequisite libraries (libtermcap just needs to be before 686# libcurses, and this only matters for the NOCLEAN case when NOPIC is 687# not set). 688# 689# This is mostly wrong. The build tools must run on the host system, 690# so they should use host libraries. We depend on the target being 691# similar enough to the host for new target libraries to work on the 692# host. 693# 694bootstrap-libraries: 695.for _lib in ${_csu} gnu/usr.bin/cc/libgcc lib/libtermcap \ 696 gnu/lib/libregex gnu/lib/libreadline lib/libc \ 697 ${_libcrypt} lib/libcurses lib/libedit ${_libm} \ 698 lib/libmd lib/libutil lib/libz usr.bin/lex/lib 699.if exists(${.CURDIR}/${_lib}) 700 cd ${.CURDIR}/${_lib}; \ 701 ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 702 ${MAKE} ${MK_FLAGS} all; \ 703 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 704.endif 705.endfor 706 707# 708# libraries - build all libraries, and install them under ${DESTDIR}. 709# 710# The ordering is not as special as for bootstrap-libraries. Build 711# the prerequisites first, then build almost everything else in 712# alphabetical order. 713# 714libraries: 715.for _lib in lib/libcom_err ${_libcrypt} ${_libm} lib/libmytinfo \ 716 lib/libncurses lib/libtermcap \ 717 gnu/lib gnu/usr.bin/cc/libgcc lib usr.bin/lex/lib usr.sbin/pcvt/keycap 718.if exists(${.CURDIR}/${_lib}) 719 cd ${.CURDIR}/${_lib}; ${MAKE} all; ${MAKE} -B install 720.endif 721.endfor 722.if exists(${.CURDIR}/secure/lib) && !defined(NOCRYPT) && !defined(NOSECURE) 723 cd ${.CURDIR}/secure/lib; ${MAKE} all; ${MAKE} -B install 724.endif 725.if exists(${.CURDIR}/kerberosIV/lib) && !defined(NOCRYPT) && \ 726 defined(MAKE_KERBEROS4) 727 cd ${.CURDIR}/kerberosIV/lib; ${MAKE} all; ${MAKE} -B install 728.endif 729 730# 731# Exclude unused tools from build-tools. 732# 733.if !defined(NOGAMES) && exists(${.CURDIR}/games) 734_adventure= games/adventure 735_caesar= games/caesar 736_hack= games/hack 737_phantasia= games/phantasia 738_strfile= games/fortune/strfile 739.endif 740.if !defined(NOPERL) 741_perl= gnu/usr.bin/perl/perl 742.endif 743.if !defined(NOSHARE) && exists(${.CURDIR}/share) 744_scrnmaps= share/syscons/scrnmaps 745.endif 746.if !defined(NOLKM) && exists(${.CURDIR}/lkm) 747_linux= lkm/linux 748.endif 749 750BTMAKEFLAGS= ${MK_FLAGS} -D_BUILD_TOOLS 751 752# 753# build-tools - build and install any other tools needed to complete the 754# compile and install. 755# ifdef stale 756# bc and cpp are required to build groff. Otherwise, the order here is 757# mostly historical, i.e., bogus. 758# chmod is used to build gcc's tmpmultilib[2] at obscure times. 759# endif stale 760# XXX uname is a bug - the target should not depend on the host. 761# 762build-tools: 763.for d in \ 764 bin/cat \ 765 bin/chmod \ 766 bin/cp \ 767 bin/date \ 768 bin/dd \ 769 bin/echo \ 770 bin/expr \ 771 bin/hostname \ 772 bin/ln \ 773 bin/ls \ 774 bin/mkdir \ 775 bin/mv \ 776 bin/rm \ 777 bin/test \ 778 ${_caesar} \ 779 ${_strfile} \ 780 gnu/usr.bin/awk \ 781 gnu/usr.bin/bc \ 782 gnu/usr.bin/grep \ 783 gnu/usr.bin/groff \ 784 gnu/usr.bin/gzip \ 785 gnu/usr.bin/man/makewhatis \ 786 gnu/usr.bin/patch \ 787 ${_perl} \ 788 gnu/usr.bin/sort \ 789 gnu/usr.bin/texinfo \ 790 usr.bin/basename \ 791 usr.bin/cap_mkdb \ 792 usr.bin/chflags \ 793 usr.bin/cmp \ 794 usr.bin/col \ 795 usr.bin/colldef \ 796 usr.bin/cpp \ 797 usr.bin/expand \ 798 usr.bin/file2c \ 799 usr.bin/find \ 800 usr.bin/gencat \ 801 usr.bin/id \ 802 usr.bin/join \ 803 usr.bin/lorder \ 804 usr.bin/m4 \ 805 usr.bin/mkdep \ 806 usr.bin/mklocale \ 807 usr.bin/paste \ 808 usr.bin/sed \ 809 ${_aout_size} \ 810 usr.bin/soelim \ 811 usr.bin/symorder \ 812 usr.bin/touch \ 813 usr.bin/tr \ 814 usr.bin/true \ 815 usr.bin/uname \ 816 usr.bin/uuencode \ 817 usr.bin/vgrind \ 818 usr.bin/vi \ 819 usr.bin/wc \ 820 usr.bin/xargs \ 821 usr.bin/yacc \ 822 usr.sbin/chown \ 823 usr.sbin/mtree \ 824 usr.sbin/zic \ 825 bin/sh 826 cd ${.CURDIR}/$d; ${MAKE} ${BTMAKEFLAGS} ${_DEPEND}; \ 827 ${MAKE} ${BTMAKEFLAGS} all; \ 828 ${MAKE} ${BTMAKEFLAGS} -B install ${CLEANDIR} ${OBJDIR} 829.endfor 830.if !defined(NOGAMES) && exists(${.CURDIR}/games) 831 cd ${DESTDIR}/usr/games; cp -p caesar strfile ${DESTDIR}/usr/bin 832.endif 833.for d in \ 834 bin/sh \ 835 ${_adventure} \ 836 ${_hack} \ 837 ${_phantasia} \ 838 gnu/usr.bin/cc/cc_tools \ 839 lib/libmytinfo \ 840 ${_linux} \ 841 ${_scrnmaps} \ 842 sys/i386/boot/netboot 843 cd ${.CURDIR}/$d; ${MAKE} ${BTMAKEFLAGS} build-tools 844.endfor 845 cd ${.CURDIR}/usr.bin/tn3270/tools; ${MAKE} ${BTMAKEFLAGS} all 846 847.for __target in clean cleandepend cleandir depend obj 848.for entry in ${SUBDIR} 849${entry}.${__target}__D: .PHONY 850 @if test -d ${.CURDIR}/${entry}.${MACHINE}; then \ 851 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE}"; \ 852 edir=${entry}.${MACHINE}; \ 853 cd ${.CURDIR}/$${edir}; \ 854 else \ 855 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \ 856 edir=${entry}; \ 857 cd ${.CURDIR}/$${edir}; \ 858 fi; \ 859 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/ 860.endfor 861par-${__target}: ${SUBDIR:S/$/.${__target}__D/} 862.endfor 863 864.endif 865 866.include <bsd.subdir.mk> 867