Makefile revision 1.109 1 # $NetBSD: Makefile,v 1.109 2000/03/08 00:50:05 cjs 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 will avoid a `make cleandir' at the start of `make build',
29 # as well as having the effects listed in /usr/share/mk/bsd.README.
30 #
31 # Targets:
32 # build: builds a full release of netbsd in DESTDIR.
33 # release: does a `make build,' and then tars up the DESTDIR files
34 # into RELEASEDIR, in release(7) format. (See etc/Makefile for
35 # more information on this.)
36 # snapshot: a synonym for release.
37
38 SRCTOP=.
39 .include <bsd.crypto.mk> # for configuration variables.
40
41 .if defined(CRYPTOPATH)
42 .sinclude "${CRYPTOPATH}/Makefile.frag"
43 .endif
44
45 MKOBJDIRS ?= no
46 HAVE_GCC28!= ${CXX} --version | egrep "^(2\.8|egcs)" ; echo
47
48 .if defined(NBUILDJOBS)
49 _J= -j${NBUILDJOBS}
50 .endif
51
52 # NOTE THAT etc *DOES NOT* BELONG IN THE LIST BELOW
53
54 SUBDIR+= lib include bin libexec sbin usr.bin usr.sbin share sys
55 .if make(obj)
56 SUBDIR+= distrib
57 .endif
58
59 includes-lib: includes-include includes-sys
60
61 .if exists(games)
62 SUBDIR+= games
63 .endif
64
65 SUBDIR+= gnu
66 # This is needed for libstdc++ and gen-params.
67 includes-gnu: includes-include includes-sys
68
69 .if exists(regress)
70 .ifmake !(install)
71 SUBDIR+= regress
72 .endif
73
74 regression-tests:
75 @echo Running regression tests...
76 @(cd ${.CURDIR}/regress && ${MAKE} regress)
77 .endif
78
79 buildmsg:
80 @echo -n "Build started at: "
81 @date
82
83 beforeinstall:
84 .ifndef DESTDIR
85 (cd ${.CURDIR}/etc && ${MAKE} DESTDIR=/ distrib-dirs)
86 .else
87 (cd ${.CURDIR}/etc && ${MAKE} distrib-dirs)
88 .endif
89
90 afterinstall:
91 .if ${MKMAN} != "no" && !defined(_BUILD)
92 ${MAKE} whatis.db
93 .endif
94
95 whatis.db:
96 (cd ${.CURDIR}/share/man && ${MAKE} makedb)
97
98 # wrt info/dir below: It's safe to move this over top of /usr/share/info/dir,
99 # as the build will automatically remove/replace the non-pkg entries there.
100
101 build: buildmsg beforeinstall
102 .if defined(FORCE_DOMESTIC)
103 @echo '*** CAPUTE!'
104 @echo ' The FORCE_DOMESTIC flag is not compatible with "make build".'
105 @echo ' Please correct the problem and try again.'
106 @false
107 .endif
108 .if ${MKSHARE} != "no"
109 (cd ${.CURDIR}/share/mk && ${MAKE} install)
110 .endif
111 .if !defined(UPDATE)
112 ${MAKE} cleandir
113 .endif
114 .if ${MKOBJDIRS} != "no"
115 ${MAKE} obj
116 .endif
117 .if empty(HAVE_GCC28)
118 .if defined(DESTDIR)
119 @echo "*** CAPUTE!"
120 @echo " You attempted to compile the world without egcs. You must"
121 @echo " first install a native egcs compiler."
122 @false
123 .else
124 (cd ${.CURDIR}/gnu/usr.bin/egcs && \
125 ${MAKE} ${_J} dependall MKMAN=no && \
126 ${MAKE} MKMAN=no install && ${MAKE} cleandir)
127 .endif
128 .endif
129 ${MAKE} includes
130 (cd ${.CURDIR}/lib/csu && \
131 ${MAKE} ${_J} MKMAN=no dependall && \
132 ${MAKE} MKMAN=no install)
133 (cd ${.CURDIR}/lib && \
134 ${MAKE} ${_J} MKMAN=no dependall && \
135 ${MAKE} MKMAN=no install)
136 (cd ${.CURDIR}/gnu/lib && \
137 ${MAKE} ${_J} MKMAN=no MKINFO=no dependall && \
138 ${MAKE} MKMAN=no MKINFO=no install)
139 .if target(cryptobuild)
140 ${MAKE} ${_J} cryptobuild
141 .endif
142 ${MAKE} ${_J} dependall && ${MAKE} _BUILD= install
143 .if defined(DOMESTIC) && !defined(EXPORTABLE_SYSTEM)
144 (cd ${.CURDIR}/${DOMESTIC} && ${MAKE} ${_J} _SLAVE_BUILD= build)
145 .endif
146 ${MAKE} whatis.db
147 @echo -n "Build finished at: "
148 @date
149
150 release snapshot: build
151 (cd ${.CURDIR}/etc && ${MAKE} INSTALL_DONE=1 release)
152
153 .include <bsd.subdir.mk>
154