On Mac OS X 10.8 sed, the | operator isn't available in basic REs, only in extended ones. The null string also has to be expressed with ().
Another Mac OS X-compatible version of the RE is 's/.c(xx){0,1}//'.
Both of these versions have been tested for compatibility with GNU sed.
A third alternative is to omit generating these dummy deps altogether, and prefixing the include statements in the Makefiles with a '-', which haves make ignore any failures in including those files. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac index 998ed55..1114c71 100644 --- a/configure.ac +++ b/configure.ac @@ -122,7 +122,7 @@ if test x$enable_dependency_tracking = xyes ; then
AC_CONFIG_COMMANDS([dummy-dep-files], [(cd "$srcdir" && find . '(' -name '*.c' -o -name '*.cxx' ')' -print) \ - | sed 's/.c(xx|)$//' | (while read f; do echo > "$f.o.d"; echo > "$f.po.d"; done) + | sed -E 's/.c(xx|())$//' | (while read f; do echo > "$f.o.d"; echo > "$f.po.d"; done) ]) fi
Martin Storsjo martin@martin.st writes:
On Mac OS X 10.8 sed, the | operator isn't available in basic REs, only in extended ones. The null string also has to be expressed with ().
The first is understandable, but the second seems very odd to me, isn't that very buggy?
Another Mac OS X-compatible version of the RE is 's/.c(xx){0,1}//'.
Both of these versions have been tested for compatibility with GNU sed.
I'd prefer if we stick to basic regular expression and posix sed (and the current regexp using | is not posix either). Your second variant should be fine with posix sed, if I understand http://pubs.opengroup.org/onlinepubs/007904975/basedefs/xbd_chap09.html correctly. So I think that's the right fix.
A third alternative is to omit generating these dummy deps altogether, and prefixing the include statements in the Makefiles with a '-', which haves make ignore any failures in including those files.
The current use of include works at least with GNU make and Solaris make, but not with BSD make (the latter wants only a single file name after include). Unfortunately, I think the -include trick fails to work with Solaris make.
Regards, /Niels
On Mon, 29 Oct 2012, Niels Möller wrote:
Martin Storsjo martin@martin.st writes:
On Mac OS X 10.8 sed, the | operator isn't available in basic REs, only in extended ones. The null string also has to be expressed with ().
The first is understandable, but the second seems very odd to me, isn't that very buggy?
Not sure - with sed -E 's/.c(xx|)$//' I get:
sed: 1: "s/.c(xx|)$//": RE error: empty (sub)expression
Another Mac OS X-compatible version of the RE is 's/.c(xx){0,1}//'.
Both of these versions have been tested for compatibility with GNU sed.
I'd prefer if we stick to basic regular expression and posix sed (and the current regexp using | is not posix either). Your second variant should be fine with posix sed, if I understand http://pubs.opengroup.org/onlinepubs/007904975/basedefs/xbd_chap09.html correctly. So I think that's the right fix.
Ok, I'll send a new patch with that approach instead then.
A third alternative is to omit generating these dummy deps altogether, and prefixing the include statements in the Makefiles with a '-', which haves make ignore any failures in including those files.
The current use of include works at least with GNU make and Solaris make, but not with BSD make (the latter wants only a single file name after include). Unfortunately, I think the -include trick fails to work with Solaris make.
Ok, good to know.
// Martin
The | operator isn't supported by posix sed. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac index 998ed55..ca204c3 100644 --- a/configure.ac +++ b/configure.ac @@ -122,7 +122,7 @@ if test x$enable_dependency_tracking = xyes ; then
AC_CONFIG_COMMANDS([dummy-dep-files], [(cd "$srcdir" && find . '(' -name '*.c' -o -name '*.cxx' ')' -print) \ - | sed 's/.c(xx|)$//' | (while read f; do echo > "$f.o.d"; echo > "$f.po.d"; done) + | sed 's/.c(xx){0,1}//' | (while read f; do echo > "$f.o.d"; echo > "$f.po.d"; done) ]) fi
Martin Storsjo martin@martin.st writes:
--- a/configure.ac +++ b/configure.ac @@ -122,7 +122,7 @@ if test x$enable_dependency_tracking = xyes ; then
AC_CONFIG_COMMANDS([dummy-dep-files], [(cd "$srcdir" && find . '(' -name '*.c' -o -name '*.cxx' ')' -print) \
- | sed 's/.c(xx|)$//' | (while read f; do echo > "$f.o.d"; echo > "$f.po.d"; done)
- | sed 's/.c(xx){0,1}//' | (while read f; do echo > "$f.o.d"; echo > "$f.po.d"; done)
]) fi
Checked in, with the small modification that I keep the $ at the end of the regexp. (Actually, since we do pass glob patterns to find, I guess it would be sufficient to remove *any* extension, i.e., sed 's/.[^.]*$//' or so).
Regards, /Niels
On Mon, 29 Oct 2012, Niels Möller wrote:
Martin Storsjo martin@martin.st writes:
--- a/configure.ac +++ b/configure.ac @@ -122,7 +122,7 @@ if test x$enable_dependency_tracking = xyes ; then
AC_CONFIG_COMMANDS([dummy-dep-files], [(cd "$srcdir" && find . '(' -name '*.c' -o -name '*.cxx' ')' -print) \
- | sed 's/.c(xx|)$//' | (while read f; do echo > "$f.o.d"; echo > "$f.po.d"; done)
- | sed 's/.c(xx){0,1}//' | (while read f; do echo > "$f.o.d"; echo > "$f.po.d"; done)
]) fi
Checked in, with the small modification that I keep the $ at the end of the regexp. (Actually, since we do pass glob patterns to find, I guess it would be sufficient to remove *any* extension, i.e., sed 's/.[^.]*$//' or so).
Thanks, removing the $ was accidental.
// Martin
nettle-bugs@lists.lysator.liu.se