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