Simon Josefsson <[EMAIL PROTECTED]> writes: > If we make maint.mk minimal, it would be excellent to make coreutils' > Makefile.maint do 'include maint.mk'. This was the idea all along. > I'll suggest patches for gnulib/coreutils to achieve this.
Below are two set of patches. The first one is against coreutils, to make it start use gnulib's maint.mk file. The code that is removed from coreutils (gzip + lc_all) is in gnulib's build-aux/maint.mk. The second set of patches is against gnulib to remove most of the rules in coreutils, to avoid duplication. This removes some features from gnulib's maint.mk, but has anyone been using them heavily? If so, we can add them again by making small incremental patches against coreutils and gnulib. Thoughts? /Simon Patch against coreutils diff --git a/Makefile.maint b/Makefile.maint index ba39dec..0600efb 100644 --- a/Makefile.maint +++ b/Makefile.maint @@ -17,16 +17,12 @@ ## You should have received a copy of the GNU General Public License ## along with this program. If not, see <http://www.gnu.org/licenses/>. +include $(srcdir)/build-aux/maint.mk + # This is reported not to work with make-3.79.1 # ME := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) ME := Makefile.maint -# Do not save the original name or timestamp in the .tar.gz file. -# Use --rsyncable if available. -gzip_rsyncable := \ - $(shell gzip --help 2>/dev/null|grep rsyncable >/dev/null && echo --rsyncable) -GZIP_ENV = '--no-name --best $(gzip_rsyncable)' - CVS = cvs GIT = git VC = $(GIT) @@ -59,10 +55,6 @@ my_distdir = $(PACKAGE)-$(VERSION) # Used for diffs and xdeltas. release_archive_dir ?= ../release -# Prevent programs like 'sort' from considering distinct strings to be equal. -# Doing it here saves us from having to set LC_ALL elsewhere in this file. -export LC_ALL = C - ## --------------- ## diff --git a/bootstrap.conf b/bootstrap.conf index d07c23e..9f63008 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -58,6 +58,7 @@ gnulib_modules=" inttostr inttypes isapipe lchmod lchown lib-ignore linebuffer link-follow long-options lstat malloc mbswidth memcasecmp mempcpy + maintainer-makefile memrchr mgetgroups mkancesdirs mkdir mkdir-p mkstemp mktime modechange mountlist mpsort obstack pathmax perl physmem posixtm posixver putenv diff --git a/build-aux/.gitignore b/build-aux/.gitignore index fc92044..1629629 100644 --- a/build-aux/.gitignore +++ b/build-aux/.gitignore @@ -1,3 +1,4 @@ +GNUmakefile announce-gen compile config.guess @@ -7,6 +8,7 @@ depcomp gnupload install-sh link-warning.h +maint.mk mdate-sh missing texinfo.tex Patch against gnulib: diff --git a/build-aux/maint.mk b/build-aux/maint.mk index 662b371..45ea3ad 100644 --- a/build-aux/maint.mk +++ b/build-aux/maint.mk @@ -19,14 +19,6 @@ ME := maint.mk -# List of all C-like source code files that will be tested for -# stylistic "errors". You may want to define this to something -# more complex in Makefile.cfg. -C_SOURCES ?= $(shell find . -name '*.[chly]') - -# Add some more files to check, typically set in Makefile.cfg. -C_SOURCES += $(C_SOURCES_ADD) - # Do not save the original name or timestamp in the .tar.gz file. # Use --rsyncable if available. gzip_rsyncable := \ @@ -37,74 +29,6 @@ GZIP_ENV = '--no-name --best $(gzip_rsyncable)' # Doing it here saves us from having to set LC_ALL elsewhere in this file. export LC_ALL = C -# Casting arguments to free is never necessary. -sc_cast_of_argument_to_free: - @grep -nE '\<free *\( *\(' $(C_SOURCES) && \ - { echo '$(ME): don'\''t cast free argument' 1>&2; \ - exit 1; } || : - -sc_cast_of_x_alloc_return_value: - @grep -nE '\*\) *x(m|c|re)alloc\>' $(C_SOURCES) && \ - { echo '$(ME): don'\''t cast x*alloc return value' 1>&2; \ - exit 1; } || : - -sc_cast_of_alloca_return_value: - @grep -nE '\*\) *alloca\>' $(C_SOURCES) && \ - { echo '$(ME): don'\''t cast alloca return value' 1>&2; \ - exit 1; } || : - -sc_space_tab: - @grep -n '[ ] ' $(C_SOURCES) && \ - { echo '$(ME): found SPACE-TAB sequence; remove the SPACE' \ - 1>&2; exit 1; } || : - -# Don't use the old ato* functions in `real' code. -# They provide no error checking mechanism. -# Instead, use strto* functions. -sc_prohibit_atoi_atof: - @grep -nE '\<ato([filq]|ll)\>' $(C_SOURCES) && \ - { echo '$(ME): do not use ato''f, ato''i, ato''l, ato''ll, or ato''q' \ - 1>&2; exit 1; } || : - -# 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 -nF 'error (EXIT_SUCCESS,' $(C_SOURCES) && \ - { echo '$(ME): found error (EXIT_SUCCESS' 1>&2; \ - exit 1; } || : - -# Stylistic, use #ifdef instead of #if -sc_no_if_have_config_h: - @grep -n '^# *if HAVE_CONFIG_H' $(C_SOURCES) && \ - { echo '$(ME): found use of #if HAVE_CONFIG_H; use #ifdef' \ - 1>&2; exit 1; } || : - -# Prohibit the inclusion of assert.h without an actual use of assert. -sc_prohibit_assert_without_use: - @files=$$(grep -l '# *include [<"]assert\.h[>"]' $(C_SOURCES) \ - | grep '\.[cy]$$') && \ - grep -L '\<assert (' $$files \ - | grep . && \ - { echo "$(ME): the above files include <assert.h> but don't use it" \ - 1>&2; exit 1; } || : - -sc_obsolete_symbols: - @grep -nE '\<(HAVE''_FCNTL_H|O''_NDELAY)\>' $(C_SOURCES) && \ - { echo '$(ME): do not use HAVE''_FCNTL_H or O''_NDELAY' \ - 1>&2; exit 1; } || : - -# Each nonempty line must start with a year number, or a TAB. -sc_changelog: - @grep -n '^[^12 ]' $$(find . -name ChangeLog) && \ - { echo '$(ME): found unexpected prefix in a ChangeLog' 1>&2; \ - exit 1; } || : - -# Collect the names of rules starting with `sc_'. -syntax-check-rules := $(shell sed -n 's/^\(sc_[a-zA-Z0-9_-]*\):.*/\1/p' $(ME)) -.PHONY: $(syntax-check-rules) - -syntax-check: $(syntax-check-rules) - # Update gettext files. PACKAGE ?= $(shell basename $(PWD)) POURL = http://translationproject.org/latest/$(PACKAGE)/ @@ -116,8 +40,3 @@ refresh-po: echo '[EMAIL PROTECTED]' > $(PODIR)/LINGUAS && \ echo '[EMAIL PROTECTED]' >> $(PODIR)/LINGUAS && \ ls $(PODIR)/*.po | sed 's/.po//' | sed 's,$(PODIR)/,,' | sort >> $(PODIR)/LINGUAS - -INDENT_SOURCES ?= $(C_SOURCES) -.PHONY: indent -indent: - indent $(INDENT_SOURCES)