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