Makefile revision 1.112
1#	$OpenBSD: Makefile,v 1.112 2005/01/09 20:36:20 espie Exp $
2
3#
4# For more information on building in tricky environments, please see
5# the list of possible environment variables described in
6# /usr/share/mk/bsd.README.
7#
8# Building recommendations:
9#
10# 1) If at all possible, put this source tree in /usr/src.  If /usr/src
11# must be a symbolic link, setenv BSDSRCDIR to point to the real location.
12#
13# 2) It is also recommended that you compile with objects outside the
14# source tree. To do this, ensure /usr/obj exists or points to some
15# area of disk of sufficient size.  Then do "cd /usr/src; make obj".
16# This will make a symbolic link called "obj" in each directory, as
17# well as populate the /usr/obj properly with directories for the
18# objects.
19#
20# 3) It is strongly recommended that you build and install a new kernel
21# before rebuilding your system. Some of the new programs may use new
22# functionality or depend on API changes that your old kernel doesn't have.
23#
24# 4) If you are reasonably sure that things will compile OK, use the
25# "make build" target supplied here. Good luck.
26#
27# 5) If you want to setup a cross-build environment, there is a "cross-tools"
28# target available which upon completion of "make TARGET=<target> cross-tools"
29# (where <target> is one of the names in the /sys/arch directory) will produce
30# a set of compilation tools along with the includes in the /usr/cross/<target>
31# directory. The "cross-distrib" target will build cross-tools as well as
32# binaries for a given <target>.
33#
34
35.include <bsd.own.mk>	# for NOMAN, if it's there.
36
37SUBDIR+= lib include bin libexec sbin usr.bin usr.sbin share games
38SUBDIR+= gnu
39
40SUBDIR+= sys lkm
41
42.if (${KERBEROS5:L} == "yes")
43SUBDIR+= kerberosV
44.endif
45
46.if   make(clean) || make(cleandir) || make(obj)
47SUBDIR+= distrib regress
48.endif
49
50.if exists(regress)
51regression-tests:
52	@echo Running regression tests...
53	@cd ${.CURDIR}/regress && ${MAKE} depend && exec ${MAKE} regress
54.endif
55
56includes:
57	cd ${.CURDIR}/include && ${MAKE} prereq && exec ${SUDO} ${MAKE} includes
58
59beforeinstall:
60	cd ${.CURDIR}/etc && exec ${MAKE} DESTDIR=${DESTDIR} distrib-dirs
61	cd ${.CURDIR}/include && exec ${MAKE} includes
62
63afterinstall:
64.ifndef NOMAN
65	cd ${.CURDIR}/share/man && exec ${MAKE} makedb
66.endif
67
68build:
69.ifdef GLOBAL_AUTOCONF_CACHE
70	cp /dev/null ${GLOBAL_AUTOCONF_CACHE}
71.endif
72	cd ${.CURDIR}/share/mk && exec ${SUDO} ${MAKE} install
73	cd ${.CURDIR}/include && ${MAKE} prereq && exec ${SUDO} ${MAKE} includes
74	${SUDO} ${MAKE} cleandir
75	cd ${.CURDIR}/lib && ${MAKE} depend && ${MAKE} && \
76	    NOMAN=1 exec ${SUDO} ${MAKE} install
77	cd ${.CURDIR}/gnu/lib && ${MAKE} depend && ${MAKE} && \
78	    NOMAN=1 exec ${SUDO} ${MAKE} install
79	${MAKE} depend && ${MAKE} && exec ${SUDO} ${MAKE} install
80
81CROSS_TARGETS=cross-env cross-dirs cross-obj cross-includes cross-binutils \
82	cross-gcc cross-tools cross-lib cross-bin cross-etc-root-var \
83	cross-depend cross-clean cross-cleandir
84
85.if !defined(TARGET)
86${CROSS_TARGETS}:
87	@echo "TARGET must be set for $@"; exit 1
88.else
89. include "Makefile.cross"
90.endif # defined(TARGET)
91
92.PHONY: ${CROSS_TARGETS} \
93	build regression-tests includes beforeinstall afterinstall \
94	all depend
95
96.include <bsd.subdir.mk>
97