=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/Makefile,v retrieving revision 1.124 retrieving revision 1.131 diff -u -r1.124 -r1.131 --- src/Makefile 2015/06/02 06:10:14 1.124 +++ src/Makefile 2016/11/19 14:20:58 1.131 @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.124 2015/06/02 06:10:14 deraadt Exp $ +# $OpenBSD: Makefile,v 1.131 2016/11/19 14:20:58 tb Exp $ # # For more information on building in tricky environments, please see @@ -42,7 +42,7 @@ SUBDIR+= sys .if make(clean) || make(cleandir) || make(obj) -SUBDIR+= distrib regress +SUBDIR+= etc distrib regress .endif regression-tests: @@ -50,7 +50,9 @@ @cd ${.CURDIR}/regress && ${MAKE} depend && exec ${MAKE} regress 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 @@ -69,18 +71,28 @@ @false .else build: + umask ${WOBJUMASK}; exec ${MAKE} do-build + +do-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 - ${SUDO} /bin/sh ${.CURDIR}/distrib/sets/makeetcset ${.CURDIR} ${MAKE} + @if [[ `id -u` -ne 0 ]]; then \ + echo $@ must be called by root >&2; \ + false; \ + fi + cd ${.CURDIR}/share/mk && exec ${MAKE} install + exec ${MAKE} cleandir + exec ${MAKE} includes + 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 \