Makefile revision 1.85
1#	$NetBSD: Makefile,v 1.85 1999/02/11 17:56:46 tv 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
75# wrt info/dir below:  It's safe to move this over top of /usr/share/info/dir,
76# as the build will automatically remove/replace the non-pkg entries there.
77
78build: beforeinstall
79.if !defined(NOSHARE)
80	(cd ${.CURDIR}/share/mk && ${MAKE} install)
81	(cd ${.CURDIR}/share/tmac && ${MAKE} && ${MAKE} install)
82.endif
83.if !defined(UPDATE)
84	${MAKE} cleandir
85.endif
86.if empty(HAVE_GCC28)
87.if defined(DESTDIR)
88	@echo "*** CAPUTE!"
89	@echo "    You attempted to compile the world without egcs.  You must"
90	@echo "    first install a native egcs compiler."
91	@false
92.else
93	(cd ${.CURDIR}/gnu/usr.bin/egcs && \
94	    ${MAKE} depend && ${MAKE} ${_J} NOMAN= && \
95	    ${MAKE} NOMAN= install && ${MAKE} cleandir)
96.endif
97.endif
98	${MAKE} _BUILD= includes
99	(cd ${.CURDIR}/lib/csu && \
100	    ${MAKE} depend && ${MAKE} ${_J} NOMAN= && ${MAKE} NOMAN= install)
101	(cd ${.CURDIR}/lib && \
102	    ${MAKE} depend && ${MAKE} ${_J} NOMAN= && ${MAKE} NOMAN= install)
103	(cd ${.CURDIR}/gnu/lib && \
104	    ${MAKE} depend && ${MAKE} ${_J} NOMAN= && ${MAKE} NOMAN= install)
105.if exists(domestic) && !defined(EXPORTABLE_SYSTEM)
106	(cd ${.CURDIR}/domestic/lib && \
107	    ${MAKE} depend && ${MAKE} ${_J} NOMAN= && ${MAKE} NOMAN= install)
108.endif
109	${MAKE} depend && ${MAKE} ${_J} && ${MAKE} _BUILD= install
110.if exists(domestic) && !defined(EXPORTABLE_SYSTEM)
111	(cd ${.CURDIR}/domestic && ${MAKE} ${_J} _SLAVE_BUILD= build)
112.endif
113	${MAKE} whatis.db
114	@echo -n "Build finished at: "
115	@date
116
117.include <bsd.subdir.mk>
118