Makefile revision 1.159
11.159Sperry# $NetBSD: Makefile,v 1.159 2001/11/24 21:53:16 perry Exp $ 21.95Scjs 31.95Scjs# This is the top-level makefile for building NetBSD. For an outline of 41.95Scjs# how to build a snapshot or release, as well as other release engineering 51.95Scjs# information, see http://www.netbsd.org/developers/releng/index.html 61.95Scjs# 71.95Scjs# Not everything you can set or do is documented in this makefile. In 81.95Scjs# particular, you should review the files in /usr/share/mk (especially 91.95Scjs# bsd.README) for general information on building programs and writing 101.95Scjs# Makefiles within this structure, and see the comments in src/etc/Makefile 111.95Scjs# for further information on installation and release set options. 121.95Scjs# 131.95Scjs# Variables listed below can be set on the make command line (highest 141.95Scjs# priority), in /etc/mk.conf (middle priority), or in the environment 151.95Scjs# (lowest priority). 161.95Scjs# 171.95Scjs# Variables: 181.101Ssommerfe# DESTDIR is the target directory for installation of the compiled 191.101Ssommerfe# software. It defaults to /. Note that programs are built against 201.101Ssommerfe# libraries installed in DESTDIR. 211.95Scjs# MKMAN, if set to `no', will prevent building of manual pages. 221.101Ssommerfe# MKOBJDIRS, if not set to `no', will build object directories at 231.101Ssommerfe# an appropriate point in a build. 241.95Scjs# MKSHARE, if set to `no', will prevent building and installing 251.95Scjs# anything in /usr/share. 261.101Ssommerfe# NBUILDJOBS is the number of jobs to start in parallel during a 271.127Stv# `make build'. It defaults to 1. 281.125Smrg# UPDATE, if defined, will avoid a `make cleandir' at the start of 291.125Smrg# `make build', as well as having the effects listed in 301.125Smrg# /usr/share/mk/bsd.README. 311.125Smrg# NOCLEANDIR, if defined, will avoid a `make cleandir' at the start 321.125Smrg# of the `make build'. 331.119Stoddpw# NOINCLUDES will avoid the `make includes' usually done by `make build'. 341.95Scjs# 351.95Scjs# Targets: 361.137Stv# build: 371.137Stv# Builds a full release of NetBSD in DESTDIR. If BUILD_DONE is 381.110Sjlam# set, this is an empty target. 391.137Stv# release: 401.137Stv# Does a `make build,' and then tars up the DESTDIR files 411.95Scjs# into RELEASEDIR, in release(7) format. (See etc/Makefile for 421.95Scjs# more information on this.) 431.137Stv# regression-tests: 441.137Stv# Runs the regression tests in "regress" on this host. 451.123Smrg# 461.137Stv# Targets invoked by `make build,' in order: 471.155Stv# cleandir: cleans the tree. 481.137Stv# obj: creates object directories. 491.152Stv# do-tools: builds host toolchain. 501.131Stv# do-distrib-dirs: creates the distribution directories. 511.137Stv# includes: installs include files. 521.143Stv# do-lib-csu: builds and installs prerequisites from lib/csu. 531.143Stv# do-lib: builds and installs prerequisites from lib. 541.143Stv# do-gnu-lib: builds and installs prerequisites from gnu/lib. 551.137Stv# do-build: builds and installs the entire system. 561.32Scgd 571.146Stv.if ${.MAKEFLAGS:M${.CURDIR}/share/mk} == "" 581.146Stv.MAKEFLAGS: -m ${.CURDIR}/share/mk 591.146Stv.endif 601.148Sjmc 611.146Stv.include <bsd.own.mk> 621.4Scgd 631.137Stv# Sanity check: make sure that "make build" is not invoked simultaneously 641.137Stv# with a standard recursive target. 651.137Stv 661.137Stv.if make(build) || make(release) || make(snapshot) 671.137Stv.for targ in ${TARGETS:Nobj:Ncleandir} 681.137Stv.if make(${targ}) && !target(.BEGIN) 691.137Stv.BEGIN: 701.137Stv @echo 'BUILD ABORTED: "make build" and "make ${targ}" are mutually exclusive.' 711.137Stv @false 721.137Stv.endif 731.137Stv.endfor 741.137Stv.endif 751.58Stv 761.76Sbouyer.if defined(NBUILDJOBS) 771.137Stv_J= -j${NBUILDJOBS} 781.76Sbouyer.endif 791.76Sbouyer 801.158Stv_SUBDIR= tools lib include gnu bin games libexec sbin usr.bin \ 811.158Stv usr.sbin share sys etc distrib regress 821.105Sassar 831.137Stv# Weed out directories that don't exist. 841.36Sexplorer 851.137Stv.for dir in ${_SUBDIR} 861.154Stv.if exists(${dir}/Makefile) && (${BUILD_${dir}:Uyes} != "no") 871.137StvSUBDIR+= ${dir} 881.36Sexplorer.endif 891.137Stv.endfor 901.21Scgd 911.13Sbrezak.if exists(regress) 921.10Scgdregression-tests: 931.10Scgd @echo Running regression tests... 941.152Stv @(cd ${.CURDIR}/regress && ${MAKE} regress) 951.13Sbrezak.endif 961.20Scgd 971.159Sperrywhatis.db: 981.137Stv.if ${MKMAN} != "no" 991.152Stv (cd ${.CURDIR}/share/man && ${MAKE} makedb) 1001.137Stv.endif 1011.159Sperry 1021.159Sperry# XXX I wish there was a more rational place to do this, but I can't 1031.159Sperry# think of one. There is no one place the info/dir file gets generated. 1041.159Sperryinfodir-meta: 1051.159Sperry.if defined(UNPRIVED) && (${MKINFO} != "no") 1061.159Sperry echo "${DESTDIR}/usr/share/info/dir type=file mode=0644 uname=root gname=wheel" | \ 1071.159Sperry sed -e 's|^/|./|g' -e 's|//|/|g' >>${METALOG} 1081.159Sperry.endif 1091.159Sperry 1101.159Sperryafterinstall: whatis.db infodir-meta 1111.108Serh 1121.137Stv# Targets (in order!) called by "make build". 1131.123Smrg 1141.156StvBUILDTARGETS+= check-tools 1151.155Stv.if !defined(UPDATE) && !defined(NOCLEANDIR) 1161.155StvBUILDTARGETS+= cleandir 1171.155Stv.endif 1181.149Stv.if ${MKOBJDIRS} != "no" 1191.137StvBUILDTARGETS+= obj 1201.123Smrg.endif 1211.138Stv.if ${USETOOLS} == "yes" 1221.152StvBUILDTARGETS+= do-tools 1231.131Stv.endif 1241.137Stv.if !defined(NODISTRIBDIRS) 1251.137StvBUILDTARGETS+= do-distrib-dirs 1261.131Stv.endif 1271.137Stv.if !defined(NOINCLUDES) 1281.137StvBUILDTARGETS+= includes 1291.131Stv.endif 1301.143StvBUILDTARGETS+= do-lib-csu do-lib do-gnu-lib do-build 1311.131Stv 1321.137Stv# Enforce proper ordering of some rules. 1331.123Smrg 1341.137Stv.ORDER: ${BUILDTARGETS} 1351.137Stvincludes-lib: includes-include includes-sys 1361.137Stvincludes-gnu: includes-lib 1371.123Smrg 1381.137Stv# Build the system and install into DESTDIR. 1391.123Smrg 1401.137Stvbuild: 1411.137Stv.if defined(BUILD_DONE) 1421.137Stv @echo "Build already installed into ${DESTDIR}" 1431.137Stv.else 1441.137Stv @echo -n "Build started at: " && date 1451.145Stv.for tgt in ${BUILDTARGETS} 1461.156Stv @(cd ${.CURDIR} && ${MAKE} ${_J} ${tgt}) 1471.145Stv.endfor 1481.137Stv @echo -n "Build finished at: " && date 1491.71Smycroft.endif 1501.123Smrg 1511.137Stv# Build a release or snapshot (implies "make build"). 1521.123Smrg 1531.137Stvrelease snapshot: build 1541.152Stv (cd ${.CURDIR}/etc && ${MAKE} INSTALL_DONE=1 release) 1551.123Smrg 1561.137Stv# Special components of the "make build" process. 1571.156Stv 1581.156Stvcheck-tools: 1591.156Stv.if defined(USE_NEW_TOOLCHAIN) && (${USE_NEW_TOOLCHAIN} != "nowarn") 1601.156Stv @echo '*** WARNING: Building on MACHINE=${MACHINE} with USE_NEW_TOOLCHAIN.' 1611.156Stv @echo '*** This platform is not yet verified to work with the new toolchain,' 1621.156Stv @echo '*** and may result in a failed build or corrupt binaries!' 1631.156Stv.endif 1641.123Smrg 1651.137Stvdo-distrib-dirs: 1661.147Sjmc.if !defined(DESTDIR) || ${DESTDIR} == "" 1671.152Stv (cd ${.CURDIR}/etc && ${MAKE} DESTDIR=/ distrib-dirs) 1681.147Sjmc.else 1691.152Stv (cd ${.CURDIR}/etc && ${MAKE} DESTDIR=${DESTDIR} distrib-dirs) 1701.147Sjmc.endif 1711.123Smrg 1721.152Stv.for dir in tools lib/csu lib gnu/lib 1731.143Stvdo-${dir:S/\//-/}: 1741.137Stv.for targ in dependall install 1751.154Stv (cd ${.CURDIR}/${dir} && ${MAKE} ${_J} ${targ}) 1761.137Stv.endfor 1771.137Stv.endfor 1781.143Stv 1791.143Stvdo-build: 1801.154Stv.for targ in dependall install 1811.154Stv (cd ${.CURDIR} && ${MAKE} ${_J} ${targ} BUILD_tools=no BUILD_lib=no) 1821.154Stv.endfor 1831.87Scjs 1841.137Stv# Speedup stubs for some subtrees that don't need to run these rules. 1851.137Stv# (Tells <bsd.subdir.mk> not to recurse for them.) 1861.129Stv 1871.152Stv.for dir in bin etc distrib games libexec regress sbin usr.sbin tools 1881.152Stvincludes-${dir}: 1891.152Stv @true 1901.152Stv.endfor 1911.152Stv.for dir in etc distrib regress 1921.152Stvinstall-${dir}: 1931.152Stv @true 1941.152Stv.endfor 1951.152Stv 1961.152Stv# XXX this needs to change when distrib Makefiles are recursion compliant 1971.152Stvdependall-distrib depend-distrib all-distrib: 1981.136Snathanw @true 1991.130Stv 2001.151Stv.include <bsd.obj.mk> 2011.146Stv.include <bsd.subdir.mk> 2021.144Stv 2031.150Stvbuild-docs: ${.CURDIR}/BUILDING 2041.150Stv${.CURDIR}/BUILDING: BUILDING.mdoc 2051.150Stv groff -mdoc -Tascii -P-b -P-u -P-o $> >$@ 206