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