=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/Makefile,v retrieving revision 1.112 retrieving revision 1.129 diff -u -r1.112 -r1.129 --- src/Makefile 2005/01/09 20:36:20 1.112 +++ src/Makefile 2016/10/06 18:56:17 1.129 @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.112 2005/01/09 20:36:20 espie Exp $ +# $OpenBSD: Makefile,v 1.129 2016/10/06 18:56:17 natano Exp $ # # For more information on building in tricky environments, please see @@ -8,7 +8,8 @@ # Building recommendations: # # 1) If at all possible, put this source tree in /usr/src. If /usr/src -# must be a symbolic link, setenv BSDSRCDIR to point to the real location. +# must be a symbolic link, set BSDSRCDIR in the environment to point to +# the real location. # # 2) It is also recommended that you compile with objects outside the # source tree. To do this, ensure /usr/obj exists or points to some @@ -24,8 +25,9 @@ # 4) If you are reasonably sure that things will compile OK, use the # "make build" target supplied here. Good luck. # -# 5) If you want to setup a cross-build environment, there is a "cross-tools" -# target available which upon completion of "make TARGET= cross-tools" +# 5) If you want to setup a cross-build environment, there is a "cross-gcc" +# target available which upon completion of: +# "make -f Makefile.cross TARGET= cross-gcc" # (where is one of the names in the /sys/arch directory) will produce # a set of compilation tools along with the includes in the /usr/cross/ # directory. The "cross-distrib" target will build cross-tools as well as @@ -37,46 +39,58 @@ SUBDIR+= lib include bin libexec sbin usr.bin usr.sbin share games SUBDIR+= gnu -SUBDIR+= sys lkm +SUBDIR+= sys -.if (${KERBEROS5:L} == "yes") -SUBDIR+= kerberosV -.endif - .if make(clean) || make(cleandir) || make(obj) -SUBDIR+= distrib regress +SUBDIR+= etc distrib regress .endif -.if exists(regress) regression-tests: @echo Running regression tests... @cd ${.CURDIR}/regress && ${MAKE} depend && exec ${MAKE} regress -.endif includes: - cd ${.CURDIR}/include && ${MAKE} prereq && exec ${SUDO} ${MAKE} includes + cd ${.CURDIR}/include && \ + su ${BUILDUSER} -c 'exec ${MAKE} prereq' && \ + exec ${MAKE} includes beforeinstall: cd ${.CURDIR}/etc && exec ${MAKE} DESTDIR=${DESTDIR} distrib-dirs + cd ${.CURDIR}/etc && exec ${MAKE} DESTDIR=${DESTDIR} install-mtree cd ${.CURDIR}/include && exec ${MAKE} includes afterinstall: .ifndef NOMAN cd ${.CURDIR}/share/man && exec ${MAKE} makedb + cd ${.CURDIR}/distrib/sets && exec ${MAKE} makedb .endif +.ifdef DESTDIR build: + @echo cannot build with DESTDIR set + @false +.else +build: .ifdef GLOBAL_AUTOCONF_CACHE cp /dev/null ${GLOBAL_AUTOCONF_CACHE} .endif - cd ${.CURDIR}/share/mk && exec ${SUDO} ${MAKE} install - cd ${.CURDIR}/include && ${MAKE} prereq && exec ${SUDO} ${MAKE} includes - ${SUDO} ${MAKE} cleandir - cd ${.CURDIR}/lib && ${MAKE} depend && ${MAKE} && \ - NOMAN=1 exec ${SUDO} ${MAKE} install - cd ${.CURDIR}/gnu/lib && ${MAKE} depend && ${MAKE} && \ - NOMAN=1 exec ${SUDO} ${MAKE} install - ${MAKE} depend && ${MAKE} && exec ${SUDO} ${MAKE} install + @if [[ `id -u` -ne 0 ]]; then \ + echo $@ must be called by root >&2; \ + false; \ + fi + cd ${.CURDIR}/share/mk && exec ${MAKE} install + exec ${MAKE} includes + exec ${MAKE} cleandir + cd ${.CURDIR}/lib && \ + su ${BUILDUSER} -c '${MAKE} depend && exec ${MAKE}' && \ + NOMAN=1 exec ${MAKE} install + cd ${.CURDIR}/gnu/lib && \ + su ${BUILDUSER} -c '${MAKE} depend && exec ${MAKE}' && \ + NOMAN=1 exec ${MAKE} install + su ${BUILDUSER} -c '${MAKE} depend && exec ${MAKE}' && \ + exec ${MAKE} install + /bin/sh ${.CURDIR}/distrib/sets/makeetcset ${.CURDIR} ${MAKE} +.endif CROSS_TARGETS=cross-env cross-dirs cross-obj cross-includes cross-binutils \ cross-gcc cross-tools cross-lib cross-bin cross-etc-root-var \