xref: /openbsd/Makefile (revision de206b4f)
1*de206b4fSderaadt#	$OpenBSD: Makefile,v 1.114 2005/12/02 01:17:20 deraadt Exp $
2df930be7Sderaadt
35034ab0fSderaadt#
45034ab0fSderaadt# For more information on building in tricky environments, please see
55034ab0fSderaadt# the list of possible environment variables described in
65034ab0fSderaadt# /usr/share/mk/bsd.README.
75034ab0fSderaadt#
85034ab0fSderaadt# Building recommendations:
95034ab0fSderaadt#
105034ab0fSderaadt# 1) If at all possible, put this source tree in /usr/src.  If /usr/src
1137a1d5d8Sjmc# must be a symbolic link, set BSDSRCDIR in the environment to point to
1237a1d5d8Sjmc# the real location.
135034ab0fSderaadt#
145034ab0fSderaadt# 2) It is also recommended that you compile with objects outside the
155034ab0fSderaadt# source tree. To do this, ensure /usr/obj exists or points to some
165034ab0fSderaadt# area of disk of sufficient size.  Then do "cd /usr/src; make obj".
175034ab0fSderaadt# This will make a symbolic link called "obj" in each directory, as
185034ab0fSderaadt# well as populate the /usr/obj properly with directories for the
195034ab0fSderaadt# objects.
205034ab0fSderaadt#
21b908e61cSart# 3) It is strongly recommended that you build and install a new kernel
22b908e61cSart# before rebuilding your system. Some of the new programs may use new
23b908e61cSart# functionality or depend on API changes that your old kernel doesn't have.
24b908e61cSart#
25b908e61cSart# 4) If you are reasonably sure that things will compile OK, use the
265034ab0fSderaadt# "make build" target supplied here. Good luck.
27d05f021aSmickey#
28b908e61cSart# 5) If you want to setup a cross-build environment, there is a "cross-tools"
29d05f021aSmickey# target available which upon completion of "make TARGET=<target> cross-tools"
30d05f021aSmickey# (where <target> is one of the names in the /sys/arch directory) will produce
31d05f021aSmickey# a set of compilation tools along with the includes in the /usr/cross/<target>
323e0db07eSwcobb# directory. The "cross-distrib" target will build cross-tools as well as
333e0db07eSwcobb# binaries for a given <target>.
34d05f021aSmickey#
35094eb183Smickey
365034ab0fSderaadt.include <bsd.own.mk>	# for NOMAN, if it's there.
37df930be7Sderaadt
38df930be7SderaadtSUBDIR+= lib include bin libexec sbin usr.bin usr.sbin share games
39df930be7SderaadtSUBDIR+= gnu
40df930be7Sderaadt
41*de206b4fSderaadtSUBDIR+= sys
42df930be7Sderaadt
433bedaf2eShin.if (${KERBEROS5:L} == "yes")
443bedaf2eShinSUBDIR+= kerberosV
453bedaf2eShin.endif
463bedaf2eShin
474f7a1a57Sderaadt.if   make(clean) || make(cleandir) || make(obj)
48dd6f3c0cSartSUBDIR+= distrib regress
494f7a1a57Sderaadt.endif
504f7a1a57Sderaadt
51df930be7Sderaadt.if exists(regress)
52df930be7Sderaadtregression-tests:
53df930be7Sderaadt	@echo Running regression tests...
5419806625Sart	@cd ${.CURDIR}/regress && ${MAKE} depend && exec ${MAKE} regress
55df930be7Sderaadt.endif
56df930be7Sderaadt
574ae007f5Sderaadtincludes:
58eb700df3Sniklas	cd ${.CURDIR}/include && ${MAKE} prereq && exec ${SUDO} ${MAKE} includes
594ae007f5Sderaadt
600d5e6725Sderaadtbeforeinstall:
61efeb256fSespie	cd ${.CURDIR}/etc && exec ${MAKE} DESTDIR=${DESTDIR} distrib-dirs
62efeb256fSespie	cd ${.CURDIR}/include && exec ${MAKE} includes
63df930be7Sderaadt
64df930be7Sderaadtafterinstall:
65df930be7Sderaadt.ifndef NOMAN
66efeb256fSespie	cd ${.CURDIR}/share/man && exec ${MAKE} makedb
67df930be7Sderaadt.endif
68df930be7Sderaadt
69df930be7Sderaadtbuild:
7071e87bb9Skstailey.ifdef GLOBAL_AUTOCONF_CACHE
719518c5e7Sangelos	cp /dev/null ${GLOBAL_AUTOCONF_CACHE}
729a76bd19Skstailey.endif
73efeb256fSespie	cd ${.CURDIR}/share/mk && exec ${SUDO} ${MAKE} install
74efeb256fSespie	cd ${.CURDIR}/include && ${MAKE} prereq && exec ${SUDO} ${MAKE} includes
752a6fc024Smillert	${SUDO} ${MAKE} cleandir
76efeb256fSespie	cd ${.CURDIR}/lib && ${MAKE} depend && ${MAKE} && \
77efeb256fSespie	    NOMAN=1 exec ${SUDO} ${MAKE} install
78efeb256fSespie	cd ${.CURDIR}/gnu/lib && ${MAKE} depend && ${MAKE} && \
79efeb256fSespie	    NOMAN=1 exec ${SUDO} ${MAKE} install
80efeb256fSespie	${MAKE} depend && ${MAKE} && exec ${SUDO} ${MAKE} install
81df930be7Sderaadt
82a222f159SespieCROSS_TARGETS=cross-env cross-dirs cross-obj cross-includes cross-binutils \
83a222f159Sespie	cross-gcc cross-tools cross-lib cross-bin cross-etc-root-var \
84a222f159Sespie	cross-depend cross-clean cross-cleandir
85a222f159Sespie
869c3ce19dSniklas.if !defined(TARGET)
87a222f159Sespie${CROSS_TARGETS}:
88a222f159Sespie	@echo "TARGET must be set for $@"; exit 1
899c3ce19dSniklas.else
90a222f159Sespie. include "Makefile.cross"
913e0db07eSwcobb.endif # defined(TARGET)
929c3ce19dSniklas
93a222f159Sespie.PHONY: ${CROSS_TARGETS} \
94a222f159Sespie	build regression-tests includes beforeinstall afterinstall \
95a222f159Sespie	all depend
96a222f159Sespie
97df930be7Sderaadt.include <bsd.subdir.mk>
98