summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2016-10-15 13:00:08 +0000
committerMarc Espie <espie@cvs.openbsd.org>2016-10-15 13:00:08 +0000
commit4e969093904145dc177cda98b0e3caa6ba1fb4c2 (patch)
treee85ef76c660c896b72f2ab05718ee02cb368ac73
parent0c240516630330822da320485e0b867102e38384 (diff)
unify tmp depend generation.
- simpler uniform pattern - put the tmpfile in OBJDIR, so that mv doesn't whine about groups when using a separate builduser. okay millert@
-rw-r--r--lib/csu/Makefile13
-rw-r--r--share/mk/bsd.lib.mk17
2 files changed, 16 insertions, 14 deletions
diff --git a/lib/csu/Makefile b/lib/csu/Makefile
index 88563a69c0c..4436e2fdfe7 100644
--- a/lib/csu/Makefile
+++ b/lib/csu/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.23 2016/09/03 10:47:24 jsg Exp $
+# $OpenBSD: Makefile,v 1.24 2016/10/15 13:00:07 espie Exp $
OBJS= crt0.o gcrt0.o
OBJS+= crtbegin.o crtend.o
@@ -82,9 +82,12 @@ realinstall:
${DESTDIR}/usr/lib
afterdepend: .depend
- @(TMP=/tmp/_depend$$$$; \
- sed -e 's/^\([^\.]*\).o[ ]*:/\1.o g\1.o r\1.o:/' \
- < .depend > $$TMP; \
- mv $$TMP .depend)
+ @TMP=`mktemp .dependXXXXXXXXXX` || exit 1; \
+ if sed -e 's/^\([^\.]*\).o[ ]*:/\1.o g\1.o r\1.o:/' \
+ < .depend > $$TMP; then \
+ mv $$TMP .depend; \
+ else \
+ rm -f $$TMP; \
+ fi
.include <bsd.prog.mk>
diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk
index 0e23e870076..167cf6cb053 100644
--- a/share/mk/bsd.lib.mk
+++ b/share/mk/bsd.lib.mk
@@ -1,4 +1,4 @@
-# $OpenBSD: bsd.lib.mk,v 1.77 2016/07/04 18:01:44 guenther Exp $
+# $OpenBSD: bsd.lib.mk,v 1.78 2016/10/15 13:00:07 espie Exp $
# $NetBSD: bsd.lib.mk,v 1.67 1996/01/17 20:39:26 mycroft Exp $
# @(#)bsd.lib.mk 5.26 (Berkeley) 5/2/91
@@ -227,14 +227,13 @@ cleandir: _SUBDIRUSE clean
.if defined(SRCS)
afterdepend: .depend
- @(TMP=`mktemp -q /tmp/_dependXXXXXXXXXX`; \
- if [ $$? -ne 0 ]; then \
- echo "$$0: cannot create temp file, exiting..."; \
- exit 1; \
- fi; \
- sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po \1.so \1.do:/' \
- < .depend > $$TMP; \
- mv $$TMP .depend)
+ @TMP=`mktemp .dependXXXXXXXXXX` || exit 1; \
+ if sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po \1.so \1.do:/' \
+ < .depend > $$TMP; then \
+ mv $$TMP .depend; \
+ else \
+ rm -f $$TMP; \
+ fi
.endif
.if !target(install)