Makefile revision 1.84
1#	$NetBSD: Makefile,v 1.84 1999/02/11 14:49:49 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	if [ -f ${DESTDIR}/usr/pkg/info/dir ]; then \
83		${INSTALL} -c -m 644 -o ${BINOWN} -g ${BINGRP} \
84			${DESTDIR}/usr/pkg/info/dir ${DESTDIR}/usr/share/info/dir; \
85		rm -f ${DESTDIR}/usr/pkg/info/dir; \
86		ln -s /usr/share/info/dir ${DESTDIR}/usr/pkg/info/dir; \
87	fi
88.endif
89.if !defined(UPDATE)
90	${MAKE} cleandir
91.endif
92.if empty(HAVE_GCC28)
93.if defined(DESTDIR)
94	@echo "*** CAPUTE!"
95	@echo "    You attempted to compile the world without egcs.  You must"
96	@echo "    first install a native egcs compiler."
97	@false
98.else
99	(cd ${.CURDIR}/gnu/usr.bin/egcs && \
100	    ${MAKE} depend && ${MAKE} ${_J} NOMAN= && \
101	    ${MAKE} NOMAN= install && ${MAKE} cleandir)
102.endif
103.endif
104	${MAKE} _BUILD= includes
105	(cd ${.CURDIR}/lib/csu && \
106	    ${MAKE} depend && ${MAKE} ${_J} NOMAN= && ${MAKE} NOMAN= install)
107	(cd ${.CURDIR}/lib && \
108	    ${MAKE} depend && ${MAKE} ${_J} NOMAN= && ${MAKE} NOMAN= install)
109	(cd ${.CURDIR}/gnu/lib && \
110	    ${MAKE} depend && ${MAKE} ${_J} NOMAN= && ${MAKE} NOMAN= install)
111.if exists(domestic) && !defined(EXPORTABLE_SYSTEM)
112	(cd ${.CURDIR}/domestic/lib && \
113	    ${MAKE} depend && ${MAKE} ${_J} NOMAN= && ${MAKE} NOMAN= install)
114.endif
115	${MAKE} depend && ${MAKE} ${_J} && ${MAKE} _BUILD= install
116.if exists(domestic) && !defined(EXPORTABLE_SYSTEM)
117	(cd ${.CURDIR}/domestic && ${MAKE} ${_J} _SLAVE_BUILD= build)
118.endif
119	${MAKE} whatis.db
120	@echo -n "Build finished at: "
121	@date
122
123.include <bsd.subdir.mk>
124