Makefile revision 1.148
11.148Sjmc# $NetBSD: Makefile,v 1.148 2001/11/01 15:48:39 jmc 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.137Stv# obj: creates object directories. 481.137Stv# cleandir: cleans the tree. 491.137Stv# do-make-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.148SjmcMKOBJDIRS ?= no 621.146Stv 631.146Stv.include <bsd.own.mk> 641.4Scgd 651.137Stv# Sanity check: make sure that "make build" is not invoked simultaneously 661.137Stv# with a standard recursive target. 671.137Stv 681.137Stv.if make(build) || make(release) || make(snapshot) 691.137Stv.for targ in ${TARGETS:Nobj:Ncleandir} 701.137Stv.if make(${targ}) && !target(.BEGIN) 711.137Stv.BEGIN: 721.137Stv @echo 'BUILD ABORTED: "make build" and "make ${targ}" are mutually exclusive.' 731.137Stv @false 741.137Stv.endif 751.137Stv.endfor 761.137Stv.endif 771.58Stv 781.76Sbouyer.if defined(NBUILDJOBS) 791.137Stv_J= -j${NBUILDJOBS} 801.76Sbouyer.endif 811.76Sbouyer 821.146Stv_SUBDIR= tools lib include gnu bin games libexec sbin usr.bin \ 831.141Stv usr.sbin share sys etc distrib regress 841.105Sassar 851.137Stv# Weed out directories that don't exist. 861.36Sexplorer 871.137Stv.for dir in ${_SUBDIR} 881.137Stv.if exists(${dir}/Makefile) 891.137StvSUBDIR+= ${dir} 901.36Sexplorer.endif 911.137Stv.endfor 921.21Scgd 931.13Sbrezak.if exists(regress) 941.10Scgdregression-tests: 951.10Scgd @echo Running regression tests... 961.146Stv @cd ${.CURDIR}/regress && ${MAKE} regress 971.13Sbrezak.endif 981.20Scgd 991.137Stv.if ${MKMAN} != "no" 1001.137Stvafterinstall: whatis.db 1011.137Stvwhatis.db: 1021.146Stv cd ${.CURDIR}/share/man && ${MAKE} makedb 1031.137Stv.endif 1041.108Serh 1051.137Stv# Targets (in order!) called by "make build". 1061.123Smrg 1071.137Stv.if ${MKOBJDIRS:Uno} != "no" 1081.137StvBUILDTARGETS+= obj 1091.81Sscottr.endif 1101.137Stv.if !defined(UPDATE) && !defined(NOCLEANDIR) 1111.137StvBUILDTARGETS+= cleandir 1121.123Smrg.endif 1131.138Stv.if ${USETOOLS} == "yes" 1141.137StvBUILDTARGETS+= do-make-tools 1151.131Stv.endif 1161.137Stv.if !defined(NODISTRIBDIRS) 1171.137StvBUILDTARGETS+= do-distrib-dirs 1181.131Stv.endif 1191.137Stv.if !defined(NOINCLUDES) 1201.137StvBUILDTARGETS+= includes 1211.131Stv.endif 1221.143StvBUILDTARGETS+= do-lib-csu do-lib do-gnu-lib do-build 1231.131Stv 1241.137Stv# Enforce proper ordering of some rules. 1251.123Smrg 1261.137Stv.ORDER: ${BUILDTARGETS} 1271.137Stvincludes-lib: includes-include includes-sys 1281.137Stvincludes-gnu: includes-lib 1291.123Smrg 1301.137Stv# Build the system and install into DESTDIR. 1311.123Smrg 1321.137Stvbuild: 1331.137Stv.if defined(BUILD_DONE) 1341.137Stv @echo "Build already installed into ${DESTDIR}" 1351.137Stv.else 1361.137Stv @echo -n "Build started at: " && date 1371.145Stv.for tgt in ${BUILDTARGETS} 1381.146Stv ${MAKE} ${_J} ${tgt} 1391.145Stv.endfor 1401.137Stv @echo -n "Build finished at: " && date 1411.71Smycroft.endif 1421.123Smrg 1431.137Stv# Build a release or snapshot (implies "make build"). 1441.123Smrg 1451.137Stvrelease snapshot: build 1461.146Stv cd ${.CURDIR}/etc && ${MAKE} INSTALL_DONE=1 release 1471.123Smrg 1481.137Stv# Special components of the "make build" process. 1491.123Smrg 1501.137Stvdo-make-tools: 1511.146Stv cd ${.CURDIR}/tools && ${MAKE} build 1521.123Smrg 1531.137Stvdo-distrib-dirs: 1541.147Sjmc.if !defined(DESTDIR) || ${DESTDIR} == "" 1551.147Sjmc cd ${.CURDIR}/etc && ${MAKE} DESTDIR=/ distrib-dirs 1561.147Sjmc.else 1571.146Stv cd ${.CURDIR}/etc && ${MAKE} DESTDIR=${DESTDIR} distrib-dirs 1581.147Sjmc.endif 1591.123Smrg 1601.137Stv.for dir in lib/csu lib gnu/lib 1611.143Stvdo-${dir:S/\//-/}: 1621.137Stv.for targ in dependall install 1631.137Stv cd ${.CURDIR}/${dir} && \ 1641.146Stv ${MAKE} ${_J} MKSHARE=no MKLINT=no ${targ} 1651.137Stv.endfor 1661.137Stv.endfor 1671.143Stv 1681.143Stvdo-build: 1691.146Stv ${MAKE} ${_J} dependall 1701.146Stv ${MAKE} ${_J} install 1711.87Scjs 1721.137Stv# Speedup stubs for some subtrees that don't need to run these rules. 1731.137Stv# (Tells <bsd.subdir.mk> not to recurse for them.) 1741.129Stv 1751.129Stvincludes-bin includes-games includes-libexec includes-regress \ 1761.137Stvincludes-sbin includes-usr.sbin includes-tools \ 1771.142Stvdependall-tools depend-tools all-tools install-tools install-regress \ 1781.142Stvdependall-distrib depend-distrib all-distrib install-distrib includes-distrib: 1791.136Snathanw @true 1801.130Stv 1811.146Stv.include <bsd.subdir.mk> 1821.144Stv 1831.144Stv# Rules for building the BUILDING.* documentation files. 1841.144Stv 1851.144Stvbuild-docs: ${.CURDIR}/BUILDING.txt ${.CURDIR}/BUILDING.html 1861.144Stv 1871.144Stv.SUFFIXES: .mdoc .html .txt 1881.144Stv 1891.144Stv.mdoc.html: ${.CURDIR}/Makefile 1901.144Stv groff -mdoc2html -Tlatin1 -P-b -P-u -P-o -ww -mtty-char $< >$@ 1911.144Stv 1921.144Stv# The awk expression changes line endings from LF to CR-LF to make 1931.144Stv# this readable on many more platforms than just Un*x. 1941.144Stv.mdoc.txt: ${.CURDIR}/Makefile 1951.144Stv groff -mdoc -Tascii -P-b -P-u -P-o $< | \ 1961.144Stv awk 'BEGIN{ORS="\r\n"}{print}' >$@ 197