xref: /openbsd/Makefile (revision 7797d2ab)
1*7797d2abSpirofti#	$OpenBSD: Makefile,v 1.117 2011/09/17 16:59:53 pirofti 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#
28*7797d2abSpirofti# 5) If you want to setup a cross-build environment, there is a "cross-gcc"
29*7797d2abSpirofti# target available which upon completion of:
30*7797d2abSpirofti#	make -f Makefile.cross TARGET=<target> cross-gcc"
31d05f021aSmickey# (where <target> is one of the names in the /sys/arch directory) will produce
32d05f021aSmickey# a set of compilation tools along with the includes in the /usr/cross/<target>
333e0db07eSwcobb# directory. The "cross-distrib" target will build cross-tools as well as
343e0db07eSwcobb# binaries for a given <target>.
35d05f021aSmickey#
36094eb183Smickey
375034ab0fSderaadt.include <bsd.own.mk>	# for NOMAN, if it's there.
38df930be7Sderaadt
39df930be7SderaadtSUBDIR+= lib include bin libexec sbin usr.bin usr.sbin share games
40df930be7SderaadtSUBDIR+= gnu
41df930be7Sderaadt
42de206b4fSderaadtSUBDIR+= sys
43df930be7Sderaadt
443bedaf2eShin.if (${KERBEROS5:L} == "yes")
453bedaf2eShinSUBDIR+= kerberosV
463bedaf2eShin.endif
473bedaf2eShin
484f7a1a57Sderaadt.if   make(clean) || make(cleandir) || make(obj)
49dd6f3c0cSartSUBDIR+= distrib regress
504f7a1a57Sderaadt.endif
514f7a1a57Sderaadt
52df930be7Sderaadt.if exists(regress)
53df930be7Sderaadtregression-tests:
54df930be7Sderaadt	@echo Running regression tests...
5519806625Sart	@cd ${.CURDIR}/regress && ${MAKE} depend && exec ${MAKE} regress
56df930be7Sderaadt.endif
57df930be7Sderaadt
584ae007f5Sderaadtincludes:
59eb700df3Sniklas	cd ${.CURDIR}/include && ${MAKE} prereq && exec ${SUDO} ${MAKE} includes
604ae007f5Sderaadt
610d5e6725Sderaadtbeforeinstall:
62efeb256fSespie	cd ${.CURDIR}/etc && exec ${MAKE} DESTDIR=${DESTDIR} distrib-dirs
63fcf05718Sespie	cd ${.CURDIR}/etc && exec ${MAKE} DESTDIR=${DESTDIR} install-mtree
64efeb256fSespie	cd ${.CURDIR}/include && exec ${MAKE} includes
65df930be7Sderaadt
66df930be7Sderaadtafterinstall:
67df930be7Sderaadt.ifndef NOMAN
68efeb256fSespie	cd ${.CURDIR}/share/man && exec ${MAKE} makedb
69df930be7Sderaadt.endif
70df930be7Sderaadt
717feaea15Sguenther.ifdef DESTDIR
727feaea15Sguentherbuild:
737feaea15Sguenther	@echo cannot build with DESTDIR set
747feaea15Sguenther	@false
757feaea15Sguenther.else
76df930be7Sderaadtbuild:
7771e87bb9Skstailey.ifdef GLOBAL_AUTOCONF_CACHE
789518c5e7Sangelos	cp /dev/null ${GLOBAL_AUTOCONF_CACHE}
799a76bd19Skstailey.endif
80efeb256fSespie	cd ${.CURDIR}/share/mk && exec ${SUDO} ${MAKE} install
81efeb256fSespie	cd ${.CURDIR}/include && ${MAKE} prereq && exec ${SUDO} ${MAKE} includes
822a6fc024Smillert	${SUDO} ${MAKE} cleandir
83efeb256fSespie	cd ${.CURDIR}/lib && ${MAKE} depend && ${MAKE} && \
84efeb256fSespie	    NOMAN=1 exec ${SUDO} ${MAKE} install
85efeb256fSespie	cd ${.CURDIR}/gnu/lib && ${MAKE} depend && ${MAKE} && \
86efeb256fSespie	    NOMAN=1 exec ${SUDO} ${MAKE} install
87efeb256fSespie	${MAKE} depend && ${MAKE} && exec ${SUDO} ${MAKE} install
887feaea15Sguenther.endif
89df930be7Sderaadt
90a222f159SespieCROSS_TARGETS=cross-env cross-dirs cross-obj cross-includes cross-binutils \
91a222f159Sespie	cross-gcc cross-tools cross-lib cross-bin cross-etc-root-var \
92a222f159Sespie	cross-depend cross-clean cross-cleandir
93a222f159Sespie
949c3ce19dSniklas.if !defined(TARGET)
95a222f159Sespie${CROSS_TARGETS}:
96a222f159Sespie	@echo "TARGET must be set for $@"; exit 1
979c3ce19dSniklas.else
98a222f159Sespie. include "Makefile.cross"
993e0db07eSwcobb.endif # defined(TARGET)
1009c3ce19dSniklas
101a222f159Sespie.PHONY: ${CROSS_TARGETS} \
102a222f159Sespie	build regression-tests includes beforeinstall afterinstall \
103a222f159Sespie	all depend
104a222f159Sespie
105df930be7Sderaadt.include <bsd.subdir.mk>
106