📄 makefile.maint
字号:
# -*-Makefile-*-# This Makefile fragment is shared between the coreutils,# CPPI, Bison, and Autoconf.## Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 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## the Free Software Foundation; either version 2, or (at your option)## any later version.#### This program is distributed in the hope that it will be useful,## but WITHOUT ANY WARRANTY; without even the implied warranty of## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the## GNU General Public License for more details.#### You should have received a copy of the GNU General Public License## along with this program; if not, write to the Free Software## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA## 02110-1301, USA.# 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_ENV = \ "--no-name --best$$( \ case $$(gzip --help) in \ (*--rsyncable*) echo ' --rsyncable';; \ esac \ )"CVS = cvsCVS_LIST = sh -c ' \ (cvsu --find --types=AFGM $$*) 2>/dev/null || \ awk -F/ '\''{ \ if (!$$1 && $$3 !~ /^-/) { \ f=FILENAME; \ sub(/CVS\/Entries/, "", f); \ print f $$2; \ }}'\'' \ $$(find $${*-*} -name Entries -print) /dev/null \ ' dummyCVS_LIST_EXCEPT = \ $(CVS_LIST) | if test -f .x-$@; then grep -vEf .x-$@; else grep -v ChangeLog; fiifeq ($(origin prev_version_file), undefined) prev_version_file = .prev-versionendifPREV_VERSION := $(shell cat $(prev_version_file))tag-package = $(shell echo "$(PACKAGE)" | tr '[:lower:]' '[:upper:]')tag-this-version = $(subst .,_,$(VERSION))this-cvs-tag = $(tag-package)-$(tag-this-version)my_distdir = $(PACKAGE)-$(VERSION)# Old releases are stored here.# 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## --------------- #### Sanity checks. #### --------------- ### Checks that don't require cvs.# Run `changelog-check' last, as previous test may reveal problems requiring# new ChangeLog entries.local-checks-available = \ po-check copyright-check writable-files m4-check author_mark_check \ changelog-check strftime-check syntax-check makefile_path_separator_check \ makefile-check.PHONY: $(local-checks-available)local-check = $(filter-out $(local-checks-to-skip), $(local-checks-available)).PHONY: $(syntax-check-rules)syntax-check-rules = \ sc_cast_of_argument_to_free \ sc_cast_of_x_alloc_return_value \ sc_cast_of_alloca_return_value \ sc_changelog \ sc_dd_max_sym_length \ sc_error_exit_success \ sc_file_system \ sc_obsolete_symbols \ sc_prohibit_atoi_atof \ sc_prohibit_jm_in_m4 \ sc_root_tests \ sc_space_tab \ sc_sun_os_names \ sc_system_h_headers \ sc_tight_scope \ sc_trailing_space \ sc_unmarked_diagnostics \ sc_texi_notabsyntax-check: $(syntax-check-rules)# @shopt -s nullglob; \# grep -nE '# *include <(limits|std(def|arg|bool))\.h>' \# $$(find -type f -name '*.[chly]') /dev/null && \# { echo '$(ME): found conditional include' 1>&2; \# exit 1; } || :# grep -nE '^# *include <(string|stdlib)\.h>' \# $(srcdir)/{lib,src}/*.[chy] /dev/null && \# { echo '$(ME): FIXME' 1>&2; \# exit 1; } || :# FIXME: don't allow `#include .strings\.h' anywheresc_cast_of_argument_to_free: @shopt -s nullglob; \ grep -nE '\<free \(\(' \ $(srcdir)/{lib,src}/*.[chly] /dev/null && \ { echo '$(ME): don'\''t cast free argument' 1>&2; \ exit 1; } || :sc_cast_of_x_alloc_return_value: @shopt -s nullglob; \ grep -nE --exclude=$(srcdir)/lib/regex.c \ '\*\) *x(m|c|re)alloc\>' \ $(srcdir)/{lib,src}/*.[chy] /dev/null && \ { echo '$(ME): don'\''t cast x*alloc return value' 1>&2; \ exit 1; } || :sc_cast_of_alloca_return_value: @shopt -s nullglob; \ grep -nE '\*\) *alloca\>' \ $(srcdir)/src/*.[chy] /dev/null && \ { echo '$(ME): don'\''t cast alloca return value' 1>&2; \ exit 1; } || :sc_space_tab: @grep -n '[ ] ' \ $$($(CVS_LIST_EXCEPT)) && \ { 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]|ato''ll)\>' \ $$($(CVS_LIST_EXCEPT)) && \ { 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,' \ $$(find -type f -name '*.[chly]') /dev/null && \ { echo '$(ME): found error (EXIT_SUCCESS' 1>&2; \ exit 1; } || :sc_file_system: @grep -ni 'file''system' \ $$($(CVS_LIST_EXCEPT)) && \ { echo '$(ME): found use of "file''system";' \ 'rewrite to use "file system"' 1>&2; \ exit 1; } || :sc_obsolete_symbols: @grep -nE '\<(HAVE_''FCNTL_H)\>' \ $$($(CVS_LIST_EXCEPT)) && \ { echo '$(ME): do not use HAVE_''FCNTL_H' \ 1>&2; exit 1; } || :# FIXME: warn about definitions of EXIT_FAILURE, EXIT_SUCCESS, STREQ# Do not use TABs in .texi files, except in verbatim environments.sc_texi_notab: @sed '/^@verbatim/,/^@end verbatim/d' /dev/null \ $$($(CVS_LIST_EXCEPT) | grep -E '\.(texi|txi|texinfo)$$' ) \ | grep '[ ]' && \ { echo '$(ME): Do not use TABs in texinfo files outside of @verbatim' \ 1>&2; exit 1; } || :# Each nonempty line must start with a year number, or a TAB.sc_changelog: @sed '/^-----/,$$d' $$(find . -maxdepth 2 -name ChangeLog) \ | grep -n '^[^12 ]' && \ { echo '$(ME): found unexpected prefix in a ChangeLog' 1>&2; \ exit 1; } || :# Ensure that dd's definition of LONGEST_SYMBOL stays in sync# with the strings from the two affected variables.dd_c = $(srcdir)/src/dd.csc_dd_max_sym_length:ifneq ($(wildcard $(dd_c)),) @len=$$( (sed -n '/conversions\[\] =$$/,/^};/p' $(dd_c);\ sed -n '/flags\[\] =$$/,/^};/p' $(dd_c) ) \ |sed -n '/"/s/^[^"]*"\([^"]*\)".*/\1/p' \ | wc --max-line-length); \ max=$$(sed -n '/^#define LONGEST_SYMBOL /s///p' $(dd_c) \ |tr -d '"' | wc --max-line-length); \ if test "$$len" = "$$max"; then :; else \ echo 'dd.c: LONGEST_SYMBOL is not longest' 1>&2; \ exit 1; \ fiendif# Many m4 macros names once began with `jm_'.# On 2004-04-13, they were all changed to start with gl_ instead.# Make sure that none are inadvertently reintroduced.sc_prohibit_jm_in_m4: @grep -nE 'jm_[A-Z]' /dev/null \ $$($(CVS_LIST) $(srcdir)/m4 |grep '\.m4$$') && \ { echo '$(ME): do not use jm_ in m4 macro names' \ 1>&2; exit 1; } || :sc_root_tests: @t1=sc-root.expected; t2=sc-root.actual; \ grep -nl '^PRIV_CHECK_ARG=require-root' \ $$($(CVS_LIST) tests) |sed s/tests/./ |sort > $$t1; \ sed -n 's, cd \([^ ]*\) .*MAKE..check TESTS=\(.*\),./\1/\2,p' \ $(srcdir)/tests/Makefile.am |sort > $$t2; \ diff -u $$t1 $$t2 || diff=1; \ rm -f $$t1 $$t2; \ test "$$diff" \ && { echo 'tests/Makefile.am: missing check-root action'>&2; \ exit 1; } || :# Create a list of regular expressions matching the names# of files included from system.h. Exclude a couple..re-list: @shopt -s nullglob; \ sed -n '/^# *include /s///p' $(srcdir)/src/system.[h] /dev/null \ | grep -Ev 'sys/(param|file)\.h' \ | sed 's/ .*//;;s/^["<]/^# *include [<"]/;s/\.h[">]$$/\\.h[">]/' \ > $@-t @mv $@-t $@# Files in src/ should not include directly any of# the headers already included via system.h.sc_system_h_headers: .re-list @if test -f $(srcdir)/src/system.h; then \ trap 'rc=$$?; rm -f .re-list; exit $$rc' 0 1 2 3 15; \ grep -nE -f .re-list \ $$($(CVS_LIST) src | \ grep -Ev '((copy|system)\.h|parse-gram\.c)$$') \ && { echo '$(ME): the above are already included via system.h'\ 1>&2; exit 1; } || :; \ fisc_sun_os_names: @grep -nEi \ 'solaris[^[:alnum:]]*2\.(7|8|9|[1-9][0-9])|sunos[^[:alnum:]][6-9]' \ $$($(CVS_LIST_EXCEPT)) && \ { echo '$(ME): found misuse of Sun OS version numbers' 1>&2; \ exit 1; } || :sc_tight_scope: @if test -d src; then $(MAKE) -C src $@; else :; fisc_trailing_space: @grep -n '[ ]$$' \ $$($(CVS_LIST_EXCEPT)) && \ { echo '$(ME): found trailing space(s)' \ 1>&2; exit 1; } || :# Look for diagnostics that aren't marked for translation.# This won't find any for which error's format string is on a separate line.sc_unmarked_diagnostics: @shopt -s nullglob; \ grep -nE '\<error \([^"]*"[^"]*[a-z]{3}' \ $(srcdir)/{lib,src}/*.c /dev/null \ | grep -v '_(' && \ { echo '$(ME): found unmarked diagnostic(s)' 1>&2; \ exit 1; } || :# Ensure that date's --help output stays in sync with the info# documentation for GNU strftime. The only exception is %N,# which date accepts but GNU strftime does not.extract_char = sed 's/^[^%][^%]*%\(.\).*/\1/'strftime-check: if test -f $(srcdir)/src/date.c; then \ grep '^ %. ' $(srcdir)/src/date.c | sort \ | $(extract_char) > $@-src; \ { echo N; \ info libc date calendar format | grep '^ `%.'\' \ | $(extract_char); } | sort > $@-info; \ diff -u $@-src $@-info || exit 1; \ rm -f $@-src $@-info; \ fi# Ensure that we use only the standard $(VAR) notation,# not @...@ in Makefile.am, now that we can rely on automake# to emit a definition for each substituted variable.makefile-check: grep -nE '@[A-Z_0-9]+@' `find . -name Makefile.am` \ && { echo 'Makefile.maint: use $$(...), not @...@' 1>&2; exit 1; } || :news-date-check: NEWS today=`date +%Y-%m-%d`; \ if head NEWS | grep $$today >/dev/null; then \ :; \ else \ echo "today's date is not in NEWS" 1>&2; \ exit 1; \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -