Makefile revision 1.83
1#	$NetBSD: Makefile,v 1.83 1999/02/09 19:52:50 christos Exp $
2
3.include <bsd.own.mk>			# for configuration variables.
4
5# Configurations variables (can be set either in /etc/mk.conf or
6# as environement variable
7# NBUILDJOBS: the number of jobs to start in parallel in a 'make build'.
8#             defaults to 1
9# NOMAN: if set to 1, don't build and install man pages
10# NOSHARE: if set to 1, don't build or install /usr/share stuffs
11# UPDATE: if set to 1, don't do a 'make cleandir' before compile
12# DESTDIR: The target directory for installation (default to '/',
13#          which mean the current system is updated).
14
15HAVE_GCC28!=	${CXX} --version | egrep "^(2\.8|egcs)" ; echo
16
17.if defined(NBUILDJOBS)
18_J= -j${NBUILDJOBS}
19.endif
20
21# NOTE THAT etc *DOES NOT* BELONG IN THE LIST BELOW
22
23SUBDIR+= lib include bin libexec sbin usr.bin usr.sbin share sys
24
25.if exists(games)
26SUBDIR+= games
27.endif
28
29SUBDIR+= gnu
30# This is needed for libstdc++ and gen-params.
31includes-gnu: includes-include includes-sys
32
33# Descend into the domestic tree if it exists AND
34#  1) the target is clean, cleandir, or obj, OR
35#  2) the the target is install or includes AND NOT
36#    a) compiling only "exportable" code OR
37#    b) doing it as part of build.
38
39.if exists(domestic) && \
40    (make(clean) || make(cleandir) || make(obj) || \
41    ((make(includes) || make(install)) && \
42    !(defined(EXPORTABLE_SYSTEM) || defined(_BUILD))))
43SUBDIR+= domestic
44.endif
45
46.if exists(regress)
47.ifmake !(install)
48SUBDIR+= regress
49.endif
50
51regression-tests:
52	@echo Running regression tests...
53	@(cd ${.CURDIR}/regress && ${MAKE} regress)
54.endif
55
56beforeinstall:
57.ifmake build
58	@echo -n "Build started at: "
59	@date
60.endif
61.ifndef DESTDIR
62	(cd ${.CURDIR}/etc && ${MAKE} DESTDIR=/ distrib-dirs)
63.else
64	(cd ${.CURDIR}/etc && ${MAKE} distrib-dirs)
65.endif
66
67afterinstall:
68.if !defined(NOMAN) && !defined(NOSHARE) && !defined(_BUILD)
69	${MAKE} whatis.db
70.endif
71
72whatis.db:
73	(cd ${.CURDIR}/share/man && ${MAKE} makedb)
74
75build: beforeinstall
76.if !defined(NOSHARE)
77	(cd ${.CURDIR}/share/mk && ${MAKE} install)
78	(cd ${.CURDIR}/share/tmac && ${MAKE} && ${MAKE} install)
79.endif
80.if !defined(UPDATE)
81	${MAKE} cleandir
82.endif
83.if empty(HAVE_GCC28)
84.if defined(DESTDIR)
85	@echo "*** CAPUTE!"
86	@echo "    You attempted to compile the world with egcs.  You must"
87	@echo "    first install a native egcs compiler."
88	false
89.else
90	(cd ${.CURDIR}/gnu/usr.bin/egcs && \
91	    ${MAKE} depend && ${MAKE} ${_J} NOMAN= && \
92	    ${MAKE} NOMAN= install && ${MAKE} cleandir)
93.endif
94.endif
95	${MAKE} _BUILD= includes
96	(cd ${.CURDIR}/lib/csu && \
97	    ${MAKE} depend && ${MAKE} ${_J} NOMAN= && ${MAKE} NOMAN= install)
98	(cd ${.CURDIR}/lib && \
99	    ${MAKE} depend && ${MAKE} ${_J} NOMAN= && ${MAKE} NOMAN= install)
100	(cd ${.CURDIR}/gnu/lib && \
101	    ${MAKE} depend && ${MAKE} ${_J} NOMAN= && ${MAKE} NOMAN= install)
102.if exists(domestic) && !defined(EXPORTABLE_SYSTEM)
103	(cd ${.CURDIR}/domestic/lib && \
104	    ${MAKE} depend && ${MAKE} ${_J} NOMAN= && ${MAKE} NOMAN= install)
105.endif
106	${MAKE} depend && ${MAKE} ${_J} && ${MAKE} _BUILD= install
107.if exists(domestic) && !defined(EXPORTABLE_SYSTEM)
108	(cd ${.CURDIR}/domestic && ${MAKE} ${_J} _SLAVE_BUILD= build)
109.endif
110	${MAKE} whatis.db
111	@echo -n "Build finished at: "
112	@date
113
114.include <bsd.subdir.mk>
115