xref: /openbsd/Makefile (revision fcf05718)
1*fcf05718Sespie#	$OpenBSD: Makefile,v 1.115 2010/03/23 21:31:02 espie 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
41de206b4fSderaadtSUBDIR+= 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
62*fcf05718Sespie	cd ${.CURDIR}/etc && exec ${MAKE} DESTDIR=${DESTDIR} install-mtree
63efeb256fSespie	cd ${.CURDIR}/include && exec ${MAKE} includes
64df930be7Sderaadt
65df930be7Sderaadtafterinstall:
66df930be7Sderaadt.ifndef NOMAN
67efeb256fSespie	cd ${.CURDIR}/share/man && exec ${MAKE} makedb
68df930be7Sderaadt.endif
69df930be7Sderaadt
70df930be7Sderaadtbuild:
7171e87bb9Skstailey.ifdef GLOBAL_AUTOCONF_CACHE
729518c5e7Sangelos	cp /dev/null ${GLOBAL_AUTOCONF_CACHE}
739a76bd19Skstailey.endif
74efeb256fSespie	cd ${.CURDIR}/share/mk && exec ${SUDO} ${MAKE} install
75efeb256fSespie	cd ${.CURDIR}/include && ${MAKE} prereq && exec ${SUDO} ${MAKE} includes
762a6fc024Smillert	${SUDO} ${MAKE} cleandir
77efeb256fSespie	cd ${.CURDIR}/lib && ${MAKE} depend && ${MAKE} && \
78efeb256fSespie	    NOMAN=1 exec ${SUDO} ${MAKE} install
79efeb256fSespie	cd ${.CURDIR}/gnu/lib && ${MAKE} depend && ${MAKE} && \
80efeb256fSespie	    NOMAN=1 exec ${SUDO} ${MAKE} install
81efeb256fSespie	${MAKE} depend && ${MAKE} && exec ${SUDO} ${MAKE} install
82df930be7Sderaadt
83a222f159SespieCROSS_TARGETS=cross-env cross-dirs cross-obj cross-includes cross-binutils \
84a222f159Sespie	cross-gcc cross-tools cross-lib cross-bin cross-etc-root-var \
85a222f159Sespie	cross-depend cross-clean cross-cleandir
86a222f159Sespie
879c3ce19dSniklas.if !defined(TARGET)
88a222f159Sespie${CROSS_TARGETS}:
89a222f159Sespie	@echo "TARGET must be set for $@"; exit 1
909c3ce19dSniklas.else
91a222f159Sespie. include "Makefile.cross"
923e0db07eSwcobb.endif # defined(TARGET)
939c3ce19dSniklas
94a222f159Sespie.PHONY: ${CROSS_TARGETS} \
95a222f159Sespie	build regression-tests includes beforeinstall afterinstall \
96a222f159Sespie	all depend
97a222f159Sespie
98df930be7Sderaadt.include <bsd.subdir.mk>
99