summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorMartin Natano <natano@cvs.openbsd.org>2016-10-14 10:14:01 +0000
committerMartin Natano <natano@cvs.openbsd.org>2016-10-14 10:14:01 +0000
commit03e0af44bacc174610c7edbc6ceb98690e41dec9 (patch)
treed381eee3be4f3ad79cddd0fa52057622de92266d /Makefile
parentb698f60f9cf3194a6232de1d2374162f24e5e0cb (diff)
Port the de-escalation mechanism we have in src to xenocara's make
bootstrap/obj/build. This is now possible due to a normal build not writing to the source tree anymore. ok deraadt
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile21
1 files changed, 15 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 363ed766a..5e12eb176 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.74 2016/10/10 13:34:43 matthieu Exp $
+# $OpenBSD: Makefile,v 1.75 2016/10/14 10:14:00 natano Exp $
.include <bsd.own.mk>
.include <bsd.xconf.mk>
@@ -24,18 +24,27 @@ build:
@exit 2
.else
build:
- exec ${SUDO} ${MAKE} bootstrap-root
- cd util/macros && exec ${MAKE} -f Makefile.bsd-wrapper
- exec ${SUDO} ${MAKE} beforebuild
+ @if [[ `id -u` -ne 0 ]]; then \
+ echo $@ must be called by root >&2; \
+ false; \
+ fi
+ exec ${MAKE} bootstrap-root
+ cd util/macros && \
+ exec su ${BUILDUSER} -c 'exec ${MAKE} -f Makefile.bsd-wrapper'
+ exec ${MAKE} beforebuild
exec ${MAKE} realbuild
- exec ${SUDO} ${MAKE} afterbuild
+ exec ${MAKE} afterbuild
.endif
realbuild: _SUBDIRUSE
# that's all folks
bootstrap:
- exec ${SUDO} ${MAKE} bootstrap-root
+ @if [[ `id -u` -ne 0 ]]; then \
+ echo $@ must be called by root >&2; \
+ false; \
+ fi
+ exec ${MAKE} bootstrap-root
bootstrap-root:
exec ${MAKE} distrib-dirs