xref: /openbsd/Makefile (revision a222f159)
1*a222f159Sespie#	$OpenBSD: Makefile,v 1.112 2005/01/09 20:36:20 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
115034ab0fSderaadt# must be a symbolic link, setenv BSDSRCDIR to point to the real location.
125034ab0fSderaadt#
135034ab0fSderaadt# 2) It is also recommended that you compile with objects outside the
145034ab0fSderaadt# source tree. To do this, ensure /usr/obj exists or points to some
155034ab0fSderaadt# area of disk of sufficient size.  Then do "cd /usr/src; make obj".
165034ab0fSderaadt# This will make a symbolic link called "obj" in each directory, as
175034ab0fSderaadt# well as populate the /usr/obj properly with directories for the
185034ab0fSderaadt# objects.
195034ab0fSderaadt#
20b908e61cSart# 3) It is strongly recommended that you build and install a new kernel
21b908e61cSart# before rebuilding your system. Some of the new programs may use new
22b908e61cSart# functionality or depend on API changes that your old kernel doesn't have.
23b908e61cSart#
24b908e61cSart# 4) If you are reasonably sure that things will compile OK, use the
255034ab0fSderaadt# "make build" target supplied here. Good luck.
26d05f021aSmickey#
27b908e61cSart# 5) If you want to setup a cross-build environment, there is a "cross-tools"
28d05f021aSmickey# target available which upon completion of "make TARGET=<target> cross-tools"
29d05f021aSmickey# (where <target> is one of the names in the /sys/arch directory) will produce
30d05f021aSmickey# a set of compilation tools along with the includes in the /usr/cross/<target>
313e0db07eSwcobb# directory. The "cross-distrib" target will build cross-tools as well as
323e0db07eSwcobb# binaries for a given <target>.
33d05f021aSmickey#
34094eb183Smickey
355034ab0fSderaadt.include <bsd.own.mk>	# for NOMAN, if it's there.
36df930be7Sderaadt
37df930be7SderaadtSUBDIR+= lib include bin libexec sbin usr.bin usr.sbin share games
38df930be7SderaadtSUBDIR+= gnu
39df930be7Sderaadt
40900e3302StholoSUBDIR+= sys lkm
41df930be7Sderaadt
423bedaf2eShin.if (${KERBEROS5:L} == "yes")
433bedaf2eShinSUBDIR+= kerberosV
443bedaf2eShin.endif
453bedaf2eShin
464f7a1a57Sderaadt.if   make(clean) || make(cleandir) || make(obj)
47dd6f3c0cSartSUBDIR+= distrib regress
484f7a1a57Sderaadt.endif
494f7a1a57Sderaadt
50df930be7Sderaadt.if exists(regress)
51df930be7Sderaadtregression-tests:
52df930be7Sderaadt	@echo Running regression tests...
5319806625Sart	@cd ${.CURDIR}/regress && ${MAKE} depend && exec ${MAKE} regress
54df930be7Sderaadt.endif
55df930be7Sderaadt
564ae007f5Sderaadtincludes:
57eb700df3Sniklas	cd ${.CURDIR}/include && ${MAKE} prereq && exec ${SUDO} ${MAKE} includes
584ae007f5Sderaadt
590d5e6725Sderaadtbeforeinstall:
60efeb256fSespie	cd ${.CURDIR}/etc && exec ${MAKE} DESTDIR=${DESTDIR} distrib-dirs
61efeb256fSespie	cd ${.CURDIR}/include && exec ${MAKE} includes
62df930be7Sderaadt
63df930be7Sderaadtafterinstall:
64df930be7Sderaadt.ifndef NOMAN
65efeb256fSespie	cd ${.CURDIR}/share/man && exec ${MAKE} makedb
66df930be7Sderaadt.endif
67df930be7Sderaadt
68df930be7Sderaadtbuild:
6971e87bb9Skstailey.ifdef GLOBAL_AUTOCONF_CACHE
709518c5e7Sangelos	cp /dev/null ${GLOBAL_AUTOCONF_CACHE}
719a76bd19Skstailey.endif
72efeb256fSespie	cd ${.CURDIR}/share/mk && exec ${SUDO} ${MAKE} install
73efeb256fSespie	cd ${.CURDIR}/include && ${MAKE} prereq && exec ${SUDO} ${MAKE} includes
742a6fc024Smillert	${SUDO} ${MAKE} cleandir
75efeb256fSespie	cd ${.CURDIR}/lib && ${MAKE} depend && ${MAKE} && \
76efeb256fSespie	    NOMAN=1 exec ${SUDO} ${MAKE} install
77efeb256fSespie	cd ${.CURDIR}/gnu/lib && ${MAKE} depend && ${MAKE} && \
78efeb256fSespie	    NOMAN=1 exec ${SUDO} ${MAKE} install
79efeb256fSespie	${MAKE} depend && ${MAKE} && exec ${SUDO} ${MAKE} install
80df930be7Sderaadt
81*a222f159SespieCROSS_TARGETS=cross-env cross-dirs cross-obj cross-includes cross-binutils \
82*a222f159Sespie	cross-gcc cross-tools cross-lib cross-bin cross-etc-root-var \
83*a222f159Sespie	cross-depend cross-clean cross-cleandir
84*a222f159Sespie
859c3ce19dSniklas.if !defined(TARGET)
86*a222f159Sespie${CROSS_TARGETS}:
87*a222f159Sespie	@echo "TARGET must be set for $@"; exit 1
889c3ce19dSniklas.else
89*a222f159Sespie. include "Makefile.cross"
903e0db07eSwcobb.endif # defined(TARGET)
919c3ce19dSniklas
92*a222f159Sespie.PHONY: ${CROSS_TARGETS} \
93*a222f159Sespie	build regression-tests includes beforeinstall afterinstall \
94*a222f159Sespie	all depend
95*a222f159Sespie
96df930be7Sderaadt.include <bsd.subdir.mk>
97