Makefile revision 36939
1139804Simp# 2103571Salfred# $Id: Makefile,v 1.201 1998/06/09 07:19:13 bde Exp $ 3145855Srwatson# 4142498Srwatson# While porting to the another architecture include the bootstrap instead 5103571Salfred# of the normal build. 6103571Salfred# 7145855Srwatson.if exists(${.CURDIR}/Makefile.${MACHINE}) && defined(BOOTSTRAP_WORLD) 8145855Srwatson.include "${.CURDIR}/Makefile.${MACHINE}" 9145855Srwatson.else 10145855Srwatson# 11145855Srwatson# Make command line options: 12103571Salfred# -DCLOBBER will remove /usr/include 13103571Salfred# -DMAKE_KERBEROS4 to build KerberosIV 14103571Salfred# -DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir 15103571Salfred# -DNOCLEAN do not clean at all 16103571Salfred# -DNOTOOLS do not rebuild any tools first 17103571Salfred# -DNOCRYPT will prevent building of crypt versions 18103571Salfred# -DNOLKM do not build loadable kernel modules 19103571Salfred# -DNOOBJDIR do not run ``${MAKE} obj'' 20103571Salfred# -DNOPROFILE do not build profiled libraries 21103571Salfred# -DNOSECURE do not go into secure subdir 22103571Salfred# -DNOGAMES do not go into games subdir 23103571Salfred# -DNOSHARE do not go into share subdir 24103571Salfred# -DNOINFO do not make or install info files 25103571Salfred# -DNOLIBC_R do not build libc_r. 26103571Salfred# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list 27103571Salfred 28103571Salfred# 29103571Salfred# The intended user-driven targets are: 30103571Salfred# buildworld - rebuild *everything*, including glue to help do upgrades 31103571Salfred# installworld- install everything built by "buildworld" 32103571Salfred# world - buildworld + installworld 33103571Salfred# update - convenient way to update your source tree (eg: sup/cvs) 34116182Sobrien# most - build user commands, no libraries or include files 35116182Sobrien# installmost - install user commands, no libraries or include files 36116182Sobrien# 37205324Skib# Standard targets (not defined here) are documented in the makefiles in 38103571Salfred# /usr/share/mk. These include: 39103571Salfred# obj depend all install clean cleandepend cleanobj 40103571Salfred 41224778Srwatson.if (!make(world)) && (!make(buildworld)) && (!make(installworld)) 42180059Sjhb.MAKEFLAGS:= -m ${.CURDIR}/share/mk ${.MAKEFLAGS} 43180059Sjhb.endif 44180059Sjhb 45180059Sjhb# Put initial settings here. 46180059SjhbSUBDIR= 47103571Salfred 48164184Strhodes# We must do share/info early so that installation of info `dir' 49180059Sjhb# entries works correctly. Do it first since it is less likely to 50180059Sjhb# grow dependencies on include and lib than vice versa. 51180059Sjhb.if exists(share/info) 52180059SjhbSUBDIR+= share/info 53164033Srwatson.endif 54103571Salfred 55164184Strhodes# We must do include and lib early so that the perl *.ph generation 56180059Sjhb# works correctly as it uses the header files installed by this. 57180059Sjhb.if exists(include) 58103571SalfredSUBDIR+= include 59180059Sjhb.endif 60180059Sjhb.if exists(lib) 61103571SalfredSUBDIR+= lib 62180059Sjhb.endif 63180059Sjhb 64180059Sjhb.if exists(bin) 65180059SjhbSUBDIR+= bin 66103571Salfred.endif 67163606Srwatson.if exists(games) && !defined(NOGAMES) 68163606SrwatsonSUBDIR+= games 69219030Snetchild.endif 70180059Sjhb.if exists(gnu) 71180059SjhbSUBDIR+= gnu 72180059Sjhb.endif 73180059Sjhb.if exists(kerberosIV) && exists(crypto) && !defined(NOCRYPT) && \ 74180059Sjhb defined(MAKE_KERBEROS4) 75180059SjhbSUBDIR+= kerberosIV 76180059Sjhb.endif 77103571Salfred.if exists(libexec) 78103571SalfredSUBDIR+= libexec 79179054Srwatson.endif 80103571Salfred.if exists(sbin) 81103571SalfredSUBDIR+= sbin 82180059Sjhb.endif 83180059Sjhb.if exists(share) && !defined(NOSHARE) 84180059SjhbSUBDIR+= share 85180059Sjhb.endif 86180059Sjhb.if exists(sys) 87103571SalfredSUBDIR+= sys 88180059Sjhb.endif 89180059Sjhb.if exists(usr.bin) 90180059SjhbSUBDIR+= usr.bin 91180059Sjhb.endif 92180059Sjhb.if exists(usr.sbin) 93180059SjhbSUBDIR+= usr.sbin 94103571Salfred.endif 95180059Sjhb.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE) 96180059SjhbSUBDIR+= secure 97180059Sjhb.endif 98180059Sjhb.if exists(lkm) && !defined(NOLKM) 99180059SjhbSUBDIR+= lkm 100180059Sjhb.endif 101180059Sjhb 102179054Srwatson# etc must be last for "distribute" to work 103180059Sjhb.if exists(etc) && make(distribute) 104103571SalfredSUBDIR+= etc 105103571Salfred.endif 106103571Salfred 107180059Sjhb# These are last, since it is nice to at least get the base system 108180059Sjhb# rebuilt before you do them. 109103571Salfred.if defined(LOCAL_DIRS) 110180059Sjhb.for _DIR in ${LOCAL_DIRS} 111180059Sjhb.if exists(${_DIR}) & exists(${_DIR}/Makefile) 112180059SjhbSUBDIR+= ${_DIR} 113180059Sjhb.endif 114180059Sjhb.endfor 115180059Sjhb.endif 116180059Sjhb 117205324Skib# Handle -DNOOBJDIR, -DNOCLEAN and -DNOCLEANDIR 118180059Sjhb.if defined(NOOBJDIR) 119224778SrwatsonOBJDIR= 120224778Srwatson.else 121180059SjhbOBJDIR= obj 122180059Sjhb.endif 123180059Sjhb 124180059Sjhb.if defined(NOCLEAN) 125180059SjhbCLEANDIR= 126180059Sjhb.else 127180059Sjhb.if defined(NOCLEANDIR) 128112564SjhbCLEANDIR= clean cleandepend 129180059Sjhb.else 130180059SjhbCLEANDIR= cleandir 131180059Sjhb.endif 132180059Sjhb.endif 133180059Sjhb 134180059Sjhb.if !defined(NOCLEAN) && ${.MAKEFLAGS:M-j} == "" 135180059Sjhb_NODEPEND= true 136180059Sjhb.endif 137224914Skib.if defined(_NODEPEND) 138224914Skib_DEPEND= cleandepend 139104596Salfred.else 140180059Sjhb_DEPEND= depend 141180059Sjhb.endif 142180059Sjhb 143180059SjhbSUP?= cvsup 144180059SjhbSUPFLAGS?= -g -L 2 -P - 145180059Sjhb 146180059Sjhb# 147180059Sjhb# While building tools for bootstrapping, we don't need to waste time on 148180059Sjhb# shared or profiled libraries, shared linkage, or documentation, except 149180059Sjhb# when the tools won't get cleaned we must use the defaults for shared 150224914Skib# libraries and shared linkage (and this doesn't waste time). 151224914Skib# XXX actually, we do need to waste time building shared libraries. 152180059Sjhb# 153180059Sjhb.if defined(NOCLEAN) 154180059SjhbMK_FLAGS= -DNOINFO -DNOMAN -DNOPROFILE 155180059Sjhb.else 156180059SjhbMK_FLAGS= -DNOINFO -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED 157180059Sjhb.endif 158180059Sjhb 159180059Sjhb# 160103571Salfred# world 161103571Salfred# 162180059Sjhb# Attempt to rebuild and reinstall *everything*, with reasonable chance of 163103571Salfred# success, regardless of how old your existing system is. 164103571Salfred# 165180059Sjhb# >> Beware, it overwrites the local build environment! << 166180059Sjhb# 167180059Sjhbworld: 168103571Salfred @echo "--------------------------------------------------------------" 169103571Salfred @echo "make world started on `LC_TIME=C date`" 170180059Sjhb @echo "--------------------------------------------------------------" 171103571Salfred.if target(pre-world) 172103571Salfred @echo 173180059Sjhb @echo "--------------------------------------------------------------" 174180059Sjhb @echo " Making 'pre-world' target" 175180059Sjhb @echo "--------------------------------------------------------------" 176103571Salfred cd ${.CURDIR}; ${MAKE} pre-world 177103571Salfred.endif 178180059Sjhb cd ${.CURDIR}; ${MAKE} buildworld 179103571Salfred cd ${.CURDIR}; ${MAKE} -B installworld 180103571Salfred.if target(post-world) 181180059Sjhb @echo 182180059Sjhb @echo "--------------------------------------------------------------" 183180059Sjhb @echo " Making 'post-world' target" 184103571Salfred @echo "--------------------------------------------------------------" 185103571Salfred cd ${.CURDIR}; ${MAKE} post-world 186180059Sjhb.endif 187103571Salfred @echo 188103571Salfred @echo "--------------------------------------------------------------" 189105227Sphk @echo "make world completed on `LC_TIME=C date`" 190180059Sjhb @echo "--------------------------------------------------------------" 191180059Sjhb 192103571Salfred.if defined(MAKEOBJDIRPREFIX) 193180059SjhbWORLDTMP= ${MAKEOBJDIRPREFIX}${.CURDIR}/tmp 194180059Sjhb.else 195180059SjhbWORLDTMP= /usr/obj${.CURDIR}/tmp 196180059Sjhb.endif 197180059SjhbSTRICTTMPPATH= ${WORLDTMP}/sbin:${WORLDTMP}/usr/sbin:${WORLDTMP}/bin:${WORLDTMP}/usr/bin 198180059SjhbTMPPATH= ${STRICTTMPPATH}:${PATH} 199180059Sjhb 200180059Sjhb# XXX COMPILER_PATH is needed for finding cc1, ld and as 201180059Sjhb# XXX GCC_EXEC_PREFIX is for *crt.o. It is probably unnecessary now 202180059Sjhb# that LIBRARY_PATH is set. We still can't use -nostdlib, since gcc 203180059Sjhb# wouldn't link *crt.o or libgcc if it were used. 204180059Sjhb# XXX LD_LIBRARY_PATH is for ld.so. It is also used by ld, although we don't 205180059Sjhb# want that - all compile-time library paths should be resolved by gcc. 206180059Sjhb# It fails for set[ug]id executables (are any used?). 207180059SjhbCOMPILER_ENV= BISON_SIMPLE=${WORLDTMP}/usr/share/misc/bison.simple \ 208180059Sjhb COMPILER_PATH=${WORLDTMP}/usr/libexec:${WORLDTMP}/usr/bin \ 209180059Sjhb GCC_EXEC_PREFIX=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib/ \ 210103571Salfred LD_LIBRARY_PATH=${WORLDTMP}${SHLIBDIR} \ 211180059Sjhb LIBRARY_PATH=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib 212103571Salfred 213180059SjhbBMAKEENV= PATH=${TMPPATH} ${COMPILER_ENV} NOEXTRADEPEND=t \ 214179054Srwatson OBJFORMAT_PATH=${WORLDTMP}/usr/libexec:/usr/libexec 215145855SrwatsonXMAKEENV= PATH=${STRICTTMPPATH} ${COMPILER_ENV} \ 216180059Sjhb OBJFORMAT_PATH=${WORLDTMP}/usr/libexec \ 217180059Sjhb CFLAGS="-nostdinc ${CFLAGS}" # XXX -nostdlib 218180059Sjhb 219145855Srwatson# used to compile and install 'make' in temporary build tree 220180059SjhbMAKETMP= ${WORLDTMP}/make 221180059SjhbIBMAKE= ${BMAKEENV} MAKEOBJDIR=${MAKETMP} ${MAKE} DESTDIR=${WORLDTMP} 222180059Sjhb# bootstrap make 223180059SjhbBMAKE= ${BMAKEENV} ${WORLDTMP}/usr/bin/make DESTDIR=${WORLDTMP} 224180059Sjhb# cross make used for compilation 225180059SjhbXMAKE= ${XMAKEENV} ${WORLDTMP}/usr/bin/make DESTDIR=${WORLDTMP} 226180059Sjhb# cross make used for final installation 227224914SkibIXMAKE= ${XMAKEENV} ${WORLDTMP}/usr/bin/make 228205792Sed 229205792Sed# 230205792Sed# buildworld 231224914Skib# 232180059Sjhb# Attempt to rebuild the entire system, with reasonable chance of 233180059Sjhb# success, regardless of how old your existing system is. 234224914Skib# 235224914Skibbuildworld: 236180059Sjhb.if !defined(NOCLEAN) 237180059Sjhb @echo 238103571Salfred @echo "--------------------------------------------------------------" 239103571Salfred @echo " Cleaning up the temporary build tree" 240180059Sjhb @echo "--------------------------------------------------------------" 241224914Skib mkdir -p ${WORLDTMP} 242224914Skib chflags -R noschg ${WORLDTMP}/ 243224914Skib rm -rf ${WORLDTMP} 244224914Skib.endif 245224914Skib.if !defined(NOTOOLS) 246224914Skib @echo 247224914Skib @echo "--------------------------------------------------------------" 248224914Skib @echo " Making make" 249224914Skib @echo "--------------------------------------------------------------" 250224914Skib mkdir -p ${WORLDTMP}/usr/bin ${MAKETMP} 251224914Skib ( \ 252224914Skib cd ${.CURDIR}/usr.bin/make; \ 253224914Skib MAKEOBJDIRPREFIX=""; unset MAKEOBJDIRPREFIX; \ 254224914Skib ${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} all; \ 255224914Skib ${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} install; \ 256224914Skib ${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} clean \ 257224914Skib ) 258224914Skib @echo 259224914Skib @echo "--------------------------------------------------------------" 260224914Skib @echo " Making mtree" 261224914Skib @echo "--------------------------------------------------------------" 262224914Skib mkdir -p ${WORLDTMP}/usr/sbin ${WORLDTMP}/mtree 263224914Skib ( \ 264224914Skib cd ${.CURDIR}/usr.sbin/mtree; \ 265224914Skib MAKEOBJDIRPREFIX=""; unset MAKEOBJDIRPREFIX; \ 266224914Skib export MAKEOBJDIR=${WORLDTMP}/mtree; \ 267224914Skib ${BMAKE} ${MK_FLAGS} all; \ 268224914Skib ${BMAKE} ${MK_FLAGS} -B install clean \ 269224914Skib ) 270224914Skib.endif 271224914Skib @echo 272224935Skib @echo "--------------------------------------------------------------" 273224914Skib @echo " Making hierarchy" 274224914Skib @echo "--------------------------------------------------------------" 275224914Skib cd ${.CURDIR}; ${BMAKE} hierarchy 276224914Skib.if !defined(NOCLEAN) 277224914Skib @echo 278224914Skib @echo "--------------------------------------------------------------" 279224914Skib @echo " Cleaning up the obj tree" 280224914Skib @echo "--------------------------------------------------------------" 281224914Skib cd ${.CURDIR}; ${BMAKE} ${CLEANDIR:S/^/par-/} 282224914Skib.endif 283224914Skib.if !defined(NOOBJDIR) 284224914Skib @echo 285224914Skib @echo "--------------------------------------------------------------" 286224914Skib @echo " Rebuilding the obj tree" 287224914Skib @echo "--------------------------------------------------------------" 288224914Skib cd ${.CURDIR}; ${BMAKE} par-${OBJDIR} 289224914Skib.endif 290224914Skib.if !defined(NOTOOLS) 291224914Skib @echo 292224914Skib @echo "--------------------------------------------------------------" 293224914Skib @echo " Rebuilding bootstrap tools" 294224914Skib @echo "--------------------------------------------------------------" 295224914Skib cd ${.CURDIR}; ${BMAKE} bootstrap 296180059Sjhb @echo 297103571Salfred @echo "--------------------------------------------------------------" 298180059Sjhb @echo " Rebuilding tools necessary to build the include files" 299103571Salfred @echo "--------------------------------------------------------------" 300180059Sjhb cd ${.CURDIR}; ${BMAKE} include-tools 301180059Sjhb.endif 302180059Sjhb @echo 303180059Sjhb @echo "--------------------------------------------------------------" 304180059Sjhb @echo " Rebuilding ${DESTDIR}/usr/include" 305103571Salfred @echo "--------------------------------------------------------------" 306103571Salfred cd ${.CURDIR}; SHARED=copies ${BMAKE} includes 307180059Sjhb @echo 308180059Sjhb @echo "--------------------------------------------------------------" 309180059Sjhb @echo " Rebuilding bootstrap libraries" 310180059Sjhb @echo "--------------------------------------------------------------" 311180059Sjhb cd ${.CURDIR}; ${BMAKE} bootstrap-libraries 312180059Sjhb.if !defined(NOTOOLS) 313103571Salfred @echo 314103571Salfred @echo "--------------------------------------------------------------" 315103571Salfred @echo " Rebuilding tools needed to build libraries" 316180059Sjhb @echo "--------------------------------------------------------------" 317180059Sjhb cd ${.CURDIR}; ${BMAKE} lib-tools 318180059Sjhb.endif 319180059Sjhb.if !defined(NOTOOLS) 320103571Salfred @echo 321180059Sjhb @echo "--------------------------------------------------------------" 322180059Sjhb @echo " Rebuilding all other tools needed to build the world" 323180059Sjhb @echo "--------------------------------------------------------------" 324180059Sjhb cd ${.CURDIR}; ${BMAKE} build-tools 325180059Sjhb.endif 326180059Sjhb.if !defined(_NODEPEND) 327180059Sjhb @echo 328180059Sjhb @echo "--------------------------------------------------------------" 329180059Sjhb @echo " Rebuilding dependencies" 330180059Sjhb @echo "--------------------------------------------------------------" 331180059Sjhb cd ${.CURDIR}; ${XMAKE} par-depend 332180059Sjhb.endif 333180059Sjhb @echo 334180059Sjhb @echo "--------------------------------------------------------------" 335180059Sjhb @echo " Building libraries" 336180059Sjhb @echo "--------------------------------------------------------------" 337180059Sjhb cd ${.CURDIR}; ${XMAKE} -DNOINFO -DNOMAN libraries 338103571Salfred @echo 339103571Salfred @echo "--------------------------------------------------------------" 340180059Sjhb @echo " Building everything.." 341180059Sjhb @echo "--------------------------------------------------------------" 342180059Sjhb cd ${.CURDIR}; ${XMAKE} all 343180059Sjhb 344180059Sjhb# 345180059Sjhb# installworld 346180059Sjhb# 347180059Sjhb# Installs everything compiled by a 'buildworld'. 348180059Sjhb# 349180059Sjhbinstallworld: 350180059Sjhb cd ${.CURDIR}; ${IXMAKE} reinstall 351180059Sjhb 352180059Sjhb# 353180059Sjhb# reinstall 354180059Sjhb# 355103571Salfred# If you have a build server, you can NFS mount the source and obj directories 356180059Sjhb# and do a 'make reinstall' on the *client* to install new binaries from the 357180059Sjhb# most recent server build. 358180059Sjhb# 359180059Sjhbreinstall: 360180059Sjhb @echo "--------------------------------------------------------------" 361180059Sjhb @echo " Making hierarchy" 362180059Sjhb @echo "--------------------------------------------------------------" 363180059Sjhb cd ${.CURDIR}; ${MAKE} hierarchy 364180059Sjhb @echo 365180059Sjhb @echo "--------------------------------------------------------------" 366180059Sjhb @echo " Installing everything.." 367180059Sjhb @echo "--------------------------------------------------------------" 368180059Sjhb cd ${.CURDIR}; ${MAKE} install 369180059Sjhb.if ${MACHINE_ARCH} == "i386" 370103571Salfred @echo 371103571Salfred @echo "--------------------------------------------------------------" 372103571Salfred @echo " Re-scanning the shared libraries.." 373180059Sjhb @echo "--------------------------------------------------------------" 374180059Sjhb cd ${.CURDIR}; /sbin/ldconfig -R 375103571Salfred.endif 376180059Sjhb @echo 377103571Salfred @echo "--------------------------------------------------------------" 378103571Salfred @echo " Rebuilding man page indexes" 379103571Salfred @echo "--------------------------------------------------------------" 380180059Sjhb cd ${.CURDIR}/share/man; ${MAKE} makedb 381180059Sjhb 382180059Sjhb# 383180059Sjhb# update 384180059Sjhb# 385180059Sjhb# Update the source tree, by running sup and/or running cvs to update to the 386180059Sjhb# latest copy. 387103571Salfred# 388180059Sjhbupdate: 389103571Salfred.if defined(SUP_UPDATE) 390180059Sjhb @echo "--------------------------------------------------------------" 391180059Sjhb @echo "Running ${SUP}" 392180059Sjhb @echo "--------------------------------------------------------------" 393180059Sjhb @${SUP} ${SUPFLAGS} ${SUPFILE} 394180059Sjhb.if defined(SUPFILE1) 395103571Salfred @${SUP} ${SUPFLAGS} ${SUPFILE1} 396179054Srwatson.endif 397180059Sjhb.if defined(SUPFILE2) 398180059Sjhb @${SUP} ${SUPFLAGS} ${SUPFILE2} 399179054Srwatson.endif 400180059Sjhb.endif 401180059Sjhb.if defined(CVS_UPDATE) 402180059Sjhb @echo "--------------------------------------------------------------" 403180059Sjhb @echo "Updating /usr/src from cvs repository" ${CVSROOT} 404179054Srwatson @echo "--------------------------------------------------------------" 405180059Sjhb cd ${.CURDIR}; cvs -q update -P -d 406180059Sjhb.endif 407180059Sjhb 408180059Sjhb# 409252163Sjhb# most 410180059Sjhb# 411180059Sjhb# Build most of the user binaries on the existing system libs and includes. 412180059Sjhb# 413180059Sjhbmost: 414180059Sjhb @echo "--------------------------------------------------------------" 415180059Sjhb @echo " Building programs only" 416180059Sjhb @echo "--------------------------------------------------------------" 417180059Sjhb cd ${.CURDIR}/bin; ${MAKE} all 418180059Sjhb cd ${.CURDIR}/sbin; ${MAKE} all 419180059Sjhb cd ${.CURDIR}/libexec; ${MAKE} all 420180059Sjhb cd ${.CURDIR}/usr.bin; ${MAKE} all 421180059Sjhb cd ${.CURDIR}/usr.sbin; ${MAKE} all 422180059Sjhb cd ${.CURDIR}/gnu/libexec; ${MAKE} all 423145855Srwatson cd ${.CURDIR}/gnu/usr.bin; ${MAKE} all 424180059Sjhb cd ${.CURDIR}/gnu/usr.sbin; ${MAKE} all 425180059Sjhb#.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT) 426180059Sjhb# cd ${.CURDIR}/kerberosIV; ${MAKE} most 427145855Srwatson#.endif 428180059Sjhb#.if !defined(NOSECURE) && !defined(NOCRYPT) 429180059Sjhb# cd ${.CURDIR}/secure; ${MAKE} most 430103571Salfred#.endif 431252163Sjhb 432180059Sjhb# 433180059Sjhb# installmost 434180059Sjhb# 435180059Sjhb# Install the binaries built by the 'most' target. This does not include 436180059Sjhb# libraries or include files. 437103571Salfred# 438103571Salfredinstallmost: 439180059Sjhb @echo "--------------------------------------------------------------" 440180059Sjhb @echo " Installing programs only" 441103571Salfred @echo "--------------------------------------------------------------" 442103571Salfred cd ${.CURDIR}/bin; ${MAKE} install 443252163Sjhb cd ${.CURDIR}/sbin; ${MAKE} install 444252163Sjhb cd ${.CURDIR}/libexec; ${MAKE} install 445252163Sjhb cd ${.CURDIR}/usr.bin; ${MAKE} install 446252163Sjhb cd ${.CURDIR}/usr.sbin; ${MAKE} install 447252163Sjhb cd ${.CURDIR}/gnu/libexec; ${MAKE} install 448252163Sjhb cd ${.CURDIR}/gnu/usr.bin; ${MAKE} install 449252163Sjhb cd ${.CURDIR}/gnu/usr.sbin; ${MAKE} install 450252163Sjhb#.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT) 451252163Sjhb# cd ${.CURDIR}/kerberosIV; ${MAKE} installmost 452252163Sjhb#.endif 453252163Sjhb#.if !defined(NOSECURE) && !defined(NOCRYPT) 454252163Sjhb# cd ${.CURDIR}/secure; ${MAKE} installmost 455252163Sjhb#.endif 456252163Sjhb 457205324Skib# 458205324Skib# ------------------------------------------------------------------------ 459205324Skib# 460205324Skib# From here onwards are utility targets used by the 'make world' and 461205324Skib# related targets. If your 'world' breaks, you may like to try to fix 462205324Skib# the problem and manually run the following targets to attempt to 463205324Skib# complete the build. Beware, this is *not* guaranteed to work, you 464205324Skib# need to have a pretty good grip on the current state of the system 465205324Skib# to attempt to manually finish it. If in doubt, 'make world' again. 466205324Skib# 467205324Skib 468205324Skib# 469205324Skib# heirarchy - ensure that all the needed directories are present 470205324Skib# 471205324Skibhierarchy: 472205324Skib cd ${.CURDIR}/etc; ${MAKE} distrib-dirs 473205324Skib 474205324Skib# 475205324Skib# bootstrap - [re]build tools needed to run the actual build, this includes 476205324Skib# tools needed by 'make depend', as some tools are needed to generate source 477205324Skib# for the dependency information to be gathered from. 478205324Skib# 479205324Skibbootstrap: 480205324Skib.if defined(DESTDIR) 481205324Skib rm -f ${DESTDIR}/usr/src/sys 482205324Skib ln -s ${.CURDIR}/sys ${DESTDIR}/usr/src 483205324Skib cd ${.CURDIR}/include; find -dx . | cpio -dump ${DESTDIR}/usr/include 484205324Skib.for d in net netinet posix4 sys vm machine 485205324Skib if [ -h ${DESTDIR}/usr/include/$d ]; then \ 486180059Sjhb rm -f ${DESTDIR}/usr/include/$d ; \ 487105227Sphk fi 488180059Sjhb.endfor 489205324Skib cd ${.CURDIR}/sys; \ 490103571Salfred find -dx net netinet posix4 sys vm -name '*.h' -o -type d | \ 491180059Sjhb cpio -dump ${DESTDIR}/usr/include 492180059Sjhb mkdir -p ${DESTDIR}/usr/include/machine 493180059Sjhb cd ${.CURDIR}/sys/${MACHINE_ARCH}/include; find -dx . -name '*.h' -o -type d | \ 494180059Sjhb cpio -dump ${DESTDIR}/usr/include/machine 495180059Sjhb.endif 496180059Sjhb cd ${.CURDIR}/usr.bin/make; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 497103571Salfred ${MAKE} ${MK_FLAGS} all; \ 498180059Sjhb ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 499180059Sjhb cd ${.CURDIR}/usr.bin/xinstall; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 500180059Sjhb ${MAKE} ${MK_FLAGS} all; \ 501180059Sjhb ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 502180059Sjhb cd ${.CURDIR}/usr.bin/lex; ${MAKE} bootstrap; \ 503249953Sjilles ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 504180059Sjhb ${MAKE} ${MK_FLAGS} -DNOLIB all; \ 505180059Sjhb ${MAKE} ${MK_FLAGS} -DNOLIB -B install ${CLEANDIR} 506180059Sjhb.if !defined(NOOBJDIR) 507180059Sjhb cd ${.CURDIR}/usr.bin/lex; ${MAKE} ${OBJDIR} 508180059Sjhb.endif 509180059Sjhb cd ${.CURDIR}/usr.sbin/mtree; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 510164033Srwatson ${MAKE} ${MK_FLAGS} all; \ 511180059Sjhb ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 512180059Sjhb.if defined(DESTDIR) 513180059Sjhb cd ${.CURDIR}/include && ${MAKE} copies 514164033Srwatson.endif 515205324Skib 516180059Sjhb# 517180059Sjhb# include-tools - generally the same as 'bootstrap', except that it's for 518180059Sjhb# things that are specifically needed to generate include files. 519180059Sjhb# 520180059Sjhb# XXX should be merged with bootstrap, it's not worth keeeping them separate. 521103571Salfred# Well, maybe it is now. We force 'cleandepend' here to avoid dependencies 522180059Sjhb# on cleaned away headers in ${WORLDTMP}. 523180059Sjhb# 524180059Sjhbinclude-tools: 525180059Sjhb.for d in usr.bin/compile_et usr.bin/rpcgen 526180059Sjhb cd ${.CURDIR}/$d; ${MAKE} cleandepend; \ 527180059Sjhb ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 528180059Sjhb ${MAKE} ${MK_FLAGS} all; \ 529180059Sjhb ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 530180059Sjhb.endfor 531180059Sjhb 532103571Salfred# 533180059Sjhb# includes - possibly generate and install the include files. 534180059Sjhb# 535180059Sjhbincludes: 536180059Sjhb.if defined(CLOBBER) 537180059Sjhb rm -rf ${DESTDIR}/usr/include/* 538180059Sjhb mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 539180059Sjhb -p ${DESTDIR}/usr/include 540180059Sjhb.endif 541180059Sjhb cd ${.CURDIR}/include; ${MAKE} -B all install 542180059Sjhb cd ${.CURDIR}/gnu/include; ${MAKE} install 543180059Sjhb cd ${.CURDIR}/gnu/lib/libmp; ${MAKE} beforeinstall 544180059Sjhb cd ${.CURDIR}/gnu/lib/libobjc; ${MAKE} beforeinstall 545180059Sjhb cd ${.CURDIR}/gnu/lib/libreadline; ${MAKE} beforeinstall 546180059Sjhb cd ${.CURDIR}/gnu/lib/libregex; ${MAKE} beforeinstall 547180059Sjhb cd ${.CURDIR}/gnu/lib/libstdc++; ${MAKE} beforeinstall 548180059Sjhb cd ${.CURDIR}/gnu/lib/libg++; ${MAKE} beforeinstall 549180059Sjhb cd ${.CURDIR}/gnu/lib/libdialog; ${MAKE} beforeinstall 550180059Sjhb cd ${.CURDIR}/gnu/lib/libgmp; ${MAKE} beforeinstall 551180059Sjhb.if exists(secure) && !defined(NOCRYPT) 552180059Sjhb cd ${.CURDIR}/secure/lib/libdes; ${MAKE} beforeinstall 553180059Sjhb.endif 554180059Sjhb.if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS4) 555180059Sjhb cd ${.CURDIR}/kerberosIV/lib/libacl; ${MAKE} beforeinstall 556180059Sjhb cd ${.CURDIR}/kerberosIV/lib/libkadm; ${MAKE} beforeinstall 557180059Sjhb cd ${.CURDIR}/kerberosIV/lib/libkafs; ${MAKE} beforeinstall 558180059Sjhb cd ${.CURDIR}/kerberosIV/lib/libkdb; ${MAKE} beforeinstall 559180059Sjhb cd ${.CURDIR}/kerberosIV/lib/libkrb; ${MAKE} beforeinstall 560180059Sjhb cd ${.CURDIR}/kerberosIV/lib/libtelnet; ${MAKE} beforeinstall 561180059Sjhb.else 562180059Sjhb cd ${.CURDIR}/lib/libtelnet; ${MAKE} beforeinstall 563180059Sjhb.endif 564180059Sjhb.if exists(${.CURDIR}/lib/csu/${MACHINE}) 565180059Sjhb cd ${.CURDIR}/lib/csu/${MACHINE}; ${MAKE} beforeinstall 566180059Sjhb.endif 567175148Srwatson cd ${.CURDIR}/lib/libalias; ${MAKE} beforeinstall 568180059Sjhb cd ${.CURDIR}/lib/libc; ${MAKE} beforeinstall 569180059Sjhb cd ${.CURDIR}/lib/libcalendar; ${MAKE} beforeinstall 570180059Sjhb cd ${.CURDIR}/lib/libcurses; ${MAKE} beforeinstall 571175148Srwatson cd ${.CURDIR}/lib/libdisk; ${MAKE} beforeinstall 572180059Sjhb cd ${.CURDIR}/lib/libedit; ${MAKE} beforeinstall 573180059Sjhb cd ${.CURDIR}/lib/libftpio; ${MAKE} beforeinstall 574180059Sjhb cd ${.CURDIR}/lib/libmd; ${MAKE} beforeinstall 575180059Sjhb cd ${.CURDIR}/lib/libmytinfo; ${MAKE} beforeinstall 576180059Sjhb cd ${.CURDIR}/lib/libncurses; ${MAKE} beforeinstall 577180059Sjhb.if !defined(WANT_CSRG_LIBM) 578180059Sjhb cd ${.CURDIR}/lib/msun; ${MAKE} beforeinstall 579180059Sjhb.endif 580180059Sjhb cd ${.CURDIR}/lib/libopie; ${MAKE} beforeinstall 581180059Sjhb cd ${.CURDIR}/lib/libpcap; ${MAKE} beforeinstall 582180059Sjhb cd ${.CURDIR}/lib/librpcsvc; ${MAKE} beforeinstall 583180059Sjhb cd ${.CURDIR}/lib/libskey; ${MAKE} beforeinstall 584180059Sjhb.if !defined(NOTCL) && exists (${.CURDIR}/contrib/tcl) && \ 585103571Salfred exists(${.CURDIR}/usr.bin/tclsh) && exists (${.CURDIR}/lib/libtcl) 586180059Sjhb cd ${.CURDIR}/lib/libtcl; ${MAKE} installhdrs 587180059Sjhb.endif 588180059Sjhb cd ${.CURDIR}/lib/libtermcap; ${MAKE} beforeinstall 589180059Sjhb cd ${.CURDIR}/lib/libcom_err; ${MAKE} beforeinstall 590180059Sjhb cd ${.CURDIR}/lib/libss; ${MAKE} -B hdrs beforeinstall 591180059Sjhb cd ${.CURDIR}/lib/libscsi; ${MAKE} beforeinstall 592180059Sjhb cd ${.CURDIR}/lib/libutil; ${MAKE} beforeinstall 593103571Salfred cd ${.CURDIR}/lib/libvgl; ${MAKE} beforeinstall 594180059Sjhb cd ${.CURDIR}/lib/libz; ${MAKE} beforeinstall 595180059Sjhb cd ${.CURDIR}/usr.bin/f2c; ${MAKE} beforeinstall 596180059Sjhb cd ${.CURDIR}/usr.bin/lex; ${MAKE} beforeinstall 597180059Sjhb 598180059Sjhb# 599103571Salfred# Declare tools if they are not required on all architectures. 600103571Salfred# 601105227Sphk.if ${MACHINE_ARCH} == "i386" 602224778Srwatson# aout tools: 603103571Salfred_aout_ar = usr.bin/ar 604180059Sjhb_aout_as = gnu/usr.bin/as 605180059Sjhb_aout_ld = gnu/usr.bin/ld 606180059Sjhb_aout_nm = usr.bin/nm 607180059Sjhb_aout_ranlib = usr.bin/ranlib 608224778Srwatson_aout_size = usr.bin/size 609180059Sjhb_aout_strip = usr.bin/strip 610180059Sjhb_objformat = usr.bin/objformat 611180059Sjhb.endif 612180059Sjhb 613180059Sjhb# 614180059Sjhb# lib-tools - build tools to compile and install the libraries. 615180059Sjhb# 616180059Sjhb# XXX gperf is required for cc 617180059Sjhb# XXX a new ld and tsort is required for cc 618180059Sjhblib-tools: 619180059Sjhb.for d in \ 620180059Sjhb gnu/usr.bin/gperf \ 621180059Sjhb ${_aout_ld} \ 622103571Salfred usr.bin/tsort \ 623103571Salfred ${_aout_as} \ 624180059Sjhb gnu/usr.bin/bison \ 625180059Sjhb gnu/usr.bin/cc \ 626180059Sjhb ${_aout_ar} \ 627180059Sjhb usr.bin/env \ 628180059Sjhb usr.bin/lex/lib \ 629180059Sjhb usr.bin/mk_cmds \ 630180059Sjhb ${_aout_nm} \ 631180059Sjhb ${_aout_ranlib} \ 632225617Skmacy ${_aout_strip} \ 633103571Salfred gnu/usr.bin/binutils \ 634103571Salfred usr.bin/uudecode \ 635180059Sjhb ${_objformat} 636205324Skib cd ${.CURDIR}/$d; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 637103571Salfred ${MAKE} ${MK_FLAGS} all; \ 638103571Salfred ${MAKE} ${MK_FLAGS} -B install; \ 639180059Sjhb ${MAKE} ${MK_FLAGS:S/-DNOPIC//} -B ${CLEANDIR} ${OBJDIR} 640180059Sjhb.endfor 641180059Sjhb 642180059Sjhb# 643180059Sjhb# We have to know too much about ordering and subdirs in the lib trees: 644180059Sjhb# 645180059Sjhb# To satisfy shared library linkage when only the libraries being built 646180059Sjhb# are visible: 647180059Sjhb# 648180059Sjhb# libcom_err must be built before libss. 649225617Skmacy# libcrypt and libmd must be built before libskey. 650103571Salfred# libm must be built before libtcl. 651103571Salfred# libmytinfo must be built before libdialog and libncurses. 652189735Sbms# libncurses must be built before libdialog. 653189735Sbms# libtermcap must be built before libcurses, libedit and libreadline. 654180059Sjhb# 655180059Sjhb# Some libraries are built conditionally and/or are in inconsistently 656180059Sjhb# named directories: 657205324Skib# 658103571Salfred.if exists(lib/csu/${MACHINE}.pcc) 659103571Salfred_csu=lib/csu/${MACHINE}.pcc 660103571Salfred.else 661103571Salfred_csu=lib/csu/${MACHINE} 662180059Sjhb.endif 663103571Salfred 664103571Salfred.if !defined(NOSECURE) && !defined(NOCRYPT) 665103571Salfred_libcrypt= secure/lib/libcrypt lib/libcrypt 666225617Skmacy.else 667103571Salfred_libcrypt= lib/libcrypt 668180059Sjhb.endif 669180059Sjhb 670103571Salfred.if defined(WANT_CSRG_LIBM) 671103571Salfred_libm= lib/libm 672180059Sjhb.else 673180059Sjhb_libm= lib/msun 674180059Sjhb.endif 675180059Sjhb 676180059Sjhb# 677180059Sjhb# bootstrap-libraries - build just enough libraries for the bootstrap 678103571Salfred# tools, and install them under ${WORLDTMP}. 679180059Sjhb# 680180059Sjhb# Build csu and libgcc early so that some tools get linked to the new 681180059Sjhb# versions (too late for the main tools, however). Then build the 682180059Sjhb# necessary prerequisite libraries (libtermcap just needs to be before 683180059Sjhb# libcurses, and this only matters for the NOCLEAN case when NOPIC is 684103571Salfred# not set). 685103571Salfred# 686103571Salfred# This is mostly wrong. The build tools must run on the host system, 687103571Salfred# so they should use host libraries. We depend on the target being 688103571Salfred# similar enough to the host for new target libraries to work on the 689103571Salfred# host. 690180059Sjhb# 691103571Salfredbootstrap-libraries: 692103571Salfred.for _lib in ${_csu} gnu/usr.bin/cc/libgcc lib/libtermcap \ 693103571Salfred gnu/lib/libregex gnu/lib/libreadline lib/libc \ 694225617Skmacy ${_libcrypt} lib/libcurses lib/libedit ${_libm} \ 695103571Salfred lib/libmd lib/libutil lib/libz usr.bin/lex/lib 696103571Salfred.if exists(${.CURDIR}/${_lib}) 697180059Sjhb cd ${.CURDIR}/${_lib}; \ 698103571Salfred ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 699103571Salfred ${MAKE} ${MK_FLAGS} all; \ 700224778Srwatson ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 701224778Srwatson.endif 702180059Sjhb.endfor 703180059Sjhb 704180059Sjhb# 705180059Sjhb# libraries - build all libraries, and install them under ${DESTDIR}. 706180059Sjhb# 707180059Sjhb# The ordering is not as special as for bootstrap-libraries. Build 708180059Sjhb# the prerequisites first, then build almost everything else in 709180059Sjhb# alphabetical order. 710180059Sjhb# 711109084Salfredlibraries: 712103571Salfred.for _lib in lib/libcom_err ${_libcrypt} ${_libm} lib/libmytinfo \ 713103571Salfred lib/libncurses lib/libtermcap \ 714103571Salfred gnu/lib gnu/usr.bin/cc/libgcc lib usr.bin/lex/lib usr.sbin/pcvt/keycap 715103571Salfred.if exists(${.CURDIR}/${_lib}) 716180059Sjhb cd ${.CURDIR}/${_lib}; ${MAKE} all; ${MAKE} -B install 717103571Salfred.endif 718103571Salfred.endfor 719103571Salfred.if exists(${.CURDIR}/secure/lib) && !defined(NOCRYPT) && !defined(NOSECURE) 720225617Skmacy cd ${.CURDIR}/secure/lib; ${MAKE} all; ${MAKE} -B install 721103571Salfred.endif 722180059Sjhb.if exists(${.CURDIR}/kerberosIV/lib) && !defined(NOCRYPT) && \ 723103571Salfred defined(MAKE_KERBEROS4) 724103571Salfred cd ${.CURDIR}/kerberosIV/lib; ${MAKE} all; ${MAKE} -B install 725103571Salfred.endif 726224778Srwatson 727180059Sjhb# Exclude perl from the build-tools if NOPERL is defined. 728180059Sjhb.if defined(NOPERL) 729180059Sjhb_perl= 730180059Sjhb.else 731103571Salfred_perl= gnu/usr.bin/perl/perl 732145855Srwatson.endif 733180059Sjhb 734145855Srwatson# 735145855Srwatson# build-tools - build and install any other tools needed to complete the 736145855Srwatson# compile and install. 737103571Salfred# ifdef stale 738103571Salfred# bc and cpp are required to build groff. Otherwise, the order here is 739103571Salfred# mostly historical, i.e., bogus. 740103571Salfred# chmod is used to build gcc's tmpmultilib[2] at obscure times. 741103571Salfred# endif stale 742103571Salfred# XXX uname is a bug - the target should not depend on the host. 743103571Salfred# 744103571Salfredbuild-tools: 745180059Sjhb.for d in \ 746103571Salfred bin/cat \ 747103571Salfred bin/chmod \ 748180059Sjhb bin/cp \ 749103571Salfred bin/date \ 750103571Salfred bin/dd \ 751103571Salfred bin/echo \ 752103571Salfred bin/expr \ 753103571Salfred bin/hostname \ 754180059Sjhb bin/ln \ 755103571Salfred bin/ls \ 756103571Salfred bin/mkdir \ 757103571Salfred bin/mv \ 758225617Skmacy bin/rm \ 759103571Salfred bin/test \ 760103571Salfred gnu/usr.bin/awk \ 761125368Sdeischen gnu/usr.bin/bc \ 762103571Salfred gnu/usr.bin/grep \ 763103571Salfred gnu/usr.bin/groff \ 764103571Salfred gnu/usr.bin/gzip \ 765125368Sdeischen gnu/usr.bin/man/makewhatis \ 766180059Sjhb gnu/usr.bin/patch \ 767151445Sstefanf ${_perl} \ 768125368Sdeischen gnu/usr.bin/sort \ 769125368Sdeischen gnu/usr.bin/texinfo \ 770125368Sdeischen usr.bin/basename \ 771225617Skmacy usr.bin/cap_mkdb \ 772125368Sdeischen usr.bin/chflags \ 773125368Sdeischen usr.bin/cmp \ 774125368Sdeischen usr.bin/col \ 775125368Sdeischen usr.bin/cpp \ 776125368Sdeischen usr.bin/expand \ 777179054Srwatson usr.bin/file2c \ 778179054Srwatson usr.bin/find \ 779179054Srwatson usr.bin/gencat \ 780125368Sdeischen usr.bin/id \ 781125368Sdeischen usr.bin/join \ 782125368Sdeischen usr.bin/lorder \ 783125368Sdeischen usr.bin/m4 \ 784125368Sdeischen usr.bin/mkdep \ 785125368Sdeischen usr.bin/paste \ 786125368Sdeischen usr.bin/sed \ 787125368Sdeischen ${_aout_size} \ 788125368Sdeischen usr.bin/soelim \ 789125368Sdeischen usr.bin/symorder \ 790125368Sdeischen usr.bin/touch \ 791125368Sdeischen usr.bin/tr \ 792125368Sdeischen usr.bin/true \ 793125368Sdeischen usr.bin/uname \ 794103571Salfred usr.bin/uuencode \ 795180059Sjhb usr.bin/vgrind \ 796103571Salfred usr.bin/vi \ 797103571Salfred usr.bin/wc \ 798103571Salfred usr.bin/xargs \ 799225617Skmacy usr.bin/yacc \ 800103571Salfred usr.sbin/chown \ 801103571Salfred usr.sbin/mtree \ 802125368Sdeischen usr.sbin/zic \ 803103571Salfred bin/sh 804103571Salfred cd ${.CURDIR}/$d; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 805105227Sphk ${MAKE} ${MK_FLAGS} all; \ 806154659Srwatson ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 807154659Srwatson.endfor 808103571Salfred 809125368Sdeischen.for __target in clean cleandepend cleandir depend obj 810125368Sdeischen.for entry in ${SUBDIR} 811180059Sjhb${entry}.${__target}__D: .PHONY 812103571Salfred @if test -d ${.CURDIR}/${entry}.${MACHINE}; then \ 813103571Salfred ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE}"; \ 814103571Salfred edir=${entry}.${MACHINE}; \ 815189735Sbms cd ${.CURDIR}/$${edir}; \ 816224778Srwatson else \ 817180059Sjhb ${ECHODIR} "===> ${DIRPRFX}${entry}"; \ 818180059Sjhb edir=${entry}; \ 819180059Sjhb cd ${.CURDIR}/$${edir}; \ 820103571Salfred fi; \ 821189735Sbms ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/ 822189735Sbms.endfor 823145855Srwatsonpar-${__target}: ${SUBDIR:S/$/.${__target}__D/} 824180059Sjhb.endfor 825145855Srwatson 826145855Srwatson.endif 827145855Srwatson 828145855Srwatson.include <bsd.subdir.mk> 829145855Srwatson