Makefile revision 1.81
1#	$NetBSD: Makefile,v 1.81 1999/01/28 15:36:48 scottr 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# This little mess makes the includes and install targets
34# do the expected thing.
35.if exists(domestic) && \
36    (make(clean) || make(cleandir) || make(obj) || \
37    (!defined(_BUILD) && (make(includes) || make(install))))
38SUBDIR+= domestic
39.endif
40
41.if exists(regress)
42.ifmake !(install)
43SUBDIR+= regress
44.endif
45
46regression-tests:
47	@echo Running regression tests...
48	@(cd ${.CURDIR}/regress && ${MAKE} regress)
49.endif
50
51beforeinstall:
52.ifmake build
53	@echo -n "Build started at: "
54	@date
55.endif
56.ifndef DESTDIR
57	(cd ${.CURDIR}/etc && ${MAKE} DESTDIR=/ distrib-dirs)
58.else
59	(cd ${.CURDIR}/etc && ${MAKE} distrib-dirs)
60.endif
61
62afterinstall:
63.if !defined(NOMAN) && !defined(NOSHARE) && !defined(_BUILD)
64	${MAKE} whatis.db
65.endif
66
67whatis.db:
68	(cd ${.CURDIR}/share/man && ${MAKE} makedb)
69
70build: beforeinstall
71.if !defined(NOSHARE)
72	(cd ${.CURDIR}/share/mk && ${MAKE} install)
73	(cd ${.CURDIR}/share/tmac && ${MAKE} && ${MAKE} install)
74.endif
75.if !defined(UPDATE)
76	${MAKE} cleandir
77.endif
78.if empty(HAVE_GCC28)
79.if defined(DESTDIR)
80	@echo "*** CAPUTE!"
81	@echo "    You attempted to compile the world with egcs.  You must"
82	@echo "    first install a native egcs compiler."
83	false
84.else
85	(cd ${.CURDIR}/gnu/usr.bin/egcs && \
86	    ${MAKE} depend && ${MAKE} ${_J} NOMAN= && \
87	    ${MAKE} NOMAN= install && ${MAKE} cleandir)
88.endif
89.endif
90	${MAKE} _BUILD= includes
91	(cd ${.CURDIR}/lib/csu && \
92	    ${MAKE} depend && ${MAKE} ${_J} NOMAN= && ${MAKE} NOMAN= install)
93	(cd ${.CURDIR}/lib && \
94	    ${MAKE} depend && ${MAKE} ${_J} NOMAN= && ${MAKE} NOMAN= install)
95	(cd ${.CURDIR}/gnu/lib && \
96	    ${MAKE} depend && ${MAKE} ${_J} NOMAN= && ${MAKE} NOMAN= install)
97	${MAKE} depend && ${MAKE} ${_J} && ${MAKE} _BUILD= install
98.if exists(domestic) && !defined(EXPORTABLE_SYSTEM)
99	(cd ${.CURDIR}/domestic && ${MAKE} ${_J} _SLAVE_BUILD= build)
100.endif
101	${MAKE} whatis.db
102	@echo -n "Build finished at: "
103	@date
104
105.include <bsd.subdir.mk>
106