1*6340e171Sespie# $OpenBSD: Makefile,v 1.134 2017/07/05 10:22:32 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# 287797d2abSpirofti# 5) If you want to setup a cross-build environment, there is a "cross-gcc" 297797d2abSpirofti# target available which upon completion of: 3091c7b537Sderaadt# "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 444f7a1a57Sderaadt.if make(clean) || make(cleandir) || make(obj) 4584b1e8aeSderaadtSUBDIR+= etc distrib regress 464f7a1a57Sderaadt.endif 474f7a1a57Sderaadt 48df930be7Sderaadtregression-tests: 49df930be7Sderaadt @echo Running regression tests... 5019806625Sart @cd ${.CURDIR}/regress && ${MAKE} depend && exec ${MAKE} regress 51df930be7Sderaadt 524ae007f5Sderaadtincludes: 53192f59d4Stb cd ${.CURDIR}/include && \ 54192f59d4Stb su ${BUILDUSER} -c 'exec ${MAKE} prereq' && \ 55192f59d4Stb exec ${MAKE} includes 564ae007f5Sderaadt 570d5e6725Sderaadtbeforeinstall: 58efeb256fSespie cd ${.CURDIR}/etc && exec ${MAKE} DESTDIR=${DESTDIR} distrib-dirs 59fcf05718Sespie cd ${.CURDIR}/etc && exec ${MAKE} DESTDIR=${DESTDIR} install-mtree 60efeb256fSespie cd ${.CURDIR}/include && exec ${MAKE} includes 61df930be7Sderaadt 62df930be7Sderaadtafterinstall: 63df930be7Sderaadt.ifndef NOMAN 64efeb256fSespie cd ${.CURDIR}/share/man && exec ${MAKE} makedb 6579df76e3Sespie cd ${.CURDIR}/distrib/sets && exec ${MAKE} makedb 66df930be7Sderaadt.endif 67df930be7Sderaadt 687feaea15Sguenther.ifdef DESTDIR 697feaea15Sguentherbuild: 707feaea15Sguenther @echo cannot build with DESTDIR set 717feaea15Sguenther @false 727feaea15Sguenther.else 73df930be7Sderaadtbuild: 7446df90c2Stb umask ${WOBJUMASK}; exec ${MAKE} do-build 7546df90c2Stb 7646df90c2Stbdo-build: 7771e87bb9Skstailey.ifdef GLOBAL_AUTOCONF_CACHE 7892d422c2Srpe ${INSTALL} -c -o ${BUILDUSER} -g ${WOBJGROUP} -m 664 /dev/null \ 7992d422c2Srpe ${GLOBAL_AUTOCONF_CACHE} 809a76bd19Skstailey.endif 812a3ca3e9Snatano @if [[ `id -u` -ne 0 ]]; then \ 820afaca0cSnatano echo $@ must be called by root >&2; \ 832a3ca3e9Snatano false; \ 842a3ca3e9Snatano fi 85f10adcc6Sderaadt cd ${.CURDIR}/share/mk && exec ${MAKE} install 86192f59d4Stb exec ${MAKE} cleandir 8757fb2d25Stb exec ${MAKE} includes 882a3ca3e9Snatano cd ${.CURDIR}/lib && \ 89*6340e171Sespie su ${BUILDUSER} -c 'exec ${MAKE}' && \ 90f10adcc6Sderaadt NOMAN=1 exec ${MAKE} install 912a3ca3e9Snatano cd ${.CURDIR}/gnu/lib && \ 92*6340e171Sespie su ${BUILDUSER} -c 'exec ${MAKE}' && \ 93f10adcc6Sderaadt NOMAN=1 exec ${MAKE} install 94*6340e171Sespie su ${BUILDUSER} -c 'exec ${MAKE}' && \ 952a3ca3e9Snatano exec ${MAKE} install 96f10adcc6Sderaadt /bin/sh ${.CURDIR}/distrib/sets/makeetcset ${.CURDIR} ${MAKE} 977feaea15Sguenther.endif 98df930be7Sderaadt 99a222f159SespieCROSS_TARGETS=cross-env cross-dirs cross-obj cross-includes cross-binutils \ 100a222f159Sespie cross-gcc cross-tools cross-lib cross-bin cross-etc-root-var \ 101a222f159Sespie cross-depend cross-clean cross-cleandir 102a222f159Sespie 1039c3ce19dSniklas.if !defined(TARGET) 104a222f159Sespie${CROSS_TARGETS}: 105a222f159Sespie @echo "TARGET must be set for $@"; exit 1 1069c3ce19dSniklas.else 107a222f159Sespie. include "Makefile.cross" 1083e0db07eSwcobb.endif # defined(TARGET) 1099c3ce19dSniklas 110a222f159Sespie.PHONY: ${CROSS_TARGETS} \ 111a222f159Sespie build regression-tests includes beforeinstall afterinstall \ 11260fd9b10Sespie all depend do-build 113a222f159Sespie 114df930be7Sderaadt.include <bsd.subdir.mk> 115