On Tue, Nov 08, 2016 at 11:24:12AM +0100, Theo Buehler wrote:
> On Tue, Nov 08, 2016 at 10:26:43AM +0100, Martin Natano wrote:
> > This code comes from a time before sed -i existed. In this time and age
> > we can just use inline sed.
> >
> > sed -i 's/^\([^\.]*\).o[ ]*:/\1.o g\1.o r\1.o:/' .depend
> >
> > With this we avoid /tmp and the related permission issues altogether.
> > What do you think?
>
> Beautiful! It changes the behavior in that a sed error will now stop
> the build, but I think that's better anyway.
>
> I checked that it generates the same .depend files (why wouldn't it?)
> and tested it by making a release. No problems, so please commit it.
>
Well, I suppose we should keep it silent.
Index: lib/csu/Makefile
===================================================================
RCS file: /var/cvs/src/lib/csu/Makefile,v
retrieving revision 1.24
diff -u -p -r1.24 Makefile
--- lib/csu/Makefile 15 Oct 2016 13:00:07 -0000 1.24
+++ lib/csu/Makefile 8 Nov 2016 11:37:46 -0000
@@ -82,12 +82,6 @@ realinstall:
${DESTDIR}/usr/lib
afterdepend: .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
+ @sed -i 's/^\([^\.]*\).o[ ]*:/\1.o g\1.o r\1.o:/' .depend
.include <bsd.prog.mk>
Index: share/mk/bsd.lib.mk
===================================================================
RCS file: /var/cvs/src/share/mk/bsd.lib.mk,v
retrieving revision 1.78
diff -u -p -r1.78 bsd.lib.mk
--- share/mk/bsd.lib.mk 15 Oct 2016 13:00:07 -0000 1.78
+++ share/mk/bsd.lib.mk 8 Nov 2016 11:37:59 -0000
@@ -227,13 +227,7 @@ cleandir: _SUBDIRUSE clean
.if defined(SRCS)
afterdepend: .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
+ @sed -i 's/^\([^\.]*\).o[ ]*:/\1.o \1.po \1.so \1.do:/' .depend
.endif
.if !target(install)