Hi.
Just another little patch to avoid some of the sc_* rules to freeze if
the filtering of VC_LIST_EXCEPT gives an empty string (for example,
'make sc_error_exit_success' freezes if there are not source files in
${srcdir}/).
I found this problem due to the bazaar issue in vc-list-files.
2010-02-21 Jose E. Marchesi <[email protected]>
* top/maint.mk (sc_error_exit_success): Apply the rule only if the
filtering of VC_LIST_EXCEPT is not empty. Otherwise the main grep
freezes waiting for data in the standard input.
(sc_makefile_TAB_only_indentation): Likewise.
(sc_makefile_path_separator_check): Likewise.
(sc_m4_quote_check): Likewise.
diff --git a/top/maint.mk b/top/maint.mk
index 7d84b6c..11afe6b 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -217,9 +217,13 @@ sc_prohibit_magic_number_exit:
# Using EXIT_SUCCESS as the first argument to error is misleading,
# since when that parameter is 0, error does not exit. Use `0' instead.
sc_error_exit_success:
- @grep -nE 'error \(EXIT_SUCCESS,' \
- $$($(VC_LIST_EXCEPT) | grep -E '\.[chly]$$') && \
- { echo '$(ME): found error (EXIT_SUCCESS' 1>&2; exit 1; } || :
+ @if $(VC_LIST_EXCEPT) | grep -E '\.[chly]$$' > /dev/null; then \
+ grep -nE 'error \(EXIT_SUCCESS,' \
+ $$($(VC_LIST_EXCEPT) | grep -E '\.[chly]$$') && \
+ { echo '$(ME): found error (EXIT_SUCCESS' \
+ 1>&2; exit 1; } || :; \
+ else :; \
+ fi
# `FATAL:' should be fully upper-cased in error messages
# `WARNING:' should be fully upper-cased, or fully lower-cased
@@ -652,16 +656,22 @@ news-check: NEWS
fi
sc_makefile_TAB_only_indentation:
- @grep -nE '^ [ ]{8}' \
- $$($(VC_LIST_EXCEPT) | grep -E 'akefile|\.mk$$') \
- && { echo '$(ME): found TAB-8-space indentation' 1>&2; \
- exit 1; } || :
+ @if $(VC_LIST_EXCEPT) | grep -E 'akefile|\.mk$$' > /dev/null; then
\
+ grep -nE '^ [ ]{8}'
\
+ $$($(VC_LIST_EXCEPT) | grep -E 'akefile|\.mk$$')
\
+ && { echo '$(ME): found TAB-8-space indentation' 1>&2;
\
+ exit 1; } || :;
\
+ else :;
\
+ fi
sc_m4_quote_check:
- @grep -nE '(AC_DEFINE(_UNQUOTED)?|AC_DEFUN)\([^[]' \
- $$($(VC_LIST_EXCEPT) | grep -E '(^configure\.ac|\.m4)$$') \
- && { echo '$(ME): quote the first arg to AC_DEF*' 1>&2; \
- exit 1; } || :
+ @if $(VC_LIST_EXCEPT) | grep -E '(^configure\.ac|\.m4)$$' > /dev/null;
then \
+ grep -nE '(AC_DEFINE(_UNQUOTED)?|AC_DEFUN)\([^[]'
\
+ $$($(VC_LIST_EXCEPT) | grep -E '(^configure\.ac|\.m4)$$')
\
+ && { echo '$(ME): quote the first arg to AC_DEF*' 1>&2;
\
+ exit 1; } || :;
\
+ else :;
\
+ fi
fix_po_file_diag = \
'you have changed the set of files with translatable diagnostics;\n\
@@ -700,9 +710,12 @@ sc_po_check:
# path separator of `:', but rather the automake-provided `$(PATH_SEPARATOR)'.
msg = '$(ME): Do not use `:'\'' above; use $$(PATH_SEPARATOR) instead'
sc_makefile_path_separator_check:
- @grep -nE 'PATH[=].*:' \
- $$($(VC_LIST_EXCEPT) | grep -E 'akefile|\.mk$$') \
- && { echo $(msg) 1>&2; exit 1; } || :
+ @if $(VC_LIST_EXCEPT) | grep -E 'akefile|\.mk$$' > /dev/null; then
\
+ grep -nE 'PATH[=].*:'
\
+ $$($(VC_LIST_EXCEPT) | grep -E 'akefile|\.mk$$')
\
+ && { echo $(msg) 1>&2; exit 1; } || :;
\
+ else :;
\
+ fi
# Check that `make alpha' will not fail at the end of the process.
writable-files: