Makefile revision 1.133
1# $NetBSD: Makefile,v 1.133 2001/10/04 17:59:49 tv Exp $ 2 3# This is the top-level makefile for building NetBSD. For an outline of 4# how to build a snapshot or release, as well as other release engineering 5# information, see http://www.netbsd.org/developers/releng/index.html 6# 7# Not everything you can set or do is documented in this makefile. In 8# particular, you should review the files in /usr/share/mk (especially 9# bsd.README) for general information on building programs and writing 10# Makefiles within this structure, and see the comments in src/etc/Makefile 11# for further information on installation and release set options. 12# 13# Variables listed below can be set on the make command line (highest 14# priority), in /etc/mk.conf (middle priority), or in the environment 15# (lowest priority). 16# 17# Variables: 18# DESTDIR is the target directory for installation of the compiled 19# software. It defaults to /. Note that programs are built against 20# libraries installed in DESTDIR. 21# MKMAN, if set to `no', will prevent building of manual pages. 22# MKOBJDIRS, if not set to `no', will build object directories at 23# an appropriate point in a build. 24# MKSHARE, if set to `no', will prevent building and installing 25# anything in /usr/share. 26# NBUILDJOBS is the number of jobs to start in parallel during a 27# `make build'. It defaults to 1. 28# UPDATE, if defined, will avoid a `make cleandir' at the start of 29# `make build', as well as having the effects listed in 30# /usr/share/mk/bsd.README. 31# NOCLEANDIR, if defined, will avoid a `make cleandir' at the start 32# of the `make build'. 33# NOINCLUDES will avoid the `make includes' usually done by `make build'. 34 35# 36# Targets: 37# build: builds a full release of netbsd in DESTDIR. If BUILD_DONE is 38# set, this is an empty target. 39# release: does a `make build,' and then tars up the DESTDIR files 40# into RELEASEDIR, in release(7) format. (See etc/Makefile for 41# more information on this.) 42# snapshot: a synonym for release. 43# 44# Sub targets of `make build,' in order: 45# buildstartmsg: displays the start time of the build. 46# do-make-tools: builds host toolchain. 47# do-distrib-dirs: creates the distribution directories. 48# do-force-domestic: check's that FORCE_DOMESTIC isn't set (deprecated.) 49# do-cleandir: cleans the tree. 50# do-make-obj: creates object directories if required. 51# do-make-includes: install include files. 52# do-lib-csu: build & install startup object files. 53# do-lib: build & install system libraries. 54# do-gnu-lib: build & install gnu system libraries. 55# do-dependall: builds & install the entire system. 56# do-domestic: build & install the domestic tree (deprecated.) 57# do-whatisdb: build & install the `whatis.db' man database. 58# buildendmsg: displays the end time of the build. 59 60.include "${.CURDIR}/share/mk/bsd.own.mk" 61 62MKOBJDIRS ?= no 63 64.if defined(NBUILDJOBS) 65_J= -j${NBUILDJOBS} 66.endif 67 68# NOTE THAT etc *DOES NOT* BELONG IN THE LIST BELOW 69 70SUBDIR+= lib include bin libexec sbin usr.bin usr.sbin share sys 71.if make(cleandir) || make(obj) 72SUBDIR+= distrib 73.ifdef MAKEOBJDIRPREFIX 74SUBDIR+= etc 75.endif 76.endif 77 78includes-lib: includes-include includes-sys 79 80.if exists(games) 81SUBDIR+= games 82.endif 83 84SUBDIR+= gnu 85# This is needed for libstdc++ and gen-params. 86includes-gnu: includes-include includes-sys 87 88.if exists(regress) 89.ifmake !(install) 90SUBDIR+= regress 91.endif 92 93regression-tests: 94 @echo Running regression tests... 95 @(cd ${.CURDIR}/regress && ${MAKE} ${_M} regress) 96.endif 97 98buildstartmsg: 99 @echo -n "Build started at: " 100 @date 101 102buildendmsg: 103 @echo -n "Build finished at: " 104 @date 105 106afterinstall: 107.if ${MKMAN} != "no" && !defined(_BUILD) 108 ${MAKE} ${_M} whatis.db 109.endif 110 111whatis.db: 112 (cd ${.CURDIR}/share/man && ${MAKE} ${_M} makedb) 113 114# wrt info/dir below: It's safe to move this over top of /usr/share/info/dir, 115# as the build will automatically remove/replace the non-pkg entries there. 116 117.if defined(BUILD_DONE) 118build: 119 @echo "Build installed into ${DESTDIR}" 120.else 121build: 122 @${MAKE} ${_M} buildstartmsg 123 @${MAKE} ${_M} do-make-tools 124 @${MAKE} ${_M} do-distrib-dirs 125 @${MAKE} ${_M} do-force-domestic 126 @${MAKE} ${_M} do-cleandir 127 @${MAKE} ${_M} do-make-obj 128 @${MAKE} ${_M} do-make-includes 129 @${MAKE} ${_M} do-lib-csu 130 @${MAKE} ${_M} do-lib 131 @${MAKE} ${_M} do-gnu-lib 132 @${MAKE} ${_M} do-dependall 133 @${MAKE} ${_M} do-domestic 134 @${MAKE} ${_M} do-whatisdb 135 @${MAKE} ${_M} buildendmsg 136.endif 137 138do-make-tools: 139.if ${USETOOLS} != "no" 140.if ${MKOBJDIRS} != "no" 141 cd ${.CURDIR}/tools && ${MAKE} ${_M} obj 142.endif 143 cd ${.CURDIR}/tools && ${MAKE} ${_M} build 144.endif 145 146do-distrib-dirs: 147.ifndef NODISTRIBDIRS 148.ifndef DESTDIR 149 (cd ${.CURDIR}/etc && ${MAKE} ${_M} DESTDIR=/ distrib-dirs) 150.else 151 (cd ${.CURDIR}/etc && ${MAKE} ${_M} DESTDIR=${DESTDIR} distrib-dirs) 152.endif 153.endif 154 155do-force-domestic: 156.if defined(FORCE_DOMESTIC) 157 @echo '*** CAPUTE!' 158 @echo ' The FORCE_DOMESTIC flag is not compatible with "make build".' 159 @echo ' Please correct the problem and try again.' 160 @false 161.endif 162 163do-cleandir: 164.if !defined(UPDATE) && !defined(NOCLEANDIR) 165 ${MAKE} ${_J} ${_M} cleandir 166.endif 167 168do-make-obj: 169.if ${MKOBJDIRS} != "no" 170 ${MAKE} ${_J} ${_M} obj 171.endif 172 173do-make-includes: 174.if !defined(NOINCLUDES) 175 ${MAKE} ${_M} includes 176.endif 177 178do-lib-csu: 179 (cd ${.CURDIR}/lib/csu && \ 180 ${MAKE} ${_M} ${_J} MKSHARE=no dependall && \ 181 ${MAKE} ${_M} MKSHARE=no install) 182 183do-lib: 184 (cd ${.CURDIR}/lib && \ 185 ${MAKE} ${_M} ${_J} MKSHARE=no dependall && \ 186 ${MAKE} ${_M} MKSHARE=no install) 187 188do-gnu-lib: 189 (cd ${.CURDIR}/gnu/lib && \ 190 ${MAKE} ${_M} ${_J} MKSHARE=no dependall && \ 191 ${MAKE} ${_M} MKSHARE=no install) 192 193do-dependall: 194 ${MAKE} ${_M} ${_J} dependall && ${MAKE} ${_M} _BUILD= install 195 196do-domestic: 197.if defined(DOMESTIC) && !defined(EXPORTABLE_SYSTEM) 198 (cd ${.CURDIR}/${DOMESTIC} && ${MAKE} ${_M} ${_J} _SLAVE_BUILD= build) 199.endif 200 201do-whatisdb: 202 ${MAKE} ${_M} whatis.db 203 204release snapshot: build 205 (cd ${.CURDIR}/etc && ${MAKE} ${_M} INSTALL_DONE=1 release) 206 207# Speedup stubs for some subtrees that don't need to run these rules 208includes-bin includes-games includes-libexec includes-regress \ 209includes-sbin includes-usr.sbin: 210 @${TRUE} 211 212.if !exists(${.CURDIR}/share/mk) 213.BEGIN: 214 @echo 'BUILD ABORTED: share/mk does not exist, cannot run make.' 215 @false 216.endif 217 218.include "${.CURDIR}/share/mk/bsd.subdir.mk" 219 220_M:= -m ${.CURDIR}/share/mk 221