Makefile revision 1.137 1 1.137 tv # $NetBSD: Makefile,v 1.137 2001/10/19 02:35:45 tv Exp $
2 1.95 cjs
3 1.95 cjs # This is the top-level makefile for building NetBSD. For an outline of
4 1.95 cjs # how to build a snapshot or release, as well as other release engineering
5 1.95 cjs # information, see http://www.netbsd.org/developers/releng/index.html
6 1.95 cjs #
7 1.95 cjs # Not everything you can set or do is documented in this makefile. In
8 1.95 cjs # particular, you should review the files in /usr/share/mk (especially
9 1.95 cjs # bsd.README) for general information on building programs and writing
10 1.95 cjs # Makefiles within this structure, and see the comments in src/etc/Makefile
11 1.95 cjs # for further information on installation and release set options.
12 1.95 cjs #
13 1.95 cjs # Variables listed below can be set on the make command line (highest
14 1.95 cjs # priority), in /etc/mk.conf (middle priority), or in the environment
15 1.95 cjs # (lowest priority).
16 1.95 cjs #
17 1.95 cjs # Variables:
18 1.101 sommerfe # DESTDIR is the target directory for installation of the compiled
19 1.101 sommerfe # software. It defaults to /. Note that programs are built against
20 1.101 sommerfe # libraries installed in DESTDIR.
21 1.95 cjs # MKMAN, if set to `no', will prevent building of manual pages.
22 1.101 sommerfe # MKOBJDIRS, if not set to `no', will build object directories at
23 1.101 sommerfe # an appropriate point in a build.
24 1.95 cjs # MKSHARE, if set to `no', will prevent building and installing
25 1.95 cjs # anything in /usr/share.
26 1.101 sommerfe # NBUILDJOBS is the number of jobs to start in parallel during a
27 1.127 tv # `make build'. It defaults to 1.
28 1.125 mrg # UPDATE, if defined, will avoid a `make cleandir' at the start of
29 1.125 mrg # `make build', as well as having the effects listed in
30 1.125 mrg # /usr/share/mk/bsd.README.
31 1.125 mrg # NOCLEANDIR, if defined, will avoid a `make cleandir' at the start
32 1.125 mrg # of the `make build'.
33 1.119 toddpw # NOINCLUDES will avoid the `make includes' usually done by `make build'.
34 1.95 cjs #
35 1.95 cjs # Targets:
36 1.137 tv # build:
37 1.137 tv # Builds a full release of NetBSD in DESTDIR. If BUILD_DONE is
38 1.110 jlam # set, this is an empty target.
39 1.137 tv # release:
40 1.137 tv # Does a `make build,' and then tars up the DESTDIR files
41 1.95 cjs # into RELEASEDIR, in release(7) format. (See etc/Makefile for
42 1.95 cjs # more information on this.)
43 1.137 tv # regression-tests:
44 1.137 tv # Runs the regression tests in "regress" on this host.
45 1.123 mrg #
46 1.137 tv # Targets invoked by `make build,' in order:
47 1.137 tv # obj: creates object directories.
48 1.137 tv # cleandir: cleans the tree.
49 1.137 tv # do-make-tools: builds host toolchain.
50 1.131 tv # do-distrib-dirs: creates the distribution directories.
51 1.137 tv # includes: installs include files.
52 1.137 tv # do-build: builds and installs the entire system.
53 1.32 cgd
54 1.133 tv .include "${.CURDIR}/share/mk/bsd.own.mk"
55 1.4 cgd
56 1.137 tv # Sanity check: make sure that "make build" is not invoked simultaneously
57 1.137 tv # with a standard recursive target.
58 1.137 tv
59 1.137 tv .if make(build) || make(release) || make(snapshot)
60 1.137 tv .for targ in ${TARGETS:Nobj:Ncleandir}
61 1.137 tv .if make(${targ}) && !target(.BEGIN)
62 1.137 tv .BEGIN:
63 1.137 tv @echo 'BUILD ABORTED: "make build" and "make ${targ}" are mutually exclusive.'
64 1.137 tv @false
65 1.137 tv .endif
66 1.137 tv .endfor
67 1.137 tv .endif
68 1.58 tv
69 1.76 bouyer .if defined(NBUILDJOBS)
70 1.137 tv _J= -j${NBUILDJOBS}
71 1.76 bouyer .endif
72 1.76 bouyer
73 1.135 jwise .if ${USETOOLS} != "no"
74 1.137 tv _SUBDIR+= tools
75 1.109 cjs .endif
76 1.137 tv _SUBDIR+= lib include gnu bin games libexec sbin usr.bin \
77 1.137 tv usr.sbin share sys etc distrib regress
78 1.105 assar
79 1.137 tv # Weed out directories that don't exist.
80 1.36 explorer
81 1.137 tv .for dir in ${_SUBDIR}
82 1.137 tv .if exists(${dir}/Makefile)
83 1.137 tv SUBDIR+= ${dir}
84 1.36 explorer .endif
85 1.137 tv .endfor
86 1.21 cgd
87 1.13 brezak .if exists(regress)
88 1.10 cgd regression-tests:
89 1.10 cgd @echo Running regression tests...
90 1.137 tv @cd ${.CURDIR}/regress && ${MAKE} ${_M} regress
91 1.13 brezak .endif
92 1.20 cgd
93 1.137 tv .if ${MKMAN} != "no"
94 1.137 tv afterinstall: whatis.db
95 1.137 tv whatis.db:
96 1.137 tv cd ${.CURDIR}/share/man && ${MAKE} ${_M} makedb
97 1.137 tv .endif
98 1.108 erh
99 1.137 tv # Targets (in order!) called by "make build".
100 1.123 mrg
101 1.137 tv .if ${MKOBJDIRS:Uno} != "no"
102 1.137 tv BUILDTARGETS+= obj
103 1.81 scottr .endif
104 1.137 tv .if !defined(UPDATE) && !defined(NOCLEANDIR)
105 1.137 tv BUILDTARGETS+= cleandir
106 1.123 mrg .endif
107 1.132 mason .if ${USETOOLS} != "no"
108 1.137 tv BUILDTARGETS+= do-make-tools
109 1.131 tv .endif
110 1.137 tv .if !defined(NODISTRIBDIRS)
111 1.137 tv BUILDTARGETS+= do-distrib-dirs
112 1.131 tv .endif
113 1.137 tv .if !defined(NOINCLUDES)
114 1.137 tv BUILDTARGETS+= includes
115 1.131 tv .endif
116 1.137 tv BUILDTARGETS+= do-build
117 1.131 tv
118 1.137 tv # Enforce proper ordering of some rules.
119 1.123 mrg
120 1.137 tv .ORDER: ${BUILDTARGETS}
121 1.137 tv includes-lib: includes-include includes-sys
122 1.137 tv includes-gnu: includes-lib
123 1.123 mrg
124 1.137 tv # Build the system and install into DESTDIR.
125 1.123 mrg
126 1.137 tv build:
127 1.137 tv .if defined(BUILD_DONE)
128 1.137 tv @echo "Build already installed into ${DESTDIR}"
129 1.137 tv .else
130 1.137 tv @echo -n "Build started at: " && date
131 1.137 tv @${MAKE} ${_J} ${_M} ${BUILDTARGETS}
132 1.137 tv @echo -n "Build finished at: " && date
133 1.71 mycroft .endif
134 1.123 mrg
135 1.137 tv # Build a release or snapshot (implies "make build").
136 1.123 mrg
137 1.137 tv release snapshot: build
138 1.137 tv cd ${.CURDIR}/etc && ${MAKE} ${_M} INSTALL_DONE=1 release
139 1.123 mrg
140 1.137 tv # Special components of the "make build" process.
141 1.123 mrg
142 1.137 tv do-make-tools:
143 1.137 tv cd ${.CURDIR}/tools && ${MAKE} ${_M} build
144 1.123 mrg
145 1.137 tv do-distrib-dirs:
146 1.137 tv cd ${.CURDIR}/etc && ${MAKE} ${_M} DESTDIR=${DESTDIR} distrib-dirs
147 1.123 mrg
148 1.137 tv do-build:
149 1.137 tv .for dir in lib/csu lib gnu/lib
150 1.137 tv .for targ in dependall install
151 1.137 tv cd ${.CURDIR}/${dir} && \
152 1.137 tv ${MAKE} ${_M} ${_J} MKSHARE=no MKLINT=no ${targ}
153 1.137 tv .endfor
154 1.137 tv .endfor
155 1.137 tv ${MAKE} ${_M} ${_J} dependall
156 1.137 tv ${MAKE} ${_M} ${_J} install
157 1.87 cjs
158 1.137 tv # Speedup stubs for some subtrees that don't need to run these rules.
159 1.137 tv # (Tells <bsd.subdir.mk> not to recurse for them.)
160 1.129 tv
161 1.129 tv includes-bin includes-games includes-libexec includes-regress \
162 1.137 tv includes-sbin includes-usr.sbin includes-tools \
163 1.137 tv all-tools install-tools install-regress:
164 1.136 nathanw @true
165 1.130 tv
166 1.133 tv .include "${.CURDIR}/share/mk/bsd.subdir.mk"
167 1.130 tv
168 1.130 tv _M:= -m ${.CURDIR}/share/mk
169