Makefile revision 36672
1230557Sjimharris# 2230557Sjimharris# $Id: Makefile,v 1.195 1998/06/04 12:02:52 jb Exp $ 3230557Sjimharris# 4230557Sjimharris# While porting to the another architecture include the bootstrap instead 5230557Sjimharris# of the normal build. 6230557Sjimharris# 7230557Sjimharris.if exists(${.CURDIR}/Makefile.${MACHINE}) && defined(BOOTSTRAP_WORLD) 8230557Sjimharris.include "${.CURDIR}/Makefile.${MACHINE}" 9230557Sjimharris.else 10230557Sjimharris# 11230557Sjimharris# Make command line options: 12230557Sjimharris# -DCLOBBER will remove /usr/include 13230557Sjimharris# -DMAKE_KERBEROS4 to build KerberosIV 14230557Sjimharris# -DALLLANG to build documentation for all languages 15230557Sjimharris# (where available -- see share/doc/Makefile) 16230557Sjimharris# 17230557Sjimharris# -DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir 18230557Sjimharris# -DNOCLEAN do not clean at all 19230557Sjimharris# -DNOTOOLS do not rebuild any tools first 20230557Sjimharris# -DNOCRYPT will prevent building of crypt versions 21230557Sjimharris# -DNOLKM do not build loadable kernel modules 22230557Sjimharris# -DNOOBJDIR do not run ``${MAKE} obj'' 23230557Sjimharris# -DNOPROFILE do not build profiled libraries 24230557Sjimharris# -DNOSECURE do not go into secure subdir 25230557Sjimharris# -DNOGAMES do not go into games subdir 26230557Sjimharris# -DNOSHARE do not go into share subdir 27230557Sjimharris# -DNOINFO do not make or install info files 28230557Sjimharris# -DNOLIBC_R do not build libc_r. 29230557Sjimharris# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list 30230557Sjimharris 31230557Sjimharris# 32230557Sjimharris# The intended user-driven targets are: 33230557Sjimharris# buildworld - rebuild *everything*, including glue to help do upgrades 34230557Sjimharris# installworld- install everything built by "buildworld" 35230557Sjimharris# world - buildworld + installworld 36230557Sjimharris# update - convenient way to update your source tree (eg: sup/cvs) 37230557Sjimharris# most - build user commands, no libraries or include files 38230557Sjimharris# installmost - install user commands, no libraries or include files 39230557Sjimharris# 40230557Sjimharris# Standard targets (not defined here) are documented in the makefiles in 41230557Sjimharris# /usr/share/mk. These include: 42230557Sjimharris# obj depend all install clean cleandepend cleanobj 43230557Sjimharris 44230557Sjimharris.if (!make(world)) && (!make(buildworld)) && (!make(installworld)) 45230557Sjimharris.MAKEFLAGS:= -m ${.CURDIR}/share/mk ${.MAKEFLAGS} 46230557Sjimharris.endif 47230557Sjimharris 48230557Sjimharris# Put initial settings here. 49230557SjimharrisSUBDIR= 50230557Sjimharris 51230557Sjimharris# We must do share/info early so that installation of info `dir' 52230557Sjimharris# entries works correctly. Do it first since it is less likely to 53230557Sjimharris# grow dependencies on include and lib than vice versa. 54230557Sjimharris.if exists(share/info) 55230557SjimharrisSUBDIR+= share/info 56230557Sjimharris.endif 57230557Sjimharris 58230557Sjimharris# We must do include and lib early so that the perl *.ph generation 59230557Sjimharris# works correctly as it uses the header files installed by this. 60230557Sjimharris.if exists(include) 61230557SjimharrisSUBDIR+= include 62230557Sjimharris.endif 63230557Sjimharris.if exists(lib) 64230557SjimharrisSUBDIR+= lib 65230557Sjimharris.endif 66230557Sjimharris 67230557Sjimharris.if exists(bin) 68230557SjimharrisSUBDIR+= bin 69230557Sjimharris.endif 70230557Sjimharris.if exists(games) && !defined(NOGAMES) 71230557SjimharrisSUBDIR+= games 72230557Sjimharris.endif 73230557Sjimharris.if exists(gnu) 74230557SjimharrisSUBDIR+= gnu 75230557Sjimharris.endif 76230557Sjimharris.if exists(kerberosIV) && exists(crypto) && !defined(NOCRYPT) && \ 77230557Sjimharris defined(MAKE_KERBEROS4) 78230557SjimharrisSUBDIR+= kerberosIV 79230557Sjimharris.endif 80230557Sjimharris.if exists(libexec) 81230557SjimharrisSUBDIR+= libexec 82230557Sjimharris.endif 83230557Sjimharris.if exists(sbin) 84230557SjimharrisSUBDIR+= sbin 85230557Sjimharris.endif 86230557Sjimharris.if exists(share) && !defined(NOSHARE) 87230557SjimharrisSUBDIR+= share 88230557Sjimharris.endif 89230557Sjimharris.if exists(sys) 90230557SjimharrisSUBDIR+= sys 91230557Sjimharris.endif 92230557Sjimharris.if exists(usr.bin) 93230557SjimharrisSUBDIR+= usr.bin 94230557Sjimharris.endif 95230557Sjimharris.if exists(usr.sbin) 96230557SjimharrisSUBDIR+= usr.sbin 97230557Sjimharris.endif 98230557Sjimharris.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE) 99230557SjimharrisSUBDIR+= secure 100230557Sjimharris.endif 101230557Sjimharris.if exists(lkm) && !defined(NOLKM) 102230557SjimharrisSUBDIR+= lkm 103230557Sjimharris.endif 104230557Sjimharris 105230557Sjimharris# etc must be last for "distribute" to work 106230557Sjimharris.if exists(etc) && make(distribute) 107230557SjimharrisSUBDIR+= etc 108230557Sjimharris.endif 109230557Sjimharris 110230557Sjimharris# These are last, since it is nice to at least get the base system 111230557Sjimharris# rebuilt before you do them. 112230557Sjimharris.if defined(LOCAL_DIRS) 113230557Sjimharris.for _DIR in ${LOCAL_DIRS} 114230557Sjimharris.if exists(${_DIR}) & exists(${_DIR}/Makefile) 115230557SjimharrisSUBDIR+= ${_DIR} 116230557Sjimharris.endif 117230557Sjimharris.endfor 118230557Sjimharris.endif 119230557Sjimharris 120230557Sjimharris# Handle -DNOOBJDIR, -DNOCLEAN and -DNOCLEANDIR 121230557Sjimharris.if defined(NOOBJDIR) 122230557SjimharrisOBJDIR= 123230557Sjimharris.else 124230557SjimharrisOBJDIR= obj 125230557Sjimharris.endif 126230557Sjimharris 127230557Sjimharris.if defined(NOCLEAN) 128230557SjimharrisCLEANDIR= 129230557Sjimharris.else 130230557Sjimharris.if defined(NOCLEANDIR) 131230557SjimharrisCLEANDIR= clean cleandepend 132230557Sjimharris.else 133230557SjimharrisCLEANDIR= cleandir 134230557Sjimharris.endif 135230557Sjimharris.endif 136230557Sjimharris 137230557Sjimharris.if !defined(NOCLEAN) && ${.MAKEFLAGS:M-j} == "" 138230557Sjimharris_NODEPEND= true 139230557Sjimharris.endif 140230557Sjimharris.if defined(_NODEPEND) 141230557Sjimharris_DEPEND= cleandepend 142230557Sjimharris.else 143230557Sjimharris_DEPEND= depend 144230557Sjimharris.endif 145230557Sjimharris 146230557SjimharrisSUP?= cvsup 147230557SjimharrisSUPFLAGS?= -g -L 2 -P - 148230557Sjimharris 149230557Sjimharris# 150230557Sjimharris# While building tools for bootstrapping, we don't need to waste time on 151230557Sjimharris# shared or profiled libraries, shared linkage, or documentation, except 152230557Sjimharris# when the tools won't get cleaned we must use the defaults for shared 153230557Sjimharris# libraries and shared linkage (and this doesn't waste time). 154230557Sjimharris# XXX actually, we do need to waste time building shared libraries. 155230557Sjimharris# 156230557Sjimharris.if defined(NOCLEAN) 157230557SjimharrisMK_FLAGS= -DNOINFO -DNOMAN -DNOPROFILE 158230557Sjimharris.else 159230557SjimharrisMK_FLAGS= -DNOINFO -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED 160230557Sjimharris.endif 161230557Sjimharris 162230557Sjimharris# 163230557Sjimharris# world 164230557Sjimharris# 165230557Sjimharris# Attempt to rebuild and reinstall *everything*, with reasonable chance of 166230557Sjimharris# success, regardless of how old your existing system is. 167230557Sjimharris# 168230557Sjimharris# >> Beware, it overwrites the local build environment! << 169230557Sjimharris# 170230557Sjimharrisworld: 171230557Sjimharris @echo "--------------------------------------------------------------" 172230557Sjimharris @echo "make world started on `LC_TIME=C date`" 173230557Sjimharris @echo "--------------------------------------------------------------" 174230557Sjimharris.if target(pre-world) 175230557Sjimharris @echo 176230557Sjimharris @echo "--------------------------------------------------------------" 177230557Sjimharris @echo " Making 'pre-world' target" 178230557Sjimharris @echo "--------------------------------------------------------------" 179230557Sjimharris cd ${.CURDIR}; ${MAKE} pre-world 180230557Sjimharris.endif 181230557Sjimharris cd ${.CURDIR}; ${MAKE} buildworld 182230557Sjimharris cd ${.CURDIR}; ${MAKE} -B installworld 183230557Sjimharris.if target(post-world) 184230557Sjimharris @echo 185230557Sjimharris @echo "--------------------------------------------------------------" 186230557Sjimharris @echo " Making 'post-world' target" 187230557Sjimharris @echo "--------------------------------------------------------------" 188230557Sjimharris cd ${.CURDIR}; ${MAKE} post-world 189230557Sjimharris.endif 190230557Sjimharris @echo 191230557Sjimharris @echo "--------------------------------------------------------------" 192230557Sjimharris @echo "make world completed on `LC_TIME=C date`" 193230557Sjimharris @echo "--------------------------------------------------------------" 194230557Sjimharris 195230557Sjimharris.if defined(MAKEOBJDIRPREFIX) 196230557SjimharrisWORLDTMP= ${MAKEOBJDIRPREFIX}${.CURDIR}/tmp 197230557Sjimharris.else 198230557SjimharrisWORLDTMP= /usr/obj${.CURDIR}/tmp 199230557Sjimharris.endif 200230557SjimharrisSTRICTTMPPATH= ${WORLDTMP}/sbin:${WORLDTMP}/usr/sbin:${WORLDTMP}/bin:${WORLDTMP}/usr/bin 201230557SjimharrisTMPPATH= ${STRICTTMPPATH}:${PATH} 202230557Sjimharris 203230557Sjimharris# XXX COMPILER_PATH is needed for finding cc1, ld and as 204230557Sjimharris# XXX GCC_EXEC_PREFIX is for *crt.o. It is probably unnecessary now 205230557Sjimharris# that LIBRARY_PATH is set. We still can't use -nostdlib, since gcc 206230557Sjimharris# wouldn't link *crt.o or libgcc if it were used. 207230557Sjimharris# XXX LD_LIBRARY_PATH is for ld.so. It is also used by ld, although we don't 208230557Sjimharris# want that - all compile-time library paths should be resolved by gcc. 209230557Sjimharris# It fails for set[ug]id executables (are any used?). 210230557SjimharrisCOMPILER_ENV= BISON_SIMPLE=${WORLDTMP}/usr/share/misc/bison.simple \ 211230557Sjimharris COMPILER_PATH=${WORLDTMP}/usr/libexec:${WORLDTMP}/usr/bin \ 212230557Sjimharris GCC_EXEC_PREFIX=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib/ \ 213230557Sjimharris LD_LIBRARY_PATH=${WORLDTMP}${SHLIBDIR} \ 214230557Sjimharris LIBRARY_PATH=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib 215230557Sjimharris 216230557SjimharrisBMAKEENV= PATH=${TMPPATH} ${COMPILER_ENV} NOEXTRADEPEND=t \ 217230557Sjimharris OBJFORMAT_PATH=${WORLDTMP}/usr/libexec:/usr/libexec 218230557SjimharrisXMAKEENV= PATH=${STRICTTMPPATH} ${COMPILER_ENV} \ 219230557Sjimharris OBJFORMAT_PATH=${WORLDTMP}/usr/libexec \ 220230557Sjimharris CFLAGS="-nostdinc ${CFLAGS}" # XXX -nostdlib 221230557Sjimharris 222230557Sjimharris# used to compile and install 'make' in temporary build tree 223230557SjimharrisMAKETMP= ${WORLDTMP}/make 224230557SjimharrisIBMAKE= ${BMAKEENV} MAKEOBJDIR=${MAKETMP} ${MAKE} DESTDIR=${WORLDTMP} 225230557Sjimharris# bootstrap make 226230557SjimharrisBMAKE= ${BMAKEENV} ${WORLDTMP}/usr/bin/make DESTDIR=${WORLDTMP} 227230557Sjimharris# cross make used for compilation 228230557SjimharrisXMAKE= ${XMAKEENV} ${WORLDTMP}/usr/bin/make DESTDIR=${WORLDTMP} 229230557Sjimharris# cross make used for final installation 230230557SjimharrisIXMAKE= ${XMAKEENV} ${WORLDTMP}/usr/bin/make 231230557Sjimharris 232230557Sjimharris# 233230557Sjimharris# buildworld 234230557Sjimharris# 235230557Sjimharris# Attempt to rebuild the entire system, with reasonable chance of 236230557Sjimharris# success, regardless of how old your existing system is. 237230557Sjimharris# 238230557Sjimharrisbuildworld: 239230557Sjimharris.if !defined(NOCLEAN) 240230557Sjimharris @echo 241230557Sjimharris @echo "--------------------------------------------------------------" 242230557Sjimharris @echo " Cleaning up the temporary build tree" 243230557Sjimharris @echo "--------------------------------------------------------------" 244230557Sjimharris mkdir -p ${WORLDTMP} 245230557Sjimharris chflags -R noschg ${WORLDTMP}/ 246230557Sjimharris rm -rf ${WORLDTMP} 247230557Sjimharris.endif 248230557Sjimharris.if !defined(NOTOOLS) 249230557Sjimharris @echo 250230557Sjimharris @echo "--------------------------------------------------------------" 251230557Sjimharris @echo " Making make" 252230557Sjimharris @echo "--------------------------------------------------------------" 253230557Sjimharris mkdir -p ${WORLDTMP}/usr/bin ${MAKETMP} 254230557Sjimharris ( \ 255230557Sjimharris cd ${.CURDIR}/usr.bin/make; \ 256230557Sjimharris MAKEOBJDIRPREFIX=""; unset MAKEOBJDIRPREFIX; \ 257230557Sjimharris ${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} all; \ 258230557Sjimharris ${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} install; \ 259230557Sjimharris ${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} clean \ 260230557Sjimharris ) 261230557Sjimharris.endif 262230557Sjimharris @echo 263230557Sjimharris @echo "--------------------------------------------------------------" 264230557Sjimharris @echo " Making hierarchy" 265230557Sjimharris @echo "--------------------------------------------------------------" 266230557Sjimharris cd ${.CURDIR}; ${BMAKE} hierarchy 267230557Sjimharris.if !defined(NOCLEAN) 268230557Sjimharris @echo 269230557Sjimharris @echo "--------------------------------------------------------------" 270230557Sjimharris @echo " Cleaning up the obj tree" 271230557Sjimharris @echo "--------------------------------------------------------------" 272230557Sjimharris cd ${.CURDIR}; ${BMAKE} ${CLEANDIR:S/^/par-/} 273230557Sjimharris.endif 274230557Sjimharris.if !defined(NOOBJDIR) 275230557Sjimharris @echo 276230557Sjimharris @echo "--------------------------------------------------------------" 277230557Sjimharris @echo " Rebuilding the obj tree" 278230557Sjimharris @echo "--------------------------------------------------------------" 279230557Sjimharris cd ${.CURDIR}; ${BMAKE} par-${OBJDIR} 280230557Sjimharris.endif 281230557Sjimharris.if !defined(NOTOOLS) 282230557Sjimharris @echo 283230557Sjimharris @echo "--------------------------------------------------------------" 284230557Sjimharris @echo " Rebuilding bootstrap tools" 285230557Sjimharris @echo "--------------------------------------------------------------" 286230557Sjimharris cd ${.CURDIR}; ${BMAKE} bootstrap 287230557Sjimharris @echo 288230557Sjimharris @echo "--------------------------------------------------------------" 289230557Sjimharris @echo " Rebuilding tools necessary to build the include files" 290230557Sjimharris @echo "--------------------------------------------------------------" 291230557Sjimharris cd ${.CURDIR}; ${BMAKE} include-tools 292230557Sjimharris.endif 293230557Sjimharris @echo 294230557Sjimharris @echo "--------------------------------------------------------------" 295230557Sjimharris @echo " Rebuilding ${DESTDIR}/usr/include" 296230557Sjimharris @echo "--------------------------------------------------------------" 297230557Sjimharris cd ${.CURDIR}; SHARED=copies ${BMAKE} includes 298230557Sjimharris @echo 299230557Sjimharris @echo "--------------------------------------------------------------" 300230557Sjimharris @echo " Rebuilding bootstrap libraries" 301230557Sjimharris @echo "--------------------------------------------------------------" 302230557Sjimharris cd ${.CURDIR}; ${BMAKE} bootstrap-libraries 303230557Sjimharris.if !defined(NOTOOLS) 304230557Sjimharris @echo 305230557Sjimharris @echo "--------------------------------------------------------------" 306230557Sjimharris @echo " Rebuilding tools needed to build libraries" 307230557Sjimharris @echo "--------------------------------------------------------------" 308230557Sjimharris cd ${.CURDIR}; ${BMAKE} lib-tools 309230557Sjimharris.endif 310230557Sjimharris.if !defined(NOTOOLS) 311230557Sjimharris @echo 312230557Sjimharris @echo "--------------------------------------------------------------" 313230557Sjimharris @echo " Rebuilding all other tools needed to build the world" 314230557Sjimharris @echo "--------------------------------------------------------------" 315230557Sjimharris cd ${.CURDIR}; ${BMAKE} build-tools 316230557Sjimharris.endif 317230557Sjimharris.if !defined(_NODEPEND) 318230557Sjimharris @echo 319230557Sjimharris @echo "--------------------------------------------------------------" 320230557Sjimharris @echo " Rebuilding dependencies" 321230557Sjimharris @echo "--------------------------------------------------------------" 322230557Sjimharris cd ${.CURDIR}; ${XMAKE} par-depend 323230557Sjimharris.endif 324230557Sjimharris @echo 325230557Sjimharris @echo "--------------------------------------------------------------" 326230557Sjimharris @echo " Building libraries" 327230557Sjimharris @echo "--------------------------------------------------------------" 328230557Sjimharris cd ${.CURDIR}; ${XMAKE} -DNOINFO -DNOMAN libraries 329230557Sjimharris @echo 330230557Sjimharris @echo "--------------------------------------------------------------" 331230557Sjimharris @echo " Building everything.." 332230557Sjimharris @echo "--------------------------------------------------------------" 333230557Sjimharris cd ${.CURDIR}; ${XMAKE} all 334230557Sjimharris 335230557Sjimharris# 336230557Sjimharris# installworld 337230557Sjimharris# 338230557Sjimharris# Installs everything compiled by a 'buildworld'. 339230557Sjimharris# 340230557Sjimharrisinstallworld: 341230557Sjimharris cd ${.CURDIR}; ${IXMAKE} reinstall 342230557Sjimharris 343230557Sjimharris# 344230557Sjimharris# reinstall 345230557Sjimharris# 346230557Sjimharris# If you have a build server, you can NFS mount the source and obj directories 347230557Sjimharris# and do a 'make reinstall' on the *client* to install new binaries from the 348230557Sjimharris# most recent server build. 349230557Sjimharris# 350230557Sjimharrisreinstall: 351230557Sjimharris @echo "--------------------------------------------------------------" 352230557Sjimharris @echo " Making hierarchy" 353230557Sjimharris @echo "--------------------------------------------------------------" 354230557Sjimharris cd ${.CURDIR}; ${MAKE} hierarchy 355230557Sjimharris @echo 356230557Sjimharris @echo "--------------------------------------------------------------" 357230557Sjimharris @echo " Installing everything.." 358230557Sjimharris @echo "--------------------------------------------------------------" 359230557Sjimharris cd ${.CURDIR}; ${MAKE} install 360230557Sjimharris.if ${MACHINE_ARCH} == "i386" 361230557Sjimharris @echo 362230557Sjimharris @echo "--------------------------------------------------------------" 363230557Sjimharris @echo " Re-scanning the shared libraries.." 364230557Sjimharris @echo "--------------------------------------------------------------" 365230557Sjimharris cd ${.CURDIR}; ldconfig -R 366230557Sjimharris.endif 367230557Sjimharris @echo 368230557Sjimharris @echo "--------------------------------------------------------------" 369230557Sjimharris @echo " Rebuilding man page indexes" 370230557Sjimharris @echo "--------------------------------------------------------------" 371230557Sjimharris cd ${.CURDIR}/share/man; ${MAKE} makedb 372230557Sjimharris 373230557Sjimharris# 374230557Sjimharris# update 375230557Sjimharris# 376230557Sjimharris# Update the source tree, by running sup and/or running cvs to update to the 377230557Sjimharris# latest copy. 378230557Sjimharris# 379230557Sjimharrisupdate: 380230557Sjimharris.if defined(SUP_UPDATE) 381230557Sjimharris @echo "--------------------------------------------------------------" 382230557Sjimharris @echo "Running ${SUP}" 383230557Sjimharris @echo "--------------------------------------------------------------" 384230557Sjimharris @${SUP} ${SUPFLAGS} ${SUPFILE} 385230557Sjimharris.if defined(SUPFILE1) 386230557Sjimharris @${SUP} ${SUPFLAGS} ${SUPFILE1} 387230557Sjimharris.endif 388230557Sjimharris.if defined(SUPFILE2) 389230557Sjimharris @${SUP} ${SUPFLAGS} ${SUPFILE2} 390230557Sjimharris.endif 391230557Sjimharris.endif 392230557Sjimharris.if defined(CVS_UPDATE) 393230557Sjimharris @echo "--------------------------------------------------------------" 394230557Sjimharris @echo "Updating /usr/src from cvs repository" ${CVSROOT} 395230557Sjimharris @echo "--------------------------------------------------------------" 396230557Sjimharris cd ${.CURDIR}; cvs -q update -P -d 397230557Sjimharris.endif 398230557Sjimharris 399230557Sjimharris# 400230557Sjimharris# most 401230557Sjimharris# 402230557Sjimharris# Build most of the user binaries on the existing system libs and includes. 403230557Sjimharris# 404230557Sjimharrismost: 405230557Sjimharris @echo "--------------------------------------------------------------" 406230557Sjimharris @echo " Building programs only" 407230557Sjimharris @echo "--------------------------------------------------------------" 408230557Sjimharris cd ${.CURDIR}/bin; ${MAKE} all 409230557Sjimharris cd ${.CURDIR}/sbin; ${MAKE} all 410230557Sjimharris cd ${.CURDIR}/libexec; ${MAKE} all 411230557Sjimharris cd ${.CURDIR}/usr.bin; ${MAKE} all 412230557Sjimharris cd ${.CURDIR}/usr.sbin; ${MAKE} all 413230557Sjimharris cd ${.CURDIR}/gnu/libexec; ${MAKE} all 414230557Sjimharris cd ${.CURDIR}/gnu/usr.bin; ${MAKE} all 415230557Sjimharris cd ${.CURDIR}/gnu/usr.sbin; ${MAKE} all 416230557Sjimharris#.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT) 417230557Sjimharris# cd ${.CURDIR}/kerberosIV; ${MAKE} most 418230557Sjimharris#.endif 419230557Sjimharris#.if !defined(NOSECURE) && !defined(NOCRYPT) 420230557Sjimharris# cd ${.CURDIR}/secure; ${MAKE} most 421230557Sjimharris#.endif 422230557Sjimharris 423230557Sjimharris# 424230557Sjimharris# installmost 425230557Sjimharris# 426230557Sjimharris# Install the binaries built by the 'most' target. This does not include 427230557Sjimharris# libraries or include files. 428230557Sjimharris# 429230557Sjimharrisinstallmost: 430230557Sjimharris @echo "--------------------------------------------------------------" 431230557Sjimharris @echo " Installing programs only" 432230557Sjimharris @echo "--------------------------------------------------------------" 433230557Sjimharris cd ${.CURDIR}/bin; ${MAKE} install 434230557Sjimharris cd ${.CURDIR}/sbin; ${MAKE} install 435230557Sjimharris cd ${.CURDIR}/libexec; ${MAKE} install 436230557Sjimharris cd ${.CURDIR}/usr.bin; ${MAKE} install 437230557Sjimharris cd ${.CURDIR}/usr.sbin; ${MAKE} install 438230557Sjimharris cd ${.CURDIR}/gnu/libexec; ${MAKE} install 439230557Sjimharris cd ${.CURDIR}/gnu/usr.bin; ${MAKE} install 440230557Sjimharris cd ${.CURDIR}/gnu/usr.sbin; ${MAKE} install 441230557Sjimharris#.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT) 442230557Sjimharris# cd ${.CURDIR}/kerberosIV; ${MAKE} installmost 443230557Sjimharris#.endif 444230557Sjimharris#.if !defined(NOSECURE) && !defined(NOCRYPT) 445230557Sjimharris# cd ${.CURDIR}/secure; ${MAKE} installmost 446230557Sjimharris#.endif 447230557Sjimharris 448230557Sjimharris# 449230557Sjimharris# ------------------------------------------------------------------------ 450230557Sjimharris# 451230557Sjimharris# From here onwards are utility targets used by the 'make world' and 452230557Sjimharris# related targets. If your 'world' breaks, you may like to try to fix 453230557Sjimharris# the problem and manually run the following targets to attempt to 454230557Sjimharris# 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# heirarchy - 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 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 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/lex; ${MAKE} bootstrap; \ 494 ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 495 ${MAKE} ${MK_FLAGS} -DNOLIB all; \ 496 ${MAKE} ${MK_FLAGS} -DNOLIB -B install ${CLEANDIR} ${OBJDIR} 497 cd ${.CURDIR}/usr.sbin/mtree; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 498 ${MAKE} ${MK_FLAGS} all; \ 499 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 500.if defined(DESTDIR) 501 cd ${.CURDIR}/include && ${MAKE} copies 502.endif 503.if !defined(NOOBJDIR) 504 cd ${.CURDIR}/usr.bin/lex; ${MAKE} ${OBJDIR} 505.endif 506 507# 508# include-tools - generally the same as 'bootstrap', except that it's for 509# things that are specifically needed to generate include files. 510# 511# XXX should be merged with bootstrap, it's not worth keeeping them separate. 512# Well, maybe it is now. We force 'cleandepend' here to avoid dependencies 513# on cleaned away headers in ${WORLDTMP}. 514# 515include-tools: 516.for d in usr.bin/compile_et usr.bin/rpcgen 517 cd ${.CURDIR}/$d; ${MAKE} cleandepend; \ 518 ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 519 ${MAKE} ${MK_FLAGS} all; \ 520 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 521.endfor 522 523# 524# includes - possibly generate and install the include files. 525# 526includes: 527.if defined(CLOBBER) 528 rm -rf ${DESTDIR}/usr/include/* 529 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 530 -p ${DESTDIR}/usr/include 531.endif 532 cd ${.CURDIR}/include; ${MAKE} -B all install 533 cd ${.CURDIR}/gnu/include; ${MAKE} install 534 cd ${.CURDIR}/gnu/lib/libmp; ${MAKE} beforeinstall 535 cd ${.CURDIR}/gnu/lib/libobjc; ${MAKE} beforeinstall 536 cd ${.CURDIR}/gnu/lib/libreadline; ${MAKE} beforeinstall 537 cd ${.CURDIR}/gnu/lib/libregex; ${MAKE} beforeinstall 538 cd ${.CURDIR}/gnu/lib/libstdc++; ${MAKE} beforeinstall 539 cd ${.CURDIR}/gnu/lib/libg++; ${MAKE} beforeinstall 540 cd ${.CURDIR}/gnu/lib/libdialog; ${MAKE} beforeinstall 541 cd ${.CURDIR}/gnu/lib/libgmp; ${MAKE} beforeinstall 542.if exists(secure) && !defined(NOCRYPT) 543 cd ${.CURDIR}/secure/lib/libdes; ${MAKE} beforeinstall 544.endif 545.if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS4) 546 cd ${.CURDIR}/kerberosIV/lib/libacl; ${MAKE} beforeinstall 547 cd ${.CURDIR}/kerberosIV/lib/libkadm; ${MAKE} beforeinstall 548 cd ${.CURDIR}/kerberosIV/lib/libkafs; ${MAKE} beforeinstall 549 cd ${.CURDIR}/kerberosIV/lib/libkdb; ${MAKE} beforeinstall 550 cd ${.CURDIR}/kerberosIV/lib/libkrb; ${MAKE} beforeinstall 551 cd ${.CURDIR}/kerberosIV/lib/libtelnet; ${MAKE} beforeinstall 552.else 553 cd ${.CURDIR}/lib/libtelnet; ${MAKE} beforeinstall 554.endif 555.if exists(${.CURDIR}/lib/csu/${MACHINE}) 556 cd ${.CURDIR}/lib/csu/${MACHINE}; ${MAKE} beforeinstall 557.endif 558 cd ${.CURDIR}/lib/libalias; ${MAKE} beforeinstall 559 cd ${.CURDIR}/lib/libc; ${MAKE} beforeinstall 560 cd ${.CURDIR}/lib/libcalendar; ${MAKE} beforeinstall 561 cd ${.CURDIR}/lib/libcurses; ${MAKE} beforeinstall 562 cd ${.CURDIR}/lib/libdisk; ${MAKE} beforeinstall 563 cd ${.CURDIR}/lib/libedit; ${MAKE} beforeinstall 564 cd ${.CURDIR}/lib/libftpio; ${MAKE} beforeinstall 565 cd ${.CURDIR}/lib/libmd; ${MAKE} beforeinstall 566 cd ${.CURDIR}/lib/libmytinfo; ${MAKE} beforeinstall 567 cd ${.CURDIR}/lib/libncurses; ${MAKE} beforeinstall 568.if !defined(WANT_CSRG_LIBM) 569 cd ${.CURDIR}/lib/msun; ${MAKE} beforeinstall 570.endif 571 cd ${.CURDIR}/lib/libopie; ${MAKE} beforeinstall 572 cd ${.CURDIR}/lib/libpcap; ${MAKE} beforeinstall 573 cd ${.CURDIR}/lib/librpcsvc; ${MAKE} beforeinstall 574 cd ${.CURDIR}/lib/libskey; ${MAKE} beforeinstall 575.if !defined(NOTCL) && exists (${.CURDIR}/contrib/tcl) && \ 576 exists(${.CURDIR}/usr.bin/tclsh) && exists (${.CURDIR}/lib/libtcl) 577 cd ${.CURDIR}/lib/libtcl; ${MAKE} installhdrs 578.endif 579 cd ${.CURDIR}/lib/libtermcap; ${MAKE} beforeinstall 580 cd ${.CURDIR}/lib/libcom_err; ${MAKE} beforeinstall 581 cd ${.CURDIR}/lib/libss; ${MAKE} -B hdrs beforeinstall 582 cd ${.CURDIR}/lib/libscsi; ${MAKE} beforeinstall 583 cd ${.CURDIR}/lib/libutil; ${MAKE} beforeinstall 584 cd ${.CURDIR}/lib/libvgl; ${MAKE} beforeinstall 585 cd ${.CURDIR}/lib/libz; ${MAKE} beforeinstall 586 cd ${.CURDIR}/usr.bin/f2c; ${MAKE} beforeinstall 587 cd ${.CURDIR}/usr.bin/lex; ${MAKE} beforeinstall 588 589# 590# Declare tools if they are not required on all architectures. 591# 592.if ${MACHINE_ARCH} == "i386" 593# aout tools: 594_aout_ar = usr.bin/ar 595_aout_as = gnu/usr.bin/as 596_aout_ld = gnu/usr.bin/ld 597_aout_nm = usr.bin/nm 598_aout_ranlib = usr.bin/ranlib 599_aout_size = usr.bin/size 600_aout_strip = usr.bin/strip 601_aout_ldconfig = sbin/ldconfig 602_objformat = usr.bin/objformat 603.endif 604 605# 606# lib-tools - build tools to compile and install the libraries. 607# 608# XXX gperf is required for cc 609# XXX a new ld and tsort is required for cc 610# XXX ldconfig is required at the end of reinstall/installworld. 611lib-tools: 612.for d in \ 613 gnu/usr.bin/gperf \ 614 ${_aout_ld} \ 615 usr.bin/tsort \ 616 ${_aout_as} \ 617 gnu/usr.bin/bison \ 618 gnu/usr.bin/cc \ 619 ${_aout_ar} \ 620 usr.bin/lex/lib \ 621 usr.bin/mk_cmds \ 622 ${_aout_nm} \ 623 ${_aout_ranlib} \ 624 ${_aout_strip} \ 625 usr.bin/env \ 626 gnu/usr.bin/binutils \ 627 usr.bin/uudecode \ 628 ${_aout_ldconfig} \ 629 ${_objformat} 630 cd ${.CURDIR}/$d; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 631 ${MAKE} ${MK_FLAGS} all; \ 632 ${MAKE} ${MK_FLAGS} -B install; \ 633 ${MAKE} ${MK_FLAGS:S/-DNOPIC//} -B ${CLEANDIR} ${OBJDIR} 634.endfor 635 636# 637# We have to know too much about ordering and subdirs in the lib trees: 638# 639# To satisfy shared library linkage when only the libraries being built 640# are visible: 641# 642# libcom_err must be built before libss. 643# libcrypt and libmd must be built before libskey. 644# libm must be built before libtcl. 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}.pcc) 653_csu=lib/csu/${MACHINE}.pcc 654.else 655_csu=lib/csu/${MACHINE} 656.endif 657 658# Build the "default" libcrypt first since it sets symlinks for static 659# binaries such as /sbin/init. lib/Makefile builds the other if needed. 660.if exists(secure) && !defined(NOSECURE) && !defined(NOCRYPT) 661_libcrypt= secure/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.if exists(${.CURDIR}/${_lib}) 693 cd ${.CURDIR}/${_lib}; \ 694 ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 695 ${MAKE} ${MK_FLAGS} all; \ 696 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 697.endif 698.endfor 699 700# 701# libraries - build all libraries, and install them under ${DESTDIR}. 702# 703# The ordering is not as special as for bootstrap-libraries. Build 704# the prerequisites first, then build almost everything else in 705# alphabetical order. 706# 707libraries: 708.for _lib in lib/libcom_err ${_libcrypt} ${_libm} lib/libmytinfo \ 709 lib/libncurses lib/libtermcap \ 710 gnu/lib gnu/usr.bin/cc/libgcc lib usr.bin/lex/lib usr.sbin/pcvt/keycap 711.if exists(${.CURDIR}/${_lib}) 712 cd ${.CURDIR}/${_lib}; ${MAKE} all; ${MAKE} -B install 713.endif 714.endfor 715.if exists(${.CURDIR}/secure/lib) && !defined(NOCRYPT) && !defined(NOSECURE) 716 cd ${.CURDIR}/secure/lib; ${MAKE} all; ${MAKE} -B install 717.endif 718.if exists(${.CURDIR}/kerberosIV/lib) && !defined(NOCRYPT) && \ 719 defined(MAKE_KERBEROS4) 720 cd ${.CURDIR}/kerberosIV/lib; ${MAKE} all; ${MAKE} -B install 721.endif 722 723# Exclude perl from the build-tools if NOPERL is defined. 724.if defined(NOPERL) 725_perl= 726.else 727_perl= gnu/usr.bin/perl/perl 728.endif 729 730# 731# build-tools - build and install any other tools needed to complete the 732# compile and install. 733# ifdef stale 734# bc and cpp are required to build groff. Otherwise, the order here is 735# mostly historical, i.e., bogus. 736# chmod is used to build gcc's tmpmultilib[2] at obscure times. 737# endif stale 738# XXX uname is a bug - the target should not depend on the host. 739# 740build-tools: 741.for d in \ 742 bin/cat \ 743 bin/chmod \ 744 bin/cp \ 745 bin/date \ 746 bin/dd \ 747 bin/echo \ 748 bin/expr \ 749 bin/hostname \ 750 bin/ln \ 751 bin/ls \ 752 bin/mkdir \ 753 bin/mv \ 754 bin/rm \ 755 bin/test \ 756 gnu/usr.bin/awk \ 757 gnu/usr.bin/bc \ 758 gnu/usr.bin/grep \ 759 gnu/usr.bin/groff \ 760 gnu/usr.bin/gzip \ 761 gnu/usr.bin/man/makewhatis \ 762 gnu/usr.bin/patch \ 763 ${_perl} \ 764 gnu/usr.bin/sort \ 765 gnu/usr.bin/texinfo \ 766 usr.bin/basename \ 767 usr.bin/cap_mkdb \ 768 usr.bin/chflags \ 769 usr.bin/cmp \ 770 usr.bin/col \ 771 usr.bin/cpp \ 772 usr.bin/expand \ 773 usr.bin/file2c \ 774 usr.bin/find \ 775 usr.bin/gencat \ 776 usr.bin/id \ 777 usr.bin/lorder \ 778 usr.bin/m4 \ 779 usr.bin/mkdep \ 780 usr.bin/paste \ 781 usr.bin/sed \ 782 ${_aout_size} \ 783 usr.bin/soelim \ 784 ${_aout_strip} \ 785 usr.bin/symorder \ 786 usr.bin/touch \ 787 usr.bin/tr \ 788 usr.bin/true \ 789 usr.bin/uname \ 790 usr.bin/uuencode \ 791 usr.bin/vgrind \ 792 usr.bin/vi \ 793 usr.bin/wc \ 794 usr.bin/xargs \ 795 usr.bin/yacc \ 796 usr.sbin/chown \ 797 usr.sbin/mtree \ 798 usr.sbin/zic \ 799 bin/sh 800 cd ${.CURDIR}/$d; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 801 ${MAKE} ${MK_FLAGS} all; \ 802 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 803.endfor 804 805.for __target in clean cleandepend cleandir depend obj 806.for entry in ${SUBDIR} 807${entry}.${__target}__D: .PHONY 808 @if test -d ${.CURDIR}/${entry}.${MACHINE}; then \ 809 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE}"; \ 810 edir=${entry}.${MACHINE}; \ 811 cd ${.CURDIR}/$${edir}; \ 812 else \ 813 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \ 814 edir=${entry}; \ 815 cd ${.CURDIR}/$${edir}; \ 816 fi; \ 817 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/ 818.endfor 819par-${__target}: ${SUBDIR:S/$/.${__target}__D/} 820.endfor 821 822.endif 823 824.include <bsd.subdir.mk> 825