Makefile revision 1.120
1#	$OpenBSD: Makefile,v 1.120 2013/07/23 22:37:02 todd 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-gcc"
29# target available which upon completion of: 
30#	make -f Makefile.cross TARGET=<target> cross-gcc"
31# (where <target> is one of the names in the /sys/arch directory) will produce
32# a set of compilation tools along with the includes in the /usr/cross/<target>
33# directory. The "cross-distrib" target will build cross-tools as well as
34# binaries for a given <target>.
35#
36
37.include <bsd.own.mk>	# for NOMAN, if it's there.
38
39SUBDIR+= lib include bin libexec sbin usr.bin usr.sbin share games
40SUBDIR+= gnu
41
42SUBDIR+= sys
43
44.if (${KERBEROS5:L} == "yes")
45SUBDIR+=kerberosV/tools
46SUBDIR+=kerberosV/libexec
47SUBDIR+=kerberosV/usr.bin
48SUBDIR+=kerberosV/usr.sbin
49SUBDIR+=kerberosV/doc
50.endif
51
52.if   make(clean) || make(cleandir) || make(obj)
53SUBDIR+= distrib regress
54.endif
55
56regression-tests:
57	@echo Running regression tests...
58	@cd ${.CURDIR}/regress && ${MAKE} depend && exec ${MAKE} regress
59
60includes:
61	cd ${.CURDIR}/include && ${MAKE} prereq && exec ${SUDO} ${MAKE} includes
62
63beforeinstall:
64	cd ${.CURDIR}/etc && exec ${MAKE} DESTDIR=${DESTDIR} distrib-dirs
65	cd ${.CURDIR}/etc && exec ${MAKE} DESTDIR=${DESTDIR} install-mtree
66	cd ${.CURDIR}/include && exec ${MAKE} includes
67
68afterinstall:
69.ifndef NOMAN
70	cd ${.CURDIR}/share/man && exec ${MAKE} makedb
71.endif
72
73.ifdef DESTDIR
74build:
75	@echo cannot build with DESTDIR set
76	@false
77.else
78build:
79.ifdef GLOBAL_AUTOCONF_CACHE
80	cp /dev/null ${GLOBAL_AUTOCONF_CACHE}
81.endif
82	cd ${.CURDIR}/share/mk && exec ${SUDO} ${MAKE} install
83	cd ${.CURDIR}/include && ${MAKE} prereq && exec ${SUDO} ${MAKE} includes
84	${SUDO} ${MAKE} cleandir
85	cd ${.CURDIR}/lib && ${MAKE} depend && ${MAKE} && \
86	    NOMAN=1 exec ${SUDO} ${MAKE} install
87	cd ${.CURDIR}/gnu/lib && ${MAKE} depend && ${MAKE} && \
88	    NOMAN=1 exec ${SUDO} ${MAKE} install
89	${MAKE} depend && ${MAKE} && exec ${SUDO} ${MAKE} install
90.endif
91
92CROSS_TARGETS=cross-env cross-dirs cross-obj cross-includes cross-binutils \
93	cross-gcc cross-tools cross-lib cross-bin cross-etc-root-var \
94	cross-depend cross-clean cross-cleandir
95
96.if !defined(TARGET)
97${CROSS_TARGETS}:
98	@echo "TARGET must be set for $@"; exit 1
99.else
100. include "Makefile.cross"
101.endif # defined(TARGET)
102
103.PHONY: ${CROSS_TARGETS} \
104	build regression-tests includes beforeinstall afterinstall \
105	all depend
106
107.include <bsd.subdir.mk>
108