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