[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
misc maint.mk improvements
From: |
Jim Meyering |
Subject: |
misc maint.mk improvements |
Date: |
Thu, 29 Jan 2009 13:43:49 +0100 |
FYI, I've just pushed these:
>From 60ca9e1599ed5c9a1a06130d915438cbb32ab391 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Thu, 29 Jan 2009 10:44:10 +0100
Subject: [PATCH 1/3] maint: factor syntax-check rules
* maint.mk (_ignore_case): New macro.
(_prohibit_regexp): Use it.
Factor many existing syntax-check rules to use $(_prohibit_regexp).
---
maint.mk | 40 ++++++++++++++++++++--------------------
1 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/maint.mk b/maint.mk
index 4b449d8..38724c2 100644
--- a/maint.mk
+++ b/maint.mk
@@ -62,8 +62,6 @@ release_archive_dir ?= ../release
# Doing it here saves us from having to set LC_ALL elsewhere in this file.
export LC_ALL = C
-
-
## --------------- ##
## Sanity checks. ##
## --------------- ##
@@ -92,6 +90,10 @@ syntax-check: $(local-check)
# exit 1; } || :
# FIXME: don't allow `#include .strings\.h' anywhere
+# By default, _prohibit_regexp does not ignore case.
+export ignore_case =
+_ignore_case = $$(test -n "$$ignore_case" && echo -i || :)
+
# There are many rules below that prohibit constructs in this package.
# If the offending construct can be matched with a grep-E-style regexp,
# use this macro. The shell variables "re" and "msg" must be defined.
@@ -99,7 +101,7 @@ define _prohibit_regexp
dummy=; : so we do not need a semicolon before each use \
test "x$$re" != x || { echo '$(ME): re not defined' 1>&2; exit 1; }; \
test "x$$msg" != x || { echo '$(ME): msg not defined' 1>&2; exit 1; };\
- grep -nE "$$re" $$($(VC_LIST_EXCEPT)) && \
+ grep $(_ignore_case) -nE "$$re" $$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): '"$$msg" 1>&2; exit 1; } || :
endef
@@ -175,13 +177,12 @@ sc_error_message_period:
exit 1; } || :
sc_file_system:
- @grep -ni 'file''system' $$($(VC_LIST_EXCEPT)) && \
- { echo '$(ME): found use of "file''system";' \
- 'rewrite to use "file system"' 1>&2; \
- exit 1; } || :
+ @re=file''system ignore_case=1 \
+ msg='found use of "file''system"; spell it "file system"' \
+ $(_prohibit_regexp)
# Don't use cpp tests of this symbol. All code assumes config.h is included.
-sc_no_have_config_h:
+sc_prohibit_have_config_h:
@grep -n '^# *if.*HAVE''_CONFIG_H' $$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): found use of HAVE''_CONFIG_H; remove' \
1>&2; exit 1; } || :
@@ -278,10 +279,9 @@ sc_prohibit_root_dev_ino_without_use:
$(_header_without_use)
sc_obsolete_symbols:
- @grep -nE '\<(HAVE''_FCNTL_H|O''_NDELAY)\>' \
- $$($(VC_LIST_EXCEPT)) && \
- { echo '$(ME): do not use HAVE''_FCNTL_H or O''_NDELAY' \
- 1>&2; exit 1; } || :
+ @re='\<(HAVE''_FCNTL_H|O''_NDELAY)\>' \
+ msg='do not use HAVE''_FCNTL_H or O'_NDELAY \
+ $(_prohibit_regexp)
# FIXME: warn about definitions of EXIT_FAILURE, EXIT_SUCCESS, STREQ
@@ -320,14 +320,14 @@ sc_require_test_exit_idiom:
fi
sc_the_the:
- @grep -ni '\<the ''the\>' $$($(VC_LIST_EXCEPT)) && \
- { echo '$(ME): found use of "the ''the";' 1>&2; \
- exit 1; } || :
+ @re='\<the ''the\>' \
+ ignore_case=1 msg='found use of "the ''the";' \
+ $(_prohibit_regexp)
sc_trailing_blank:
- @grep -n '[ ]$$' $$($(VC_LIST_EXCEPT)) && \
- { echo '$(ME): found trailing blank(s)' \
- 1>&2; exit 1; } || :
+ @re='[ ]$$' \
+ ignore_case=1 msg='found trailing blank(s)' \
+ $(_prohibit_regexp)
# Match lines like the following, but where there is only one space
# between the options and the description:
@@ -358,8 +358,8 @@ sc_useless_cpp_parens:
# Require the latest GPL.
sc_GPL_version:
- @grep -n 'either ''version [^3]' $$($(VC_LIST_EXCEPT)) && \
- { echo '$(ME): GPL vN, N!=3' 1>&2; exit 1; } || :
+ @re='either ''version [^3]' msg='GPL vN, N!=3' \
+ $(_prohibit_regexp)
cvs_keywords = \
Author|Date|Header|Id|Name|Locker|Log|RCSfile|Revision|Source|State
--
1.6.1.1.423.gc2891
>From 61a42e37431928b861e69b236b9d6ad04fafbdc3 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Thu, 29 Jan 2009 10:44:25 +0100
Subject: [PATCH 2/3] maint: silence some syntax-check rules
* cfg.mk (sc_strftime_check): Silence the rule.
(sc_tight_scope): Likewise.
* src/Makefile.am (check-AUTHORS): Likewise.
---
cfg.mk | 6 +++---
src/Makefile.am | 12 ++++++------
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/cfg.mk b/cfg.mk
index 8266afe..0e42042 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -1,5 +1,5 @@
# Customize maint.mk -*- makefile -*-
-# Copyright (C) 2003-2008 Free Software Foundation, Inc.
+# Copyright (C) 2003-2009 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -165,7 +165,7 @@ sc_sun_os_names:
exit 1; } || :
sc_tight_scope:
- $(MAKE) -C src $@
+ @$(MAKE) -C src $@
# Perl-based tests used to exec perl from a #!/bin/sh script.
# Now they all start with #!/usr/bin/perl and the portability
@@ -183,7 +183,7 @@ sc_no_exec_perl_coreutils:
# which date accepts but GNU strftime does not.
extract_char = sed 's/^[^%][^%]*%\(.\).*/\1/'
sc_strftime_check:
- if test -f $(srcdir)/src/date.c; then \
+ @if test -f $(srcdir)/src/date.c; then \
grep '^ %. ' $(srcdir)/src/date.c | sort \
| $(extract_char) > address@hidden;
\
{ echo N; \
diff --git a/src/Makefile.am b/src/Makefile.am
index 907b9e7..b88db6b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in -*-Makefile-*-
-## Copyright (C) 1990, 1991, 1993-2008 Free Software Foundation, Inc.
+## Copyright (C) 1990, 1991, 1993-2009 Free Software Foundation, Inc.
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -382,8 +382,8 @@ au_dotdot = authors-dotdot
au_actual = authors-actual
.PHONY: check-AUTHORS
check-AUTHORS: $(all_programs)
- rm -f $(au_actual) $(au_dotdot)
- for i in `ls $(all_programs) | sed -e 's,$(EXEEXT)$$,,' \
+ @rm -f $(au_actual) $(au_dotdot)
+ @for i in `ls $(all_programs) | sed -e 's,$(EXEEXT)$$,,' \
| $(ASSORT) -u`; do \
test "$$i" = '[' && continue; \
exe=$$i; \
@@ -392,12 +392,12 @@ check-AUTHORS: $(all_programs)
elif test "$$i" = test; then \
exe='['; \
fi; \
- LC_ALL=en_US.UTF-8 ./$$exe --version \
+ LC_ALL=en_US.UTF-8 ./$$exe --version \
| perl -0 -pi -e 's/,\n/, /gm' \
|sed -n '/Written by /{ s//'"$$i"': /; s/,* and /, /; s/\.$$//; p;
}'; \
done > $(au_actual)
- sed -n '/^[^ ][^ ]*:/p' $(top_srcdir)/AUTHORS > $(au_dotdot)
- diff $(au_actual) $(au_dotdot) && rm -f $(au_actual) $(au_dotdot)
+ @sed -n '/^[^ ][^ ]*:/p' $(top_srcdir)/AUTHORS > $(au_dotdot)
+ @diff $(au_actual) $(au_dotdot) && rm -f $(au_actual) $(au_dotdot)
# Extract the list of authors from each file.
sed_filter = s/^ *//;s/N_ (//;s/^"//;s/")*$$//
--
1.6.1.1.423.gc2891
>From 44421c22a3c9aca7b7899b9fa8037d89dddaff20 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Thu, 29 Jan 2009 10:46:39 +0100
Subject: [PATCH 3/3] maint: teach "make syntax-check" to print each check name
as it's run
* maint.mk (%.m): New rules to print each syntax-checking rule name,
just before running its commands.
($(syntax-check-rules)): Depend on it.
---
maint.mk | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/maint.mk b/maint.mk
index 38724c2..65cdf5b 100644
--- a/maint.mk
+++ b/maint.mk
@@ -76,6 +76,11 @@ local-checks-available = \
makefile-check check-AUTHORS
.PHONY: $(local-checks-available)
+# Arrange to print the name of each syntax-checking rule just before running
it.
+$(syntax-check-rules): %: %.m
+$(patsubst %, %.m, $(syntax-check-rules)):
+ @echo $(patsubst sc_%.m, %, $@)
+
local-check := $(filter-out $(local-checks-to-skip), $(local-checks-available))
syntax-check: $(local-check)
--
1.6.1.1.423.gc2891
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- misc maint.mk improvements,
Jim Meyering <=